summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/kexdhc.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2006-10-31 16:33:13 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2006-10-31 16:33:13 +0000
commit2355c662c63ae117c3eb1022fa87d0ba1d2b95c1 (patch)
treeab5f3d6d94774cace9fe8be54cf219d8ede78a27 /usr.bin/ssh/kexdhc.c
parent71837f57e11215f447e7080e4aee9b8d6c8a8b72 (diff)
check DH_compute_key() for -1 even if it should not happen because of
earlier calls to dh_pub_is_valid(); report krahmer at suse.de; ok djm
Diffstat (limited to 'usr.bin/ssh/kexdhc.c')
-rw-r--r--usr.bin/ssh/kexdhc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/ssh/kexdhc.c b/usr.bin/ssh/kexdhc.c
index 90bdbeda02f..79231bd4383 100644
--- a/usr.bin/ssh/kexdhc.c
+++ b/usr.bin/ssh/kexdhc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kexdhc.c,v 1.9 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: kexdhc.c,v 1.10 2006/10/31 16:33:12 markus Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
*
@@ -47,7 +47,8 @@ kexdh_client(Kex *kex)
Key *server_host_key;
u_char *server_host_key_blob = NULL, *signature = NULL;
u_char *kbuf, *hash;
- u_int klen, kout, slen, sbloblen, hashlen;
+ u_int klen, slen, sbloblen, hashlen;
+ int kout;
/* generate and send 'e', client DH public key */
switch (kex->kex_type) {
@@ -109,7 +110,8 @@ kexdh_client(Kex *kex)
klen = DH_size(dh);
kbuf = xmalloc(klen);
- kout = DH_compute_key(kbuf, dh_server_pub, dh);
+ if ((kout = DH_compute_key(kbuf, dh_server_pub, dh)) < 0)
+ fatal("DH_compute_key: failed");
#ifdef DEBUG_KEXDH
dump_digest("shared secret", kbuf, kout);
#endif