-
Notifications
You must be signed in to change notification settings - Fork 270
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
Add a global-context-less-secure feature which skips randomization #279
Conversation
I guess that's okay but can you explain why using rand isn't a safe idea? |
Well, mostly I’m not sure how you’d need to map JavaScript functions into the WASM env in order to get rand to work - it needs external access to work at all. Ideally it’s also possible to use a global context without std, though we need sync::Once for that (under the hood it’s all atomics and thread::park, so we could drop the park and do it ourselves easily).
… On Feb 15, 2021, at 07:05, Tim Ruffing ***@***.***> wrote:
I guess that's okay but can you explain why using rand isn't a safe idea?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@TheBlueMatt which wasm target have std and doesn't have rand support? |
Also, see bitcoin-core/secp256k1#893 for fully non std global context |
Currently we're building rust-lightning targeting wasm32-wasi, but linking it with C code and not exposing any of the wasi runtime to the wasm binary. |
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Note that this uses rust-bitcoin/rust-secp256k1#279
Rebased to pick up new upstream CI with no other changes. |
This is useful for us downstream as we wish to target WASM with a global context, and using rand in such a build doesn't seem like a safe idea.
Rebased on latest upstream to fix our Cargo patches. Any update on getting this landed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack ce930ab
I'm not totally thrilled about the "less secure" name but I'm not sure what would be better.
FYI @TheBlueMatt |
Lol, wow, when I saw your "why is this a feature?" issue I couldn't remember the reason, but I am a little surprised it was "WASM compatibility". We can drop the features now; we haven't had any issues with randomness in particular for a few years in wasm. Other than remembering to turn on that feature. (But then I think the correct solution is to detect at compile-time if we are targeting wasm and the feature isn't turned on.) |
Their code already has
|
Oh, wonderful. I'm glad they have a compile error now. At the time of this issue in was a runtime panic in a very obscure location, which as I mentioned elsewhere, would present as a blank webpage. |
This is useful for us downstream as we wish to target WASM with a
global context, and using rand in such a build doesn't seem like a
safe idea.