From: Herbert Xu Date: Sun, 4 May 2025 13:33:23 +0000 (+0800) Subject: crypto: ahash - Add HASH_REQUEST_ZERO X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=88bca957e87e9a8a274213db257a744170b7248a;p=users%2Fwilly%2Fxarray.git 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 --- 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 */