From 87fa15aa293b00d614a9a97bf1c3f46e3239161c Mon Sep 17 00:00:00 2001 From: Spencer Thomason Date: Tue, 9 Aug 2016 15:14:32 -0700 Subject: [PATCH 1/5] xmpp: use in tree portable endianness macros - replace WORDS_BIGENDIAN with __IS_BIG_ENDIAN - not all platforms define WORDS_BIGENDIAN on big endian archs --- modules/xmpp/sha.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/xmpp/sha.c b/modules/xmpp/sha.c index e1ca80f7c3d..fcdc313dc6e 100644 --- a/modules/xmpp/sha.c +++ b/modules/xmpp/sha.c @@ -49,6 +49,7 @@ #include #include #include +#include "../../endianness.h" #ifndef MACOS # include @@ -104,7 +105,7 @@ sha_hash(int *data, int *hash) for (t=0; t<16; t++) { -#ifndef WORDS_BIGENDIAN +#ifndef __IS_BIG_ENDIAN W[t]=switch_endianness(data[t]); #else W[t]=data[t]; @@ -244,7 +245,7 @@ char *shahash(const char *str) for (i=0; i<14; i++) ((int*)read_buffer)[i]=0; } -#ifndef WORDS_BIGENDIAN +#ifndef __IS_BIG_ENDIAN for (i=0; i<8; i++) { read_buffer[56+i]=(char)(length>>(56-(i*8))) & 0xff; From 67d5800a045a6e759467b9f14cac52de937b3bd7 Mon Sep 17 00:00:00 2001 From: Spencer Thomason Date: Tue, 9 Aug 2016 15:15:07 -0700 Subject: [PATCH 2/5] acc: use in tree portable endianness macros - replace WORDS_BIGENDIAN with __IS_BIG_ENDIAN - not all platforms define WORDS_BIGENDIAN on big endian archs --- modules/acc/diam_message.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/acc/diam_message.h b/modules/acc/diam_message.h index d5e3535acaa..b1d81cb4578 100644 --- a/modules/acc/diam_message.h +++ b/modules/acc/diam_message.h @@ -38,6 +38,7 @@ #include "../../str.h" #include "../../mem/mem.h" +#include "../../endianness.h" #define ad_malloc pkg_malloc #define ad_free pkg_free @@ -68,7 +69,7 @@ /* message codes */ -#ifndef WORDS_BIGENDIAN +#ifndef __IS_BIG_ENDIAN #define AS_MSG_CODE 0x12010000 #define AC_MSG_CODE 0x0f010000 #define CE_MSG_CODE 0x01010000 From 830b48bdf28855fbe305db846533d24c7f84bc32 Mon Sep 17 00:00:00 2001 From: Spencer Thomason Date: Tue, 9 Aug 2016 15:16:17 -0700 Subject: [PATCH 3/5] auth_diameter: use in tree portable endianness macros - replace WORDS_BIGENDIAN with __IS_BIG_ENDIAN - not all platforms define WORDS_BIGENDIAN on big endian archs --- modules/auth_diameter/diameter_msg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/auth_diameter/diameter_msg.h b/modules/auth_diameter/diameter_msg.h index e0b95512050..ebe2ce232b0 100644 --- a/modules/auth_diameter/diameter_msg.h +++ b/modules/auth_diameter/diameter_msg.h @@ -29,6 +29,7 @@ #include "../../str.h" #include "../../mem/mem.h" +#include "../../endianness.h" #define ad_malloc pkg_malloc #define ad_free pkg_free @@ -59,7 +60,7 @@ /* message codes */ -#ifndef WORDS_BIGENDIAN +#ifndef __IS_BIG_ENDIAN #define AS_MSG_CODE 0x12010000 #define AC_MSG_CODE 0x0f010000 #define CE_MSG_CODE 0x01010000 @@ -69,7 +70,6 @@ #define ST_MSG_CODE 0x13010000 #define MASK_MSG_CODE 0xffffff00 #else - #error BIG endian detected!! #define AS_MSG_CODE 0x00000112 #define AC_MSG_CODE 0x0000010f #define CE_MSG_CODE 0x00000101 From bf4d9d803d560417461287759c124bab4389155f Mon Sep 17 00:00:00 2001 From: Spencer Thomason Date: Tue, 9 Aug 2016 15:16:53 -0700 Subject: [PATCH 4/5] cdp: use in tree portable endianness macros - replace WORDS_BIGENDIAN with __IS_BIG_ENDIAN - not all platforms define WORDS_BIGENDIAN on big endian archs --- modules/cdp/diameter.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/cdp/diameter.h b/modules/cdp/diameter.h index f5ce4107cf6..df1b450aa5d 100644 --- a/modules/cdp/diameter.h +++ b/modules/cdp/diameter.h @@ -47,6 +47,7 @@ #include "utils.h" #include +#include "../../endianness.h" #include "diameter_code_result.h" #include "diameter_code_avp.h" @@ -104,7 +105,7 @@ AVP_VENDOR_ID_SIZE*(((_flags_)&AAA_AVP_FLAG_VENDOR_SPECIFIC)!=0) ) /* mesage codes */ -#ifndef WORDS_BIGENDIAN +#ifndef __IS_BIG_ENDIAN #define AS_MSG_CODE 0x12010000 #define AC_MSG_CODE 0x0f010000 #define CE_MSG_CODE 0x01010000 From 72eed465dd142619e643fd8cbf7e42c73753fa12 Mon Sep 17 00:00:00 2001 From: Spencer Thomason Date: Tue, 9 Aug 2016 15:18:59 -0700 Subject: [PATCH 5/5] core: use in tree portable endianness macros - replace WORDS_BIGENDIAN with __IS_BIG_ENDIAN - not all platforms define WORDS_BIGENDIAN on big endian archs - closes GH #739 --- md5.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/md5.c b/md5.c index d675dd1c022..fdb166a1188 100644 --- a/md5.c +++ b/md5.c @@ -20,6 +20,7 @@ #include #include +#include "endianness.h" #include "md5.h" #ifndef __OS_solaris @@ -159,7 +160,7 @@ MD5Transform(u_int32_t state[4], const u_int8_t block[MD5_BLOCK_LENGTH]) { u_int32_t a, b, c, d, in[MD5_BLOCK_LENGTH / 4]; -#ifndef WORDS_BIGENDIAN +#ifndef __IS_BIG_ENDIAN memcpy(in, block, sizeof(in)); #else for (a = 0; a < MD5_BLOCK_LENGTH / 4; a++) {