[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-backports
Subject:    [PATCH 05/16] header: add shash_desc_zero() and ahash_request_zero()
From:       Hauke Mehrtens <hauke () hauke-m ! de>
Date:       2016-04-30 21:00:37
Message-ID: 1462050048-8953-6-git-send-email-hauke () hauke-m ! de
[Download RAW message or body]

shash_desc_zero() and ahash_request_zero() were added in Linux commit
e67ffe0af "crypto: hash - Add helpers to zero stack request/descriptor".

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/crypto/hash.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 backport/backport-include/crypto/hash.h

diff --git a/backport/backport-include/crypto/hash.h b/backport/backport-include/crypto/hash.h
new file mode 100644
index 0000000..18cb630
--- /dev/null
+++ b/backport/backport-include/crypto/hash.h
@@ -0,0 +1,24 @@
+#ifndef _BACKPORT_CRYPTO_HASH_H
+#define _BACKPORT_CRYPTO_HASH_H
+#include_next <crypto/hash.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
+#define shash_desc_zero LINUX_BACKPORT(shash_desc_zero)
+static inline void shash_desc_zero(struct shash_desc *desc)
+{
+	memzero_explicit(desc,
+			 sizeof(*desc) + crypto_shash_descsize(desc->tfm));
+}
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
+#define ahash_request_zero LINUX_BACKPORT(ahash_request_zero)
+static inline void ahash_request_zero(struct ahash_request *req)
+{
+	memzero_explicit(req, sizeof(*req) +
+			      crypto_ahash_reqsize(crypto_ahash_reqtfm(req)));
+}
+#endif
+
+#endif /* _BACKPORT_CRYPTO_HASH_H */
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic