Skip to content

Commit c2110f2

Browse files
committed
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>
1 parent 5c98d62 commit c2110f2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎crypto/algapi.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,8 @@ EXPORT_SYMBOL_GPL(crypto_xor);
980980

981981
unsigned int crypto_alg_extsize(struct crypto_alg *alg)
982982
{
983-
return alg->cra_ctxsize;
983+
return alg->cra_ctxsize +
984+
(alg->cra_alignmask & ~(crypto_tfm_ctx_alignment() - 1));
984985
}
985986
EXPORT_SYMBOL_GPL(crypto_alg_extsize);
986987

0 commit comments

Comments
 (0)