1818//! | iOS | [`SecRandomCopyBytes`][4]
1919//! | FreeBSD | [`getrandom()`][21] if available, otherwise [`kern.arandom`][5]
2020//! | OpenBSD | [`getentropy`][6]
21- //! | NetBSD | [`/dev/urandom `][7] after successfully polling `/dev/random`
21+ //! | NetBSD | [`kern.arandom `][7]
2222//! | Dragonfly BSD | [`/dev/random`][8]
2323//! | Solaris, illumos | [`getrandom`][9] system call if available, otherwise [`/dev/random`][10]
2424//! | Fuchsia OS | [`cprng_draw`][11]
2727//! | Haiku | `/dev/random` (identical to `/dev/urandom`)
2828//! | L4RE, SGX, UEFI | [RDRAND][18]
2929//! | Hermit | [RDRAND][18] as [`sys_rand`][22] is currently broken.
30- //! | Web browsers | [`Crypto.getRandomValues`][14] (see [Support for WebAssembly and ams.js][14])
31- //! | Node.js | [`crypto.randomBytes`][15] (see [Support for WebAssembly and ams.js][16])
30+ //! | VxWorks | `randABytes` after checking entropy pool initialization with `randSecure`
31+ //! | Web browsers | [`Crypto.getRandomValues`][14] (see [Support for WebAssembly and asm.js][16])
32+ //! | Node.js | [`crypto.randomBytes`][15] (see [Support for WebAssembly and asm.js][16])
3233//! | WASI | [`__wasi_random_get`][17]
3334//!
3435//! Getrandom doesn't have a blanket implementation for all Unix-like operating
8081//! A few, Linux, NetBSD and Solaris, offer a choice between blocking and
8182//! getting an error; in these cases we always choose to block.
8283//!
83- //! On Linux (when the `genrandom ` system call is not available) and on NetBSD
84+ //! On Linux (when the `getrandom ` system call is not available) and on NetBSD
8485//! reading from `/dev/urandom` never blocks, even when the OS hasn't collected
8586//! enough entropy yet. To avoid returning low-entropy bytes, we first read from
8687//! `/dev/random` and only switch to `/dev/urandom` once this has succeeded.
102103//! [4]: https://developer.apple.com/documentation/security/1399291-secrandomcopybytes?language=objc
103104//! [5]: https://www.freebsd.org/cgi/man.cgi?query=random&sektion=4
104105//! [6]: https://man.openbsd.org/getentropy.2
105- //! [7]: http ://netbsd.gw.com/cgi-bin/man-cgi?random+4 +NetBSD-current
106+ //! [7]: https ://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7 +NetBSD-8.0
106107//! [8]: https://leaf.dragonflybsd.org/cgi/web-man?command=random§ion=4
107108//! [9]: https://docs.oracle.com/cd/E88353_01/html/E37841/getrandom-2.html
108109//! [10]: https://docs.oracle.com/cd/E86824_01/html/E54777/random-7d.html
111112//! [13]: https://github.com/nuxinl/cloudabi#random_get
112113//! [14]: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues
113114//! [15]: https://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback
114- //! [16]: #support-for-webassembly-and-amsjs
115+ //! [16]: #support-for-webassembly-and-asmjs
115116//! [17]: https://github.com/WebAssembly/WASI/blob/master/design/WASI-core.md#__wasi_random_get
116117//! [18]: https://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide
117118//! [19]: https://www.unix.com/man-page/mojave/2/getentropy/
@@ -196,7 +197,7 @@ cfg_if! {
196197 } else if #[ cfg( target_os = "emscripten" ) ] {
197198 #[ path = "use_file.rs" ] mod imp;
198199 } else if #[ cfg( target_os = "freebsd" ) ] {
199- #[ path = "freebsd .rs" ] mod imp;
200+ #[ path = "bsd_arandom .rs" ] mod imp;
200201 } else if #[ cfg( target_os = "fuchsia" ) ] {
201202 #[ path = "fuchsia.rs" ] mod imp;
202203 } else if #[ cfg( target_os = "haiku" ) ] {
@@ -210,7 +211,7 @@ cfg_if! {
210211 } else if #[ cfg( target_os = "macos" ) ] {
211212 #[ path = "macos.rs" ] mod imp;
212213 } else if #[ cfg( target_os = "netbsd" ) ] {
213- #[ path = "use_file .rs" ] mod imp;
214+ #[ path = "bsd_arandom .rs" ] mod imp;
214215 } else if #[ cfg( target_os = "openbsd" ) ] {
215216 #[ path = "openbsd.rs" ] mod imp;
216217 } else if #[ cfg( target_os = "redox" ) ] {
@@ -219,6 +220,8 @@ cfg_if! {
219220 #[ path = "solaris_illumos.rs" ] mod imp;
220221 } else if #[ cfg( target_os = "wasi" ) ] {
221222 #[ path = "wasi.rs" ] mod imp;
223+ } else if #[ cfg( target_os = "vxworks" ) ] {
224+ #[ path = "vxworks.rs" ] mod imp;
222225 } else if #[ cfg( all( windows, getrandom_uwp) ) ] {
223226 #[ path = "windows_uwp.rs" ] mod imp;
224227 } else if #[ cfg( windows) ] {
0 commit comments