Files
Jakub Zelenka 5f9b4da9dd rand: add seed_strict option enforcing the configured seed source
When a provider requests seeding material via the get_user_entropy or
get_user_nonce core callbacks before the primary DRBG was created, the
request silently falls back to the operating system entropy sources,
because the seed source EVP_RAND_CTX only comes into existence as a
side effect of creating the primary DRBG.  Whether a configured seed
source is used therefore depends on operation order: for example with
the FIPS provider, genrsa happened to use the configured source while
ecparam -genkey did not.

This fallback is acceptable for most setups, but not when the seed
source selection is meant to be a guarantee, for example for compliance
reasons.  Add a seed_strict option to the [random] configuration
section which makes the callbacks instantiate the seed source on
demand and turns an unusable seed source into an error rather than a
silent fallback.  The option is off by default with two exceptions:
selecting the JITTER seed source, at runtime or at build time via
-DOPENSSL_DEFAULT_SEED_SRC, seeds strictly unless the option disables
it, and enable-fips-jitter builds always seed strictly.

The boolean value parsing is shared with the provider section by
factoring the existing parser out into ossl_conf_parse_bool().  A build
time default property query can now be set with
-DOPENSSL_DEFAULT_SEED_PROPQ.

Add a regression test covering the on-demand creation and the no
fallback behaviour on the strict provider seeding path, a test for the
default non-strict fallback behaviour including the JITTER strictness
default, and [random] seed configuration coverage in the rand config
test recipe.

Fixes #25941

Assisted-by: Claude:claude-fable-5
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Merge-date: Tue Sep  1 12:07:39 2026
Merged-from: https://github.com/openssl/openssl/pull/31939
2026-09-01 14:07:27 +02:00
..
2026-03-10 14:37:52 +00:00
2026-03-10 14:37:52 +00:00