comparison common-kex.c @ 1702:8f93f37c01de

Allow DH to be completely disabled (#97) Reduces binary size by ~2kB by default and by 21kB with no other libtommath functions users, ex. with curve25519 kex and ed25519 key only.
author Vladislav Grishenko <themiron@users.noreply.github.com>
date Thu, 28 May 2020 20:01:48 +0500
parents 56f636f84bf5
children 7d8462677355
comparison
equal deleted inserted replaced
1701:6e5037ae2c1c 1702:8f93f37c01de
546 ses.kexstate.recvkexinit = 1; 546 ses.kexstate.recvkexinit = 1;
547 547
548 TRACE(("leave recv_msg_kexinit")) 548 TRACE(("leave recv_msg_kexinit"))
549 } 549 }
550 550
551 #if DROPBEAR_NORMAL_DH
551 static void load_dh_p(mp_int * dh_p) 552 static void load_dh_p(mp_int * dh_p)
552 { 553 {
553 bytes_to_mp(dh_p, ses.newkeys->algo_kex->dh_p_bytes, 554 bytes_to_mp(dh_p, ses.newkeys->algo_kex->dh_p_bytes,
554 ses.newkeys->algo_kex->dh_p_len); 555 ses.newkeys->algo_kex->dh_p_len);
555 } 556 }
654 buf_putmpint(ses.kexhashbuf, ses.dh_K); 655 buf_putmpint(ses.kexhashbuf, ses.dh_K);
655 656
656 /* calculate the hash H to sign */ 657 /* calculate the hash H to sign */
657 finish_kexhashbuf(); 658 finish_kexhashbuf();
658 } 659 }
660 #endif
659 661
660 #if DROPBEAR_ECDH 662 #if DROPBEAR_ECDH
661 struct kex_ecdh_param *gen_kexecdh_param() { 663 struct kex_ecdh_param *gen_kexecdh_param() {
662 struct kex_ecdh_param *param = m_malloc(sizeof(*param)); 664 struct kex_ecdh_param *param = m_malloc(sizeof(*param));
663 if (ecc_make_key_ex(NULL, dropbear_ltc_prng, 665 if (ecc_make_key_ex(NULL, dropbear_ltc_prng,