Skip to content

Foundation attempts to read from /dev/urandom #2605

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

Closed
MaxDesiatov opened this issue Jan 29, 2021 · 4 comments
Closed

Foundation attempts to read from /dev/urandom #2605

MaxDesiatov opened this issue Jan 29, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@MaxDesiatov
Copy link

It was discovered by @kateinoigakukun. See this line, which causes exceptions on WASI.

@MaxDesiatov MaxDesiatov added the bug Something isn't working label Jan 29, 2021
@j-f1
Copy link
Member

j-f1 commented Jan 30, 2021

This can be fixed by implementing a platform-specific version of read_random using random_get. It might be as simple as #define read_random random_get.

@kateinoigakukun
Copy link
Member

This is also resolved by swiftwasm/swift-corelibs-foundation#323

@MaxDesiatov
Copy link
Author

Is there any substantial difference between getentropy and random_get? Why would we use one over the other?

@kateinoigakukun
Copy link
Member

kateinoigakukun commented Aug 7, 2021

getentropy internally use random_get. https://github.com/WebAssembly/wasi-libc/blob/main/libc-bottom-half/sources/getentropy.c

getentropy is more portable API than wasi specific random_get, so I prefer it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants