diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-06-14 04:18:15 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-06-14 05:25:23 +0200 |
commit | 6f85449d79bc4d8bd324852b012456eeaf47ec24 (patch) | |
tree | 7f409a317affc8ee836009dc079fa08a784ef600 /src/genkey.c | |
parent | wg: support getentropy(3) (diff) | |
download | wireguard-tools-6f85449d79bc4d8bd324852b012456eeaf47ec24.tar.xz wireguard-tools-6f85449d79bc4d8bd324852b012456eeaf47ec24.zip |
wg: getentropy requires 10.12
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/genkey.c')
-rw-r--r-- | src/genkey.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/genkey.c b/src/genkey.c index 04de2ba..d2d4c53 100644 --- a/src/genkey.c +++ b/src/genkey.c @@ -14,8 +14,14 @@ #include <sys/syscall.h> #endif #ifdef __APPLE__ +#include <AvailabilityMacros.h> +#ifndef MAC_OS_X_VERSION_10_12 +#define MAC_OS_X_VERSION_10_12 101200 +#endif +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12 #include <sys/random.h> #endif +#endif #include "curve25519.h" #include "encoding.h" @@ -26,7 +32,7 @@ static inline ssize_t get_random_bytes(uint8_t *out, size_t len) ssize_t ret; int fd; -#if defined(__OpenBSD__) || defined(__APPLE__) || (defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25))) +#if defined(__OpenBSD__) || (defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12) || (defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25))) ret = getentropy(out, len); if (!ret) return len; |