Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jedisct1/boringssl-wasm
BoringSSL for WebAssembly/WASI
https://github.com/jedisct1/boringssl-wasm
boringssl wasi wasm webassembly
Last synced: 7 days ago
JSON representation
BoringSSL for WebAssembly/WASI
- Host: GitHub
- URL: https://github.com/jedisct1/boringssl-wasm
- Owner: jedisct1
- License: other
- Created: 2022-10-03T22:27:56.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-01T16:53:21.000Z (2 months ago)
- Last Synced: 2024-12-19T03:11:24.372Z (15 days ago)
- Topics: boringssl, wasi, wasm, webassembly
- Language: Zig
- Homepage:
- Size: 5.76 MB
- Stars: 60
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BoringSSL (boringcrypto) for WebAssembly
A zig build file to compile BoringSSL's `libcrypto` to WebAssembly/WASI.
## Precompiled library
For convenience, a [precompiled library](precompiled/libcrypto.a) for WebAssembly can be directly downloaded from this repository.
## Dependencies
The only required dependencies to rebuild the library are:
* [Go](https://www.golang.org) - Required by BoringSSL to generate the error codes map
* [Zig](https://www.ziglang.org) - To compile C/C++ code to WebAssembly## BoringSSL submodule
This repository includes an unmodified version of `BoringSSL` as a submodule. If you didn't clone it with the `--recursive` flag, the following command can be used to pull the submodule:
```sh
git submodule update --init --recursive --depth=1
```## Building the BoringSSL crypto library for WebAssembly
Generic build for WebAssembly/WASI:
```sh
zig build -Doptimize=ReleaseFast
```The resulting static library is put into `zig-out/libcrypto.a`.
Build modes:
* `-Doptimize=ReleaseFast`
* `-Doptimize=ReleaseSafe`
* `-Doptimize-ReleaseSmall` (also turns `OPENSSL_SMALL` on to disable precomputed tables)
* `-Doptimize=Debug` (default, not recommended in production builds)The library is compatible with the vast majority of WebAssembly runtimes, and can be used linked with C, Zig, Rust, whatever.
Optimizations only compatible with some runtimes can be also enabled:
```sh
zig build -Dtarget=wasm32-wasi -Drelease-fast \
-Dcpu=generic+simd128+multivalue+bulk_memory
```Possibly relevant extensions:
* `bulk_memory`
* `exception_handling`
* `multivalue`
* `sign_ext`
* `simd128`
* `tail_call`## Cross-compiling to other targets
The build file can be used to cross-compile to other targets as well. However, assembly implementations will not be included.
### Examples
Compile to the native architecture:
```sh
zig build -Dtarget=native -Drelease-fast
```Cross-compile to `x86_64-linux`:
```sh
zig build -Dtarget=x86_64-linux -Drelease-small
```Cross-compile to Apple Silicon:
```sh
zig build -Dtarget=aarch64-macos -Drelease-safe
```