34 lines
1.0 KiB
Diff
34 lines
1.0 KiB
Diff
|
https://bugs.webkit.org/show_bug.cgi?id=157554
|
||
|
|
||
|
--- a/Source/WTF/wtf/OSRandomSource.cpp
|
||
|
+++ b/Source/WTF/wtf/OSRandomSource.cpp
|
||
|
@@ -29,7 +29,7 @@
|
||
|
#include <stdint.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
-#if !OS(DARWIN) && OS(UNIX)
|
||
|
+#if OS(UNIX) && !(OS(DARWIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
|
||
|
#include <errno.h>
|
||
|
#include <fcntl.h>
|
||
|
#include <unistd.h>
|
||
|
@@ -46,7 +46,7 @@
|
||
|
|
||
|
namespace WTF {
|
||
|
|
||
|
-#if !OS(DARWIN) && OS(UNIX)
|
||
|
+#if OS(UNIX) && !(OS(DARWIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
|
||
|
NEVER_INLINE NO_RETURN_DUE_TO_CRASH static void crashUnableToOpenURandom()
|
||
|
{
|
||
|
CRASH();
|
||
|
@@ -60,8 +56,8 @@ NEVER_INLINE NO_RETURN_DUE_TO_CRASH static void crashUnableToReadFromURandom()
|
||
|
|
||
|
void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length)
|
||
|
{
|
||
|
-#if OS(DARWIN)
|
||
|
- RELEASE_ASSERT(!CCRandomCopyBytes(kCCRandomDefault, buffer, length));
|
||
|
+#if OS(DARWIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
|
||
|
+ return arc4random_buf(buffer, length);
|
||
|
#elif OS(UNIX)
|
||
|
int fd = open("/dev/urandom", O_RDONLY, 0);
|
||
|
if (fd < 0)
|