summaryrefslogtreecommitdiff
path: root/providers/fips/fipsprov.c
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-05-28 10:25:55 +1000
committerPauli <pauli@openssl.org>2021-05-29 20:46:11 +1000
commit43dbe3b72de0ba4ebd20e9e6a2c526ef747326ab (patch)
tree030ef45c04b5018a65a339859473d243d7b8648f /providers/fips/fipsprov.c
parentf839361e3e45b5becce7c3267fa8e2f72654e75f (diff)
downloadopenssl-new-43dbe3b72de0ba4ebd20e9e6a2c526ef747326ab.tar.gz
fips: set the library context and handle later
They need to be set once the provider will definitely be loading. If they are set earlier, a double free results on a failure. Fixes #15452 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15492)
Diffstat (limited to 'providers/fips/fipsprov.c')
-rw-r--r--providers/fips/fipsprov.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/providers/fips/fipsprov.c b/providers/fips/fipsprov.c
index 580eea574f..4155b64197 100644
--- a/providers/fips/fipsprov.c
+++ b/providers/fips/fipsprov.c
@@ -663,8 +663,6 @@ int OSSL_provider_init_int(const OSSL_CORE_HANDLE *handle,
OSSL_LIB_CTX_free(libctx);
goto err;
}
- ossl_prov_ctx_set0_libctx(*provctx, libctx);
- ossl_prov_ctx_set0_handle(*provctx, handle);
if ((fgbl = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_FIPS_PROV_INDEX,
&fips_prov_ossl_ctx_method)) == NULL)
@@ -707,6 +705,9 @@ int OSSL_provider_init_int(const OSSL_CORE_HANDLE *handle,
goto err;
}
+ ossl_prov_ctx_set0_libctx(*provctx, libctx);
+ ossl_prov_ctx_set0_handle(*provctx, handle);
+
*out = fips_dispatch_table;
return 1;
err: