From: Jason A. Donenfeld Date: Tue, 9 Oct 2018 13:21:27 +0000 (+0200) Subject: wg: use libc's endianness macro if no compiler macro X-Git-Tag: v1.0.20191226~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c1ca487f634c3fb382fcc5b65fdd8efa4dfdbe69;p=thirdparty%2Fwireguard-tools.git wg: use libc's endianness macro if no compiler macro This lets us be compiled with ancient gcc. Reported-by: Jeff Brandt Signed-off-by: Jason A. Donenfeld --- diff --git a/src/curve25519.c b/src/curve25519.c index 1852df5..c65b2ca 100644 --- a/src/curve25519.c +++ b/src/curve25519.c @@ -8,6 +8,16 @@ #include #include +#ifndef __BYTE_ORDER__ +#include +#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 typedef __u64 u64;