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

Compilation to wasm #225

Open
bshvass opened this issue Mar 20, 2024 · 6 comments
Open

Compilation to wasm #225

bshvass opened this issue Mar 20, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@bshvass
Copy link

bshvass commented Mar 20, 2024

Compilation to wasm does not seem to work. I've tried on several machines and with several commands.
The wasm job also seems to have been skipped in recent commits.

Running the command

cargo build --features wasm --target wasm32-unknown-unknown

fails with

fatal error: 'string.h' file not found

when compiling the files in sys/hacl/c.

Running the command

CC=emcc AR=emar cargo build --features wasm --target wasm32-unknown-unknown

fails with

emcc: error: unsupported target: wasm32-unknown-unknown (emcc only supports wasm64-unknown-emscripten and wasm32-unknown-emscripten)

Trying with the wasm32-unknown-emscripten target simply freezes.

I get similar errors when I try to compile independent packages, which have libcrux as dependency, to wasm.

I'm not sure what else to try to get things to compile, but I suspect the issue with the Emscripten compilation.
What is needed to get this working again?

@franziskuskiefer franziskuskiefer added the enhancement New feature or request label Mar 23, 2024
@franziskuskiefer
Copy link
Member

WASM support is currently pretty limited because a lot of the underlying C code uses raw 64-bit pointers.
We work on integrating a Rust version directly for the legacy C code (see hacl-star/hacl-star#918). But this is work in progress.

Are you interested in a specific algorithm? We could see if we can expose that in the current version.

@bshvass
Copy link
Author

bshvass commented Apr 4, 2024

I was trying to run HMAC compiled to wasm (cf. this pull request)

@franziskuskiefer
Copy link
Member

I think we could make hmac work, SHA2 should be fine. Do you want to take a stab at it? I'm happy to review or give you more concrete pointer if needed.

@spitters
Copy link

spitters commented Apr 8, 2024

@bshvass this is related to getting the bigints to work in rust
RustCrypto/crypto-bigint#577 (comment)

@spitters
Copy link

spitters commented May 7, 2024

@bshvass What is the status of this?

@bshvass
Copy link
Author

bshvass commented May 7, 2024

I haven't had time to look at it yet, but might have some time soon. @franziskuskiefer, I can take a stab at it; did you have any concrete pointers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants