Skip to content
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

Building for wasm doesn't work (well, building works but running does not) #124

Closed
apoelstra opened this issue Jul 4, 2019 · 3 comments · Fixed by #125
Closed

Building for wasm doesn't work (well, building works but running does not) #124

apoelstra opened this issue Jul 4, 2019 · 3 comments · Fixed by #125

Comments

@apoelstra
Copy link
Member

Related to #119

We currently depend on the following symbols:

  • malloc
  • free

(We additionally depended on abort and printf until #115 )

This prevents use with rust-wasm for this library and all downstream users (e.g. rust-bitcoin). While doing any cryptography in a browser is very ill-advised, rust-secp does a lot more than just signing and verification (it can also parse and display keys), and its downstream deps such as rust-bitcoin do many things that certainly should be possible and easy to do with rust-wasm.

We also don't want to encourage users to find other pure-Rust secp256k1 libraries with dramatically less review and QA on them, and to use these in a Bitcoin context.

See rust-bitcoin/rust-bitcoin#240 for earlier discussion.

@apoelstra
Copy link
Member Author

I was able to get a wasm application working which parses and Javascript alerts a public key. Unfortunately to do so I needed to

  1. Hack Implementing pre allocation context creation #116 to eliminate all calls to context_create and context_destroy (this I expected).
  2. Actually delete context_create, scratch_space_create, context_destroy, scratch_space_destroy from the libsecp source. Deleting the FFI bindings was not enough (this I did not expect).

@elichai
Copy link
Member

elichai commented Jul 4, 2019

Yeah, we need to eliminate the symbols, we don't use the scratch space, right?

@apoelstra
Copy link
Member Author

Correct, we do not use the scratch space. (It will eventually be used for MuSig but before then we'll figure out a preallocated solution for it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants