summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2008-12-08 11:12:30 +0100
committerKarel Zak2008-12-08 11:12:30 +0100
commit6fc2c88210780982b67f9b7a053663fecf4b2621 (patch)
treefb732c798e27f7e92ec16f0e84e4a7792116f6bc
parenttests: add MD5 regression test (diff)
downloadkernel-qcow2-util-linux-6fc2c88210780982b67f9b7a053663fecf4b2621.tar.gz
kernel-qcow2-util-linux-6fc2c88210780982b67f9b7a053663fecf4b2621.tar.xz
kernel-qcow2-util-linux-6fc2c88210780982b67f9b7a053663fecf4b2621.zip
lib: add __BYTE_ORDER to md5.c
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--lib/md5.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/md5.c b/lib/md5.c
index a78eec467..306984517 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -14,11 +14,16 @@
* needed on buffers full of bytes, and then call MD5Final, which
* will fill a supplied 16-byte array with the digest.
*/
+#include <endian.h>
#include <string.h> /* for memcpy() */
#include "md5.h"
-#ifndef HIGHFIRST
+#if !defined __BYTE_ORDER || !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN)
+#error missing __BYTE_ORDER
+#endif
+
+#if (__BYTE_ORDER == __LITTLE_ENDIAN)
#define byteReverse(buf, len) /* Nothing */
#else
void byteReverse(unsigned char *buf, unsigned longs);