WASM emulator demo support#3869
Draft
swenson wants to merge 5 commits into
Draft
Conversation
Adds KeyVault::snapshot() and KeyVaultSnapshot struct exposing key data, PCRs, and control register state for external inspection. ModelEmulated::key_vault_snapshot() forwards the call so WASM consumers can display the keyvault contents in real time.
self.keys is a ReadWriteMemory<2048> (KEY_REG_SIZE = 0x800) but only 24 keys × 64 bytes = 1536 bytes are valid. Slicing the source down to the valid portion avoids the copy_from_slice length mismatch panic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR collects the
caliptra-swchanges needed to run Caliptra in abrowser via WebAssembly. They back the standalone WASM emulator demo at
https://swenson.github.io/caliptra-wasm/ (source:
https://github.com/swenson/caliptra-wasm).
What's here
The substantive emulator/model changes that the WASM build depends on:
sw-emulator/.../key_vault.rs– Add aKeyVaultsnapshot accessor sothe demo UI can display key-vault state, and fix a
snapshotpanic(keys storage is padded to 2048 bytes).
hw-model/– Expose the snapshot accessor throughModelEmulated/ the
HwModeltrait, plus the dependency wiring needed to build forwasm32-unknown-unknown.for the demo flow.
Plus an early embedded prototype of the demo itself under
wasm-demo/. Thatprototype has since graduated into the standalone
caliptra-wasmrepository; it isincluded here only for historical context and is not intended to live in
caliptra-swlong-term.Commits
Why open it now
Folks have asked to see the current state of the WASM-enabling changes. This
draft makes them reviewable in one place even though the branch needs a
rebase onto current
mainbefore it could merge.