summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@android.com>2011-03-14 10:39:10 -0700
committerAndroid Code Review <code-review@android.com>2011-03-14 10:39:10 -0700
commit0c3989854fa3ea3ffb4152c013f68f2a21a52dc1 (patch)
tree8584c9484bcae878c2659d8b1652052f1d61d7db
parentda8ea213abb8bec08da37622179061630bd8e2f8 (diff)
parent865e3789dd222ca2ec4f173f43085851165a0ecb (diff)
downloadbionic-0c3989854fa3ea3ffb4152c013f68f2a21a52dc1.zip
bionic-0c3989854fa3ea3ffb4152c013f68f2a21a52dc1.tar.gz
bionic-0c3989854fa3ea3ffb4152c013f68f2a21a52dc1.tar.bz2
Merge "[ENDIAN] Build md5 code correctly for bigendian targets"
-rw-r--r--libc/bionic/md5.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libc/bionic/md5.c b/libc/bionic/md5.c
index 087786f..16674f1 100644
--- a/libc/bionic/md5.c
+++ b/libc/bionic/md5.c
@@ -38,6 +38,7 @@ __RCSID("$Heimdal: md5.c,v 1.15 2001/01/29 04:33:44 assar Exp $"
"$NetBSD: md5.c,v 1.1.1.4 2002/09/12 12:41:42 joda Exp $");
#endif
+#include <endian.h>
#include "md5.h"
#include "hash.h"
@@ -178,8 +179,11 @@ calc (struct md5 *m, u_int32_t *data)
/*
* From `Performance analysis of MD5' by Joseph D. Touch <touch@isi.edu>
*/
+#if !defined(__BYTE_ORDER) || !defined (__BIG_ENDIAN)
+#error __BYTE_ORDER macros not defined
+#endif
-#if defined(WORDS_BIGENDIAN)
+#if __BYTE_ORDER == __BIG_ENDIAN
static inline u_int32_t
swap_u_int32_t (u_int32_t t)
{
@@ -217,7 +221,7 @@ MD5_Update (struct md5 *m, const void *v, size_t len)
p += l;
len -= l;
if(offset == 64){
-#if defined(WORDS_BIGENDIAN)
+#if __BYTE_ORDER == __BIG_ENDIAN
int i;
u_int32_t current[16];
struct x32 *u = (struct x32*)m->save;