Mercurial > dropbear
comparison common-kex.c @ 502:43bbe17d6ba0
- Add Counter Mode support
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 29 Sep 2008 13:53:31 +0000 |
parents | d58c478bd399 |
children | 582cb38e4eb5 0431915df79f 76097ec1a29a |
comparison
equal
deleted
inserted
replaced
501:d58c478bd399 | 502:43bbe17d6ba0 |
---|---|
293 hashkeys(S2C_key, S2C_keysize, &hs, 'D'); | 293 hashkeys(S2C_key, S2C_keysize, &hs, 'D'); |
294 | 294 |
295 recv_cipher = find_cipher(ses.newkeys->recv_algo_crypt->cipherdesc->name); | 295 recv_cipher = find_cipher(ses.newkeys->recv_algo_crypt->cipherdesc->name); |
296 if (recv_cipher < 0) | 296 if (recv_cipher < 0) |
297 dropbear_exit("crypto error"); | 297 dropbear_exit("crypto error"); |
298 | 298 if (ses.newkeys->recv_crypt_mode->start(recv_cipher, |
299 if (cbc_start(recv_cipher, recv_IV, recv_key, | 299 recv_IV, recv_key, |
300 ses.newkeys->recv_algo_crypt->keysize, 0, | 300 ses.newkeys->recv_algo_crypt->keysize, 0, |
301 &ses.newkeys->recv_symmetric_struct) != CRYPT_OK) { | 301 &ses.newkeys->recv_cipher_state) != CRYPT_OK) { |
302 dropbear_exit("crypto error"); | 302 dropbear_exit("crypto error"); |
303 } | 303 } |
304 | |
304 trans_cipher = find_cipher(ses.newkeys->trans_algo_crypt->cipherdesc->name); | 305 trans_cipher = find_cipher(ses.newkeys->trans_algo_crypt->cipherdesc->name); |
305 if (trans_cipher < 0) | 306 if (trans_cipher < 0) |
306 dropbear_exit("crypto error"); | 307 dropbear_exit("crypto error"); |
307 | 308 if (ses.newkeys->trans_crypt_mode->start(trans_cipher, |
308 if (cbc_start(trans_cipher, trans_IV, trans_key, | 309 trans_IV, trans_key, |
309 ses.newkeys->trans_algo_crypt->keysize, 0, | 310 ses.newkeys->trans_algo_crypt->keysize, 0, |
310 &ses.newkeys->trans_symmetric_struct) != CRYPT_OK) { | 311 &ses.newkeys->trans_cipher_state) != CRYPT_OK) { |
311 dropbear_exit("crypto error"); | 312 dropbear_exit("crypto error"); |
312 } | 313 } |
313 | 314 |
314 /* MAC keys */ | 315 /* MAC keys */ |
315 hashkeys(ses.newkeys->transmackey, | 316 hashkeys(ses.newkeys->transmackey, |
699 if (IS_DROPBEAR_CLIENT) { | 700 if (IS_DROPBEAR_CLIENT) { |
700 ses.newkeys->recv_algo_crypt = | 701 ses.newkeys->recv_algo_crypt = |
701 (struct dropbear_cipher*)s2c_cipher_algo->data; | 702 (struct dropbear_cipher*)s2c_cipher_algo->data; |
702 ses.newkeys->trans_algo_crypt = | 703 ses.newkeys->trans_algo_crypt = |
703 (struct dropbear_cipher*)c2s_cipher_algo->data; | 704 (struct dropbear_cipher*)c2s_cipher_algo->data; |
705 ses.newkeys->recv_crypt_mode = | |
706 (struct dropbear_cipher_mode*)s2c_cipher_algo->mode; | |
707 ses.newkeys->trans_crypt_mode = | |
708 (struct dropbear_cipher_mode*)c2s_cipher_algo->mode; | |
704 ses.newkeys->recv_algo_mac = | 709 ses.newkeys->recv_algo_mac = |
705 (struct dropbear_hash*)s2c_hash_algo->data; | 710 (struct dropbear_hash*)s2c_hash_algo->data; |
706 ses.newkeys->trans_algo_mac = | 711 ses.newkeys->trans_algo_mac = |
707 (struct dropbear_hash*)c2s_hash_algo->data; | 712 (struct dropbear_hash*)c2s_hash_algo->data; |
708 ses.newkeys->recv_algo_comp = s2c_comp_algo->val; | 713 ses.newkeys->recv_algo_comp = s2c_comp_algo->val; |
711 /* SERVER */ | 716 /* SERVER */ |
712 ses.newkeys->recv_algo_crypt = | 717 ses.newkeys->recv_algo_crypt = |
713 (struct dropbear_cipher*)c2s_cipher_algo->data; | 718 (struct dropbear_cipher*)c2s_cipher_algo->data; |
714 ses.newkeys->trans_algo_crypt = | 719 ses.newkeys->trans_algo_crypt = |
715 (struct dropbear_cipher*)s2c_cipher_algo->data; | 720 (struct dropbear_cipher*)s2c_cipher_algo->data; |
721 ses.newkeys->recv_crypt_mode = | |
722 (struct dropbear_cipher_mode*)c2s_cipher_algo->mode; | |
723 ses.newkeys->trans_crypt_mode = | |
724 (struct dropbear_cipher_mode*)s2c_cipher_algo->mode; | |
716 ses.newkeys->recv_algo_mac = | 725 ses.newkeys->recv_algo_mac = |
717 (struct dropbear_hash*)c2s_hash_algo->data; | 726 (struct dropbear_hash*)c2s_hash_algo->data; |
718 ses.newkeys->trans_algo_mac = | 727 ses.newkeys->trans_algo_mac = |
719 (struct dropbear_hash*)s2c_hash_algo->data; | 728 (struct dropbear_hash*)s2c_hash_algo->data; |
720 ses.newkeys->recv_algo_comp = c2s_comp_algo->val; | 729 ses.newkeys->recv_algo_comp = c2s_comp_algo->val; |