summaryrefslogtreecommitdiffstats
path: root/crypto/provider_core.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-06-18 18:37:38 +0100
committerMatt Caswell <matt@openssl.org>2019-06-19 11:54:34 +0100
commit6913f5fe05a38fa72213b5b5d1f41ef10ca908bd (patch)
tree386fad30f5f06eaed4cdadcd8a24a36b4e09aff1 /crypto/provider_core.c
parentd73458d17ac7e44270a2bcbace45ab99334754b4 (diff)
Provide an ability to deregister thread stop handlers
If a provider gets unloaded then any thread stop handlers that it had registered will be left hanging. We should clean them up before tearing down the provider. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9186)
Diffstat (limited to 'crypto/provider_core.c')
-rw-r--r--crypto/provider_core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/provider_core.c b/crypto/provider_core.c
index 10948ce271..274bdf94ba 100644
--- a/crypto/provider_core.c
+++ b/crypto/provider_core.c
@@ -269,6 +269,9 @@ void ossl_provider_free(OSSL_PROVIDER *prov)
* When that happens, the provider is inactivated.
*/
if (ref < 2 && prov->flag_initialized) {
+#ifndef FIPS_MODE
+ ossl_init_thread_deregister(prov);
+#endif
if (prov->teardown != NULL)
prov->teardown(prov->provctx);
prov->flag_initialized = 0;
@@ -670,7 +673,7 @@ static OPENSSL_CTX *core_get_libctx(const OSSL_PROVIDER *prov)
static int core_thread_start(const OSSL_PROVIDER *prov,
OSSL_thread_stop_handler_fn handfn)
{
- return ossl_init_thread_start(prov->provctx, handfn);
+ return ossl_init_thread_start(prov, prov->provctx, handfn);
}
static const OSSL_DISPATCH core_dispatch_[] = {