|
28 | 28 | //! | SGX | `x86_64‑*‑sgx` | [`RDRAND`] |
29 | 29 | //! | VxWorks | `*‑wrs‑vxworks‑*` | `randABytes` after checking entropy pool initialization with `randSecure` |
30 | 30 | //! | ESP-IDF | `*‑espidf` | [`esp_fill_random`] |
31 | | -//! | Emscripten | `*‑emscripten` | `/dev/urandom` (identical to `/dev/random`) |
| 31 | +//! | Emscripten | `*‑emscripten` | [`getentropy`][13] |
32 | 32 | //! | WASI | `wasm32‑wasi` | [`random_get`] |
33 | 33 | //! | Web Browser and Node.js | `wasm*‑*‑unknown` | [`Crypto.getRandomValues`] if available, then [`crypto.randomFillSync`] if on Node.js, see [WebAssembly support] |
34 | 34 | //! | SOLID | `*-kmc-solid_*` | `SOLID_RNG_SampleRandomBytes` |
|
159 | 159 | //! [10]: https://leaf.dragonflybsd.org/cgi/web-man?command=random§ion=4 |
160 | 160 | //! [11]: https://docs.oracle.com/cd/E88353_01/html/E37841/getrandom-2.html |
161 | 161 | //! [12]: https://docs.oracle.com/cd/E86824_01/html/E54777/random-7d.html |
| 162 | +//! [13]: https://github.com/emscripten-core/emscripten/pull/12240 |
162 | 163 | //! |
163 | 164 | //! [`BCryptGenRandom`]: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom |
164 | 165 | //! [`Crypto.getRandomValues`]: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues |
@@ -208,8 +209,7 @@ pub use crate::error::Error; |
208 | 209 | // The function MUST NOT ever write uninitialized bytes into `dest`, |
209 | 210 | // regardless of what value it returns. |
210 | 211 | cfg_if! { |
211 | | - if #[cfg(any(target_os = "emscripten", target_os = "haiku", |
212 | | - target_os = "redox"))] { |
| 212 | + if #[cfg(any(target_os = "haiku", target_os = "redox"))] { |
213 | 213 | mod util_libc; |
214 | 214 | #[path = "use_file.rs"] mod imp; |
215 | 215 | } else if #[cfg(any(target_os = "android", target_os = "linux"))] { |
@@ -256,6 +256,9 @@ cfg_if! { |
256 | 256 | // uses Horizon OS (it is aarch64). |
257 | 257 | mod util_libc; |
258 | 258 | #[path = "3ds.rs"] mod imp; |
| 259 | + } else if #[cfg(target_os = "emscripten")] { |
| 260 | + mod util_libc; |
| 261 | + #[path = "emscripten.rs"] mod imp; |
259 | 262 | } else if #[cfg(all(target_arch = "x86_64", target_env = "sgx"))] { |
260 | 263 | #[path = "rdrand.rs"] mod imp; |
261 | 264 | } else if #[cfg(all(feature = "rdrand", |
|
0 commit comments