comparison common-kex.c @ 351:e66eec4dcba7 debug-unrandom

some more debugging output
author Matt Johnston <matt@ucc.asn.au>
date Tue, 08 Aug 2006 15:31:38 +0000
parents 3e098639b05f
children
comparison
equal deleted inserted replaced
348:cd14c94fe89c 351:e66eec4dcba7
477 477
478 DEF_MP_INT(dh_p); 478 DEF_MP_INT(dh_p);
479 DEF_MP_INT(dh_q); 479 DEF_MP_INT(dh_q);
480 DEF_MP_INT(dh_g); 480 DEF_MP_INT(dh_g);
481 481
482 TRACE(("enter send_msg_kexdh_reply")) 482 TRACE(("enter gen_kexdh_vals"))
483 483
484 m_mp_init_multi(&dh_g, &dh_p, &dh_q, NULL); 484 m_mp_init_multi(&dh_g, &dh_p, &dh_q, NULL);
485 485
486 /* read the prime and generator*/ 486 /* read the prime and generator*/
487 bytes_to_mp(&dh_p, (unsigned char*)dh_p_val, DH_P_LEN); 487 bytes_to_mp(&dh_p, (unsigned char*)dh_p_val, DH_P_LEN);
505 /* f = g^y mod p */ 505 /* f = g^y mod p */
506 if (mp_exptmod(&dh_g, dh_priv, &dh_p, dh_pub) != MP_OKAY) { 506 if (mp_exptmod(&dh_g, dh_priv, &dh_p, dh_pub) != MP_OKAY) {
507 dropbear_exit("Diffie-Hellman error"); 507 dropbear_exit("Diffie-Hellman error");
508 } 508 }
509 mp_clear_multi(&dh_g, &dh_p, &dh_q, NULL); 509 mp_clear_multi(&dh_g, &dh_p, &dh_q, NULL);
510 TRACE(("leave gen_kexdh_vals"))
510 } 511 }
511 512
512 /* This function is fairly common between client/server, with some substitution 513 /* This function is fairly common between client/server, with some substitution
513 * of dh_e/dh_f etc. Hence these arguments: 514 * of dh_e/dh_f etc. Hence these arguments:
514 * dh_pub_us is 'e' for the client, 'f' for the server. dh_pub_them is 515 * dh_pub_us is 'e' for the client, 'f' for the server. dh_pub_them is
517 sign_key *hostkey) { 518 sign_key *hostkey) {
518 519
519 mp_int dh_p; 520 mp_int dh_p;
520 mp_int *dh_e = NULL, *dh_f = NULL; 521 mp_int *dh_e = NULL, *dh_f = NULL;
521 hash_state hs; 522 hash_state hs;
523
524 TRACE(("enter kexdh_comb_key"))
522 525
523 /* read the prime and generator*/ 526 /* read the prime and generator*/
524 m_mp_init(&dh_p); 527 m_mp_init(&dh_p);
525 bytes_to_mp(&dh_p, dh_p_val, DH_P_LEN); 528 bytes_to_mp(&dh_p, dh_p_val, DH_P_LEN);
526 529
575 if (ses.session_id == NULL) { 578 if (ses.session_id == NULL) {
576 /* create the session_id, this never needs freeing */ 579 /* create the session_id, this never needs freeing */
577 ses.session_id = (unsigned char*)m_malloc(SHA1_HASH_SIZE); 580 ses.session_id = (unsigned char*)m_malloc(SHA1_HASH_SIZE);
578 memcpy(ses.session_id, ses.hash, SHA1_HASH_SIZE); 581 memcpy(ses.session_id, ses.hash, SHA1_HASH_SIZE);
579 } 582 }
583 TRACE(("leave kexdh_comb_key"))
580 } 584 }
581 585
582 /* read the other side's algo list. buf_match_algo is a callback to match 586 /* read the other side's algo list. buf_match_algo is a callback to match
583 * algos for the client or server. */ 587 * algos for the client or server. */
584 static void read_kex_algos() { 588 static void read_kex_algos() {