Mercurial > dropbear
comparison common-kex.c @ 1123:d7b752525b91
buf_getstring and buf_putstring now use non-unsigned char*
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 04 Jun 2015 23:08:50 +0800 |
parents | 2ebf450edc2d |
children | 6aeadee3f16b |
comparison
equal
deleted
inserted
replaced
1121:bb3a03feb31f | 1123:d7b752525b91 |
---|---|
126 | 126 |
127 /* compression_algorithms_server_to_client */ | 127 /* compression_algorithms_server_to_client */ |
128 buf_put_algolist(ses.writepayload, ses.compress_algos); | 128 buf_put_algolist(ses.writepayload, ses.compress_algos); |
129 | 129 |
130 /* languages_client_to_server */ | 130 /* languages_client_to_server */ |
131 buf_putstring(ses.writepayload, (const unsigned char *) "", 0); | 131 buf_putstring(ses.writepayload, "", 0); |
132 | 132 |
133 /* languages_server_to_client */ | 133 /* languages_server_to_client */ |
134 buf_putstring(ses.writepayload, (const unsigned char *) "", 0); | 134 buf_putstring(ses.writepayload, "", 0); |
135 | 135 |
136 /* first_kex_packet_follows */ | 136 /* first_kex_packet_follows */ |
137 buf_putbyte(ses.writepayload, (ses.send_kex_first_guess != NULL)); | 137 buf_putbyte(ses.writepayload, (ses.send_kex_first_guess != NULL)); |
138 | 138 |
139 /* reserved unit32 */ | 139 /* reserved unit32 */ |
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, | 528 buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len); |
529 (unsigned char*)LOCAL_IDENT, local_ident_len); | |
530 /* V_S, the server's version string (CR and NL excluded) */ | 529 /* V_S, the server's version string (CR and NL excluded) */ |
531 buf_putstring(ses.kexhashbuf, (unsigned char*)ses.remoteident, remote_ident_len); | 530 buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len); |
532 | 531 |
533 /* I_C, the payload of the client's SSH_MSG_KEXINIT */ | 532 /* I_C, the payload of the client's SSH_MSG_KEXINIT */ |
534 buf_putstring(ses.kexhashbuf, | 533 buf_putstring(ses.kexhashbuf, |
535 ses.transkexinit->data, ses.transkexinit->len); | 534 (const char*)ses.transkexinit->data, ses.transkexinit->len); |
536 /* I_S, the payload of the server's SSH_MSG_KEXINIT */ | 535 /* I_S, the payload of the server's SSH_MSG_KEXINIT */ |
537 buf_setpos(ses.payload, ses.payload_beginning); | 536 buf_setpos(ses.payload, ses.payload_beginning); |
538 buf_putstring(ses.kexhashbuf, | 537 buf_putstring(ses.kexhashbuf, |
539 buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), | 538 (const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), |
540 ses.payload->len-ses.payload->pos); | 539 ses.payload->len-ses.payload->pos); |
541 ses.requirenext = SSH_MSG_KEXDH_REPLY; | 540 ses.requirenext = SSH_MSG_KEXDH_REPLY; |
542 } else { | 541 } else { |
543 /* SERVER */ | 542 /* SERVER */ |
544 | 543 |
545 /* read the peer's choice of algos */ | 544 /* read the peer's choice of algos */ |
546 read_kex_algos(); | 545 read_kex_algos(); |
547 /* V_C, the client's version string (CR and NL excluded) */ | 546 /* V_C, the client's version string (CR and NL excluded) */ |
548 buf_putstring(ses.kexhashbuf, (unsigned char*)ses.remoteident, remote_ident_len); | 547 buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len); |
549 /* V_S, the server's version string (CR and NL excluded) */ | 548 /* V_S, the server's version string (CR and NL excluded) */ |
550 buf_putstring(ses.kexhashbuf, | 549 buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len); |
551 (unsigned char*)LOCAL_IDENT, local_ident_len); | |
552 | 550 |
553 /* I_C, the payload of the client's SSH_MSG_KEXINIT */ | 551 /* I_C, the payload of the client's SSH_MSG_KEXINIT */ |
554 buf_setpos(ses.payload, ses.payload_beginning); | 552 buf_setpos(ses.payload, ses.payload_beginning); |
555 buf_putstring(ses.kexhashbuf, | 553 buf_putstring(ses.kexhashbuf, |
556 buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), | 554 (const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), |
557 ses.payload->len-ses.payload->pos); | 555 ses.payload->len-ses.payload->pos); |
558 | 556 |
559 /* I_S, the payload of the server's SSH_MSG_KEXINIT */ | 557 /* I_S, the payload of the server's SSH_MSG_KEXINIT */ |
560 buf_putstring(ses.kexhashbuf, | 558 buf_putstring(ses.kexhashbuf, |
561 ses.transkexinit->data, ses.transkexinit->len); | 559 (const char*)ses.transkexinit->data, ses.transkexinit->len); |
562 | 560 |
563 ses.requirenext = SSH_MSG_KEXDH_INIT; | 561 ses.requirenext = SSH_MSG_KEXDH_INIT; |
564 } | 562 } |
565 | 563 |
566 buf_free(ses.transkexinit); | 564 buf_free(ses.transkexinit); |
781 } | 779 } |
782 | 780 |
783 /* K_S, the host key */ | 781 /* K_S, the host key */ |
784 buf_put_pub_key(ses.kexhashbuf, hostkey, ses.newkeys->algo_hostkey); | 782 buf_put_pub_key(ses.kexhashbuf, hostkey, ses.newkeys->algo_hostkey); |
785 /* Q_C, client's ephemeral public key octet string */ | 783 /* Q_C, client's ephemeral public key octet string */ |
786 buf_putstring(ses.kexhashbuf, Q_C, CURVE25519_LEN); | 784 buf_putstring(ses.kexhashbuf, (const char*)Q_C, CURVE25519_LEN); |
787 /* Q_S, server's ephemeral public key octet string */ | 785 /* Q_S, server's ephemeral public key octet string */ |
788 buf_putstring(ses.kexhashbuf, Q_S, CURVE25519_LEN); | 786 buf_putstring(ses.kexhashbuf, (const char*)Q_S, CURVE25519_LEN); |
789 /* K, the shared secret */ | 787 /* K, the shared secret */ |
790 buf_putmpint(ses.kexhashbuf, ses.dh_K); | 788 buf_putmpint(ses.kexhashbuf, ses.dh_K); |
791 | 789 |
792 /* calculate the hash H to sign */ | 790 /* calculate the hash H to sign */ |
793 finish_kexhashbuf(); | 791 finish_kexhashbuf(); |