Commit 1aaa753d authored by Herbert Xu's avatar Herbert Xu

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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e67ffe0a
...@@ -445,6 +445,13 @@ static inline void skcipher_request_free(struct skcipher_request *req) ...@@ -445,6 +445,13 @@ static inline void skcipher_request_free(struct skcipher_request *req)
kzfree(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 * skcipher_request_set_callback() - set asynchronous callback function
* @req: request handle * @req: request handle
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment