2009-07-15 13:18:01

by Herbert Xu

[permalink] [raw]
Subject: crypto: shash - Fix digest size offset

Hi:

This one fixes failures when using shash algorithms through
ahash.

commit fa64966473830219fe74952029ddb0e981a87749
Author: Herbert Xu <[email protected]>
Date: Wed Jul 15 21:16:05 2009 +0800

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 <[email protected]>

diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index 3e89ce1..26cb1eb 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -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;

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt