|
25 | 25 | //! | Redox | [`rand:`][12]
|
26 | 26 | //! | CloudABI | [`cloudabi_sys_random_get`][13]
|
27 | 27 | //! | Haiku | `/dev/random` (identical to `/dev/urandom`)
|
28 |
| -//! | SGX, UEFI | [RDRAND][18] |
| 28 | +//! | L4RE, SGX, UEFI | [RDRAND][18] |
| 29 | +//! | Hermit | [RDRAND][18] as [`sys_rand`][22] is currently broken. |
29 | 30 | //! | Web browsers | [`Crypto.getRandomValues`][14] (see [Support for WebAssembly and ams.js][14])
|
30 | 31 | //! | Node.js | [`crypto.randomBytes`][15] (see [Support for WebAssembly and ams.js][16])
|
31 | 32 | //! | WASI | [`__wasi_random_get`][17]
|
|
119 | 120 | //! [19]: https://www.unix.com/man-page/mojave/2/getentropy/
|
120 | 121 | //! [20]: https://www.unix.com/man-page/mojave/4/random/
|
121 | 122 | //! [21]: https://www.freebsd.org/cgi/man.cgi?query=getrandom&manpath=FreeBSD+12.0-stable
|
| 123 | +//! [22]: https://github.com/hermitcore/libhermit-rs/blob/09c38b0371cee6f56a541400ba453e319e43db53/src/syscalls/random.rs#L21 |
122 | 124 |
|
123 | 125 | #![doc(
|
124 | 126 | html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
|
@@ -152,12 +154,39 @@ pub use crate::error::Error;
|
152 | 154 |
|
153 | 155 | #[allow(dead_code)]
|
154 | 156 | mod util;
|
155 |
| -#[cfg(any(unix, target_os = "redox"))] |
| 157 | +#[cfg(any( |
| 158 | + target_os = "android", |
| 159 | + target_os = "dragonfly", |
| 160 | + target_os = "emscripten", |
| 161 | + target_os = "freebsd", |
| 162 | + target_os = "haiku", |
| 163 | + target_os = "illumos", |
| 164 | + target_os = "linux", |
| 165 | + target_os = "macos", |
| 166 | + target_os = "netbsd", |
| 167 | + target_os = "openbsd", |
| 168 | + target_os = "redox", |
| 169 | + target_os = "solaris", |
| 170 | +))] |
156 | 171 | #[allow(dead_code)]
|
157 | 172 | mod util_libc;
|
158 | 173 |
|
159 | 174 | // std-only trait definitions (also need for use_file)
|
160 |
| -#[cfg(any(feature = "std", unix, target_os = "redox"))] |
| 175 | +#[cfg(any( |
| 176 | + feature = "std", |
| 177 | + target_os = "android", |
| 178 | + target_os = "dragonfly", |
| 179 | + target_os = "emscripten", |
| 180 | + target_os = "freebsd", |
| 181 | + target_os = "haiku", |
| 182 | + target_os = "illumos", |
| 183 | + target_os = "linux", |
| 184 | + target_os = "macos", |
| 185 | + target_os = "netbsd", |
| 186 | + target_os = "openbsd", |
| 187 | + target_os = "redox", |
| 188 | + target_os = "solaris", |
| 189 | +))] |
161 | 190 | mod error_impls;
|
162 | 191 |
|
163 | 192 | // These targets read from a file as a fallback method.
|
@@ -209,9 +238,12 @@ cfg_if! {
|
209 | 238 | #[path = "wasi.rs"] mod imp;
|
210 | 239 | } else if #[cfg(windows)] {
|
211 | 240 | #[path = "windows.rs"] mod imp;
|
212 |
| - } else if #[cfg(target_env = "sgx")] { |
213 |
| - #[path = "rdrand.rs"] mod imp; |
214 |
| - } else if #[cfg(all(target_arch = "x86_64", target_os = "uefi"))] { |
| 241 | + } else if #[cfg(all(target_arch = "x86_64", any( |
| 242 | + target_os = "hermit", |
| 243 | + target_os = "l4re", |
| 244 | + target_os = "uefi", |
| 245 | + target_env = "sgx", |
| 246 | + )))] { |
215 | 247 | #[path = "rdrand.rs"] mod imp;
|
216 | 248 | } else if #[cfg(target_arch = "wasm32")] {
|
217 | 249 | cfg_if! {
|
|
0 commit comments