From: Herbert Xu Date: Thu, 28 May 2015 14:07:56 +0000 (+0800) Subject: crypto: api - Include alignment in crypto_alg_extsize X-Git-Tag: v4.14-rc1~5235^2~106 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c2110f28341cec2ecfd9474db15ac090bce1234c;p=platform%2Fkernel%2Flinux-rpi.git 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 --- diff --git a/crypto/algapi.c b/crypto/algapi.c index abf100c..3c079b7 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);