summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/dh.c
diff options
context:
space:
mode:
authorray <ray@openbsd.org>2007-09-27 00:15:57 +0000
committerray <ray@openbsd.org>2007-09-27 00:15:57 +0000
commit389638a625f311587f674e836dbd76eb5f52c233 (patch)
tree08bd1019a2eaea626922d34aa2b43a056d7bcc25 /usr.bin/ssh/dh.c
parentsome cleanup. remove #ifdef __FreeBSD__ code, last sync to FreeBSD was (diff)
downloadwireguard-openbsd-389638a625f311587f674e836dbd76eb5f52c233.tar.xz
wireguard-openbsd-389638a625f311587f674e836dbd76eb5f52c233.zip
Don't return -1 on error in dh_pub_is_valid(), since it evaluates
to true. Also fix a typo. Initial diff from Matthew Dempsky, input from djm. OK djm, markus.
Diffstat (limited to 'usr.bin/ssh/dh.c')
-rw-r--r--usr.bin/ssh/dh.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/ssh/dh.c b/usr.bin/ssh/dh.c
index 1ab5682c55a..c658f745ef0 100644
--- a/usr.bin/ssh/dh.c
+++ b/usr.bin/ssh/dh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dh.c,v 1.44 2006/11/07 13:02:07 markus Exp $ */
+/* $OpenBSD: dh.c,v 1.45 2007/09/27 00:15:57 ray Exp $ */
/*
* Copyright (c) 2000 Niels Provos. All rights reserved.
*
@@ -182,7 +182,7 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub)
BIGNUM *tmp;
if (dh_pub->neg) {
- logit("invalid public DH value: negativ");
+ logit("invalid public DH value: negative");
return 0;
}
if (BN_cmp(dh_pub, BN_value_one()) != 1) { /* pub_exp <= 1 */
@@ -190,8 +190,10 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub)
return 0;
}
- if ((tmp = BN_new()) == NULL)
- return (-1);
+ if ((tmp = BN_new()) == NULL) {
+ error("%s: BN_new failed", __func__);
+ return 0;
+ }
if (!BN_sub(tmp, dh->p, BN_value_one()) ||
BN_cmp(dh_pub, tmp) != -1) { /* pub_exp > p-2 */
BN_clear_free(tmp);