comparison common-kex.c @ 84:29a5c7c62350

default initialisers for mp_ints
author Matt Johnston <matt@ucc.asn.au>
date Tue, 17 Aug 2004 10:20:20 +0000
parents 5a55bd66707f
children 2010f4119c1a
comparison
equal deleted inserted replaced
83:6539c9480b23 84:29a5c7c62350
462 TRACE(("leave recv_msg_kexinit")); 462 TRACE(("leave recv_msg_kexinit"));
463 } 463 }
464 464
465 /* Initialises and generate one side of the diffie-hellman key exchange values. 465 /* Initialises and generate one side of the diffie-hellman key exchange values.
466 * See the ietf-secsh-transport draft, section 6, for details */ 466 * See the ietf-secsh-transport draft, section 6, for details */
467 /* dh_pub and dh_priv will be initialised by this function, and should be 467 /* dh_pub and dh_priv MUST be already initialised */
468 * mp_clear()ed after finished */
469 void gen_kexdh_vals(mp_int *dh_pub, mp_int *dh_priv) { 468 void gen_kexdh_vals(mp_int *dh_pub, mp_int *dh_priv) {
470 469
471 mp_int dh_p, dh_q, dh_g; 470 DEF_MP_INT(dh_p);
471 DEF_MP_INT(dh_q);
472 DEF_MP_INT(dh_g);
472 unsigned char randbuf[DH_P_LEN]; 473 unsigned char randbuf[DH_P_LEN];
473 int dh_q_len; 474 int dh_q_len;
474 475
475 TRACE(("enter send_msg_kexdh_reply")); 476 TRACE(("enter send_msg_kexdh_reply"));
476 477
477 m_mp_init_multi(&dh_g, &dh_p, &dh_q, dh_priv, dh_pub, NULL); 478 m_mp_init_multi(&dh_g, &dh_p, &dh_q, NULL);
478 479
479 /* read the prime and generator*/ 480 /* read the prime and generator*/
480 if (mp_read_unsigned_bin(&dh_p, (unsigned char*)dh_p_val, DH_P_LEN) 481 if (mp_read_unsigned_bin(&dh_p, (unsigned char*)dh_p_val, DH_P_LEN)
481 != MP_OKAY) { 482 != MP_OKAY) {
482 dropbear_exit("Diffie-Hellman error"); 483 dropbear_exit("Diffie-Hellman error");