Fixed a problem with byte switching
authorFelix Morgner <felix.morgner@gmail.com>
Thu, 24 Apr 2014 10:42:47 +0000 (12:42 +0200)
committerFelix Morgner <felix.morgner@gmail.com>
Thu, 24 Apr 2014 10:42:47 +0000 (12:42 +0200)
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
src/crypt.h

index ddf1f74af93dc9eff77e922e116555860aefbd79..6eb87b41260511adfbabe77ab9fa1f8fbb3f7be5 100644 (file)
@@ -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__
index 292f196f6d72493e7fa38fe17c1cf726c2182308..300563e0aa5064f5ec91bacb9db07ddd58f5eb8e 100644 (file)
 #ifndef CRYPTSTATE_H_34564356
 #define CRYPTSTATE_H_34564356
 
+#ifdef NETBSD
+#include <machine/endian.h>
+#if BYTE_ORDER == BIG_ENDIAN
+#define CRYPT_BE
+#endif
+#endif
+
+#ifdef LINUX
+#include <endian.h>
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define CRYPT_BE
+#endif
+#endif
+
 #include "config.h"
 
 #ifdef USE_POLARSSL