summaryrefslogtreecommitdiffstats
path: root/crypto/rand/rand_lib.c
diff options
context:
space:
mode:
authorFrederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk>2025-01-05 20:42:51 +0100
committerTomas Mraz <tomas@openssl.org>2025-01-08 11:18:13 +0100
commitdfce0d7418d6d5b54d74fa80fc50392f00270c53 (patch)
treed61d1941ca5ae0126f7a1d4c4b6dac34d2f357e5 /crypto/rand/rand_lib.c
parentAdded configuration for Embarcadero-Borland Clang Compiler 64 (BCC64) (diff)
downloadopenssl-dfce0d7418d6d5b54d74fa80fc50392f00270c53.tar.xz
openssl-dfce0d7418d6d5b54d74fa80fc50392f00270c53.zip
Return NULL from ossl_lib_ctx_get_concrete() when it is uninitialized
When default_context_inited is set to false we return NULL instead of the global default context. Fixes #25442 Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/26319)
Diffstat (limited to '')
-rw-r--r--crypto/rand/rand_lib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c
index ad66cd7791..a15614faa5 100644
--- a/crypto/rand/rand_lib.c
+++ b/crypto/rand/rand_lib.c
@@ -818,6 +818,9 @@ EVP_RAND_CTX *RAND_get0_public(OSSL_LIB_CTX *ctx)
return NULL;
ctx = ossl_lib_ctx_get_concrete(ctx);
+
+ if (ctx == NULL)
+ return NULL;
/*
* If the private is also NULL then this is the first time we've
* used this thread.
@@ -851,6 +854,9 @@ EVP_RAND_CTX *RAND_get0_private(OSSL_LIB_CTX *ctx)
return NULL;
ctx = ossl_lib_ctx_get_concrete(ctx);
+
+ if (ctx == NULL)
+ return NULL;
/*
* If the public is also NULL then this is the first time we've
* used this thread.