diff options
author | Andrew Morton <akpm@osdl.org> | 2004-10-25 06:45:35 -0700 |
---|---|---|
committer | David S. Miller <davem@nuts.davemloft.net> | 2004-10-25 06:45:35 -0700 |
commit | 989424947198ae1612f8a09a49fa75996b7dc62d (patch) | |
tree | 980d0758392b5a692973e14edcf18b06d1a03b29 /crypto | |
parent | 11bde9b1c0d130fb780787473a4a77fad3d1402a (diff) | |
download | history-989424947198ae1612f8a09a49fa75996b7dc62d.tar.gz |
[CRYPTO]: small sha256 cleanup
Looks like open-coded be_to_cpu. GCC produces rather poor code for this.
be_to_cpu produces asm()s which are ~4 times shorter.
Compile-tested only.
I am not sure whether input can be 32bit-unaligned.
If it indeed can be, replace:
((u32*)(input))[I] -> get_unaligned( ((u32*)(input))+I )
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/sha256.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/crypto/sha256.c b/crypto/sha256.c index e8adf150d5939b..39f5a654709e14 100644 --- a/crypto/sha256.c +++ b/crypto/sha256.c @@ -63,15 +63,7 @@ static inline u32 RORu32(u32 x, u32 y) static inline void LOAD_OP(int I, u32 *W, const u8 *input) { - u32 t1 = input[(4 * I)] & 0xff; - - t1 <<= 8; - t1 |= input[(4 * I) + 1] & 0xff; - t1 <<= 8; - t1 |= input[(4 * I) + 2] & 0xff; - t1 <<= 8; - t1 |= input[(4 * I) + 3] & 0xff; - W[I] = t1; + W[I] = __be32_to_cpu( ((u32*)(input))[I] ); } static inline void BLEND_OP(int I, u32 *W) |