comparison cli-session.c @ 745:15999b098cc9 kexguess

Don't usually need to recalculate dh_e for the repeated kexdh_init packet
author Matt Johnston <matt@ucc.asn.au>
date Wed, 03 Apr 2013 00:32:55 +0800
parents 09c5eb71ec96
children 465fefc4f6e0
comparison
equal deleted inserted replaced
744:504f33c684b5 745:15999b098cc9
180 * service, userauth and channel requests */ 180 * service, userauth and channel requests */
181 static void cli_sessionloop() { 181 static void cli_sessionloop() {
182 182
183 TRACE2(("enter cli_sessionloop")) 183 TRACE2(("enter cli_sessionloop"))
184 184
185 if (ses.lastpacket == 0) {
186 TRACE2(("exit cli_sessionloop: no real packets yet"))
187 return;
188 }
189
185 if (ses.lastpacket == SSH_MSG_KEXINIT && cli_ses.kex_state == KEX_NOTHING) { 190 if (ses.lastpacket == SSH_MSG_KEXINIT && cli_ses.kex_state == KEX_NOTHING) {
186 /* We initiate the KEXDH. If DH wasn't the correct type, the KEXINIT 191 /* We initiate the KEXDH. If DH wasn't the correct type, the KEXINIT
187 * negotiation would have failed. */ 192 * negotiation would have failed. */
188 if (!ses.kexstate.our_first_follows_matches) { 193 if (!ses.kexstate.our_first_follows_matches) {
189 dropbear_log(LOG_INFO, "kexdh_init after remote's kexinit"); 194 dropbear_log(LOG_INFO, "kexdh_init after remote's kexinit");
204 if (cli_ses.kex_state != KEX_NOTHING) { 209 if (cli_ses.kex_state != KEX_NOTHING) {
205 TRACE(("leave cli_sessionloop: kex_state != KEX_NOTHING")) 210 TRACE(("leave cli_sessionloop: kex_state != KEX_NOTHING"))
206 return; 211 return;
207 } 212 }
208 213
209 /* We should exit if we haven't donefirstkex: we shouldn't reach here
210 * in normal operation */
211 if (ses.kexstate.donefirstkex == 0) { 214 if (ses.kexstate.donefirstkex == 0) {
212 TRACE(("XXX XXX might be bad! leave cli_sessionloop: haven't donefirstkex")) 215 /* We might reach here if we have partial packet reads or have
216 * received SSG_MSG_IGNORE etc. Just skip it */
213 return; 217 return;
214 } 218 }
215 219
216 switch (cli_ses.state) { 220 switch (cli_ses.state) {
217 221