openssl/providers/implementations/rands
Matthias St. Pierre 7998e7dc07 rand: fix seeding from a weak entropy source
The 'rand_generate' method is not well suited for being used with
weak entropy sources in the 'get_entropy' callback, because the
caller needs to provide a preallocated buffer without knowing
how much bytes are actually needed to collect the required entropy.

Instead we use the 'rand_get_seed' and 'rand_clear_seed' methods
which were exactly designed for this purpose: it's the callee who
allocates and fills the buffer, and finally cleans it up again.

The 'rand_get_seed' and 'rand_clear_seed' methods are currently
optional for a provided random generator. We could fall back to
using 'rand_generate' if those methods are not implemented.
However, imo it would be better to simply make them an officially
documented requirement for seed sources.

Fixes #22332

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22394)
2023-10-24 11:14:11 +01:00
..
seeding "foo * bar" should be "foo *bar" 2023-09-11 10:15:30 +02:00
build.info
crngt.c
drbg_ctr.c Fix new typos found by codespell 2023-09-18 09:04:22 +10:00
drbg_hash.c Fix new typos found by codespell 2023-09-18 09:04:22 +10:00
drbg_hmac.c Fix new typos found by codespell 2023-09-18 09:04:22 +10:00
drbg_local.h Fix new typos found by codespell 2023-09-18 09:04:22 +10:00
drbg.c fix indentation 2023-09-27 17:22:54 +01:00
seed_src.c rand: fix seeding from a weak entropy source 2023-10-24 11:14:11 +01:00
test_rng.c Coverity 1545174: calling risky function 2023-10-02 19:18:21 +11:00