rand: add callbacks to cleanup the user entropy resp. nonce
authorMatthias St. Pierre <matthias.st.pierre@ncp-e.com>
Mon, 16 Oct 2023 21:48:03 +0000 (23:48 +0200)
committerMatt Caswell <matt@openssl.org>
Fri, 20 Oct 2023 08:48:34 +0000 (09:48 +0100)
commit5516d20226c496c2b22fa741698b4d48dad0428f
treed257c2536b7eb711cdc47fbd9d0495507bdde172
parent098f27f9ef8be2a418f76896ee3c824e8709fcf7
rand: add callbacks to cleanup the user entropy resp. nonce

The `get_user_{entropy,nonce}` callbacks were add recently to the
dispatch table in commit 4cde7585ce8e. Instead of adding corresponding
`cleanup_user_{entropy,nonce}` callbacks, the `cleanup_{entropy,nonce}`
callbacks were reused. This can cause a problem in the case where the
seed source is replaced by a provider: the buffer gets allocated by
the provider but cleared by the core.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22423)
crypto/provider_core.c
crypto/rand/prov_seed.c
doc/internal/man3/ossl_rand_get_entropy.pod
doc/man7/provider-base.pod
include/crypto/rand.h
include/openssl/core_dispatch.h
providers/common/provider_seeding.c