|
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/random` (identical to `/dev/urandom`) |
| 31 | +//! | Emscripten | `*‑emscripten` | [`getentropy`][13] |
32 | 32 | //! | WASI | `wasm32‑wasi` | [`random_get`]
|
33 | 33 | //! | Web Browser and Node.js | `wasm32‑*‑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"))] {
|
@@ -251,6 +251,9 @@ cfg_if! {
|
251 | 251 | #[path = "espidf.rs"] mod imp;
|
252 | 252 | } else if #[cfg(windows)] {
|
253 | 253 | #[path = "windows.rs"] mod imp;
|
| 254 | + } else if #[cfg(target_os = "emscripten")] { |
| 255 | + mod util_libc; |
| 256 | + #[path = "emscripten.rs"] mod imp; |
254 | 257 | } else if #[cfg(all(target_arch = "x86_64", target_env = "sgx"))] {
|
255 | 258 | #[path = "rdrand.rs"] mod imp;
|
256 | 259 | } else if #[cfg(all(feature = "rdrand",
|
|
0 commit comments