Skip to main content

Crate wasi_crypto_wasmtime

Crate wasi_crypto_wasmtime 

Source
Expand description

Glue that exposes the wasi-crypto host functions to Wasmtime, the same way Wasmtime exposes the regular preview1 WASI calls.

The heavy lifting (every cryptographic primitive, every handle table) lives in the wasi-crypto host-functions crate, which speaks in terms of Rust slices and u32 handles. The wasm ABI, on the other hand, speaks in terms of guest pointers and integer error codes. Wiggle bridges the two: from the witx description it generates one host trait per witx module plus a matching add_to_linker. All this file does is implement those traits by reading the arguments out of guest memory, calling into the CryptoCtx, and writing the results back.

Modules§

types

Structs§

WasiCryptoCtx
Host state for the wasi-crypto functions. Drop this into your Wasmtime store (or expose it through a view) and hand add_to_linker a closure returning &mut WasiCryptoCtx.

Enums§

WasiCryptoError
Either something went wrong inside the cryptography layer (CryptoError) or while touching guest memory (GuestError). Both funnel into a single witx crypto_errno for the guest.

Functions§

add_to_linker
Register the complete wasi-crypto API (all five witx modules) on a linker in one call, the same way wasmtime_wasi::p1::add_to_linker_sync registers WASI.