diff --git a/lib/sha2.c b/lib/sha2.c index eda9f1a3..81cee1c0 100644 --- a/lib/sha2.c +++ b/lib/sha2.c @@ -36,6 +36,10 @@ #include /* assert() */ #include "sha2.h" +#if HAVE_SYS_BYTEORDER_H + #include +#endif + /* * ASSERT NOTE: * Some sanity checking code is included using assert(). On my FreeBSD @@ -86,8 +90,14 @@ * made). */ -#ifdef WIN32 - #define BYTE_ORDER BIG_ENDIAN +#ifndef BYTE_ORDER + #ifdef WIN32 + #define BYTE_ORDER BIG_ENDIAN + #elif defined(_BIG_ENDIAN) + #define BYTE_ORDER BIG_ENDIAN + #elif defined(_LITTLE_ENDIAN) + #define BYTE_ORDER LITTLE_ENDIAN + #endif #endif #if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN) diff --git a/lib/sha2.h b/lib/sha2.h index 190b697d..8b6e6f40 100644 --- a/lib/sha2.h +++ b/lib/sha2.h @@ -48,6 +48,10 @@ extern "C" { */ #include +#if HAVE_INTTYPES_H + #define SHA2_USE_INTTYPES_H +#endif + #ifdef SHA2_USE_INTTYPES_H #include #endif /* SHA2_USE_INTTYPES_H */