openssl/providers
Karol Brzuskiewicz 42a8ef844e Fix usage of deallocated EVP_RAND_CTX after execution of FIPS on-demand self tests
Once RNG is used, triggering FIPS on-demand self tests (via
OSSL_PROVIDER_self_test() API) crashes the application. This happens because the
RNG context is stored before self tests, and restored after their execution.
In the meantime - before context restoration - RAND_set0_private() function is
called, which decrements the stored RNG context reference counter and frees it.
To resolve the issue, the stored RNG context refcount has been incremented via
the EVP_RAND_CTX_up_ref() API to avoid its deallocation during the RNG context
switch performed by the self test function.
The provider_status_test test has been updated to reproduce the issue as
a regression test.

Signed-off-by: Karol Brzuskiewicz <kabr@arista.com>

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24599)
2024-06-24 19:02:43 +02:00
..
common rsa-pss: add tests checking for SHAKE usage in RSA-PSS 2024-05-22 15:31:00 +02:00
fips Fix usage of deallocated EVP_RAND_CTX after execution of FIPS on-demand self tests 2024-06-24 19:02:43 +02:00
implementations rand: remove unimplemented librandom stub code 2024-05-24 12:03:21 +02:00
baseprov.c fips: use seed source requested 2023-09-27 17:23:04 +01:00
build.info
decoders.inc Copyright year updates 2023-09-07 09:59:15 +01:00
defltprov.c Copyright year updates 2023-09-07 09:59:15 +01:00
encoders.inc Copyright year updates 2023-09-07 09:59:15 +01:00
fips-sources.checksums make update 2023-09-28 14:24:31 +01:00
fips.checksum make update 2023-09-28 14:24:31 +01:00
fips.module.sources make update 2023-09-07 10:00:21 +01:00
legacyprov.c Copyright year updates 2023-09-07 09:59:15 +01:00
nullprov.c Copyright year updates 2023-09-07 09:59:15 +01:00
prov_running.c
stores.inc