From 178f2d1021e2d6cb9ed20ae9890a799fce9ecea2 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Wed, 29 Jun 2016 18:03:47 +0800 Subject: [PATCH] crypto: ahash - Add padding in crypto_ahash_extsize Orabug: 25243093 The function crypto_ahash_extsize did not include padding when computing the tfm context size. This patch fixes this by using the generic crypto_alg_extsize helper. Signed-off-by: Herbert Xu (cherry picked from commit 2495cf25f60e085b35beb9b215235dfe1ca4f200) Signed-off-by: Ethan Zhao --- crypto/ahash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/ahash.c b/crypto/ahash.c index 8acb886032ae..84688557b473 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c @@ -475,10 +475,10 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm) static unsigned int crypto_ahash_extsize(struct crypto_alg *alg) { - if (alg->cra_type == &crypto_ahash_type) - return alg->cra_ctxsize; + if (alg->cra_type != &crypto_ahash_type) + return sizeof(struct crypto_shash *); - return sizeof(struct crypto_shash *); + return crypto_alg_extsize(alg); } #ifdef CONFIG_NET -- 2.50.1