Mercurial > dropbear
comparison svr-kex.c @ 761:ac2158e3e403 ecc
ecc kind of works, needs fixing/testing
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 07 Apr 2013 01:36:42 +0800 |
parents | 76fba0856749 |
children | 5503e05ab3a4 |
comparison
equal
deleted
inserted
replaced
760:f336d232fc63 | 761:ac2158e3e403 |
---|---|
32 #include "ssh.h" | 32 #include "ssh.h" |
33 #include "packet.h" | 33 #include "packet.h" |
34 #include "bignum.h" | 34 #include "bignum.h" |
35 #include "random.h" | 35 #include "random.h" |
36 #include "runopts.h" | 36 #include "runopts.h" |
37 | 37 #include "ecc.h" |
38 | 38 |
39 static void send_msg_kexdh_reply(mp_int *dh_e, buffer *ecdh_qs); | 39 static void send_msg_kexdh_reply(mp_int *dh_e, buffer *ecdh_qs); |
40 | 40 |
41 /* Handle a diffie-hellman key exchange initialisation. This involves | 41 /* Handle a diffie-hellman key exchange initialisation. This involves |
42 * calculating a session key reply value, and corresponding hash. These | 42 * calculating a session key reply value, and corresponding hash. These |
57 if (buf_getmpint(ses.payload, &dh_e) != DROPBEAR_SUCCESS) { | 57 if (buf_getmpint(ses.payload, &dh_e) != DROPBEAR_SUCCESS) { |
58 dropbear_exit("Failed to get kex value"); | 58 dropbear_exit("Failed to get kex value"); |
59 } | 59 } |
60 } else { | 60 } else { |
61 #ifdef DROPBEAR_ECDH | 61 #ifdef DROPBEAR_ECDH |
62 buffer *ecdh_qs = buf_getstringbuf(ses.payload); | 62 ecdh_qs = buf_getstringbuf(ses.payload); |
63 #endif | 63 #endif |
64 } | 64 } |
65 | 65 |
66 send_msg_kexdh_reply(&dh_e, ecdh_qs); | 66 send_msg_kexdh_reply(&dh_e, ecdh_qs); |
67 | 67 |
102 } else { | 102 } else { |
103 #ifdef DROPBEAR_ECDH | 103 #ifdef DROPBEAR_ECDH |
104 struct kex_ecdh_param *ecdh_param = gen_kexecdh_param(); | 104 struct kex_ecdh_param *ecdh_param = gen_kexecdh_param(); |
105 kexecdh_comb_key(ecdh_param, ecdh_qs, svr_opts.hostkey); | 105 kexecdh_comb_key(ecdh_param, ecdh_qs, svr_opts.hostkey); |
106 | 106 |
107 buf_put_ecc_pub(ses.writepayload, &ecdh_param->key); | 107 buf_put_ecc_pubkey_string(ses.writepayload, &ecdh_param->key); |
108 free_kexecdh_param(ecdh_param); | 108 free_kexecdh_param(ecdh_param); |
109 #endif | 109 #endif |
110 } | 110 } |
111 | 111 |
112 /* calc the signature */ | 112 /* calc the signature */ |
113 buf_put_sign(ses.writepayload, svr_opts.hostkey, | 113 buf_put_sign(ses.writepayload, svr_opts.hostkey, |
114 ses.newkeys->algo_hostkey, ses.hash, SHA1_HASH_SIZE); | 114 ses.newkeys->algo_hostkey, ses.hash); |
115 | 115 |
116 /* the SSH_MSG_KEXDH_REPLY is done */ | 116 /* the SSH_MSG_KEXDH_REPLY is done */ |
117 encrypt_packet(); | 117 encrypt_packet(); |
118 | 118 |
119 TRACE(("leave send_msg_kexdh_reply")) | 119 TRACE(("leave send_msg_kexdh_reply")) |