[v2 PATCH 5/6] crypto: ahash - Add HASH_REQUEST_ZERO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a helper to zero hash stack requests that were never cloned
off the stack.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
---
 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.39.5





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux