From 88bca957e87e9a8a274213db257a744170b7248a Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sun, 4 May 2025 21:33:23 +0800 Subject: [PATCH] crypto: ahash - Add HASH_REQUEST_ZERO Add a helper to zero hash stack requests that were never cloned off the stack. Signed-off-by: Herbert Xu --- include/crypto/internal/hash.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h index e911f32f46dc..f2bbdb74e11a 100644 --- a/include/crypto/internal/hash.h +++ b/include/crypto/internal/hash.h @@ -301,5 +301,9 @@ static inline unsigned int crypto_shash_coresize(struct crypto_shash *tfm) return crypto_shash_statesize(tfm) - crypto_shash_blocksize(tfm) - 1; } +/* This can only be used if the request was never cloned. */ +#define HASH_REQUEST_ZERO(name) \ + memzero_explicit(__##name##_req, sizeof(__##name##_req)) + #endif /* _CRYPTO_INTERNAL_HASH_H */ -- 2.25.1