summaryrefslogtreecommitdiffstats
path: root/crypto/rsa
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-06-17 17:26:47 +1000
committerRichard Levitte <levitte@openssl.org>2020-06-23 12:28:48 +0200
commit7905806c94b17b1907d5352ceb047dd8d859288c (patch)
tree8f64ded43921bd29c4050bd75089b6df9bc6b4c1 /crypto/rsa
parenta4e440d6477b40b04ce825dae14c7f27778ca8f1 (diff)
Fix potential double free in rsa_keygen pairwise test.
It should never hit this branch of code, so there is no feasible test. Found due to a similar issue in PR #12176. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12177)
Diffstat (limited to 'crypto/rsa')
-rw-r--r--crypto/rsa/rsa_gen.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/rsa/rsa_gen.c b/crypto/rsa/rsa_gen.c
index e391f6419a..1cdc8d91e8 100644
--- a/crypto/rsa/rsa_gen.c
+++ b/crypto/rsa/rsa_gen.c
@@ -451,6 +451,12 @@ static int rsa_keygen(OPENSSL_CTX *libctx, RSA *rsa, int bits, int primes,
BN_clear_free(rsa->dmp1);
BN_clear_free(rsa->dmq1);
BN_clear_free(rsa->iqmp);
+ rsa->d = NULL;
+ rsa->p = NULL;
+ rsa->q = NULL;
+ rsa->dmp1 = NULL;
+ rsa->dmq1 = NULL;
+ rsa->iqmp = NULL;
}
}
return ok;