浏览代码

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>
Herbert Xu 10 年之前
父节点
当前提交
c2110f2834
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      crypto/algapi.c

+ 2 - 1
crypto/algapi.c

@@ -980,7 +980,8 @@ EXPORT_SYMBOL_GPL(crypto_xor);
 
 
 unsigned int crypto_alg_extsize(struct crypto_alg *alg)
 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);
 EXPORT_SYMBOL_GPL(crypto_alg_extsize);