aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-02-17 07:00:11 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2009-02-17 07:00:11 -0500
commit8eb2dfac41c71701bb741f496f0cb7b7e4a3c3f6 (patch)
tree20b846256745f676a91d9bc97a03ed265b8c2b56 /crypto
parentd2f8d7ee1a9b4650b4e43325b321801264f7c37a (diff)
crypto: lrw - Fix big endian support
It turns out that LRW has never worked properly on big endian. This was never discussed because nobody actually used it that way. In fact, it was only discovered when Geert Uytterhoeven loaded it through tcrypt which failed the test on it. The fix is straightforward, on big endian the to find the nth bit we should be grouping them by words instead of bytes. So setbit128_bbe should xor with 128 - BITS_PER_LONG instead of 128 - BITS_PER_BYTE == 0x78. Tested-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/lrw.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/lrw.c b/crypto/lrw.c
index 8ef664e3bcd9..358f80be2bf9 100644
--- a/crypto/lrw.c
+++ b/crypto/lrw.c
@@ -45,7 +45,13 @@ struct priv {
45 45
46static inline void setbit128_bbe(void *b, int bit) 46static inline void setbit128_bbe(void *b, int bit)
47{ 47{
48 __set_bit(bit ^ 0x78, b); 48 __set_bit(bit ^ (0x80 -
49#ifdef __BIG_ENDIAN
50 BITS_PER_LONG
51#else
52 BITS_PER_BYTE
53#endif
54 ), b);
49} 55}
50 56
51static int setkey(struct crypto_tfm *parent, const u8 *key, 57static int setkey(struct crypto_tfm *parent, const u8 *key,