Repository navigation
std: Update randomness implementation on Windows - #45370
Merged
Merged
Conversation
Contributor
|
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
This commit updates the OS random number generator on Windows to match the upstream implementation in the `rand` crate. First proposed in rust-random/rand#111 this implementation uses a "private" API of `RtlGenRandom`. Despite the [documentation][dox] indicating this is a private function its widespread use in Chromium and Firefox as well as [comments] from Microsoft internally indicates that it's highly unlikely to break. Another motivation for switching this is to also attempt to make progress on rust-lang#44911. It may be the case that this function succeeds while the previous implementation may fail in "weird" scenarios. [dox]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa387694(v=vs.85).aspx [comments]: rust-random/rand#111 (comment)
alexcrichton
force-pushed
the
update-windows-rand
branch
from
October 18, 2017 18:48
3ae9f82 to
55c0173
Compare
sfackler
reviewed
Oct 18, 2017
| exceptfds: *mut fd_set, | ||
| timeout: *const timeval) -> c_int; | ||
|
|
||
| #[link_name = "SystemFunction036"] |
Member
There was a problem hiding this comment.
Oh of course, SystemFunction036 😨
Contributor
There was a problem hiding this comment.
um\NTSecAPI.h
#define RtlGenRandom SystemFunction036
Member
There was a problem hiding this comment.
Could you add a comment about why its used.
Member
|
@bors r+ |
Collaborator
|
📌 Commit 55c0173 has been approved by |
Collaborator
bors
added a commit
that referenced
this pull request
Oct 21, 2017
std: Update randomness implementation on Windows This commit updates the OS random number generator on Windows to match the upstream implementation in the `rand` crate. First proposed in rust-random/rand#111 this implementation uses a "private" API of `RtlGenRandom`. Despite the [documentation][dox] indicating this is a private function its widespread use in Chromium and Firefox as well as [comments] from Microsoft internally indicates that it's highly unlikely to break. Another motivation for switching this is to also attempt to make progress on #44911. It may be the case that this function succeeds while the previous implementation may fail in "weird" scenarios. [dox]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa387694(v=vs.85).aspx [comments]: rust-random/rand#111 (comment)
Collaborator
|
☀️ Test successful - status-appveyor, status-travis |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit updates the OS random number generator on Windows to match the
upstream implementation in the
randcrate. First proposed inrust-random/rand#111 this implementation uses a "private" API of
RtlGenRandom. Despite the documentation indicating this is a privatefunction its widespread use in Chromium and Firefox as well as comments from
Microsoft internally indicates that it's highly unlikely to break.
Another motivation for switching this is to also attempt to make progress
on #44911. It may be the case that this function succeeds while the previous
implementation may fail in "weird" scenarios.