Revision: 16888
Author: [email protected]
Date: Mon Sep 23 14:10:57 2013 UTC
Log: Document that its the job of the embedder to provide strong
entropy for seeding the PRNG.
BUG=v8:2905
[email protected]
Review URL: https://codereview.chromium.org/23965009
http://code.google.com/p/v8/source/detail?r=16888
Modified:
/branches/bleeding_edge/src/utils/random-number-generator.cc
/branches/bleeding_edge/src/utils/random-number-generator.h
=======================================
--- /branches/bleeding_edge/src/utils/random-number-generator.cc Tue Sep 10
11:13:55 2013 UTC
+++ /branches/bleeding_edge/src/utils/random-number-generator.cc Mon Sep 23
14:10:57 2013 UTC
@@ -82,6 +82,11 @@
// 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;
=======================================
--- /branches/bleeding_edge/src/utils/random-number-generator.h Thu Sep 12
08:57:10 2013 UTC
+++ /branches/bleeding_edge/src/utils/random-number-generator.h Mon Sep 23
14:10:57 2013 UTC
@@ -42,6 +42,10 @@
// If two instances of RandomNumberGenerator are created with the same
seed, and
// the same sequence of method calls is made for each, they will generate
and
// return identical sequences of numbers.
+// This class uses (probably) weak entropy by default, 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
// This class is neither reentrant nor threadsafe.
class RandomNumberGenerator V8_FINAL {
--
--
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.