[WTF] Introduce WTF::RandomDevice which keeps /dev/urandom opened
[WebKit-https.git] / Source / WTF / ChangeLog
index d0a6c52..330259f 100644 (file)
@@ -1,3 +1,33 @@
+2017-04-03  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        [WTF] Introduce WTF::RandomDevice which keeps /dev/urandom opened
+        https://bugs.webkit.org/show_bug.cgi?id=170095
+
+        Reviewed by Michael Catanzaro.
+
+        In this patch, we introduce RandomDevice, which keeps /dev/urandom opened
+        to avoid repeatedly open and close urandom file descriptor in Linux.
+
+        The purpose is similar to std::random_device, but WTF::RandomDevice explicitly
+        avoids using ARC4, which is recently attempted to be removed from the WebKit
+        tree[1].
+
+        [1]: https://trac.webkit.org/r214329
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/OSRandomSource.cpp:
+        (WTF::cryptographicallyRandomValuesFromOS):
+        (WTF::crashUnableToOpenURandom): Deleted.
+        (WTF::crashUnableToReadFromURandom): Deleted.
+        * wtf/RandomDevice.cpp: Copied from Source/WTF/wtf/OSRandomSource.cpp.
+        (WTF::crashUnableToOpenURandom):
+        (WTF::crashUnableToReadFromURandom):
+        (WTF::RandomDevice::RandomDevice):
+        (WTF::RandomDevice::~RandomDevice):
+        (WTF::RandomDevice::cryptographicallyRandomValues):
+        * wtf/RandomDevice.h: Added.
+
 2017-04-03  Filip Pizlo  <fpizlo@apple.com>
 
         WTF::Liveness should have an API that focuses on actions at instruction boundaries