summaryrefslogtreecommitdiffstats
path: root/crypto/algapi.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-05-28 22:07:56 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2015-06-03 10:48:34 +0800
commitc2110f28341cec2ecfd9474db15ac090bce1234c (patch)
treeda177b90712ab7ea057b4945350fa01a7f89ac4c /crypto/algapi.c
parent5c98d62059faf7c59211cb591da671eaac7b7c3c (diff)
downloadlinux-c2110f28341cec2ecfd9474db15ac090bce1234c.tar.gz
linux-c2110f28341cec2ecfd9474db15ac090bce1234c.tar.bz2
linux-c2110f28341cec2ecfd9474db15ac090bce1234c.zip
crypto: api - Include alignment in crypto_alg_extsize
This patch ensures that the tfm context always has enough extra memory to ensure that it is aligned according to cra_alignment. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r--crypto/algapi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index abf100c054e0..3c079b7f23f6 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -980,7 +980,8 @@ EXPORT_SYMBOL_GPL(crypto_xor);
unsigned int crypto_alg_extsize(struct crypto_alg *alg)
{
- return alg->cra_ctxsize;
+ return alg->cra_ctxsize +
+ (alg->cra_alignmask & ~(crypto_tfm_ctx_alignment() - 1));
}
EXPORT_SYMBOL_GPL(crypto_alg_extsize);