diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2016-04-19 23:17:33 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2016-04-30 18:36:22 +0200 |
commit | 3e014acf34e29f7667ee279d7066c14a4f1b9c85 (patch) | |
tree | e10958afa14d05008ea9cc69842dd57f69909971 | |
parent | 5877a7d1318919b94dbce828e933c3afedd8d928 (diff) |
header: add shash_desc_zero() and ahash_request_zero()
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>
-rw-r--r-- | backport/backport-include/crypto/hash.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/backport/backport-include/crypto/hash.h b/backport/backport-include/crypto/hash.h new file mode 100644 index 00000000..18cb6307 --- /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 */ |