crypto: hash - Add AHASH_REQUEST_ON_STACK
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 20 Aug 2015 09:02:40 +0000 (17:02 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 21 Aug 2015 14:21:20 +0000 (22:21 +0800)
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>
include/crypto/hash.h

index 57c8a6ee33c27321d1a1e366559a858ae5cccdb3..8e920b44c0ac4b14238ef0877812fab4eaf7f8b8 100644 (file)
@@ -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