diff options
author | jsing <> | 2015-02-09 15:49:22 +0000 |
---|---|---|
committer | jsing <> | 2015-02-09 15:49:22 +0000 |
commit | 16f790d01f7a6fc6c94e2a033a67b80c8ec5291c (patch) | |
tree | d924c624d5eb949a9e7e395dc99d92616e911ce9 /src/lib/libcrypto/ec/ec_mult.c | |
parent | 42f7780549de5b7b5e3e7943cfef87e0e41970fc (diff) | |
download | openbsd-16f790d01f7a6fc6c94e2a033a67b80c8ec5291c.tar.gz openbsd-16f790d01f7a6fc6c94e2a033a67b80c8ec5291c.tar.bz2 openbsd-16f790d01f7a6fc6c94e2a033a67b80c8ec5291c.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 '')
-rw-r--r-- | src/lib/libcrypto/ec/ec_mult.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c index 9e3aee13a2..e711413598 100644 --- a/src/lib/libcrypto/ec/ec_mult.c +++ b/src/lib/libcrypto/ec/ec_mult.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_mult.c,v 1.16 2015/02/07 13:19:15 doug Exp $ */ | 1 | /* $OpenBSD: ec_mult.c,v 1.17 2015/02/09 15:49:22 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. | 3 | * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -753,8 +753,7 @@ ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | |||
753 | goto err; | 753 | goto err; |
754 | } | 754 | } |
755 | BN_CTX_start(ctx); | 755 | BN_CTX_start(ctx); |
756 | order = BN_CTX_get(ctx); | 756 | if ((order = BN_CTX_get(ctx)) == NULL) |
757 | if (order == NULL) | ||
758 | goto err; | 757 | goto err; |
759 | 758 | ||
760 | if (!EC_GROUP_get_order(group, order, ctx)) | 759 | if (!EC_GROUP_get_order(group, order, ctx)) |