aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto/skcipher.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2016-01-22 23:21:10 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2016-01-25 22:42:12 +0800
commit1aaa753d918c48c603195a468766e6a2b32b87f9 (patch)
tree5e5a893be728bd981bc3019308c6318f4d61915d /include/crypto/skcipher.h
parentcrypto: hash - Add helpers to zero stack request/descriptor (diff)
downloadlinux-dev-1aaa753d918c48c603195a468766e6a2b32b87f9.tar.xz
linux-dev-1aaa753d918c48c603195a468766e6a2b32b87f9.zip
crypto: skcipher - Add helper to zero stack request
As the size of an skcipher_request is variable, it's awkward to zero it explicitly. This patch adds a helper to do that which should be used when it is created on the stack. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/skcipher.h')
-rw-r--r--include/crypto/skcipher.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
index 2f07b4fce3e0..f7a03a17bc1d 100644
--- a/include/crypto/skcipher.h
+++ b/include/crypto/skcipher.h
@@ -445,6 +445,13 @@ static inline void skcipher_request_free(struct skcipher_request *req)
kzfree(req);
}
+static inline void skcipher_request_zero(struct skcipher_request *req)
+{
+ struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
+
+ memzero_explicit(req, sizeof(*req) + crypto_skcipher_reqsize(tfm));
+}
+
/**
* skcipher_request_set_callback() - set asynchronous callback function
* @req: request handle