Mercurial > dropbear
comparison svr-kex.c @ 24:469950e86d0f
switching to global vars
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 20 Jul 2004 12:05:00 +0000 |
parents | c1e5d9195402 |
children | 0969767bca0d |
comparison
equal
deleted
inserted
replaced
23:c896a4dd65da | 24:469950e86d0f |
---|---|
30 #include "kex.h" | 30 #include "kex.h" |
31 #include "ssh.h" | 31 #include "ssh.h" |
32 #include "packet.h" | 32 #include "packet.h" |
33 #include "bignum.h" | 33 #include "bignum.h" |
34 #include "random.h" | 34 #include "random.h" |
35 #include "runopts.h" | |
35 | 36 |
36 | 37 |
37 static void send_msg_kexdh_reply(mp_int *dh_e); | 38 static void send_msg_kexdh_reply(mp_int *dh_e); |
38 | 39 |
39 /* Handle a diffie-hellman key exchange initialisation. This involves | 40 /* Handle a diffie-hellman key exchange initialisation. This involves |
123 /* clear no longer needed vars */ | 124 /* clear no longer needed vars */ |
124 mp_clear_multi(&dh_y, &dh_p, &dh_q, NULL); | 125 mp_clear_multi(&dh_y, &dh_p, &dh_q, NULL); |
125 | 126 |
126 /* Create the remainder of the hash buffer, to generate the exchange hash */ | 127 /* Create the remainder of the hash buffer, to generate the exchange hash */ |
127 /* K_S, the host key */ | 128 /* K_S, the host key */ |
128 buf_put_pub_key(ses.kexhashbuf, ses.opts->hostkey, | 129 buf_put_pub_key(ses.kexhashbuf, svr_opts.hostkey, |
129 ses.newkeys->algo_hostkey); | 130 ses.newkeys->algo_hostkey); |
130 /* e, exchange value sent by the client */ | 131 /* e, exchange value sent by the client */ |
131 buf_putmpint(ses.kexhashbuf, dh_e); | 132 buf_putmpint(ses.kexhashbuf, dh_e); |
132 /* f, exchange value sent by the server */ | 133 /* f, exchange value sent by the server */ |
133 buf_putmpint(ses.kexhashbuf, &dh_f); | 134 buf_putmpint(ses.kexhashbuf, &dh_f); |
151 } | 152 } |
152 | 153 |
153 /* we can start creating the kexdh_reply packet */ | 154 /* we can start creating the kexdh_reply packet */ |
154 CHECKCLEARTOWRITE(); | 155 CHECKCLEARTOWRITE(); |
155 buf_putbyte(ses.writepayload, SSH_MSG_KEXDH_REPLY); | 156 buf_putbyte(ses.writepayload, SSH_MSG_KEXDH_REPLY); |
156 buf_put_pub_key(ses.writepayload, ses.opts->hostkey, | 157 buf_put_pub_key(ses.writepayload, svr_opts.hostkey, |
157 ses.newkeys->algo_hostkey); | 158 ses.newkeys->algo_hostkey); |
158 | 159 |
159 /* put f */ | 160 /* put f */ |
160 buf_putmpint(ses.writepayload, &dh_f); | 161 buf_putmpint(ses.writepayload, &dh_f); |
161 mp_clear(&dh_f); | 162 mp_clear(&dh_f); |
162 | 163 |
163 /* calc the signature */ | 164 /* calc the signature */ |
164 buf_put_sign(ses.writepayload, ses.opts->hostkey, | 165 buf_put_sign(ses.writepayload, svr_opts.hostkey, |
165 ses.newkeys->algo_hostkey, ses.hash, SHA1_HASH_SIZE); | 166 ses.newkeys->algo_hostkey, ses.hash, SHA1_HASH_SIZE); |
166 | 167 |
167 /* the SSH_MSG_KEXDH_REPLY is done */ | 168 /* the SSH_MSG_KEXDH_REPLY is done */ |
168 encrypt_packet(); | 169 encrypt_packet(); |
169 | 170 |