mirror of
https://github.com/clearml/dropbear
synced 2025-01-31 10:57:01 +00:00
* options.h, common-kex.c: fix support of 4096 byte host keys
--HG-- extra : convert_revision : 096f29c430c23f0140f0cf272942a13046483ec6
This commit is contained in:
parent
4a4e1b49ec
commit
736f370dce
42
common-kex.c
42
common-kex.c
@ -394,18 +394,28 @@ static void gen_new_zstreams() {
|
||||
/* Belongs in common_kex.c where it should be moved after review */
|
||||
void recv_msg_kexinit() {
|
||||
|
||||
unsigned int kexhashbuf_len = 0;
|
||||
unsigned int remote_ident_len = 0;
|
||||
unsigned int local_ident_len = 0;
|
||||
|
||||
TRACE(("<- KEXINIT"))
|
||||
TRACE(("enter recv_msg_kexinit"))
|
||||
|
||||
/* start the kex hash */
|
||||
ses.kexhashbuf = buf_new(MAX_KEXHASHBUF);
|
||||
|
||||
if (!ses.kexstate.sentkexinit) {
|
||||
/* we need to send a kex packet */
|
||||
send_msg_kexinit();
|
||||
TRACE(("continue recv_msg_kexinit: sent kexinit"))
|
||||
}
|
||||
|
||||
/* start the kex hash */
|
||||
local_ident_len = strlen(LOCAL_IDENT);
|
||||
remote_ident_len = strlen((char*)ses.remoteident);
|
||||
|
||||
kexhashbuf_len = local_ident_len + remote_ident_len
|
||||
+ ses.transkexinit->len + ses.payload->len
|
||||
+ KEXHASHBUF_MAX_INTS;
|
||||
|
||||
ses.kexhashbuf = buf_new(kexhashbuf_len);
|
||||
|
||||
if (IS_DROPBEAR_CLIENT) {
|
||||
|
||||
@ -414,20 +424,16 @@ void recv_msg_kexinit() {
|
||||
|
||||
/* V_C, the client's version string (CR and NL excluded) */
|
||||
buf_putstring(ses.kexhashbuf,
|
||||
(unsigned char*)LOCAL_IDENT, strlen(LOCAL_IDENT));
|
||||
(unsigned char*)LOCAL_IDENT, local_ident_len);
|
||||
/* V_S, the server's version string (CR and NL excluded) */
|
||||
buf_putstring(ses.kexhashbuf,
|
||||
ses.remoteident, strlen((char*)ses.remoteident));
|
||||
buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len);
|
||||
|
||||
/* I_C, the payload of the client's SSH_MSG_KEXINIT */
|
||||
buf_putstring(ses.kexhashbuf,
|
||||
buf_getptr(ses.transkexinit, ses.transkexinit->len),
|
||||
ses.transkexinit->len);
|
||||
ses.transkexinit->data, ses.transkexinit->len);
|
||||
/* I_S, the payload of the server's SSH_MSG_KEXINIT */
|
||||
buf_setpos(ses.payload, 0);
|
||||
buf_putstring(ses.kexhashbuf,
|
||||
buf_getptr(ses.payload, ses.payload->len),
|
||||
ses.payload->len);
|
||||
buf_putstring(ses.kexhashbuf, ses.payload->data, ses.payload->len);
|
||||
|
||||
} else {
|
||||
/* SERVER */
|
||||
@ -435,21 +441,19 @@ void recv_msg_kexinit() {
|
||||
/* read the peer's choice of algos */
|
||||
read_kex_algos();
|
||||
/* V_C, the client's version string (CR and NL excluded) */
|
||||
buf_putstring(ses.kexhashbuf,
|
||||
ses.remoteident, strlen((char*)ses.remoteident));
|
||||
buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len);
|
||||
/* V_S, the server's version string (CR and NL excluded) */
|
||||
buf_putstring(ses.kexhashbuf,
|
||||
(unsigned char*)LOCAL_IDENT, strlen(LOCAL_IDENT));
|
||||
(unsigned char*)LOCAL_IDENT, local_ident_len);
|
||||
|
||||
/* I_C, the payload of the client's SSH_MSG_KEXINIT */
|
||||
buf_setpos(ses.payload, 0);
|
||||
buf_putstring(ses.kexhashbuf,
|
||||
buf_getptr(ses.payload, ses.payload->len),
|
||||
ses.payload->len);
|
||||
buf_putstring(ses.kexhashbuf, ses.payload->data, ses.payload->len);
|
||||
|
||||
/* I_S, the payload of the server's SSH_MSG_KEXINIT */
|
||||
buf_putstring(ses.kexhashbuf,
|
||||
buf_getptr(ses.transkexinit, ses.transkexinit->len),
|
||||
ses.transkexinit->len);
|
||||
ses.transkexinit->data, ses.transkexinit->len);
|
||||
|
||||
ses.requirenext = SSH_MSG_KEXDH_INIT;
|
||||
}
|
||||
|
||||
|
12
options.h
12
options.h
@ -306,10 +306,14 @@ etc) slower (perhaps by 50%). Recommended for most small systems. */
|
||||
#define MAX_STRING_LEN 1400 /* ~= MAX_PROPOSED_ALGO * MAX_NAME_LEN, also
|
||||
is the max length for a password etc */
|
||||
|
||||
/* For a 4096 bit DSS key, empirically determined to be 1590 bytes */
|
||||
#define MAX_PUBKEY_SIZE 1600
|
||||
/* For a 4096 bit DSS key, empirically determined to be 1590 bytes */
|
||||
#define MAX_PRIVKEY_SIZE 1600
|
||||
/* For a 4096 bit DSS key, empirically determined */
|
||||
#define MAX_PUBKEY_SIZE 1700
|
||||
/* For a 4096 bit DSS key, empirically determined */
|
||||
#define MAX_PRIVKEY_SIZE 1700
|
||||
|
||||
/* The maximum size of the bignum portion of the kexhash buffer */
|
||||
/* Sect. 8 of the transport draft, K_S + e + f + K */
|
||||
#define KEXHASHBUF_MAX_INTS (1700 + 130 + 130 + 130)
|
||||
|
||||
#define DROPBEAR_MAX_SOCKS 2 /* IPv4, IPv6 are all we'll get for now. Revisit
|
||||
in a few years time.... */
|
||||
|
Loading…
Reference in New Issue
Block a user