Skip to content

Use getentropy on Emscripten - #307

Merged
josephlr merged 1 commit into
masterfrom
emscripten
Oct 23, 2022
Merged

Use getentropy on Emscripten#307
josephlr merged 1 commit into
masterfrom
emscripten

Conversation

@josephlr

@josephlrjosephlr commented Oct 23, 2022

Copy link
Copy Markdown
Member

Fixes#275, note that libc::getentropy isn't in the libc crate yet, so we have to manually declare the bindings.

The last version of the EMSDK that didn't have support for this was 2.0.4 released over two years ago, so I don't think we have to worry about users using a super old SDK version, especially considering this is an less-used target.

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

@josephlr
josephlrforce-pushed the emscripten branch 4 times, most recently from e889c6d to 731ccc7CompareOctober 23, 2022 05:58
@josephlr
josephlr marked this pull request as ready for review October 23, 2022 06:06

@newpavlovnewpavlov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe it's worth to submit a patch which adds getentropy to libc? It looks like a small enough change for them to accept. But for now, I am fine with the manual declaration.

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

Copy link
Copy Markdown
MemberAuthor

Maybe it's worth to submit a patch which adds getentropy to libc? It looks like a small enough change for them to accept. But for now, I am fine with the manual declaration.

Sounds reasonable. I'm working on a few patches to send their way to make things easier on us w.r.t. declaring our own bindings.

@josephlr
josephlr merged commit 710b24d into masterOct 23, 2022
@josephlr
josephlr deleted the emscripten branch October 23, 2022 22:09
@newpavlovnewpavlov mentioned this pull request Apr 2, 2023
@kleisauke

Copy link
Copy Markdown

FWIW, getentropy was added to libc for Emscripten via PR rust-lang/libc#3087.

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>
Signed-off-by: Joe Richey <joerichey@google.com>
Sign up for freeto 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.

Use getentropy() libc function on Emscripten

3 participants

@josephlr@kleisauke@newpavlov