summaryrefslogtreecommitdiff
path: root/pkgtools/digest
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2007-07-27 17:08:27 +0000
committerjoerg <joerg@pkgsrc.org>2007-07-27 17:08:27 +0000
commit315daaa372a79e9445e9346ee4d91ee71b311a97 (patch)
tree04b0df35e84312b14be0d3878afe546274817891 /pkgtools/digest
parentced3f1307929ac30b898ac89bfdab63a4546a3cf (diff)
downloadpkgsrc-315daaa372a79e9445e9346ee4d91ee71b311a97.tar.gz
As reported by tnn@, the old approach to find the byte order
doesn't work on HP-UX/Itanium. Use the standard approach using AC_C_BIGENDIAN. Tested by myself on i386, he@ on SPARC and tnn@ on HP-UX.
Diffstat (limited to 'pkgtools/digest')
-rw-r--r--pkgtools/digest/files/config.h.in48
-rwxr-xr-xpkgtools/digest/files/configure389
-rw-r--r--pkgtools/digest/files/configure.ac41
-rw-r--r--pkgtools/digest/files/rmd160.c14
-rw-r--r--pkgtools/digest/files/sha1.c4
-rw-r--r--pkgtools/digest/files/sha2.c68
-rw-r--r--pkgtools/digest/files/tiger.c4
7 files changed, 278 insertions, 290 deletions
diff --git a/pkgtools/digest/files/config.h.in b/pkgtools/digest/files/config.h.in
index 3812e4225e3..9a9e1178d75 100644
--- a/pkgtools/digest/files/config.h.in
+++ b/pkgtools/digest/files/config.h.in
@@ -25,9 +25,6 @@
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
-/* Define to 1 if you have the <machine/endian.h> header file. */
-#undef HAVE_MACHINE_ENDIAN_H
-
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
@@ -55,18 +52,9 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
-/* Define to 1 if you have the <sys/bitypes.h> header file. */
-#undef HAVE_SYS_BITYPES_H
-
-/* Define to 1 if you have the <sys/byteorder.h> header file. */
-#undef HAVE_SYS_BYTEORDER_H
-
/* Define to 1 if you have the <sys/cdefs.h> header file. */
#undef HAVE_SYS_CDEFS_H
-/* Define to 1 if you have the <sys/endian.h> header file. */
-#undef HAVE_SYS_ENDIAN_H
-
/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
@@ -106,6 +94,10 @@
/* Define to 1 if strerror_r returns char *. */
#undef STRERROR_R_CHAR_P
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
#define below would cause a syntax error. */
@@ -196,38 +188,6 @@
#include <sys/param.h>
#endif
-#ifdef HAVE_SYS_ENDIAN_H
-#include <sys/endian.h>
-#endif
-
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#endif
-
-#ifdef HAVE_SYS_BYTEORDER_H
-#include <sys/byteorder.h>
-#endif
-
-#ifndef LITTLE_ENDIAN
-# define LITTLE_ENDIAN 1234
-#endif
-
-#ifndef BIG_ENDIAN
-# define BIG_ENDIAN 4321
-#endif
-
-#ifndef BYTE_ORDER
-# if defined(_BIG_ENDIAN)
-# define BYTE_ORDER BIG_ENDIAN
-# elif defined(_LITTE_ENDIAN)
-# define BYTE_ORDER LITTLE_ENDIAN
-# elif defined(WORDS_BIGENDIAN)
-# define BYTE_ORDER BIG_ENDIAN
-# else
-# define BYTE_ORDER LITTLE_ENDIAN
-# endif
-#endif
-
#if defined(HAVE_MEMSET)
#define MEMSET_BZERO(p,l) memset((p), 0, (l))
#else
diff --git a/pkgtools/digest/files/configure b/pkgtools/digest/files/configure
index 0702e4967de..5b9879ebde5 100755
--- a/pkgtools/digest/files/configure
+++ b/pkgtools/digest/files/configure
@@ -3573,7 +3573,7 @@ done
-for ac_header in errno.h fcntl.h inttypes.h locale.h machine/endian.h
+for ac_header in errno.h fcntl.h inttypes.h locale.h stdlib.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
@@ -3720,155 +3720,7 @@ done
-
-for ac_header in stdlib.h sys/bitypes.h sys/byteorder.h sys/cdefs.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
- # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- ( cat <<\_ASBOX
-## ----------------------------- ##
-## Report this to agc@netbsd.org ##
-## ----------------------------- ##
-_ASBOX
- ) | sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-for ac_header in sys/endian.h sys/file.h sys/param.h
+for ac_header in sys/cdefs.h sys/file.h sys/param.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
@@ -4314,6 +4166,243 @@ _ACEOF
esac
+{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
+if test "${ac_cv_c_bigendian+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
+ && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
+ bogus endian macros
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_c_bigendian=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_c_bigendian=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # It does not; compile a test program.
+if test "$cross_compiling" = yes; then
+ # try to guess the endianness by grepping values into an object file
+ ac_cv_c_bigendian=unknown
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+int
+main ()
+{
+ _ascii (); _ebcdic ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+ ac_cv_c_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+ # finding both strings is unlikely to happen, but who knows?
+ ac_cv_c_bigendian=unknown
+ fi
+fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long int l;
+ char c[sizeof (long int)];
+ } u;
+ u.l = 1;
+ return u.c[sizeof (long int) - 1] == 1;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_bigendian=no
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
+case $ac_cv_c_bigendian in
+ yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
+_ACEOF
+ ;;
+ no)
+ ;;
+ *)
+ { { echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+
+
# Checks for library functions.
{ echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5
echo $ECHO_N "checking whether strerror_r is declared... $ECHO_C" >&6; }
diff --git a/pkgtools/digest/files/configure.ac b/pkgtools/digest/files/configure.ac
index f39a45f3c17..18f1e97aa80 100644
--- a/pkgtools/digest/files/configure.ac
+++ b/pkgtools/digest/files/configure.ac
@@ -1,4 +1,4 @@
-dnl $Id: configure.ac,v 1.9 2007/07/03 18:54:03 joerg Exp $
+dnl $Id: configure.ac,v 1.10 2007/07/27 17:08:27 joerg Exp $
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
AC_INIT([nbsd-digest],[20070703],[agc@netbsd.org])
@@ -24,15 +24,16 @@ AC_SUBST(AUTOHEADER)
dnl Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS([errno.h fcntl.h inttypes.h locale.h machine/endian.h])
-AC_CHECK_HEADERS([stdlib.h sys/bitypes.h sys/byteorder.h sys/cdefs.h])
-AC_CHECK_HEADERS([sys/endian.h sys/file.h sys/param.h])
+AC_CHECK_HEADERS([errno.h fcntl.h inttypes.h locale.h stdlib.h])
+AC_CHECK_HEADERS([sys/cdefs.h sys/file.h sys/param.h])
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
+AC_C_BIGENDIAN
+
# Checks for library functions.
AC_FUNC_STRERROR_R
AC_FUNC_VPRINTF
@@ -97,38 +98,6 @@ AH_BOTTOM([
#include <sys/param.h>
#endif
-#ifdef HAVE_SYS_ENDIAN_H
-#include <sys/endian.h>
-#endif
-
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#endif
-
-#ifdef HAVE_SYS_BYTEORDER_H
-#include <sys/byteorder.h>
-#endif
-
-#ifndef LITTLE_ENDIAN
-# define LITTLE_ENDIAN 1234
-#endif
-
-#ifndef BIG_ENDIAN
-# define BIG_ENDIAN 4321
-#endif
-
-#ifndef BYTE_ORDER
-# if defined(_BIG_ENDIAN)
-# define BYTE_ORDER BIG_ENDIAN
-# elif defined(_LITTE_ENDIAN)
-# define BYTE_ORDER LITTLE_ENDIAN
-# elif defined(WORDS_BIGENDIAN)
-# define BYTE_ORDER BIG_ENDIAN
-# else
-# define BYTE_ORDER LITTLE_ENDIAN
-# endif
-#endif
-
#if defined(HAVE_MEMSET)
#define MEMSET_BZERO(p,l) memset((p), 0, (l))
#else
diff --git a/pkgtools/digest/files/rmd160.c b/pkgtools/digest/files/rmd160.c
index 21f7577c63f..b021b2d4b8f 100644
--- a/pkgtools/digest/files/rmd160.c
+++ b/pkgtools/digest/files/rmd160.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rmd160.c,v 1.4 2007/07/03 18:54:04 joerg Exp $ */
+/* $NetBSD: rmd160.c,v 1.5 2007/07/27 17:08:27 joerg Exp $ */
/********************************************************************\
*
@@ -23,7 +23,7 @@
#endif
#ifndef lint
-__RCSID("$NetBSD: rmd160.c,v 1.4 2007/07/03 18:54:04 joerg Exp $");
+__RCSID("$NetBSD: rmd160.c,v 1.5 2007/07/27 17:08:27 joerg Exp $");
#endif /* not lint */
/* header files */
@@ -365,7 +365,7 @@ RMD160Update(RMD160_CTX *context, const u_char *data, uint32_t nbytes)
uint32_t X[16];
uint32_t ofs = 0;
uint32_t i;
-#if BYTE_ORDER != LITTLE_ENDIAN
+#ifdef WORDS_BIGENDIAN
uint32_t j;
#endif
@@ -389,7 +389,7 @@ RMD160Update(RMD160_CTX *context, const u_char *data, uint32_t nbytes)
/* process first block */
ofs = 64 - context->buflen;
(void)memcpy(context->bbuffer + context->buflen, data, ofs);
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
(void)memcpy(X, context->bbuffer, sizeof(X));
#else
for (j=0; j < 16; j++)
@@ -400,7 +400,7 @@ RMD160Update(RMD160_CTX *context, const u_char *data, uint32_t nbytes)
/* process remaining complete blocks */
for (i = 0; i < (nbytes >> 6); i++) {
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
(void)memcpy(X, data + (64 * i) + ofs, sizeof(X));
#else
for (j=0; j < 16; j++)
@@ -424,7 +424,7 @@ RMD160Final(u_char digest[20], RMD160_CTX *context)
{
uint32_t i;
uint32_t X[16];
-#if BYTE_ORDER != LITTLE_ENDIAN
+#ifdef WORDS_BIGENDIAN
uint32_t j;
#endif
@@ -436,7 +436,7 @@ RMD160Final(u_char digest[20], RMD160_CTX *context)
ZEROIZE(context->bbuffer + context->buflen + 1,
63 - context->buflen);
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
(void)memcpy(X, context->bbuffer, sizeof(X));
#else
for (j=0; j < 16; j++)
diff --git a/pkgtools/digest/files/sha1.c b/pkgtools/digest/files/sha1.c
index 5b7bd242f78..102f91e191b 100644
--- a/pkgtools/digest/files/sha1.c
+++ b/pkgtools/digest/files/sha1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sha1.c,v 1.6 2007/07/03 18:54:04 joerg Exp $ */
+/* $NetBSD: sha1.c,v 1.7 2007/07/27 17:08:27 joerg Exp $ */
/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */
/*
@@ -51,7 +51,7 @@
* blk0() and blk() perform the initial expand.
* I got the idea of expanding during the round function from SSLeay
*/
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
# define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|(rol(block->l[i],8)&0x00FF00FF))
#else
diff --git a/pkgtools/digest/files/sha2.c b/pkgtools/digest/files/sha2.c
index 217b6dd4543..78b8144c62a 100644
--- a/pkgtools/digest/files/sha2.c
+++ b/pkgtools/digest/files/sha2.c
@@ -65,36 +65,6 @@
/*** SHA-256/384/512 Machine Architecture Definitions *****************/
-/*
- * BYTE_ORDER NOTE:
- *
- * Please make sure that your system defines BYTE_ORDER. If your
- * architecture is little-endian, make sure it also defines
- * LITTLE_ENDIAN and that the two (BYTE_ORDER and LITTLE_ENDIAN) are
- * equivilent.
- *
- * If your system does not define the above, then you can do so by
- * hand like this:
- *
- * #define LITTLE_ENDIAN 1234
- * #define BIG_ENDIAN 4321
- *
- * And for little-endian machines, add:
- *
- * #define BYTE_ORDER LITTLE_ENDIAN
- *
- * Or for big-endian machines:
- *
- * #define BYTE_ORDER BIG_ENDIAN
- *
- * The FreeBSD machine this was written on defines BYTE_ORDER
- * appropriately by including <sys/types.h> (which in turn includes
- * <machine/endian.h> where the appropriate definitions are actually
- * made).
- */
-#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)
-#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN
-#endif
/*** SHA-256/384/512 Various Length Definitions ***********************/
/* NOTE: Most of these are in sha2.h */
@@ -104,7 +74,7 @@
/*** ENDIAN REVERSAL MACROS *******************************************/
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
#define REVERSE32(w,x) { \
sha2_word32 tmp = (w); \
tmp = (tmp >> 16) | (tmp << 16); \
@@ -118,7 +88,7 @@
(x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \
((tmp & 0x0000ffff0000ffffULL) << 16); \
}
-#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+#endif /* WORDS_BIGENDIAN */
/*
* Macro for incrementally adding the unsigned 64-bit integer n to the
@@ -319,7 +289,7 @@ void SHA256_Init(SHA256_CTX* context) {
/* Unrolled SHA-256 round macros: */
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
REVERSE32(*data++, W256[j]); \
@@ -330,7 +300,7 @@ void SHA256_Init(SHA256_CTX* context) {
j++
-#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#else /* WORDS__BIGENDIAN */
#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
@@ -339,7 +309,7 @@ void SHA256_Init(SHA256_CTX* context) {
(h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
j++
-#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+#endif /* WORDS_BIGENDIAN */
#define ROUND256(a,b,c,d,e,f,g,h) \
s0 = W256[(j+1)&0x0f]; \
@@ -429,15 +399,15 @@ void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) {
j = 0;
do {
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
/* Copy data while converting to host byte order */
REVERSE32(*data++,W256[j]);
/* Apply the SHA-256 compression function to update a..h */
T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j];
-#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#else /* WORDS_BIGENDIAN */
/* Apply the SHA-256 compression function to update a..h with copy */
T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++);
-#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+#endif /* WORDS_BIGENDIAN */
T2 = Sigma0_256(a) + Maj(a, b, c);
h = g;
g = f;
@@ -548,7 +518,7 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
/* If no digest buffer is passed, we don't bother doing this: */
if (digest != (sha2_byte*)0) {
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount,context->bitcount);
#endif
@@ -582,7 +552,7 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
/* Final transform: */
SHA256_Transform(context, (sha2_word32*)context->buffer);
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
{
/* Convert TO host byte order */
int j;
@@ -614,7 +584,7 @@ void SHA512_Init(SHA512_CTX* context) {
#ifdef SHA2_UNROLL_TRANSFORM
/* Unrolled SHA-512 round macros: */
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \
REVERSE64(*data++, W512[j]); \
@@ -625,7 +595,7 @@ void SHA512_Init(SHA512_CTX* context) {
j++
-#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#else /* !WORDS_BIGENDIAN */
#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \
T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
@@ -634,7 +604,7 @@ void SHA512_Init(SHA512_CTX* context) {
(h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
j++
-#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+#endif /* WORDS_BIGENDIAN */
#define ROUND512(a,b,c,d,e,f,g,h) \
s0 = W512[(j+1)&0x0f]; \
@@ -719,15 +689,15 @@ void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) {
j = 0;
do {
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
/* Convert TO host byte order */
REVERSE64(*data++, W512[j]);
/* Apply the SHA-512 compression function to update a..h */
T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j];
-#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#else
/* Apply the SHA-512 compression function to update a..h with copy */
T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++);
-#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+#endif /* WORDS_BIGENDIAN */
T2 = Sigma0_512(a) + Maj(a, b, c);
h = g;
g = f;
@@ -832,7 +802,7 @@ void SHA512_Last(SHA512_CTX* context) {
unsigned int usedspace;
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount[0],context->bitcount[0]);
REVERSE64(context->bitcount[1],context->bitcount[1]);
@@ -880,7 +850,7 @@ void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
SHA512_Last(context);
/* Save the hash data for output: */
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
{
/* Convert TO host byte order */
int j;
@@ -924,7 +894,7 @@ void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
SHA512_Last((SHA512_CTX*)context);
/* Save the hash data for output: */
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
{
/* Convert TO host byte order */
int j;
diff --git a/pkgtools/digest/files/tiger.c b/pkgtools/digest/files/tiger.c
index 3e2c08f2a36..cf781a95ee6 100644
--- a/pkgtools/digest/files/tiger.c
+++ b/pkgtools/digest/files/tiger.c
@@ -661,7 +661,7 @@ TIGERUpdate(tiger_context_t *tp, const uint8_t *data, uint32_t len)
uint8_t temp[64];
for (i = len; i >= 64; i -= 64) {
-#if BYTE_ORDER == BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
for (j = 0; j < 64; j++) {
temp[j ^ 7] = ((uint8_t *) str)[j];
}
@@ -672,7 +672,7 @@ TIGERUpdate(tiger_context_t *tp, const uint8_t *data, uint32_t len)
str += 8;
}
-#if BYTE_ORDER == BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
for (j = 0; j < i; j++) {
temp[j ^ 7] = ((uint8_t *) str)[j];
}