DescriptionRemove blink's use of RC4 for random value generation.
This re-implements Blink's random number generator (wtf::cryptographicallyRandomValues) in terms of calling crypto::RandomBytes() directly, rather than using an ARC4 keystream that periodically stirs in system randomness.
Reason: RC4 (ARC4) has known weaknesses and has already been disabled as an accepted TLS cipher for Chrome M48. It should not be used internally for generating random numbers in Blink.
The way cryptographically random number generation worked in Blink prior to this patch is that wtf::cryptographicallyRandomValues() would generate random bytes using an ARC4 keystream. Every 1.6MB of generated data it would stir in randomness obtained via Platform::current()->cryptographicallyRandomValues().
The way it works after this patchset is that wtf::cryptographicallyRandomValues() directly calls Platform::current()->cryptographicallyRandomValues(), without layering on its own PRNG. The concrete implementation of Platform::cryptographicallyRandomValues() now calls crypto::RandBytes() [1], which provides good cryptographically secure random numbers by reading from hardware/system randomness sources.
The consequences of this change are:
* The fixed sequence of random numbers seen by certain tests will have changed. I haven't observed this to be a problem with any of the tests though.
* The performance characteristics of cryptographicallyRandomValues() have changed, for the worse. Measured using a microbenchmark, window.crypto.getRandomValues() is almost 5x slower now. This is not all that surprising since RC4 was pretty fast, and was only mixing in system randomness every 1.6MB (my test generated 256MB).
[1] Technically it is calling base::RandBytes(), but under the hood that calls crypto::RandBytes(). Will fix that dependency separately.
BUG=552749
Committed: https://crrev.com/9224aa4826d29930a8194a58dfd7170411bfc672
Cr-Commit-Position: refs/heads/master@{#358803}
Patch Set 1 #
Total comments: 4
Patch Set 2 : Address David's comments #Patch Set 3 : Undo the base::RandBytes() --> crypto::RandBytes() change (moved to another CL) #
Total comments: 2
Patch Set 4 : Remove unused header #Patch Set 5 : rebase and reparent branch to origin/master #Messages
Total messages: 20 (9 generated)
|