crypto: ahash - Add padding in crypto_ahash_extsize
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 29 Jun 2016 10:03:47 +0000 (18:03 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 1 Jul 2016 15:45:03 +0000 (23:45 +0800)
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 <herbert@gondor.apana.org.au>
crypto/ahash.c

index 3887a98..2ce8bcb 100644 (file)
@@ -461,10 +461,10 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
 
 static unsigned int crypto_ahash_extsize(struct crypto_alg *alg)
 {
 
 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
 }
 
 #ifdef CONFIG_NET