From c1ca487f634c3fb382fcc5b65fdd8efa4dfdbe69 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 9 Oct 2018 15:21:27 +0200 Subject: [PATCH] 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 --- src/curve25519.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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;