Reviewers: Dmitry Lomov (chromium),

Message:
Hey Dmitry,
Here's the comment as discussed offline. PTAL
-- Benedikt

Description:
Document that its the job of the embedder to provide strong entropy for seeding
the PRNG.

BUG=v8:2905

Please review this at https://codereview.chromium.org/23965009/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+5, -0 lines):
  M src/utils/random-number-generator.cc


Index: src/utils/random-number-generator.cc
diff --git a/src/utils/random-number-generator.cc b/src/utils/random-number-generator.cc index 1e03ee24499208b1791d2c525088a07761b58a9e..df2dbec687763b6ca0608d28f17592f6a362a27d 100644
--- a/src/utils/random-number-generator.cc
+++ b/src/utils/random-number-generator.cc
@@ -82,6 +82,11 @@ RandomNumberGenerator::RandomNumberGenerator() {
   // We cannot assume that random() or rand() were seeded
   // properly, so instead of relying on random() or rand(),
   // we just seed our PRNG using timing data as fallback.
+  // This is weak entropy, but it's sufficient, because
+  // it is the responsibility of the embedder to install
+  // an entropy source using V8::V8::SetEntropySource(),
+  // which provides reasonable entropy, see:
+  // https://code.google.com/p/v8/issues/detail?id=2905
   int64_t seed = Time::NowFromSystemTime().ToInternalValue() << 24;
   seed ^= TimeTicks::HighResNow().ToInternalValue() << 16;
   seed ^= TimeTicks::Now().ToInternalValue() << 8;


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to