Mercurial > dropbear
comparison common-kex.c @ 1355:3fdd8c5a0195 fuzz
merge main to fuzz
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 18 May 2017 23:45:10 +0800 |
parents | b28624698130 750ec4ec4cbe |
children | 08f4fa4dc6a0 |
comparison
equal
deleted
inserted
replaced
1354:7618759e9327 | 1355:3fdd8c5a0195 |
---|---|
638 | 638 |
639 /* calculate the hash H to sign */ | 639 /* calculate the hash H to sign */ |
640 finish_kexhashbuf(); | 640 finish_kexhashbuf(); |
641 } | 641 } |
642 | 642 |
643 #ifdef DROPBEAR_ECDH | 643 #if DROPBEAR_ECDH |
644 struct kex_ecdh_param *gen_kexecdh_param() { | 644 struct kex_ecdh_param *gen_kexecdh_param() { |
645 struct kex_ecdh_param *param = m_malloc(sizeof(*param)); | 645 struct kex_ecdh_param *param = m_malloc(sizeof(*param)); |
646 if (ecc_make_key_ex(NULL, dropbear_ltc_prng, | 646 if (ecc_make_key_ex(NULL, dropbear_ltc_prng, |
647 ¶m->key, ses.newkeys->algo_kex->ecc_curve->dp) != CRYPT_OK) { | 647 ¶m->key, ses.newkeys->algo_kex->ecc_curve->dp) != CRYPT_OK) { |
648 dropbear_exit("ECC error"); | 648 dropbear_exit("ECC error"); |
690 /* calculate the hash H to sign */ | 690 /* calculate the hash H to sign */ |
691 finish_kexhashbuf(); | 691 finish_kexhashbuf(); |
692 } | 692 } |
693 #endif /* DROPBEAR_ECDH */ | 693 #endif /* DROPBEAR_ECDH */ |
694 | 694 |
695 #ifdef DROPBEAR_CURVE25519 | 695 #if DROPBEAR_CURVE25519 |
696 struct kex_curve25519_param *gen_kexcurve25519_param () { | 696 struct kex_curve25519_param *gen_kexcurve25519_param () { |
697 /* Per http://cr.yp.to/ecdh.html */ | 697 /* Per http://cr.yp.to/ecdh.html */ |
698 struct kex_curve25519_param *param = m_malloc(sizeof(*param)); | 698 struct kex_curve25519_param *param = m_malloc(sizeof(*param)); |
699 const unsigned char basepoint[32] = {9}; | 699 const unsigned char basepoint[32] = {9}; |
700 | 700 |
772 ses.kexhashbuf->len); | 772 ses.kexhashbuf->len); |
773 ses.hash = buf_new(hash_desc->hashsize); | 773 ses.hash = buf_new(hash_desc->hashsize); |
774 hash_desc->done(&hs, buf_getwriteptr(ses.hash, hash_desc->hashsize)); | 774 hash_desc->done(&hs, buf_getwriteptr(ses.hash, hash_desc->hashsize)); |
775 buf_setlen(ses.hash, hash_desc->hashsize); | 775 buf_setlen(ses.hash, hash_desc->hashsize); |
776 | 776 |
777 #if defined(DEBUG_KEXHASH) && defined(DEBUG_TRACE) | 777 #if (DEBUG_KEXHASH) && (DEBUG_TRACE) |
778 if (!debug_trace) { | 778 if (!debug_trace) { |
779 printhex("kexhashbuf", ses.kexhashbuf->data, ses.kexhashbuf->len); | 779 printhex("kexhashbuf", ses.kexhashbuf->data, ses.kexhashbuf->len); |
780 printhex("kexhash", ses.hash->data, ses.hash->len); | 780 printhex("kexhash", ses.hash->data, ses.hash->len); |
781 } | 781 } |
782 #endif | 782 #endif |
812 | 812 |
813 int goodguess = 0; | 813 int goodguess = 0; |
814 int allgood = 1; /* we AND this with each goodguess and see if its still | 814 int allgood = 1; /* we AND this with each goodguess and see if its still |
815 true after */ | 815 true after */ |
816 | 816 |
817 #ifdef USE_KEXGUESS2 | 817 #if DROPBEAR_KEXGUESS2 |
818 enum kexguess2_used kexguess2 = KEXGUESS2_LOOK; | 818 enum kexguess2_used kexguess2 = KEXGUESS2_LOOK; |
819 #else | 819 #else |
820 enum kexguess2_used kexguess2 = KEXGUESS2_NO; | 820 enum kexguess2_used kexguess2 = KEXGUESS2_NO; |
821 #endif | 821 #endif |
822 | 822 |