-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD. #66092
Conversation
This system call is present on all supported NetBSD versions and provides an endless stream of non-blocking random data from the kernel's ChaCha20-based CSPRNG. It doesn't require a file descriptor to be opened. The system call is documented here (under kern.arandom): https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0 And defined here: https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273 The semantics are the same as FreeBSD so reading 256 bytes per call is fine. Similar change for getrandom crate: rust-random/getrandom#115
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors r+ |
📌 Commit b4f92ea has been approved by |
Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD. This system call is present on all supported NetBSD versions and provides an endless stream of non-blocking random data from the kernel's ChaCha20-based CSPRNG. It doesn't require a file like `/dev/urandom` to be opened. The system call is documented here (under kern.arandom): https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0 And defined here: https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273 The semantics are the same as FreeBSD so reading 256 bytes per call is fine. Similar change for getrandom crate: rust-random/getrandom#115
Rollup of 9 pull requests Successful merges: - #65776 (Rename `LocalInternedString` and more) - #65973 (caller_location: point to macro invocation sites, like file!/line!, and use in core::panic!.) - #66015 (librustc_lexer: Refactor the module) - #66062 (Configure LLVM module PIC level) - #66086 (bump smallvec to 1.0) - #66092 (Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD.) - #66103 (Add target thumbv7neon-unknown-linux-musleabihf) - #66133 (Update the bundled `wasi-libc` repository) - #66139 (use American spelling for `pluralize!`) Failed merges: r? @ghost
This system call is present on all supported NetBSD versions and provides an endless stream of non-blocking random data from the kernel's ChaCha20-based CSPRNG. It doesn't require a file like
/dev/urandom
to be opened.The system call is documented here (under kern.arandom):
https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0
And defined here:
https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273
The semantics are the same as FreeBSD so reading 256 bytes per call is fine.
Similar change for getrandom crate: rust-random/getrandom#115