comparison common-kex.c @ 805:724c3e0c8734 ecc

Add m_mp_alloc_init_multi() helper
author Matt Johnston <matt@ucc.asn.au>
date Thu, 23 May 2013 22:18:16 +0800
parents 7dcb46da72d9
children 6c69e7df3621
comparison
equal deleted inserted replaced
804:34b73c9d8aa3 805:724c3e0c8734
631 || mp_cmp_d(dh_pub_them, 0) != MP_GT) { 631 || mp_cmp_d(dh_pub_them, 0) != MP_GT) {
632 dropbear_exit("Diffie-Hellman error"); 632 dropbear_exit("Diffie-Hellman error");
633 } 633 }
634 634
635 /* K = e^y mod p = f^x mod p */ 635 /* K = e^y mod p = f^x mod p */
636 ses.dh_K = (mp_int*)m_malloc(sizeof(mp_int)); 636 m_mp_alloc_init_multi(&ses.dh_K, NULL);
637 m_mp_init(ses.dh_K);
638 if (mp_exptmod(dh_pub_them, &param->priv, &dh_p, ses.dh_K) != MP_OKAY) { 637 if (mp_exptmod(dh_pub_them, &param->priv, &dh_p, ses.dh_K) != MP_OKAY) {
639 dropbear_exit("Diffie-Hellman error"); 638 dropbear_exit("Diffie-Hellman error");
640 } 639 }
641 640
642 /* clear no longer needed vars */ 641 /* clear no longer needed vars */