comparison common-kex.c @ 1250:2bb4c662d1c2

more hard tab
author Francois Perrad <francois.perrad@gadz.org>
date Fri, 01 Jan 2016 15:02:09 +0100
parents 1b8afc698e39
children 52a456a3add0
comparison
equal deleted inserted replaced
1249:c6346c63281b 1250:2bb4c662d1c2
38 #include "crypto_desc.h" 38 #include "crypto_desc.h"
39 39
40 /* diffie-hellman-group1-sha1 value for p */ 40 /* diffie-hellman-group1-sha1 value for p */
41 const unsigned char dh_p_1[DH_P_1_LEN] = { 41 const unsigned char dh_p_1[DH_P_1_LEN] = {
42 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x0F, 0xDA, 0xA2, 42 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x0F, 0xDA, 0xA2,
43 0x21, 0x68, 0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, 43 0x21, 0x68, 0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1,
44 0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, 0x02, 0x0B, 0xBE, 0xA6, 44 0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, 0x02, 0x0B, 0xBE, 0xA6,
45 0x3B, 0x13, 0x9B, 0x22, 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD, 45 0x3B, 0x13, 0x9B, 0x22, 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD,
46 0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, 0x30, 0x2B, 0x0A, 0x6D, 46 0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, 0x30, 0x2B, 0x0A, 0x6D,
47 0xF2, 0x5F, 0x14, 0x37, 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45, 47 0xF2, 0x5F, 0x14, 0x37, 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45,
48 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, 0xF4, 0x4C, 0x42, 0xE9, 48 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, 0xF4, 0x4C, 0x42, 0xE9,
52 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; 52 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
53 53
54 /* diffie-hellman-group14-sha1 value for p */ 54 /* diffie-hellman-group14-sha1 value for p */
55 const unsigned char dh_p_14[DH_P_14_LEN] = { 55 const unsigned char dh_p_14[DH_P_14_LEN] = {
56 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x0F, 0xDA, 0xA2, 56 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x0F, 0xDA, 0xA2,
57 0x21, 0x68, 0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, 57 0x21, 0x68, 0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1,
58 0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, 0x02, 0x0B, 0xBE, 0xA6, 58 0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, 0x02, 0x0B, 0xBE, 0xA6,
59 0x3B, 0x13, 0x9B, 0x22, 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD, 59 0x3B, 0x13, 0x9B, 0x22, 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD,
60 0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, 0x30, 0x2B, 0x0A, 0x6D, 60 0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, 0x30, 0x2B, 0x0A, 0x6D,
61 0xF2, 0x5F, 0x14, 0x37, 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45, 61 0xF2, 0x5F, 0x14, 0x37, 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45,
62 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, 0xF4, 0x4C, 0x42, 0xE9, 62 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, 0xF4, 0x4C, 0x42, 0xE9,
347 buf_burn(ses.hash); 347 buf_burn(ses.hash);
348 buf_free(ses.hash); 348 buf_free(ses.hash);
349 ses.hash = NULL; 349 ses.hash = NULL;
350 350
351 if (IS_DROPBEAR_CLIENT) { 351 if (IS_DROPBEAR_CLIENT) {
352 trans_IV = C2S_IV; 352 trans_IV = C2S_IV;
353 recv_IV = S2C_IV; 353 recv_IV = S2C_IV;
354 trans_key = C2S_key; 354 trans_key = C2S_key;
355 recv_key = S2C_key; 355 recv_key = S2C_key;
356 mactransletter = 'E'; 356 mactransletter = 'E';
357 macrecvletter = 'F'; 357 macrecvletter = 'F';
358 } else { 358 } else {
359 trans_IV = S2C_IV; 359 trans_IV = S2C_IV;
360 recv_IV = C2S_IV; 360 recv_IV = C2S_IV;
361 trans_key = S2C_key; 361 trans_key = S2C_key;
362 recv_key = C2S_key; 362 recv_key = C2S_key;
363 mactransletter = 'F'; 363 mactransletter = 'F';
364 macrecvletter = 'E'; 364 macrecvletter = 'E';
365 } 365 }
366 366
367 hashkeys(C2S_IV, sizeof(C2S_IV), &hs, 'A'); 367 hashkeys(C2S_IV, sizeof(C2S_IV), &hs, 'A');
523 523
524 /* read the peer's choice of algos */ 524 /* read the peer's choice of algos */
525 read_kex_algos(); 525 read_kex_algos();
526 526
527 /* V_C, the client's version string (CR and NL excluded) */ 527 /* V_C, the client's version string (CR and NL excluded) */
528 buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len); 528 buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len);
529 /* V_S, the server's version string (CR and NL excluded) */ 529 /* V_S, the server's version string (CR and NL excluded) */
530 buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len); 530 buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len);
531 531
532 /* I_C, the payload of the client's SSH_MSG_KEXINIT */ 532 /* I_C, the payload of the client's SSH_MSG_KEXINIT */
533 buf_putstring(ses.kexhashbuf, 533 buf_putstring(ses.kexhashbuf,
534 (const char*)ses.transkexinit->data, ses.transkexinit->len); 534 (const char*)ses.transkexinit->data, ses.transkexinit->len);
535 /* I_S, the payload of the server's SSH_MSG_KEXINIT */ 535 /* I_S, the payload of the server's SSH_MSG_KEXINIT */
536 buf_setpos(ses.payload, ses.payload_beginning); 536 buf_setpos(ses.payload, ses.payload_beginning);
537 buf_putstring(ses.kexhashbuf, 537 buf_putstring(ses.kexhashbuf,
538 (const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), 538 (const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos),
539 ses.payload->len-ses.payload->pos); 539 ses.payload->len-ses.payload->pos);
540 ses.requirenext = SSH_MSG_KEXDH_REPLY; 540 ses.requirenext = SSH_MSG_KEXDH_REPLY;
541 } else { 541 } else {
542 /* SERVER */ 542 /* SERVER */
543 543
544 /* read the peer's choice of algos */ 544 /* read the peer's choice of algos */
545 read_kex_algos(); 545 read_kex_algos();
546 /* V_C, the client's version string (CR and NL excluded) */ 546 /* V_C, the client's version string (CR and NL excluded) */
547 buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len); 547 buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len);
548 /* V_S, the server's version string (CR and NL excluded) */ 548 /* V_S, the server's version string (CR and NL excluded) */
549 buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len); 549 buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len);
550 550
551 /* I_C, the payload of the client's SSH_MSG_KEXINIT */ 551 /* I_C, the payload of the client's SSH_MSG_KEXINIT */
552 buf_setpos(ses.payload, ses.payload_beginning); 552 buf_setpos(ses.payload, ses.payload_beginning);
553 buf_putstring(ses.kexhashbuf, 553 buf_putstring(ses.kexhashbuf,
554 (const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), 554 (const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos),
555 ses.payload->len-ses.payload->pos); 555 ses.payload->len-ses.payload->pos);
556 556
557 /* I_S, the payload of the server's SSH_MSG_KEXINIT */ 557 /* I_S, the payload of the server's SSH_MSG_KEXINIT */
558 buf_putstring(ses.kexhashbuf, 558 buf_putstring(ses.kexhashbuf,
559 (const char*)ses.transkexinit->data, ses.transkexinit->len); 559 (const char*)ses.transkexinit->data, ses.transkexinit->len);
560 560
561 ses.requirenext = SSH_MSG_KEXDH_INIT; 561 ses.requirenext = SSH_MSG_KEXDH_INIT;
562 } 562 }
563 563