-
Notifications
You must be signed in to change notification settings - Fork 86
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
What is the expected way to get randomness on hermitcore? #63
Comments
You find at https://github.com/hermitcore/libhermit-rs/blob/master/src/syscalls/random.rs#L20-L31 our generator of random numbers. If RDRAND is available, it will use RDRAND. Otherwise, you het only pseudo random number. But you are right, I should add a function in |
Sounds good, we will just call RDRAND directly in getrandom (we already have the implementation). Also, the fallback Hermit RNG mechanism is not cryptographicly secure, is that a problem? |
We use also RDRAND to generate random numbers. However, our fallback on systems without RDRAND support is currently not cryptographicly secure.
AARCH64 has also hardware support for random numbers. For instance RDNR could be solution. I will look in the specification. |
@josephlr can you a look at hermit-os/kernel#98 Is calling the syscall fine for you? |
One issue there is the fallback,
We looked into this briefly for |
One thing some OSes do is provide a way to know if the RNG is secure/seeded/whatever. That could work, or have a separate secure_rand() function that won't ever give insecure RNG. Example for |
Yeah, this approach is really good. I will add a similar syscall. |
I add an interface in #64. Does it meet your requirements? |
Yes! That interface looks great (and would allow |
I merged #64 and close this issue. Please reopen this issue, if the interface is not suitable for your use case. |
I'm one of the maintainers for
getrandom
, ano_std
library which attempts to define the "standard" way to get cryptographic entropy on every Rust target. Therand
crate and others use this crate under the hood.As far as I can tell HermitCore doesn't expose or have a way to get OS-based randomness. For that reason, we don't currently support Hermit.
Are users simply expected to call RDRAND? This is reasonable, provided that HermitCore is
x86_64
only.The text was updated successfully, but these errors were encountered: