Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redox: Switch to /dev/urandom #222

Merged
merged 1 commit into from Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -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]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to update the documentation link here

Copy link
Member

@newpavlov newpavlov Aug 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link simply points to the relevant Redox source code. It would be nice to replace it with a proper documentation link, but AFAIK such documentation currently does not exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jackpot51 does Redox have any docs describing either rand: or /dev/urandom?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josephlr not really

//! | 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`
Expand Down
4 changes: 1 addition & 3 deletions src/use_file.rs
Expand Up @@ -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",
Expand All @@ -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> {
Expand Down