Mercurial > dropbear
comparison common-kex.c @ 1251:52a456a3add0
Merge branch '20151231_indent' of https://github.com/fperrad/dropbear into fperrad-20151231_indent
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 15 Mar 2016 21:41:06 +0800 |
parents | 82e2037d34ea 2bb4c662d1c2 |
children | 9169e4e7cbee |
comparison
equal
deleted
inserted
replaced
1248:739b3909c499 | 1251:52a456a3add0 |
---|---|
306 buf_burn(ses.hash); | 306 buf_burn(ses.hash); |
307 buf_free(ses.hash); | 307 buf_free(ses.hash); |
308 ses.hash = NULL; | 308 ses.hash = NULL; |
309 | 309 |
310 if (IS_DROPBEAR_CLIENT) { | 310 if (IS_DROPBEAR_CLIENT) { |
311 trans_IV = C2S_IV; | 311 trans_IV = C2S_IV; |
312 recv_IV = S2C_IV; | 312 recv_IV = S2C_IV; |
313 trans_key = C2S_key; | 313 trans_key = C2S_key; |
314 recv_key = S2C_key; | 314 recv_key = S2C_key; |
315 mactransletter = 'E'; | 315 mactransletter = 'E'; |
316 macrecvletter = 'F'; | 316 macrecvletter = 'F'; |
317 } else { | 317 } else { |
318 trans_IV = S2C_IV; | 318 trans_IV = S2C_IV; |
319 recv_IV = C2S_IV; | 319 recv_IV = C2S_IV; |
320 trans_key = S2C_key; | 320 trans_key = S2C_key; |
321 recv_key = C2S_key; | 321 recv_key = C2S_key; |
322 mactransletter = 'F'; | 322 mactransletter = 'F'; |
323 macrecvletter = 'E'; | 323 macrecvletter = 'E'; |
324 } | 324 } |
325 | 325 |
326 hashkeys(C2S_IV, sizeof(C2S_IV), &hs, 'A'); | 326 hashkeys(C2S_IV, sizeof(C2S_IV), &hs, 'A'); |
482 | 482 |
483 /* read the peer's choice of algos */ | 483 /* read the peer's choice of algos */ |
484 read_kex_algos(); | 484 read_kex_algos(); |
485 | 485 |
486 /* V_C, the client's version string (CR and NL excluded) */ | 486 /* V_C, the client's version string (CR and NL excluded) */ |
487 buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len); | 487 buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len); |
488 /* V_S, the server's version string (CR and NL excluded) */ | 488 /* V_S, the server's version string (CR and NL excluded) */ |
489 buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len); | 489 buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len); |
490 | 490 |
491 /* I_C, the payload of the client's SSH_MSG_KEXINIT */ | 491 /* I_C, the payload of the client's SSH_MSG_KEXINIT */ |
492 buf_putstring(ses.kexhashbuf, | 492 buf_putstring(ses.kexhashbuf, |
493 (const char*)ses.transkexinit->data, ses.transkexinit->len); | 493 (const char*)ses.transkexinit->data, ses.transkexinit->len); |
494 /* I_S, the payload of the server's SSH_MSG_KEXINIT */ | 494 /* I_S, the payload of the server's SSH_MSG_KEXINIT */ |
495 buf_setpos(ses.payload, ses.payload_beginning); | 495 buf_setpos(ses.payload, ses.payload_beginning); |
496 buf_putstring(ses.kexhashbuf, | 496 buf_putstring(ses.kexhashbuf, |
497 (const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), | 497 (const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), |
498 ses.payload->len-ses.payload->pos); | 498 ses.payload->len-ses.payload->pos); |
499 ses.requirenext = SSH_MSG_KEXDH_REPLY; | 499 ses.requirenext = SSH_MSG_KEXDH_REPLY; |
500 } else { | 500 } else { |
501 /* SERVER */ | 501 /* SERVER */ |
502 | 502 |
503 /* read the peer's choice of algos */ | 503 /* read the peer's choice of algos */ |
504 read_kex_algos(); | 504 read_kex_algos(); |
505 /* V_C, the client's version string (CR and NL excluded) */ | 505 /* V_C, the client's version string (CR and NL excluded) */ |
506 buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len); | 506 buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len); |
507 /* V_S, the server's version string (CR and NL excluded) */ | 507 /* V_S, the server's version string (CR and NL excluded) */ |
508 buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len); | 508 buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len); |
509 | 509 |
510 /* I_C, the payload of the client's SSH_MSG_KEXINIT */ | 510 /* I_C, the payload of the client's SSH_MSG_KEXINIT */ |
511 buf_setpos(ses.payload, ses.payload_beginning); | 511 buf_setpos(ses.payload, ses.payload_beginning); |
512 buf_putstring(ses.kexhashbuf, | 512 buf_putstring(ses.kexhashbuf, |
513 (const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), | 513 (const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), |
514 ses.payload->len-ses.payload->pos); | 514 ses.payload->len-ses.payload->pos); |
515 | 515 |
516 /* I_S, the payload of the server's SSH_MSG_KEXINIT */ | 516 /* I_S, the payload of the server's SSH_MSG_KEXINIT */ |
517 buf_putstring(ses.kexhashbuf, | 517 buf_putstring(ses.kexhashbuf, |
518 (const char*)ses.transkexinit->data, ses.transkexinit->len); | 518 (const char*)ses.transkexinit->data, ses.transkexinit->len); |
519 | 519 |
520 ses.requirenext = SSH_MSG_KEXDH_INIT; | 520 ses.requirenext = SSH_MSG_KEXDH_INIT; |
521 } | 521 } |
522 | 522 |