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

Unified Diff: src/api.cc

Issue 24357002: Let SetEntropySource() fail if called after V8::Initialize(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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
« include/v8.h ('K') | « include/v8.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 415bd41bb19496036f3bda9a6c78ac55ec033ecd..5e9cd65d2c206bda763ddf8ce84cb9b238088d7f 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -5181,8 +5181,16 @@ bool v8::V8::Initialize() {
}
-void v8::V8::SetEntropySource(EntropySource entropy_source) {
+bool 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();
+ if (isolate != NULL && isolate->IsInitialized())
Dmitry Lomov (no reviews) 2013/09/23 11:24:15 Looks like this should be isolate == NULL || !isol
Dmitry Lomov (no reviews) 2013/09/23 11:25:54 Nevermind.
+ return false;
Dmitry Lomov (no reviews) 2013/09/23 11:24:15 I think just returning false will be ignored (also
Benedikt Meurer 2013/09/23 11:36:41 Done.
+
i::RandomNumberGenerator::SetEntropySource(entropy_source);
+ return true;
}
« include/v8.h ('K') | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698