diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2019-03-19 00:58:09 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-03-19 07:25:48 +0100 |
commit | ce1415ed2ce15305356cd028bcf7b9bc688d6d5c (patch) | |
tree | e9f4d5ed4bbb781d42b09c6a2c9bebd73fe8917f /crypto/ec | |
parent | Fix strict-warnings build on FreeBSD (diff) | |
download | openssl-ce1415ed2ce15305356cd028bcf7b9bc688d6d5c.tar.xz openssl-ce1415ed2ce15305356cd028bcf7b9bc688d6d5c.zip |
Added NULL check to BN_clear() & BN_CTX_end()
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8518)
Diffstat (limited to 'crypto/ec')
-rw-r--r-- | crypto/ec/ec2_smpl.c | 3 | ||||
-rw-r--r-- | crypto/ec/ec_lib.c | 3 | ||||
-rw-r--r-- | crypto/ec/ec_mult.c | 3 | ||||
-rw-r--r-- | crypto/ec/ecdh_ossl.c | 3 | ||||
-rw-r--r-- | crypto/ec/ecp_nistz256.c | 3 | ||||
-rw-r--r-- | crypto/ec/ecp_smpl.c | 6 |
6 files changed, 7 insertions, 14 deletions
diff --git a/crypto/ec/ec2_smpl.c b/crypto/ec/ec2_smpl.c index 7bd2a63203..ebd6f21eec 100644 --- a/crypto/ec/ec2_smpl.c +++ b/crypto/ec/ec2_smpl.c @@ -204,8 +204,7 @@ int ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group, ret = 1; err: - if (ctx != NULL) - BN_CTX_end(ctx); + BN_CTX_end(ctx); BN_CTX_free(new_ctx); return ret; } diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index 2623b5377f..798382ac29 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -1079,8 +1079,7 @@ static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r, ret = 1; err: - if (ctx != NULL) - BN_CTX_end(ctx); + BN_CTX_end(ctx); BN_CTX_free(new_ctx); return ret; } diff --git a/crypto/ec/ec_mult.c b/crypto/ec/ec_mult.c index c76c528048..755d64400a 100644 --- a/crypto/ec/ec_mult.c +++ b/crypto/ec/ec_mult.c @@ -948,8 +948,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) ret = 1; err: - if (ctx != NULL) - BN_CTX_end(ctx); + BN_CTX_end(ctx); BN_CTX_free(new_ctx); EC_ec_pre_comp_free(pre_comp); if (points) { diff --git a/crypto/ec/ecdh_ossl.c b/crypto/ec/ecdh_ossl.c index b63cab9d91..61789f4f0c 100644 --- a/crypto/ec/ecdh_ossl.c +++ b/crypto/ec/ecdh_ossl.c @@ -113,8 +113,7 @@ int ecdh_simple_compute_key(unsigned char **pout, size_t *poutlen, err: EC_POINT_clear_free(tmp); - if (ctx) - BN_CTX_end(ctx); + BN_CTX_end(ctx); BN_CTX_free(ctx); OPENSSL_free(buf); return ret; diff --git a/crypto/ec/ecp_nistz256.c b/crypto/ec/ecp_nistz256.c index c0772ca2fe..6a64bc4f2a 100644 --- a/crypto/ec/ecp_nistz256.c +++ b/crypto/ec/ecp_nistz256.c @@ -888,8 +888,7 @@ __owur static int ecp_nistz256_mult_precompute(EC_GROUP *group, BN_CTX *ctx) ret = 1; err: - if (ctx != NULL) - BN_CTX_end(ctx); + BN_CTX_end(ctx); BN_CTX_free(new_ctx); EC_nistz256_pre_comp_free(pre_comp); diff --git a/crypto/ec/ecp_smpl.c b/crypto/ec/ecp_smpl.c index f80f98a169..2fd2ce46ea 100644 --- a/crypto/ec/ecp_smpl.c +++ b/crypto/ec/ecp_smpl.c @@ -307,8 +307,7 @@ int ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) ret = 1; err: - if (ctx != NULL) - BN_CTX_end(ctx); + BN_CTX_end(ctx); BN_CTX_free(new_ctx); return ret; } @@ -787,8 +786,7 @@ int ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, ret = 1; end: - if (ctx) /* otherwise we already called BN_CTX_end */ - BN_CTX_end(ctx); + BN_CTX_end(ctx); BN_CTX_free(new_ctx); return ret; } |