Solaris: consistantly use /dev/random source #310
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Solaris, we opt to use
/dev/random
instead of/dev/urandom
due to reasons explained in the comments and in this Solaris blog post.However, we haven't been making the same choice when getting randomness via the
getrandom(2)
function, as we just pass0
for the flags. We used to always setGRND_RANDOM
, but that was removed in the move fromOsRng
to this crate.For context, rust-random/rand#730, #9, and #51 are the major changes to the Solaris/Illumos implementation over the years.
See the solaris documentation for:
getrandom(2)
urandom(4)
I also updated the doucmentation to better reflect when Illumos added the
getrandom(2)
function.Finally, a question. #51 removed chunking for the fallback implementation that reads from
/dev/random
, should we add it back?Signed-off-by: Joe Richey joerichey@google.com