Mercurial > dropbear
comparison packet.c @ 194:e972be139cb5
Switching to libtomcrypt 1.02
(still has problems)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 09 May 2005 09:32:33 +0000 |
parents | 0cfba3034be5 |
children | 5e4110bb753a |
comparison
equal
deleted
inserted
replaced
193:ca6a7c7a925c | 194:e972be139cb5 |
---|---|
199 blocksize); | 199 blocksize); |
200 } else { | 200 } else { |
201 /* decrypt it */ | 201 /* decrypt it */ |
202 if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize), | 202 if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize), |
203 buf_getwriteptr(ses.decryptreadbuf,blocksize), | 203 buf_getwriteptr(ses.decryptreadbuf,blocksize), |
204 blocksize, | |
204 &ses.keys->recv_symmetric_struct) != CRYPT_OK) { | 205 &ses.keys->recv_symmetric_struct) != CRYPT_OK) { |
205 dropbear_exit("error decrypting"); | 206 dropbear_exit("error decrypting"); |
206 } | 207 } |
207 } | 208 } |
208 buf_setlen(ses.decryptreadbuf, blocksize); | 209 buf_setlen(ses.decryptreadbuf, blocksize); |
252 } else { | 253 } else { |
253 /* decrypt */ | 254 /* decrypt */ |
254 while (ses.readbuf->pos < ses.readbuf->len - macsize) { | 255 while (ses.readbuf->pos < ses.readbuf->len - macsize) { |
255 if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize), | 256 if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize), |
256 buf_getwriteptr(ses.decryptreadbuf, blocksize), | 257 buf_getwriteptr(ses.decryptreadbuf, blocksize), |
258 blocksize, | |
257 &ses.keys->recv_symmetric_struct) != CRYPT_OK) { | 259 &ses.keys->recv_symmetric_struct) != CRYPT_OK) { |
258 dropbear_exit("error decrypting"); | 260 dropbear_exit("error decrypting"); |
259 } | 261 } |
260 buf_incrpos(ses.readbuf, blocksize); | 262 buf_incrpos(ses.readbuf, blocksize); |
261 buf_incrwritepos(ses.decryptreadbuf, blocksize); | 263 buf_incrwritepos(ses.decryptreadbuf, blocksize); |
489 } else { | 491 } else { |
490 /* encrypt it */ | 492 /* encrypt it */ |
491 while (clearwritebuf->pos < clearwritebuf->len) { | 493 while (clearwritebuf->pos < clearwritebuf->len) { |
492 if (cbc_encrypt(buf_getptr(clearwritebuf, blocksize), | 494 if (cbc_encrypt(buf_getptr(clearwritebuf, blocksize), |
493 buf_getwriteptr(writebuf, blocksize), | 495 buf_getwriteptr(writebuf, blocksize), |
496 blocksize, | |
494 &ses.keys->trans_symmetric_struct) != CRYPT_OK) { | 497 &ses.keys->trans_symmetric_struct) != CRYPT_OK) { |
495 dropbear_exit("error encrypting"); | 498 dropbear_exit("error encrypting"); |
496 } | 499 } |
497 buf_incrpos(clearwritebuf, blocksize); | 500 buf_incrpos(clearwritebuf, blocksize); |
498 buf_incrwritepos(writebuf, blocksize); | 501 buf_incrwritepos(writebuf, blocksize); |