aboutsummaryrefslogtreecommitdiff
path: root/src/kex.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2014-04-10 17:46:54 +0200
committerAndreas Schneider <asn@cryptomilk.org>2014-08-06 09:20:49 +0200
commitcb10ad0c8471bfb86f0d2394a5abb33477c46026 (patch)
treec4d6de1d72843657b2eec29d160700c9a5a262c2 /src/kex.c
parent1f2c61d6add01c4671ba8a638471d7e0b7a77c13 (diff)
downloadlibssh-cb10ad0c8471bfb86f0d2394a5abb33477c46026.tar.gz
libssh-cb10ad0c8471bfb86f0d2394a5abb33477c46026.tar.xz
libssh-cb10ad0c8471bfb86f0d2394a5abb33477c46026.zip
buffer: adapt kex.c to new ssh_buffer_(un)pack()
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'src/kex.c')
-rw-r--r--src/kex.c24
1 files 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;
}