summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-07-09 13:30:01 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-07-09 13:30:01 +0000
commitdb16be9113fcacedacce719c862e50f0f8916157 (patch)
tree138406421e334a8f3a5bf5c23f297ae7d86a48aa /lib
parent281d7a11fda7b5e035aa64b25772dd191631bcb9 (diff)
Simplify error path of DH_check_pub_key()
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/src/crypto/dh/dh_check.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/libssl/src/crypto/dh/dh_check.c b/lib/libssl/src/crypto/dh/dh_check.c
index 1df8f4cdc76..070a33081a7 100644
--- a/lib/libssl/src/crypto/dh/dh_check.c
+++ b/lib/libssl/src/crypto/dh/dh_check.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dh_check.c,v 1.11 2014/07/09 13:26:47 miod Exp $ */
+/* $OpenBSD: dh_check.c,v 1.12 2014/07/09 13:30:00 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -124,13 +124,12 @@ err:
int
DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret)
{
- int ok = 0;
BIGNUM *q = NULL;
*ret = 0;
q = BN_new();
if (q == NULL)
- goto err;
+ return 0;
BN_set_word(q, 1);
if (BN_cmp(pub_key, q) <= 0)
*ret |= DH_CHECK_PUBKEY_TOO_SMALL;
@@ -139,9 +138,6 @@ DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret)
if (BN_cmp(pub_key, q) >= 0)
*ret |= DH_CHECK_PUBKEY_TOO_LARGE;
- ok = 1;
-err:
- if (q != NULL)
- BN_free(q);
- return ok;
+ BN_free(q);
+ return 1;
}