diff options
author | Andrew Morton <akpm@osdl.org> | 2004-10-25 06:46:17 -0700 |
---|---|---|
committer | David S. Miller <davem@nuts.davemloft.net> | 2004-10-25 06:46:17 -0700 |
commit | bc30e521501808ab0241aba022377863e0274ee5 (patch) | |
tree | 4f1cffc5acfcf6db56d7a60c83d3d9a3aadf5850 /crypto | |
parent | 989424947198ae1612f8a09a49fa75996b7dc62d (diff) | |
download | history-bc30e521501808ab0241aba022377863e0274ee5.tar.gz |
[CRYPTO]: small sha512 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 64bit-unaligned.
If it indeed can be, replace:
((u64*)(input))[I] -> get_unaligned( ((u64*)(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/sha512.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/crypto/sha512.c b/crypto/sha512.c index f1a8dc0aec4740..763093b17c1e12 100644 --- a/crypto/sha512.c +++ b/crypto/sha512.c @@ -104,27 +104,12 @@ const u64 sha512_K[80] = { static inline void LOAD_OP(int I, u64 *W, const u8 *input) { - u64 t1 = input[(8*I) ] & 0xff; - t1 <<= 8; - t1 |= input[(8*I)+1] & 0xff; - t1 <<= 8; - t1 |= input[(8*I)+2] & 0xff; - t1 <<= 8; - t1 |= input[(8*I)+3] & 0xff; - t1 <<= 8; - t1 |= input[(8*I)+4] & 0xff; - t1 <<= 8; - t1 |= input[(8*I)+5] & 0xff; - t1 <<= 8; - t1 |= input[(8*I)+6] & 0xff; - t1 <<= 8; - t1 |= input[(8*I)+7] & 0xff; - W[I] = t1; + W[I] = __be64_to_cpu( ((u64*)(input))[I] ); } static inline void BLEND_OP(int I, u64 *W) { - W[I] = s1(W[I-2]) + W[I-7] + s0(W[I-15]) + W[I-16]; + W[I] = s1(W[I-2]) + W[I-7] + s0(W[I-15]) + W[I-16]; } static void |