summaryrefslogtreecommitdiff
path: root/kexgex.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2019-06-05 06:41:44 +0100
committerColin Watson <cjwatson@debian.org>2019-06-09 22:09:07 +0100
commit865a97e05b6aab1619e1c8eeb33ccb8f9a9e48d3 (patch)
tree7bb2128eb663180bacfabca88f26d26bf0733824 /kexgex.c
parentba627ba172d6649919baedff5ba2789610da382a (diff)
parent7d50f9e5be88179325983a1f58c9d51bb58f025a (diff)
New upstream release (8.0p1)
Diffstat (limited to 'kexgex.c')
-rw-r--r--kexgex.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/kexgex.c b/kexgex.c
index 3ca4bd370..8040a1320 100644
--- a/kexgex.c
+++ b/kexgex.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexgex.c,v 1.29 2015/01/19 20:16:15 markus Exp $ */ 1/* $OpenBSD: kexgex.c,v 1.32 2019/01/23 00:30:41 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Niels Provos. All rights reserved. 3 * Copyright (c) 2000 Niels Provos. All rights reserved.
4 * Copyright (c) 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -46,17 +46,17 @@
46int 46int
47kexgex_hash( 47kexgex_hash(
48 int hash_alg, 48 int hash_alg,
49 const char *client_version_string, 49 const struct sshbuf *client_version,
50 const char *server_version_string, 50 const struct sshbuf *server_version,
51 const u_char *ckexinit, size_t ckexinitlen, 51 const struct sshbuf *client_kexinit,
52 const u_char *skexinit, size_t skexinitlen, 52 const struct sshbuf *server_kexinit,
53 const u_char *serverhostkeyblob, size_t sbloblen, 53 const struct sshbuf *server_host_key_blob,
54 int min, int wantbits, int max, 54 int min, int wantbits, int max,
55 const BIGNUM *prime, 55 const BIGNUM *prime,
56 const BIGNUM *gen, 56 const BIGNUM *gen,
57 const BIGNUM *client_dh_pub, 57 const BIGNUM *client_dh_pub,
58 const BIGNUM *server_dh_pub, 58 const BIGNUM *server_dh_pub,
59 const BIGNUM *shared_secret, 59 const u_char *shared_secret, size_t secretlen,
60 u_char *hash, size_t *hashlen) 60 u_char *hash, size_t *hashlen)
61{ 61{
62 struct sshbuf *b; 62 struct sshbuf *b;
@@ -66,16 +66,16 @@ kexgex_hash(
66 return SSH_ERR_INVALID_ARGUMENT; 66 return SSH_ERR_INVALID_ARGUMENT;
67 if ((b = sshbuf_new()) == NULL) 67 if ((b = sshbuf_new()) == NULL)
68 return SSH_ERR_ALLOC_FAIL; 68 return SSH_ERR_ALLOC_FAIL;
69 if ((r = sshbuf_put_cstring(b, client_version_string)) != 0 || 69 if ((r = sshbuf_put_stringb(b, client_version)) < 0 ||
70 (r = sshbuf_put_cstring(b, server_version_string)) != 0 || 70 (r = sshbuf_put_stringb(b, server_version)) < 0 ||
71 /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */ 71 /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */
72 (r = sshbuf_put_u32(b, ckexinitlen+1)) != 0 || 72 (r = sshbuf_put_u32(b, sshbuf_len(client_kexinit) + 1)) != 0 ||
73 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 || 73 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 ||
74 (r = sshbuf_put(b, ckexinit, ckexinitlen)) != 0 || 74 (r = sshbuf_putb(b, client_kexinit)) != 0 ||
75 (r = sshbuf_put_u32(b, skexinitlen+1)) != 0 || 75 (r = sshbuf_put_u32(b, sshbuf_len(server_kexinit) + 1)) != 0 ||
76 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 || 76 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 ||
77 (r = sshbuf_put(b, skexinit, skexinitlen)) != 0 || 77 (r = sshbuf_putb(b, server_kexinit)) != 0 ||
78 (r = sshbuf_put_string(b, serverhostkeyblob, sbloblen)) != 0 || 78 (r = sshbuf_put_stringb(b, server_host_key_blob)) != 0 ||
79 (min != -1 && (r = sshbuf_put_u32(b, min)) != 0) || 79 (min != -1 && (r = sshbuf_put_u32(b, min)) != 0) ||
80 (r = sshbuf_put_u32(b, wantbits)) != 0 || 80 (r = sshbuf_put_u32(b, wantbits)) != 0 ||
81 (max != -1 && (r = sshbuf_put_u32(b, max)) != 0) || 81 (max != -1 && (r = sshbuf_put_u32(b, max)) != 0) ||
@@ -83,7 +83,7 @@ kexgex_hash(
83 (r = sshbuf_put_bignum2(b, gen)) != 0 || 83 (r = sshbuf_put_bignum2(b, gen)) != 0 ||
84 (r = sshbuf_put_bignum2(b, client_dh_pub)) != 0 || 84 (r = sshbuf_put_bignum2(b, client_dh_pub)) != 0 ||
85 (r = sshbuf_put_bignum2(b, server_dh_pub)) != 0 || 85 (r = sshbuf_put_bignum2(b, server_dh_pub)) != 0 ||
86 (r = sshbuf_put_bignum2(b, shared_secret)) != 0) { 86 (r = sshbuf_put(b, shared_secret, secretlen)) != 0) {
87 sshbuf_free(b); 87 sshbuf_free(b);
88 return r; 88 return r;
89 } 89 }