summaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2022-03-16 13:48:27 +1100
committerPauli <pauli@openssl.org>2022-03-23 11:11:04 +1100
commit11e88882e9cd7794aeb2735f44e3321a468b98bd (patch)
tree413774b78025cb41047581f5998b1536f2e9d0dd /crypto/bn
parent91941cc1d67209e0b30401240b2065785b21b04e (diff)
Fix Coverity 1201763 uninitialised pointer read
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17890) (cherry picked from commit a0238b7ed87998c48b1c92bad7fa82dcbba507f9)
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/bn_exp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/bn/bn_exp.c b/crypto/bn/bn_exp.c
index 5329cd12a9..22745c8003 100644
--- a/crypto/bn/bn_exp.c
+++ b/crypto/bn/bn_exp.c
@@ -187,13 +187,14 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
return ret;
}
+ BN_RECP_CTX_init(&recp);
+
BN_CTX_start(ctx);
aa = BN_CTX_get(ctx);
val[0] = BN_CTX_get(ctx);
if (val[0] == NULL)
goto err;
- BN_RECP_CTX_init(&recp);
if (m->neg) {
/* ignore sign of 'm' */
if (!BN_copy(aa, m))