Skip to content

Commit

Permalink
fixup! Add support for random provider
Browse files Browse the repository at this point in the history
  • Loading branch information
paulidale committed Jan 23, 2025
1 parent e61ce27 commit 755d1ae
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions crypto/rand/rand_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 755d1ae

Please sign in to comment.