From 755d1aec1390f623ee5e11a0564c7fc73d008657 Mon Sep 17 00:00:00 2001 From: Pauli Date: Wed, 22 Jan 2025 16:33:47 +1100 Subject: [PATCH] fixup! Add support for random provider --- crypto/rand/rand_lib.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index ee4cf8ef59a5b..69b3ea80ab48f 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -1057,20 +1057,17 @@ static int random_conf_init(CONF_IMODULE *md, const CONF *cnf) return 0; } else if (OPENSSL_strcasecmp(cval->name, "random_provider") == 0) { # ifndef FIPS_MODULE - if (OSSL_PROVIDER_available(libctx, cval->value)) { - OSSL_PROVIDER *prov = OSSL_PROVIDER_load(libctx, cval->value); + OSSL_PROVIDER *prov = ossl_provider_find(libctx, cval->value, 0); - if (prov == NULL || !RAND_set1_random_provider(libctx, prov)) { - ERR_raise(ERR_LIB_CRYPTO, - RAND_R_UNABLE_TO_LOAD_RANDOM_PROVIDER); + if (prov != NULL) { + if (!RAND_set1_random_provider(libctx, prov)) { + ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR); OSSL_PROVIDER_unload(prov); return 0; } OSSL_PROVIDER_unload(prov); - } else { - if (!set_random_provider_name(dgbl, cval->value)) - return 0; - } + } else if (!set_random_provider_name(dgbl, cval->value)) + return 0; # endif } else { ERR_raise_data(ERR_LIB_CRYPTO,