forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose RAND_poll / RAND_add to user code via crypto module.
The purpose of this patch is to allow Node applications to add additional entropy to OpenSSL's pool. This is useful in environments where a running Node process can be cloned (e.g. VM snapshotting or live migration), resulting in a chance of the cloned process sharing an entropy pool with the original process. The new AddEntropy function works as follows: - If no parameters are passed, it calls RAND_poll. Performance was evaluated at about 140k ops/sec, but this will vary by OS and hardware. - If one parameter is passed, it is expected to be a buffer, which is passed to RAND_add. Performance was evaluated at about 1.8m ops/sec. The AddEntropy function is bound to crypto.addEntropy(). Usage: var crypto = require('crypto'); // Add entropy from system-supplied source crypto.addEntropy(); // Add entropy from a user-supplied source crypto.addEntropy(new Uint8Array([38, 4, 19, 22]));
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters