From e4004f41faed8ec4f6336cfab8ea11e18102392d Mon Sep 17 00:00:00 2001 From: Joseph Richey Date: Thu, 14 Oct 2021 18:16:03 -0700 Subject: [PATCH] redox: Switch to /dev/urandom (#222) Signed-off-by: Joe Richey --- src/lib.rs | 2 +- src/use_file.rs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 107b2d32..3b7bbb39 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,7 @@ //! | Dragonfly BSD | `*‑dragonfly` | [`getrandom()`][22] if available, otherwise [`/dev/random`][8] //! | Solaris, illumos | `*‑solaris`, `*‑illumos` | [`getrandom()`][9] if available, otherwise [`/dev/random`][10] //! | Fuchsia OS | `*‑fuchsia` | [`cprng_draw`][11] -//! | Redox | `*‑redox` | [`rand:`][12] +//! | Redox | `*‑redox` | [`/dev/urandom`][12] //! | Haiku | `*‑haiku` | `/dev/random` (identical to `/dev/urandom`) //! | SGX | `x86_64‑*‑sgx` | [RDRAND][18] //! | VxWorks | `*‑wrs‑vxworks‑*` | `randABytes` after checking entropy pool initialization with `randSecure` diff --git a/src/use_file.rs b/src/use_file.rs index 465c0697..366e4113 100644 --- a/src/use_file.rs +++ b/src/use_file.rs @@ -17,8 +17,6 @@ use core::{ sync::atomic::{AtomicUsize, Ordering::Relaxed}, }; -#[cfg(target_os = "redox")] -const FILE_PATH: &str = "rand:\0"; #[cfg(any( target_os = "dragonfly", target_os = "emscripten", @@ -28,7 +26,7 @@ const FILE_PATH: &str = "rand:\0"; target_os = "illumos" ))] const FILE_PATH: &str = "/dev/random\0"; -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(any(target_os = "android", target_os = "linux", target_os = "redox"))] const FILE_PATH: &str = "/dev/urandom\0"; pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {