aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tools
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-10-09 15:21:27 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-09 15:21:27 +0200
commitd65817ce05c874617e12e7c0bccc9ed39dcd9202 (patch)
tree0176071871ce44d7a2569412c9f211d5c827f0d4 /src/tools
parentglobal: give if statements brackets and other cleanups (diff)
downloadwireguard-monolithic-historical-d65817ce05c874617e12e7c0bccc9ed39dcd9202.tar.xz
wireguard-monolithic-historical-d65817ce05c874617e12e7c0bccc9ed39dcd9202.zip
tools: use libc's endianness macro if no compiler macro
This lets us be compiled with ancient gcc. Reported-by: Jeff Brandt <jeff@jeffcolo.net>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/curve25519.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tools/curve25519.c b/src/tools/curve25519.c
index 1852df5..c65b2ca 100644
--- a/src/tools/curve25519.c
+++ b/src/tools/curve25519.c
@@ -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;