Title: [91613] trunk/Source/WebKit/chromium
Revision
91613
Author
c...@chromium.org
Date
2011-07-22 15:42:51 -0700 (Fri, 22 Jul 2011)

Log Message

Hook v8 up to cryptographicallyRandomValues as an entropy source.
https://bugs.webkit.org/show_bug.cgi?id=64887

Reviewed by Adam Barth.

* public/WebKitClient.h:
* src/WebKit.cpp:
(WebKit::generateEntropy):
(WebKit::initialize):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (91612 => 91613)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-07-22 22:31:48 UTC (rev 91612)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-07-22 22:42:51 UTC (rev 91613)
@@ -1,3 +1,15 @@
+2011-07-22  Cris Neckar  <c...@chromium.org>
+
+        Hook v8 up to cryptographicallyRandomValues as an entropy source.
+        https://bugs.webkit.org/show_bug.cgi?id=64887
+
+        Reviewed by Adam Barth.
+
+        * public/WebKitClient.h:
+        * src/WebKit.cpp:
+        (WebKit::generateEntropy):
+        (WebKit::initialize):
+
 2011-07-22  Andrew Scherkus  <scher...@chromium.org>
 
         Remove surfaceType() and texture() methods from Chromium video frame classes.

Modified: trunk/Source/WebKit/chromium/public/WebKitClient.h (91612 => 91613)


--- trunk/Source/WebKit/chromium/public/WebKitClient.h	2011-07-22 22:31:48 UTC (rev 91612)
+++ trunk/Source/WebKit/chromium/public/WebKitClient.h	2011-07-22 22:42:51 UTC (rev 91613)
@@ -274,11 +274,8 @@
     // it is recommended that the fixed point be no further in the past than the epoch.
     virtual double monotonicallyIncreasingTime() { return 0; }
 
-    virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length)
-    {
-        // WebKit clients must implement this funcion if they use cryptographic randomness.
-        WEBKIT_ASSERT_NOT_REACHED();
-    }
+    // WebKit clients must implement this funcion if they use cryptographic randomness.
+    virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) = 0;
 
     // Delayed work is driven by a shared timer.
     typedef void (*SharedTimerFunction)();

Modified: trunk/Source/WebKit/chromium/src/WebKit.cpp (91612 => 91613)


--- trunk/Source/WebKit/chromium/src/WebKit.cpp	2011-07-22 22:31:48 UTC (rev 91612)
+++ trunk/Source/WebKit/chromium/src/WebKit.cpp	2011-07-22 22:42:51 UTC (rev 91613)
@@ -37,6 +37,7 @@
 #include "Settings.h"
 #include "TextEncoding.h"
 #include "V8Binding.h"
+#include "WebKitClient.h"
 #include "WebMediaPlayerClientImpl.h"
 #include "WebSocket.h"
 #include "WorkerContextExecutionProxy.h"
@@ -55,6 +56,15 @@
 static WebKitClient* s_webKitClient = 0;
 static bool s_layoutTestMode = false;
 
+static bool generateEntropy(unsigned char* buffer, size_t length)
+{
+    if (s_webKitClient) {
+        s_webKitClient->cryptographicallyRandomValues(buffer, length);
+        return true;
+    }
+    return false;
+}
+
 void initialize(WebKitClient* webKitClient)
 {
     ASSERT(!s_webKitInitialized);
@@ -77,6 +87,7 @@
     // this, initializing this lazily probably doesn't buy us much.
     WebCore::UTF8Encoding();
 
+    v8::V8::SetEntropySource(&generateEntropy);
     v8::V8::Initialize();
     WebCore::V8BindingPerIsolateData::ensureInitialized(v8::Isolate::GetCurrent());
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to