Skip to content

Commit

Permalink
crypto: api - Include alignment in crypto_alg_extsize
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
herbertx committed Jun 3, 2015
1 parent 5c98d62 commit c2110f2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/algapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c2110f2

Please sign in to comment.