Skip to content

redox: Switch to /dev/urandom#222

Merged
josephlr merged 1 commit intomasterfrom
redox
Oct 15, 2021
Merged

redox: Switch to /dev/urandom#222
josephlr merged 1 commit intomasterfrom
redox

Conversation

@josephlr
Copy link
Copy Markdown
Member

From briansmith/ring#1341 apparently on Redox the /dev/urandom device now exists. Changing the implementation for consistency between RNG crates.

@jackpot51 does this look good to you? Also, where is this device documented?

Signed-off-by: Joe Richey joerichey@google.com

@josephlr josephlr requested a review from newpavlov August 14, 2021 01:05
Signed-off-by: Joe Richey <joerichey@google.com>
Comment thread src/lib.rs
//! | 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@josephlr not really

@jackpot51
Copy link
Copy Markdown

/dev/urandom is now a symlink to rand:, and rand: is always a non-blocking CPRNG

Copy link
Copy Markdown
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

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

IIUC /dev/urandom was added mostly for compatibility purposes and reading rand: is more idiomatic. From practical point of view both options are equivalent to each other, so I am fine with this change.

@jackpot51
BTW how Redox handles entropy pool initialization on system startup? The preferred behavior for us would be for it to block rand:/dev/urandom reading until the pool gets properly initialized.

@jackpot51
Copy link
Copy Markdown

@newpavlov rand: (and /dev/urandom with it being a symlink) will not return any data until it is initialized. It will block on read.

@josephlr josephlr merged commit e4004f4 into master Oct 15, 2021
@josephlr josephlr deleted the redox branch October 15, 2021 01:16
@jackpot51
Copy link
Copy Markdown

Thanks @josephlr !

takumi-earth pushed a commit to earthlings-dev/getrandom that referenced this pull request Jan 27, 2026
Signed-off-by: Joe Richey <joerichey@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants