|
|
|
@ -70,6 +70,20 @@ typedef unsigned long long u64;
|
|
|
|
|
# undef STRICT_ALIGNMENT
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef STRICT_ALIGNMENT
|
|
|
|
|
# ifdef __GNUC__
|
|
|
|
|
typedef u64 u64_a1 __attribute((__aligned__(1)));
|
|
|
|
|
# else
|
|
|
|
|
typedef u64 u64_a1;
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(__GNUC__) && !defined(STRICT_ALIGNMENT)
|
|
|
|
|
typedef u64 u64_aX __attribute((__aligned__(1)));
|
|
|
|
|
#else
|
|
|
|
|
typedef u64 u64_aX;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#undef SMALL_REGISTER_BANK
|
|
|
|
|
#if defined(__i386) || defined(__i386__) || defined(_M_IX86)
|
|
|
|
|
# define SMALL_REGISTER_BANK
|
|
|
|
@ -197,13 +211,13 @@ typedef unsigned long long u64;
|
|
|
|
|
# define LL(c0,c1,c2,c3,c4,c5,c6,c7) c0,c1,c2,c3,c4,c5,c6,c7, \
|
|
|
|
|
c0,c1,c2,c3,c4,c5,c6,c7
|
|
|
|
|
# define C0(K,i) (((u64*)(Cx.c+0))[2*K.c[(i)*8+0]])
|
|
|
|
|
# define C1(K,i) (((u64*)(Cx.c+7))[2*K.c[(i)*8+1]])
|
|
|
|
|
# define C2(K,i) (((u64*)(Cx.c+6))[2*K.c[(i)*8+2]])
|
|
|
|
|
# define C3(K,i) (((u64*)(Cx.c+5))[2*K.c[(i)*8+3]])
|
|
|
|
|
# define C4(K,i) (((u64*)(Cx.c+4))[2*K.c[(i)*8+4]])
|
|
|
|
|
# define C5(K,i) (((u64*)(Cx.c+3))[2*K.c[(i)*8+5]])
|
|
|
|
|
# define C6(K,i) (((u64*)(Cx.c+2))[2*K.c[(i)*8+6]])
|
|
|
|
|
# define C7(K,i) (((u64*)(Cx.c+1))[2*K.c[(i)*8+7]])
|
|
|
|
|
# define C1(K,i) (((u64_a1*)(Cx.c+7))[2*K.c[(i)*8+1]])
|
|
|
|
|
# define C2(K,i) (((u64_a1*)(Cx.c+6))[2*K.c[(i)*8+2]])
|
|
|
|
|
# define C3(K,i) (((u64_a1*)(Cx.c+5))[2*K.c[(i)*8+3]])
|
|
|
|
|
# define C4(K,i) (((u64_a1*)(Cx.c+4))[2*K.c[(i)*8+4]])
|
|
|
|
|
# define C5(K,i) (((u64_a1*)(Cx.c+3))[2*K.c[(i)*8+5]])
|
|
|
|
|
# define C6(K,i) (((u64_a1*)(Cx.c+2))[2*K.c[(i)*8+6]])
|
|
|
|
|
# define C7(K,i) (((u64_a1*)(Cx.c+1))[2*K.c[(i)*8+7]])
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static const
|
|
|
|
@ -537,7 +551,7 @@ void whirlpool_block(WHIRLPOOL_CTX *ctx, const void *inp, size_t n)
|
|
|
|
|
} else
|
|
|
|
|
# endif
|
|
|
|
|
{
|
|
|
|
|
const u64 *pa = (const u64 *)p;
|
|
|
|
|
const u64_aX *pa = (const u64_aX *)p;
|
|
|
|
|
S.q[0] = (K.q[0] = H->q[0]) ^ pa[0];
|
|
|
|
|
S.q[1] = (K.q[1] = H->q[1]) ^ pa[1];
|
|
|
|
|
S.q[2] = (K.q[2] = H->q[2]) ^ pa[2];
|
|
|
|
@ -775,7 +789,7 @@ void whirlpool_block(WHIRLPOOL_CTX *ctx, const void *inp, size_t n)
|
|
|
|
|
} else
|
|
|
|
|
# endif
|
|
|
|
|
{
|
|
|
|
|
const u64 *pa = (const u64 *)p;
|
|
|
|
|
const u64_aX *pa = (const u64_aX *)p;
|
|
|
|
|
H->q[0] ^= S.q[0] ^ pa[0];
|
|
|
|
|
H->q[1] ^= S.q[1] ^ pa[1];
|
|
|
|
|
H->q[2] ^= S.q[2] ^ pa[2];
|
|
|
|
|