From: Adam Dickmeiss Date: Wed, 11 Nov 2015 14:32:28 +0000 (+0100) Subject: Avoid using non-portable debian.h X-Git-Tag: v5.15.1~4 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=a6b61b9f8b6576e8159a4e7e6aee88bba7e5d07d Avoid using non-portable debian.h Instead use autoconf's AC_C_BIGENDIAN --- diff --git a/configure.ac b/configure.ac index 4090a95..8d7e03b 100644 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,7 @@ dnl YAZ_DOC dnl dnl +AC_C_BIGENDIAN AC_CHECK_HEADERS([dirent.h fnmatch.h wchar.h locale.h langinfo.h pwd.h unistd.h sys/select.h sys/socket.h sys/stat.h sys/time.h sys/times.h sys/types.h sys/un.h sys/wait.h sys/prctl.h netdb.h arpa/inet.h netinet/tcp.h netinet/in_systm.h execinfo.h],[],[],[]) AC_CHECK_HEADERS([net/if.h netinet/in.h netinet/if_ether.h],[],[],[ #if HAVE_SYS_TYPES_H 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))