summaryrefslogtreecommitdiffstats
path: root/providers/implementations/keymgmt
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-09-21 11:39:04 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-09-23 17:16:39 +1000
commitced5231b04679dc31ce981d66d08260037fa40d8 (patch)
treeb012f03d5b568882c5571984b63e9334e8f392b1 /providers/implementations/keymgmt
parent965d3f36c49e2d0144330271be7c330b572b43df (diff)
Fix CID 1466710 : Resource leak in ec_kmgmt due to new call to ossl_prov_is_running()
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/12930)
Diffstat (limited to 'providers/implementations/keymgmt')
-rw-r--r--providers/implementations/keymgmt/ec_kmgmt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c
index 63c51af3a1..2a8980ddf5 100644
--- a/providers/implementations/keymgmt/ec_kmgmt.c
+++ b/providers/implementations/keymgmt/ec_kmgmt.c
@@ -788,9 +788,13 @@ int ec_validate(void *keydata, int selection)
{
EC_KEY *eck = keydata;
int ok = 0;
- BN_CTX *ctx = BN_CTX_new_ex(ec_key_get_libctx(eck));
+ BN_CTX *ctx = NULL;
+
+ if (!ossl_prov_is_running())
+ return 0;
- if (!ossl_prov_is_running() || ctx == NULL)
+ ctx = BN_CTX_new_ex(ec_key_get_libctx(eck));
+ if (ctx == NULL)
return 0;
if ((selection & EC_POSSIBLE_SELECTIONS) != 0)