]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: ahash - Add HASH_REQUEST_ZERO
authorHerbert Xu <herbert@gondor.apana.org.au>
Sun, 4 May 2025 13:33:23 +0000 (21:33 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 5 May 2025 10:20:46 +0000 (18:20 +0800)
Add a helper to zero hash stack requests that were never cloned
off the stack.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
include/crypto/internal/hash.h

index e911f32f46dcd92e57e973b71685af8497cccc4b..f2bbdb74e11a965a1bcc5132fbdaf917fd3beaa9 100644 (file)
@@ -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 */