summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webkitclient_impl.cc
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-23 23:39:50 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-23 23:39:50 +0000
commit7904d87a83cf58c83801e4d22b50ec0dbf1e0aea (patch)
tree8a8cd8de9d9f4a2005b2129fc59433c37d7cbf0c /webkit/glue/webkitclient_impl.cc
parentdc83fcbdc33081df9c30fd74c1d3395e32d5b0c5 (diff)
downloadchromium_src-7904d87a83cf58c83801e4d22b50ec0dbf1e0aea.zip
chromium_src-7904d87a83cf58c83801e4d22b50ec0dbf1e0aea.tar.gz
chromium_src-7904d87a83cf58c83801e4d22b50ec0dbf1e0aea.tar.bz2
Implement cryptographicallyRandomValues to let WebKit have some
cryptographically strong random values inside the sandbox. Review URL: http://codereview.chromium.org/6581007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75815 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webkitclient_impl.cc')
-rw-r--r--webkit/glue/webkitclient_impl.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index 701d5c3..3a47de4 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -14,10 +14,11 @@
#include "base/debug/trace_event.h"
#include "base/message_loop.h"
-#include "base/metrics/stats_counters.h"
#include "base/metrics/histogram.h"
-#include "base/process_util.h"
+#include "base/metrics/stats_counters.h"
#include "base/platform_file.h"
+#include "base/process_util.h"
+#include "base/rand_util.h"
#include "base/singleton.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
@@ -445,6 +446,17 @@ double WebKitClientImpl::currentTime() {
return base::Time::Now().ToDoubleT();
}
+void WebKitClientImpl::cryptographicallyRandomValues(
+ unsigned char* buffer, size_t length) {
+ uint64 bytes = 0;
+ for (size_t i = 0; i < length; ++i) {
+ size_t offset = i % sizeof(bytes);
+ if (!offset)
+ bytes = base::RandUint64();
+ buffer[i] = reinterpret_cast<unsigned char*>(&bytes)[offset];
+ }
+}
+
void WebKitClientImpl::setSharedTimerFiredFunction(void (*func)()) {
shared_timer_func_ = func;
}