Repository navigation
Closed
Conversation
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Feel free to merge as-is, but I'm happy to work on other solutions too. This is intended mostly as a starting point for discussing how this could be solved.)
We'd like to compile
ringto a customwasm32-unknown-unknowntarget. I see that there is already awasm32_unknown_unknown_jstarget on themainbranch, but our target environment doesn't have a JavaScript interface.Some of the solutions we considered:
ring::randmodule behind an optional (enabled by default)randfeature. This would work for us because the functions we call don't need RNG. However, it is not a very general solution, and adding#[cfg(rand)]everywhere would probably be undesirable in a cryptographic library.getrandom(this PR).getrandomhas acustomfeature that allows users to register their own getrandom implementation to be used on targets without a default implementation. We have a few other dependencies that depend ongetrandom, so we already do this.register_custom_getrandommacro and add it to this crate.I used the
getrandomapproach (behind an opt-in feature) here because I thought it was the simplest solution, but I would love to hear what everyone thinks. Thanks a lot for this crate!