Title: [190767] branches/safari-601-branch/Source/WTF
Revision
190767
Author
[email protected]
Date
2015-10-08 18:50:16 -0700 (Thu, 08 Oct 2015)

Log Message

Merged r188489.  rdar://problem/22824646

Modified Paths

Diff

Modified: branches/safari-601-branch/Source/WTF/ChangeLog (190766 => 190767)


--- branches/safari-601-branch/Source/WTF/ChangeLog	2015-10-09 01:33:05 UTC (rev 190766)
+++ branches/safari-601-branch/Source/WTF/ChangeLog	2015-10-09 01:50:16 UTC (rev 190767)
@@ -1,3 +1,20 @@
+2015-10-08  Lucas Forschler  <[email protected]>
+
+        Merge r188489
+
+    2015-08-14  Keith Miller  <[email protected]>
+
+            cryptographicallyRandomValuesFromOS should use arc4random_buf on Darwin.
+            https://bugs.webkit.org/show_bug.cgi?id=148038
+
+            Reviewed by Geoffrey Garen.
+
+            Currently, we open a file descriptor to /dev/urandom, which can sometimes
+            fail to open. Using arc4random_buf instead should get around this issue.
+
+            * wtf/OSRandomSource.cpp:
+            (WTF::cryptographicallyRandomValuesFromOS):
+
 2015-07-23  Lucas Forschler  <[email protected]>
 
         Merge r187129

Modified: branches/safari-601-branch/Source/WTF/wtf/OSRandomSource.cpp (190766 => 190767)


--- branches/safari-601-branch/Source/WTF/wtf/OSRandomSource.cpp	2015-10-09 01:33:05 UTC (rev 190766)
+++ branches/safari-601-branch/Source/WTF/wtf/OSRandomSource.cpp	2015-10-09 01:50:16 UTC (rev 190767)
@@ -29,7 +29,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 
-#if OS(UNIX)
+#if !OS(DARWIN) && OS(UNIX)
 #include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
@@ -42,6 +42,7 @@
 
 namespace WTF {
 
+#if !OS(DARWIN) && OS(UNIX)
 NEVER_INLINE NO_RETURN_DUE_TO_CRASH static void crashUnableToOpenURandom()
 {
     CRASH();
@@ -51,10 +52,13 @@
 {
     CRASH();
 }
+#endif
     
 void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length)
 {
-#if OS(UNIX)
+#if OS(DARWIN)
+    return arc4random_buf(buffer, length);
+#elif OS(UNIX)
     int fd = open("/dev/urandom", O_RDONLY, 0);
     if (fd < 0)
         crashUnableToOpenURandom(); // We need /dev/urandom for this API to work...
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to