Add endian test to autoconf and convert crypt to use it.

This commit is contained in:
Elizabeth Jennifer Myers 2011-01-24 21:03:00 -05:00
parent 6cb47f18b5
commit d0c759a857
3 changed files with 19 additions and 6 deletions

View File

@ -40,6 +40,7 @@ AM_MAINTAINER_MODE
AC_ISC_POSIX
AC_C_INLINE
AC_C_CONST
AC_C_BIGENDIAN
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PATH_PROG(AUTOMAKE, automake)

View File

@ -1,5 +1,8 @@
/* include/libratbox_config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
@ -229,9 +232,6 @@
/* Define this to disable debugging support. */
#undef NDEBUG
/* Define if your system needs crypt. */
#undef NEED_CRYPT
/* Define to 1 if you wish to disable the block allocator. */
#undef NOBALLOC
@ -310,6 +310,18 @@
/* This is a Windows system */
#undef WINDOWS
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Define to 1 if on MINIX. */
#undef _MINIX

View File

@ -779,7 +779,7 @@ static void MD5Init (MD5_CTX *);
static void MD5Update (MD5_CTX *, const void *, unsigned int);
static void MD5Final (unsigned char [16], MD5_CTX *);
#if (BYTE_ORDER == LITTLE_ENDIAN)
#ifndef WORDS_BIGENDIAN
#define Encode memcpy
#define Decode memcpy
#else
@ -1196,7 +1196,7 @@ struct sha256_ctx
char buffer[128]; /* NB: always correctly aligned for uint32_t. */
};
#if __BYTE_ORDER == __LITTLE_ENDIAN
#ifndef WORDS_BIGENDIAN
# define SHA256_SWAP(n) \
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
#else
@ -1738,7 +1738,7 @@ struct sha512_ctx
};
#if __BYTE_ORDER == __LITTLE_ENDIAN
#ifndef WORDS_BIGENDIAN
# define SHA512_SWAP(n) \
(((n) << 56) \
| (((n) & 0xff00) << 40) \