From: Herbert Xu Date: Sun, 4 May 2025 13:33:23 +0000 (+0800) Subject: crypto: ahash - Add HASH_REQUEST_ZERO X-Git-Tag: v6.16-rc1~206^2~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88bca957e87e9a8a274213db257a744170b7248a;p=thirdparty%2Flinux.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 e911f32f46dcd..f2bbdb74e11a9 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 */