Просмотр исходного кода

crypto: shash - Fix digest size offset

When an shash algorithm is exported as ahash, ahash will access
its digest size through hash_alg_common.  That's why the shash
layout needs to match hash_alg_common.  This wasn't the case
because the alignment weren't identical.

This patch fixes the problem.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Herbert Xu 16 лет назад
Родитель
Сommit
fa64966473
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      include/crypto/hash.h

+ 2 - 1
include/crypto/hash.h

@@ -75,7 +75,8 @@ struct shash_alg {
 	unsigned int descsize;
 	unsigned int descsize;
 
 
 	/* These fields must match hash_alg_common. */
 	/* These fields must match hash_alg_common. */
-	unsigned int digestsize;
+	unsigned int digestsize
+		__attribute__ ((aligned(__alignof__(struct hash_alg_common))));
 	unsigned int statesize;
 	unsigned int statesize;
 
 
 	struct crypto_alg base;
 	struct crypto_alg base;