at 18.03-beta 33 lines 1.1 kB view raw
1https://bugs.webkit.org/show_bug.cgi?id=157554 2 3--- a/Source/WTF/wtf/OSRandomSource.cpp 4+++ b/Source/WTF/wtf/OSRandomSource.cpp 5@@ -29,7 +29,7 @@ 6 #include <stdint.h> 7 #include <stdlib.h> 8 9-#if !OS(DARWIN) && OS(UNIX) 10+#if OS(UNIX) && !(OS(DARWIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) 11 #include <errno.h> 12 #include <fcntl.h> 13 #include <unistd.h> 14@@ -46,7 +46,7 @@ 15 16 namespace WTF { 17 18-#if !OS(DARWIN) && OS(UNIX) 19+#if OS(UNIX) && !(OS(DARWIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) 20 NEVER_INLINE NO_RETURN_DUE_TO_CRASH static void crashUnableToOpenURandom() 21 { 22 CRASH(); 23@@ -60,8 +56,8 @@ NEVER_INLINE NO_RETURN_DUE_TO_CRASH static void crashUnableToReadFromURandom() 24 25 void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length) 26 { 27-#if OS(DARWIN) 28- RELEASE_ASSERT(!CCRandomCopyBytes(kCCRandomDefault, buffer, length)); 29+#if OS(DARWIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 30+ return arc4random_buf(buffer, length); 31 #elif OS(UNIX) 32 int fd = open("/dev/urandom", O_RDONLY, 0); 33 if (fd < 0)