Commit bc30e521 authored by Andrew Morton's avatar Andrew Morton Committed by David S. Miller

[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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 98942494
......@@ -104,22 +104,7 @@ 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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment