From e34cb44ac7c08783b98a16eec70125e205e6eb12 Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Tue, 21 Nov 2017 12:59:41 +0000 Subject: initial commit Generated againts 4.14 kernel source with git backports 1d8cc151d365582b42be00af776270b834a7a37d --- backport-include/crypto/hash.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 backport-include/crypto/hash.h (limited to 'backport-include/crypto/hash.h') diff --git a/backport-include/crypto/hash.h b/backport-include/crypto/hash.h new file mode 100644 index 0000000..96ae799 --- /dev/null +++ b/backport-include/crypto/hash.h @@ -0,0 +1,38 @@ +#ifndef _BACKPORT_CRYPTO_HASH_H +#define _BACKPORT_CRYPTO_HASH_H +#include_next +#include + +#if LINUX_VERSION_IS_LESS(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_IS_LESS(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 + +#ifndef AHASH_REQUEST_ON_STACK +#define AHASH_REQUEST_ON_STACK(name, ahash) \ + char __##name##_desc[sizeof(struct ahash_request) + \ + crypto_ahash_reqsize(ahash)] CRYPTO_MINALIGN_ATTR; \ + struct ahash_request *name = (void *)__##name##_desc +#endif + +#ifndef SHASH_DESC_ON_STACK +#define SHASH_DESC_ON_STACK(shash, ctx) \ + char __##shash##_desc[sizeof(struct shash_desc) + \ + crypto_shash_descsize(ctx)] CRYPTO_MINALIGN_ATTR; \ + struct shash_desc *shash = (struct shash_desc *)__##shash##_desc +#endif + +#endif /* _BACKPORT_CRYPTO_HASH_H */ -- cgit v1.2.3