summaryrefslogtreecommitdiff
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
commita6249195af27877fbfbc2168dba00a0c1eb6a031 (patch)
tree2418d2e0ac3b0ac94899d6aeb7d620f0566d98b6
parent00e432d554827afbba93d1a5c092d489a5033618 (diff)
Simplify error path of DH_check_pub_key()
-rw-r--r--lib/libcrypto/dh/dh_check.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/libcrypto/dh/dh_check.c b/lib/libcrypto/dh/dh_check.c
index 1df8f4cdc76..070a33081a7 100644
--- a/lib/libcrypto/dh/dh_check.c
+++ b/lib/libcrypto/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;
}