comparison common-kex.c @ 512:0129fd8ccc71 insecure-nocrypto

Update nocrypto branch to current head
author Matt Johnston <matt@ucc.asn.au>
date Thu, 06 Nov 2008 13:33:06 +0000
parents 582cb38e4eb5
children a4b7627b3157
comparison
equal deleted inserted replaced
511:582cb38e4eb5 512:0129fd8ccc71
290 hashkeys(C2S_IV, SHA1_HASH_SIZE, &hs, 'A'); 290 hashkeys(C2S_IV, SHA1_HASH_SIZE, &hs, 'A');
291 hashkeys(S2C_IV, SHA1_HASH_SIZE, &hs, 'B'); 291 hashkeys(S2C_IV, SHA1_HASH_SIZE, &hs, 'B');
292 hashkeys(C2S_key, C2S_keysize, &hs, 'C'); 292 hashkeys(C2S_key, C2S_keysize, &hs, 'C');
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);
296 if (recv_cipher < 0)
297 dropbear_exit("crypto error");
298 if (ses.newkeys->recv_crypt_mode->start(recv_cipher,
299 recv_IV, recv_key,
300 ses.newkeys->recv_algo_crypt->keysize, 0,
301 &ses.newkeys->recv_cipher_state) != CRYPT_OK) {
302 dropbear_exit("crypto error");
303 }
304
305 trans_cipher = find_cipher(ses.newkeys->trans_algo_crypt->cipherdesc->name);
306 if (trans_cipher < 0)
307 dropbear_exit("crypto error");
308 if (ses.newkeys->trans_crypt_mode->start(trans_cipher,
309 trans_IV, trans_key,
310 ses.newkeys->trans_algo_crypt->keysize, 0,
311 &ses.newkeys->trans_cipher_state) != CRYPT_OK) {
312 dropbear_exit("crypto error");
313 if (ses.newkeys->recv_algo_crypt->cipherdesc != NULL) { 295 if (ses.newkeys->recv_algo_crypt->cipherdesc != NULL) {
314 if (cbc_start( 296 recv_cipher = find_cipher(ses.newkeys->recv_algo_crypt->cipherdesc->name);
315 find_cipher(ses.newkeys->recv_algo_crypt->cipherdesc->name), 297 if (recv_cipher < 0)
298 dropbear_exit("crypto error");
299 if (ses.newkeys->recv_crypt_mode->start(recv_cipher,
316 recv_IV, recv_key, 300 recv_IV, recv_key,
317 ses.newkeys->recv_algo_crypt->keysize, 0, 301 ses.newkeys->recv_algo_crypt->keysize, 0,
318 &ses.newkeys->recv_symmetric_struct) != CRYPT_OK) { 302 &ses.newkeys->recv_cipher_state) != CRYPT_OK) {
319 dropbear_exit("crypto error"); 303 dropbear_exit("crypto error");
320 } 304 }
321 } 305 }
322 306
323 if (ses.newkeys->trans_algo_crypt->cipherdesc != NULL) { 307 if (ses.newkeys->trans_algo_crypt->cipherdesc != NULL) {
324 if (cbc_start( 308 trans_cipher = find_cipher(ses.newkeys->trans_algo_crypt->cipherdesc->name);
325 find_cipher(ses.newkeys->trans_algo_crypt->cipherdesc->name), 309 if (trans_cipher < 0)
310 dropbear_exit("crypto error");
311 if (ses.newkeys->trans_crypt_mode->start(trans_cipher,
326 trans_IV, trans_key, 312 trans_IV, trans_key,
327 ses.newkeys->trans_algo_crypt->keysize, 0, 313 ses.newkeys->trans_algo_crypt->keysize, 0,
328 &ses.newkeys->trans_symmetric_struct) != CRYPT_OK) { 314 &ses.newkeys->trans_cipher_state) != CRYPT_OK) {
329 dropbear_exit("crypto error"); 315 dropbear_exit("crypto error");
330 } 316 }
331 } 317 }
332 318
333 /* MAC keys */ 319 /* MAC keys */
334 if (ses.newkeys->trans_algo_mac->hashdesc != NULL) { 320 if (ses.newkeys->trans_algo_mac->hashdesc != NULL) {
335 hashkeys(ses.newkeys->transmackey, 321 hashkeys(ses.newkeys->transmackey,
336 ses.newkeys->trans_algo_mac->keysize, &hs, mactransletter); 322 ses.newkeys->trans_algo_mac->keysize, &hs, mactransletter);
337 } 323 }