summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/kexdhs.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssh/kexdhs.c')
-rw-r--r--crypto/openssh/kexdhs.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/crypto/openssh/kexdhs.c b/crypto/openssh/kexdhs.c
index 93ec97f..8617088 100644
--- a/crypto/openssh/kexdhs.c
+++ b/crypto/openssh/kexdhs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kexdhs.c,v 1.7 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: kexdhs.c,v 1.9 2006/11/06 21:25:28 markus Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
*
@@ -52,8 +52,8 @@ kexdh_server(Kex *kex)
DH *dh;
Key *server_host_key;
u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
- u_int sbloblen, klen, kout, hashlen;
- u_int slen;
+ u_int sbloblen, klen, hashlen, slen;
+ int kout;
/* generate server DH public key */
switch (kex->kex_type) {
@@ -101,13 +101,15 @@ kexdh_server(Kex *kex)
klen = DH_size(dh);
kbuf = xmalloc(klen);
- kout = DH_compute_key(kbuf, dh_client_pub, dh);
+ if ((kout = DH_compute_key(kbuf, dh_client_pub, dh)) < 0)
+ fatal("DH_compute_key: failed");
#ifdef DEBUG_KEXDH
dump_digest("shared secret", kbuf, kout);
#endif
if ((shared_secret = BN_new()) == NULL)
fatal("kexdh_server: BN_new failed");
- BN_bin2bn(kbuf, kout, shared_secret);
+ if (BN_bin2bn(kbuf, kout, shared_secret) == NULL)
+ fatal("kexdh_server: BN_bin2bn failed");
memset(kbuf, 0, klen);
xfree(kbuf);
OpenPOWER on IntegriCloud