Re: [PATCH] crypto: atmel-sha204a - clear RNG data from memory

From: Herbert Xu

Date: Fri Jul 17 2026 - 04:19:35 EST


On Wed, Jul 08, 2026 at 05:04:00PM +0200, Thorsten Blum wrote:
> In atmel_sha204a_rng_read(), use memzero_explicit() to clear the local
> stack variable cmd before it goes out of scope, since cmd.data may still
> hold the last 32 random bytes.
>
> Since atmel_sha204a_rng_done() caches work_data in hwrng::priv, and its
> response data is later used as RNG entropy, use kfree_sensitive() to
> clear the cached data on transaction failure and device removal.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
> ---
> drivers/crypto/atmel-sha204a.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)

Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt