aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-02-01 03:34:00 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2017-01-31 14:34:00 -0500
commita840aa27992685129e0954b6e30a974123dda136 (patch)
tree1f412bb5e6a4ffa821cac31a18f15201c6ae8c95
parentc7a2e72c6c1c36244ea8a82142570d69a78791ea (diff)
downloadcryptography-a840aa27992685129e0954b6e30a974123dda136.tar.gz
cryptography-a840aa27992685129e0954b6e30a974123dda136.tar.bz2
cryptography-a840aa27992685129e0954b6e30a974123dda136.zip
make cryptography fallback to /dev/urandom on mac on macOS < 10.12 (#3354)
-rw-r--r--src/_cffi_src/openssl/src/osrandom_engine.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/_cffi_src/openssl/src/osrandom_engine.h b/src/_cffi_src/openssl/src/osrandom_engine.h
index d28ebf39..5abe8fc0 100644
--- a/src/_cffi_src/openssl/src/osrandom_engine.h
+++ b/src/_cffi_src/openssl/src/osrandom_engine.h
@@ -13,6 +13,7 @@
#ifdef __APPLE__
#include <sys/random.h>
+ #include <AvailabilityMacros.h>
#endif
#ifdef __linux__
@@ -33,8 +34,11 @@
#if defined(_WIN32)
/* Windows */
#define CRYPTOGRAPHY_OSRANDOM_ENGINE CRYPTOGRAPHY_OSRANDOM_ENGINE_CRYPTGENRANDOM
- #elif defined(BSD) && defined(SYS_getentropy)
- /* OpenBSD 5.6+ or macOS 10.12+ */
+ #elif defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+ /* macOS 10.12+ */
+ #define CRYPTOGRAPHY_OSRANDOM_ENGINE CRYPTOGRAPHY_OSRANDOM_ENGINE_GETENTROPY
+ #elif defined(BSD) && defined(SYS_getentropy) && !defined(__APPLE__)
+ /* OpenBSD 5.6+ */
#define CRYPTOGRAPHY_OSRANDOM_ENGINE CRYPTOGRAPHY_OSRANDOM_ENGINE_GETENTROPY
#elif defined(__linux__) && defined(SYS_getrandom)
/* Linux 3.4.17+ */