| 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();
|
|
|