From 9e9323bf556e20c6395071cf1bf07fbf72918c99 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 24 Apr 2014 12:42:47 +0200 Subject: [PATCH] Fixed a problem with byte switching This fixes an issue with byte switching. The preprocessor directive used to determine the endianess of the system only worked on Linux resulting in voice running over TCP only when umurmur runs on other platforms. Note, this patch could and should be implemented better but is working and should be regarded as a hotfix. --- src/crypt.c | 2 +- src/crypt.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/crypt.c b/src/crypt.c index ddf1f74..6eb87b4 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -220,7 +220,7 @@ bool_t CryptState_decrypt(cryptState_t *cs, const unsigned char *source, unsigne #define SHIFTBITS 63 typedef uint64_t subblock; -#if __BYTE_ORDER == __BIG_ENDIAN +#if CRYPT_BE #define SWAPPED(x) (x) #else #ifdef __x86_64__ diff --git a/src/crypt.h b/src/crypt.h index 292f196..300563e 100644 --- a/src/crypt.h +++ b/src/crypt.h @@ -31,6 +31,20 @@ #ifndef CRYPTSTATE_H_34564356 #define CRYPTSTATE_H_34564356 +#ifdef NETBSD +#include +#if BYTE_ORDER == BIG_ENDIAN +#define CRYPT_BE +#endif +#endif + +#ifdef LINUX +#include +#if __BYTE_ORDER == __BIG_ENDIAN +#define CRYPT_BE +#endif +#endif + #include "config.h" #ifdef USE_POLARSSL -- 2.30.2