Commit 8d65794a authored by Bernhard Link's avatar Bernhard Link

use AC_C_BIGENDIAN instead of endian.h

parent b0c25b64
......@@ -15,6 +15,7 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_SYS_LARGEFILE
AC_C_BIGENDIAN()
AC_HEADER_STDBOOL
AC_CHECK_FUNCS([closefrom])
AC_CHECK_FUNCS([strndup])
......
......@@ -20,7 +20,6 @@
* Still in the public domain.
*
* Changed to no longer need things from dpkg,
* but using endian.h instead.
* and made MD5Transfor static...
* - Bernhard R. Link <brlink@debian.org>
* Still in public domain.
......@@ -28,7 +27,6 @@
#include <config.h>
#include <endian.h> /* for __BYTE_ORDER */
#include <string.h> /* for memcpy() */
#include <sys/types.h> /* for stupid systems */
#include <netinet/in.h> /* for ntohl() */
......@@ -37,7 +35,7 @@
static void
MD5Transform(UWORD32 buf[4], UWORD32 const in[16]);
#if __BYTE_ORDER == __BIG_ENDIAN
#ifdef WORDS_BIGENDIAN
static void
byteSwap(UWORD32 *buf, unsigned words)
{
......@@ -50,11 +48,9 @@ byteSwap(UWORD32 *buf, unsigned words)
} while (--words);
}
#else
#if __BYTE_ORDER == __LITTLE_ENDIAN
/* I'm assuming there is only big and little endian, PDP_ENDIAN users
* will have bad luck... */
#define byteSwap(buf,words)
#else
#error "only supporting little or big endian currently"
#endif
#endif
/*
......
......@@ -43,13 +43,17 @@ removed wiping of temp data (as not needed for public data)
multiple modifications to make it more what I consider readable.
using endian.h now.
multiple more modifications...
Modified 06/2008
by Bernhard R. Link <brlink@debian.org>
Still 100% public domain:
use WORDS_BIGENDIAN instead of endian.h
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
......@@ -75,12 +79,12 @@ void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
{
uint32_t a, b, c, d, e;
uint32_t block[16];
#if __BYTE_ORDER != __BIG_ENDIAN
#ifndef WORDS_BIGENDIAN
int i;
#endif
assert( sizeof(block) == 64*sizeof(uint8_t) );
#if __BYTE_ORDER == __BIG_ENDIAN
#ifdef WORDS_BIGENDIAN
memcpy(block, buffer, sizeof(block));
#else
for( i = 0 ; i < 16 ; i++ ) {
......
......@@ -6,7 +6,6 @@
#include <config.h>
#include <endian.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
......@@ -17,7 +16,7 @@
#include "sha256.h"
#if __BYTE_ORDER == __LITTLE_ENDIAN
#ifndef WORDS_BIGENDIAN
# define SWAP(n) \
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment