Skip to content

Support WASM/Emscripten#2959

Merged
justsmth merged 7 commits intoaws:mainfrom
justsmth:support-WASM
Feb 20, 2026
Merged

Support WASM/Emscripten#2959
justsmth merged 7 commits intoaws:mainfrom
justsmth:support-WASM

Conversation

@justsmth
Copy link
Contributor

@justsmth justsmth commented Jan 23, 2026

Issues:

Addresses: P372521248

Description of changes:

This PR adds support for building and testing AWS-LC with WebAssembly (WASM) using an Emscripten toolchain.

Description

  • Defines OPENSSL_WASM when compiling with __wasm__ to enable WASM-specific code paths
  • Configures WASM builds to use getentropy() for random number generation, which Emscripten provides
  • Provide CMake toolchain file: util/wasm-toolchain.cmake
  • Added tests/ci/run_emscripten_tests.sh for testing.
  • Added CI workflow: .github/workflows/emscripten.yml

Call-outs:

  • Threading is enabled via Emscripten's pthread implementation using Web Workers and SharedArrayBuffer
  • Tests that require fork() or POSIX sockets are excluded as these are not supported in the WASM/Emscripten environments

Testing:

  • The new CI workflow builds AWS-LC and runs crypto_test, urandom_test, and ssl_test in a WASM/Node.js environment
  • All tests pass except those explicitly filtered out due to WASM platform limitations (fork/socket operations)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.32%. Comparing base (ab1b674) to head (2260987).
⚠️ Report is 43 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2959      +/-   ##
==========================================
+ Coverage   78.31%   78.32%   +0.01%     
==========================================
  Files         689      689              
  Lines      121007   121007              
  Branches    16996    16972      -24     
==========================================
+ Hits        94765    94783      +18     
+ Misses      25346    25329      -17     
+ Partials      896      895       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@justsmth justsmth changed the title [DRAFT] Support WASM [DRAFT] Support WASM/Emscripten Jan 30, 2026
@justsmth justsmth changed the title [DRAFT] Support WASM/Emscripten Support WASM/Emscripten Jan 30, 2026
@justsmth justsmth marked this pull request as ready for review January 30, 2026 18:53
@justsmth justsmth requested a review from a team as a code owner January 30, 2026 18:53
sgmenda
sgmenda previously approved these changes Feb 12, 2026
Copy link
Contributor

@sgmenda sgmenda left a comment

Choose a reason for hiding this comment

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

lgtm, but I think we should add a paragraph under "Platform Support" in the repo README.md about security implications.

Copy link
Contributor

@sgmenda sgmenda left a comment

Choose a reason for hiding this comment

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

lgtm, I like the README changes

@justsmth justsmth mentioned this pull request Feb 20, 2026
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 this pull request may close these issues.

4 participants