lib/sha1: use proper WORDS_BIGENDIAN macro
The original code uses BYTE_ORDER, but we use WORDS_BIGENDIAN in utl-linux. Reported-by: Andreas Schwab <schwab@linux-m68k.org> Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
43afa84581
commit
4ff4b1106e
|
@ -19,14 +19,11 @@
|
|||
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
||||
|
||||
/* blk0() and blk() perform the initial expand. */
|
||||
/* I got the idea of expanding during the round function from SSLeay */
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
# define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|
||||
|(rol(block->l[i],8)&0x00FF00FF))
|
||||
#elif BYTE_ORDER == BIG_ENDIAN
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define blk0(i) block->l[i]
|
||||
#else
|
||||
# error "Endianness not defined!"
|
||||
# define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|
||||
|(rol(block->l[i],8)&0x00FF00FF))
|
||||
#endif
|
||||
|
||||
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
|
||||
|
|
Loading…
Reference in New Issue