Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 9756874f6978bb229a0980454a120d8deb75a62c..e3cde52e168f4cc7a7d512945413eb121499fb2e 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -5175,6 +5175,13 @@ bool v8::V8::Initialize() { |
void v8::V8::SetEntropySource(EntropySource entropy_source) { |
+ // The entropy source must be set before the library is initialized, |
+ // as otherwise not all random number generators will pick up the |
+ // entropy source and will fall back to weak entropy instead. |
+ i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
Michael Starzinger
2013/09/23 14:51:31
We try to get rid of Isolate::Current, please try
Benedikt Meurer
2013/09/23 20:25:51
I know, but there's currently no other way to perf
|
+ ApiCheck(isolate != NULL && isolate->IsInitialized(), |
+ "v8::V8::SetEntropySource", |
+ "Cannot set entropy source once V8 is initialized."); |
i::RandomNumberGenerator::SetEntropySource(entropy_source); |
} |