summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/crypto/ec/ec_mult.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2015-02-09 15:49:22 +0000
committerjsing <jsing@openbsd.org>2015-02-09 15:49:22 +0000
commitaa389b8c4810b45e7b9b876db8debfbd5206e29e (patch)
treeaceaf6b9cc0050d33c77e910c34260780c91f772 /lib/libssl/src/crypto/ec/ec_mult.c
parentExpand the IMPLEMENT_ASN1_FUNCTIONS macro so that the code is visible and (diff)
downloadwireguard-openbsd-aa389b8c4810b45e7b9b876db8debfbd5206e29e.tar.xz
wireguard-openbsd-aa389b8c4810b45e7b9b876db8debfbd5206e29e.zip
BN_CTX_get() can fail - consistently check its return value.
There are currently cases where the return from each call is checked, the return from only the last call is checked and cases where it is not checked at all (including code in bn, ec and engine). Checking the last return value is valid as once the function fails it will continue to return NULL. However, in order to be consistent check each call with the same idiom. This makes it easy to verify. Note there are still a handful of cases that do not follow the idiom - these will be handled separately. ok beck@ doug@
Diffstat (limited to 'lib/libssl/src/crypto/ec/ec_mult.c')
-rw-r--r--lib/libssl/src/crypto/ec/ec_mult.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libssl/src/crypto/ec/ec_mult.c b/lib/libssl/src/crypto/ec/ec_mult.c
index 9e3aee13a29..e7114135983 100644
--- a/lib/libssl/src/crypto/ec/ec_mult.c
+++ b/lib/libssl/src/crypto/ec/ec_mult.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ec_mult.c,v 1.16 2015/02/07 13:19:15 doug Exp $ */
+/* $OpenBSD: ec_mult.c,v 1.17 2015/02/09 15:49:22 jsing Exp $ */
/*
* Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project.
*/
@@ -753,8 +753,7 @@ ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx)
goto err;
}
BN_CTX_start(ctx);
- order = BN_CTX_get(ctx);
- if (order == NULL)
+ if ((order = BN_CTX_get(ctx)) == NULL)
goto err;
if (!EC_GROUP_get_order(group, order, ctx))