]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg: use libc's endianness macro if no compiler macro
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 9 Oct 2018 13:21:27 +0000 (15:21 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 9 Oct 2018 13:21:27 +0000 (15:21 +0200)
This lets us be compiled with ancient gcc.

Reported-by: Jeff Brandt <jeff@jeffcolo.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/curve25519.c

index 1852df58094e7dea9203dbefd4f1e34f0985c6db..c65b2caf07488136ab6be57d753f7892be431b9f 100644 (file)
@@ -8,6 +8,16 @@
 #include <stdint.h>
 #include <string.h>
 
+#ifndef __BYTE_ORDER__
+#include <sys/param.h>
+#if !defined(BYTE_ORDER) || !defined(BIG_ENDIAN) || !defined(LITTLE_ENDIAN)
+#error "Unable to determine endianness."
+#endif
+#define __BYTE_ORDER__ BYTE_ORDER
+#define __ORDER_BIG_ENDIAN__ BIG_ENDIAN
+#define __ORDER_LITTLE_ENDIAN__ LITTLE_ENDIAN
+#endif
+
 #ifdef __linux__
 #include <linux/types.h>
 typedef __u64 u64;