summaryrefslogtreecommitdiffstats
path: root/crypto/context.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-10-11 17:26:23 +0200
committerTomas Mraz <tomas@openssl.org>2022-11-02 11:01:20 +0100
commita88e97fcace01ecf557b207f04328a72df5110df (patch)
tree18418437a2046ed33b1701f26f5f0799b7820f78 /crypto/context.c
parentbd363ef32403d58a8b41553b5abd602b30073b10 (diff)
Release the drbg in the global default context before engines
Fixes #17995 Fixes #18578 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/19386)
Diffstat (limited to 'crypto/context.c')
-rw-r--r--crypto/context.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/context.c b/crypto/context.c
index a7b1832cbc..173256bcfb 100644
--- a/crypto/context.c
+++ b/crypto/context.c
@@ -472,6 +472,15 @@ OSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *libctx)
return NULL;
}
+
+void ossl_release_default_drbg_ctx(void)
+{
+ /* early release of the DRBG in global default libctx */
+ if (default_context_int.drbg != NULL) {
+ ossl_rand_ctx_free(default_context_int.drbg);
+ default_context_int.drbg = NULL;
+ }
+}
#endif
OSSL_LIB_CTX *ossl_lib_ctx_get_concrete(OSSL_LIB_CTX *ctx)