X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fwrbuf_sha1.c;h=733d8a2da21c07dcc937c6a2a2abfa83c3b1d6f8;hp=3aee3caf3e53a4a4261753304d73f166ff92fc52;hb=a6b61b9f8b6576e8159a4e7e6aee88bba7e5d07d;hpb=4eb90d87b9374b30b8ea4f9d5e70d509a11d9a58 diff --git a/src/wrbuf_sha1.c b/src/wrbuf_sha1.c index 3aee3ca..733d8a2 100644 --- a/src/wrbuf_sha1.c +++ b/src/wrbuf_sha1.c @@ -24,13 +24,11 @@ By Steve Reid 100% Public Domain */ -/* #define LITTLE_ENDIAN * This should be #define'd already, if true. */ /* #define SHA1HANDSOFF * Copies data before messing with it. */ #define SHA1HANDSOFF #include -#include typedef struct { uint32_t state[5]; @@ -42,13 +40,11 @@ typedef struct { /* 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 +#if 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] \ ^block->l[(i+2)&15]^block->l[i&15],1))