crypto: shash - Fix digest size offset
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 15 Jul 2009 13:16:05 +0000 (21:16 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 15 Jul 2009 13:16:05 +0000 (21:16 +0800)
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>
include/crypto/hash.h

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