From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Thu, 20 Aug 2015 09:02:40 +0000 (+0800)
Subject: crypto: hash - Add AHASH_REQUEST_ON_STACK
X-Git-Tag: firefly_0821_release~176^2~874^2~20
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d4421c54c45f643731c92daa8e268ce74dcdf5a2;p=firefly-linux-kernel-4.4.55.git

crypto: hash - Add AHASH_REQUEST_ON_STACK

This patch adds the helper AHASH_REQUEST_ON_STACK for those users
of ahash that are synchronous only.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---

diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index 57c8a6ee33c2..8e920b44c0ac 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -63,6 +63,11 @@ struct ahash_request {
 	void *__ctx[] CRYPTO_MINALIGN_ATTR;
 };
 
+#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
+
 /**
  * struct ahash_alg - asynchronous message digest definition
  * @init: Initialize the transformation context. Intended only to initialize the