Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1795)

Unified Diff: Source/wtf/CryptographicallyRandomNumber.cpp

Issue 15861022: Build WTF as dll in component build (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix AutoDrainedPool ctor and ThreadSpecificThreadExit exports Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/CryptographicallyRandomNumber.h ('k') | Source/wtf/CurrentTime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/CryptographicallyRandomNumber.cpp
diff --git a/Source/wtf/CryptographicallyRandomNumber.cpp b/Source/wtf/CryptographicallyRandomNumber.cpp
index fe445d6b0325f5a6ccbd6d8021df5d74f763bf9c..8b6e3b31f76328e42787fc022d049c43e7d7d29b 100644
--- a/Source/wtf/CryptographicallyRandomNumber.cpp
+++ b/Source/wtf/CryptographicallyRandomNumber.cpp
@@ -30,12 +30,18 @@
#include "config.h"
#include "CryptographicallyRandomNumber.h"
-#include "OSRandomSource.h"
#include "StdLibExtras.h"
#include "ThreadingPrimitives.h"
namespace WTF {
+static RandomNumberSource sourceFunction;
+
+void setRandomSource(RandomNumberSource source)
+{
+ sourceFunction = source;
+}
+
namespace {
class ARC4Stream {
@@ -97,7 +103,7 @@ void ARC4RandomNumberGenerator::stir()
{
unsigned char randomness[128];
size_t length = sizeof(randomness);
- cryptographicallyRandomValuesFromOS(randomness, length);
+ (*sourceFunction)(randomness, length);
addRandomData(randomness, length);
// Discard early keystream, as per recommendations in:
@@ -164,6 +170,7 @@ ARC4RandomNumberGenerator& sharedRandomNumberGenerator()
}
+
uint32_t cryptographicallyRandomNumber()
{
return sharedRandomNumberGenerator().randomNumber();
« no previous file with comments | « Source/wtf/CryptographicallyRandomNumber.h ('k') | Source/wtf/CurrentTime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698