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-22 18:03:22 +0100
commitd5c02e2de86a28ab2c06e866f0db858c43d00355 (patch)
tree2dc21b95e1e9fdddf48a68a5e421a51f4a4e718d /crypto/context.c
parent872dd0a21f22724abe4a02808c3dfbb0abf661a2 (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) (cherry picked from commit a88e97fcace01ecf557b207f04328a72df5110df)
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 aec9ecd4ac..c6358afc81 100644
--- a/crypto/context.c
+++ b/crypto/context.c
@@ -456,6 +456,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)