From cb10ad0c8471bfb86f0d2394a5abb33477c46026 Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Thu, 10 Apr 2014 17:46:54 +0200 Subject: buffer: adapt kex.c to new ssh_buffer_(un)pack() Reviewed-by: Andreas Schneider --- src/kex.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/kex.c b/src/kex.c index a88cf579..f1a1b566 100644 --- a/src/kex.c +++ b/src/kex.c @@ -582,14 +582,15 @@ int ssh_send_kex(ssh_session session, int server_kex) { &session->next_crypto->client_kex); ssh_string str = NULL; int i; - - if (buffer_add_u8(session->out_buffer, SSH2_MSG_KEXINIT) < 0) { - goto error; - } - if (ssh_buffer_add_data(session->out_buffer, kex->cookie, 16) < 0) { + int rc; + + rc = ssh_buffer_pack(session->out_buffer, + "bP", + SSH2_MSG_KEXINIT, + 16, + kex->cookie); /* cookie */ + if (rc != SSH_OK) goto error; - } - if (hashbufout_add_cookie(session) < 0) { goto error; } @@ -612,10 +613,11 @@ int ssh_send_kex(ssh_session session, int server_kex) { str = NULL; } - if (buffer_add_u8(session->out_buffer, 0) < 0) { - goto error; - } - if (buffer_add_u32(session->out_buffer, 0) < 0) { + rc = ssh_buffer_pack(session->out_buffer, + "bd", + 0, + 0); + if (rc != SSH_OK) { goto error; } -- cgit