Repository navigation
Add a compact native NVM store and drop the wolfHSM NVM layers from native builds - #101
Conversation
565fad8 to
db71d92
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #101
Scan targets checked: wolftrust-src, wolftrust-bugs
Not reviewed (no scan target covers them): .github/workflows/cross-compile.yml, .gitignore, Makefile, docs/Crypto-Engines.md, docs/Footprint.md, docs/Macros.md, docs/Porting.md, docs/Project-Structure.md, docs/Security-Model.md, docs/TF-M-Compatibility.md, lib/wolfCOSE, mk/common.mk, mk/layout.mk, port/mcxn947/port.json, port/mimxrt700/port.json, port/stm32h563/port.json, port/stm32l562/port.json, tests/fuzz/Makefile, tests/fuzz/wt_spm_fuzz.c, tests/host/Makefile and 53 more
Coverage: 70 of 125 in-scope changed file(s) opened by the reviewer; not opened: include/wolftrust/arch/armv8m/cmse.h, include/wolftrust/ffm.h, include/wolftrust/ffm_boot.h, include/wolftrust/ffm_domain.h, include/wolftrust/ffm_gateway.h, include/wolftrust/guest_verify.h, include/wolftrust/irq_claim.h, include/wolftrust/manifest.h, include/wolftrust/nvm_native.h, include/wolftrust/nvm_store.h and 45 more
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Review tier: Max
e947d2f to
e7eec36
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The footprint documentation still reports a 10 KiB crypto stack despite the new 6 KiB default, leaving allocation, measurement, and headroom guidance inconsistent.
1 open issue
What changed in this PR
This PR reduces wolfTrust’s native storage footprint by introducing a compact NVM store and routing native key operations through the vault. It also carries the SPM integration changes from #97, adapting services, host fixtures and build checks to the new core.
Changes:
- Adds native-store interfaces, transactional seal-key setup and vault key operations, while retaining the wolfHSM store option.
- Migrates service transports and host fixtures to the SPM core, including restart and trimmed-API coverage.
- Updates memory allocations, footprint classification, per-port size limits and CI checks.
| File | Description |
|---|---|
| tools/secure_owners.txt | Classifies new SPM, vault and key-client objects. |
| tools/l3_layout_args.py | Supplies SPM-private ranges to layout validation. |
| tools/footprint/wolftrust.rules | Adds wolfTrust footprint categories. |
| tools/footprint/tfm.rules | Adds corresponding TF-M footprint categories. |
| tools/check-core-port-split.sh | Guards the SPM core’s include boundary. |
| tests/target/lib/scenarios.py | Allows absent wolfHSM backend diagnostics. |
| tests/host/wolfhsm_relay/Makefile | Links the shared SPM host fixture. |
| tests/host/wolfhsm_relay/main.c | Migrates relay tests to SPM host calls. |
| tests/host/vnet_relay/Makefile | Links SPM support and shared vault IPC. |
| tests/host/vnet_relay/main.c | Adapts VNET fixtures and restart handling. |
| tests/host/vault_txn/user_settings.h | Configures crypto for vault transaction tests. |
| tests/host/vault_service/Makefile | Adds native-store and SPM fixture support. |
| tests/host/tpm_relay/Makefile | Builds TPM tests against the SPM core. |
| tests/host/tpm_relay/main.c | Migrates TPM calls to the host fixture. |
| tests/host/support/test_nvm_store.h | Adapts shared tests to either store. |
| tests/host/support/spm_tables.h | Declares host manifest-to-table helpers. |
| tests/host/support/spm_host.mk | Shares SPM host sources and build flags. |
| tests/host/support/spm_host.h | Defines the synchronous SPM host fixture. |
| tests/host/support/secure_domain_resolve.h | Declares host domain-reference helpers. |
| tests/host/support/secure_domain_resolve.c | Moves descriptive domain resolution into test support. |
| tests/host/storage_service/Makefile | Adds native-store and shared IPC support. |
| tests/host/stm32l562_flash/Makefile | Enables diagnostics required by flash tests. |
| tests/host/spm/Makefile | Updates production-manifest test dependencies. |
| tests/host/spm/main.c | Retains default-build manifest validation checks. |
| tests/host/spm_start/Makefile | Adds a no-restart test configuration. |
| tests/host/spm_gate/trims_main.c | Checks rejection of disabled partition APIs. |
| tests/host/spm_gate/Makefile | Builds the shared fixture and trimmed-API tests. |
| tests/host/spm_core/Makefile | Adds core, restart and guest-count configurations. |
| tests/host/psa_storage_client/Makefile | Adds native-store and SPM fixture support. |
| tests/host/psa_secure_crypto/server.c | Initializes keys through the vault keystore interface. |
| tests/host/psa_secure_crypto/Makefile | Explicitly selects native-engine compilation. |
| tests/host/psa_ffm_client/Makefile | Uses shared SPM and vault IPC support. |
| tests/host/psa_ff_upstream/README.md | Updates core state and test-path references. |
| tests/host/psa_ff_upstream/psa_binding.h | Defines host PSA identity bindings. |
| tests/host/psa_ff_upstream/Makefile | Replaces legacy runtime sources with SPM support. |
| tests/host/ps_service/Makefile | Adds native-store and shared fixture support. |
| tests/host/port_flash/Makefile | Enables flash diagnostics and SPM support. |
| tests/host/port_binding/main.c | Adapts fixtures to pointer-based memory windows. |
| tests/host/pkcs11_relay/Makefile | Links the shared SPM host fixture. |
| tests/host/pkcs11_relay/main.c | Migrates PKCS#11 transport tests to SPM calls. |
| tests/host/nvm_native/Makefile | Adds the native NVM host-suite build. |
| tests/host/nvm_boot/Makefile | Adds native-store and vault IPC dependencies. |
| tests/host/negatives/Makefile | Supports native-store negative tests. |
| tests/host/negatives/main.c | Uses the store adapter and neutral fixture text. |
| tests/host/native_wire/Makefile | Adds explicit native-engine and store selection. |
| tests/host/native_wire/main.c | Uses the store adapter and keystore interface. |
| tests/host/monitor/Makefile | Adds explicit restart and no-restart configurations. |
| tests/host/monitor/main.c | Updates stubs and tests no-restart quarantine. |
| tests/host/manifest_render/test_manifest_render.py | Refreshes expected manifest hashes. |
| tests/host/manifest_ports/run.sh | Links table derivation instead of the old runtime. |
| tests/host/manifest_ports/main.c | Checks constant guest rows and derived SPM tables. |
| tests/host/Makefile | Registers new suites and native-store reruns. |
| tests/host/layout_config/test_layout_config.py | Checks per-guest sizing in manifest templates. |
| tests/host/keystore_isolation/main.c | Removes comparison branding from a comment. |
| tests/host/keystore_ipc/Makefile | Adds native-store, vault IPC and SPM support. |
| tests/host/irq_claim/main.c | Replaces callback fixtures with architecture symbols. |
| tests/host/ipc/Makefile | Removes the retired IPC-suite build. |
| tests/host/guest_verify/main.c | Adapts tests to pointer-based measurement records. |
| tests/host/fwu_service/Makefile | Links firmware-update tests to SPM support. |
| tests/host/fwu_restore/main.c | Captures restore hooks during scheduler registration. |
| tests/host/footprint_classify/Makefile | Adds footprint-classifier test entry points. |
| tests/host/ffm_veneer/Makefile | Adds shared SPM and vault IPC dependencies. |
| tests/host/ffm_domain/Makefile | Links host domain-reference helpers. |
| tests/host/ffm_domain/main.c | Uses the relocated domain helpers. |
| tests/host/boot_seed/main.c | Replaces legacy lifecycle stubs with core state. |
| tests/host/attestation_service/Makefile | Links attestation tests to SPM support. |
| tests/host/attestation_iak/main.c | Simplifies the key-isolation description only. |
| tests/host/attestation_golden/Makefile | Disables redundant claim-string UTF-8 checks. |
| tests/host/attest_restore/main.c | Updates restore registration and measurement stubs. |
| tests/fuzz/Makefile | Targets SPM support and gateway code. |
| src/sync/mutex.c | Shares queued acquisition and rejects recursive locking. |
| src/spm.c | Removes the generated-manifest bypass initializer. |
| src/services/wolfhsm/wt_hsm_seal.c | Uses store wrappers and native transactional key setup. |
| src/services/vnet/vnet_relay_service.c | Uses the platform-appropriate default transport. |
| src/services/nvm_client.c | Reuses the shared vault IPC client helper. |
| src/services/native/psa_crypto_service.c | Adapts persistent-record reads to the new interface. |
| src/services/native/key_client.c | Adds vault key-operation IPC forwarding. |
| src/services/native/crypto_native.c | Initializes the vault keystore and omits native-store locks. |
| src/services/msg_relay.c | Restores the platform-specific transport default. |
| src/services/initial_attestation.c | Consolidates claim validation and requires target IPC binding. |
| src/services/hsm_relay_service.c | Uses the platform-specific default transport. |
| src/services/boot_handoff.c | Consolidates handoff validation and clearing. |
| src/partition.c | Simplifies a port-validation comment only. |
| src/irq_claim.c | Calls architecture interrupt operations directly. |
| src/guest_verify.c | Stores pointers to pinned measurement records. |
| src/ffm_domain.c | Removes descriptive resolution now kept in test support. |
| src/client/psa_storage_client.c | Updates the transfer-budget name in a comment. |
| src/boot.c | Writes lifecycle state directly into the SPM core. |
| src/arch/common/spm_sp_api.c | Conditionally builds trimmable partition APIs. |
| src/arch/common/measure_ops.c | Extracts privileged measurement access. |
| src/arch/common/fwu_ops.c | Extracts privileged firmware-update operations. |
| src/arch/armv8m/irq_armv8m.c | Exposes architecture interrupt operations directly. |
| src/arch/armv8m/ffm_nsc.c | Uses consolidated guest-buffer validation. |
| src/arch/armv8m/coroutine_armv8m.c | Uses shared coroutine offsets in assembly. |
| port/stm32l562/port.json | Adds non-crypto and SPM flash ceilings. |
| port/stm32l562/flash_drv.c | Makes first-error diagnostics optional. |
| port/stm32h563/port.json | Adds non-crypto and SPM flash ceilings. |
| port/stm32h563/flash_drv.c | Makes first-error diagnostics optional. |
| port/mimxrt700/port.json | Adds non-crypto and SPM flash ceilings. |
| port/mcxn947/port.json | Adds non-crypto and SPM flash ceilings. |
| port/common/hsm_flash.h | Guards optional forensic declarations. |
| port/common/hsm_flash_ctx.c | Guards optional flash-gate diagnostic state. |
| port/common/armv8m/secure_l3_bands.ld | Places native-store and key-client partition data. |
| port/common/armv8m/platform_armv8m.c | Removes obsolete gateway installation. |
| port/common/armv8m/l3_layout.h | Reduces the default wolfHSM crypto stack. |
| mk/layout.mk | Adjusts crypto-stack and native-vault sizing. |
| Makefile | Replaces legacy IPC/FF-M test targets with SPM-core targets. |
| include/wolftrust/vnet/vnet_abi.h | Updates the transfer-budget name in a comment. |
| include/wolftrust/spm.h | Removes the generated-manifest initializer declaration. |
| include/wolftrust/spm_sp_mem.h | Defines generated partition memory rows. |
| include/wolftrust/spm_sched.h | Combines scheduling and restore-hook registration. |
| include/wolftrust/spm_ops.h | Declares privileged service-operation helpers. |
| include/wolftrust/spm_gate.h | Defines transport defaults and the run hook. |
| include/wolftrust/services/vault_ipc.h | Defines shared service and client IPC interfaces. |
| include/wolftrust/services/storage_service.h | Removes obsolete per-loop connection state. |
| include/wolftrust/services/nvm_client.h | Aliases the shared service-client context. |
| include/wolftrust/services/msg_relay.h | Uses platform-specific transport initialization. |
| include/wolftrust/services/hsm.h | Adds native vault contracts and conditional locking. |
| include/wolftrust/services/crypto_native.h | Declares vault-backed key-client interfaces. |
| include/wolftrust/sched/tasklet.h | Removes the obsolete tick wrapper. |
| include/wolftrust/sched/coroutine.h | Updates explicit-run and fault-recovery contracts. |
| include/wolftrust/sched/coroutine_internal.h | Sizes coroutine tables and centralizes assembly offsets. |
| include/wolftrust/partition.h | Uses constant per-guest memory arrays. |
| include/wolftrust/nvm_store.h | Omits the mutex declaration for native storage. |
| include/wolftrust/nvm_native.h | Defines native-store state and transaction APIs. |
| include/wolftrust/manifest.h | Defines when boot isolation validation runs. |
| include/wolftrust/irq_claim.h | Replaces interrupt callbacks with architecture functions. |
| include/wolftrust/ipc.h | Removes the retired IPC contract. |
| include/wolftrust/guest_verify.h | Documents retained measurement-pointer lifetime. |
| include/wolftrust/ffm_gateway.h | Removes the obsolete installation declaration. |
| include/wolftrust/ffm_domain.h | Removes runtime resolution and stack fields. |
| include/wolftrust/ffm_boot.h | Simplifies the SPM boot interface. |
| include/wolftrust/arch/armv8m/cmse.h | Declares consolidated guest-buffer validation. |
| docs/Security-Model.md | Updates documented main-stack allocation and usage. |
| docs/Project-Structure.md | Documents SPM-core and footprint-tool locations. |
| docs/Porting.md | Documents per-port footprint ceilings. |
| docs/Macros.md | Documents store selection, restart and diagnostic controls. |
| docs/Footprint.md | Updates storage allocation and footprint descriptions. |
| .gitignore | Removes the retired IPC build-directory entry. |
| .github/workflows/cross-compile.yml | Adds footprint gates and store/feature build checks. |
Review effort: Balanced
66058b0 to
1ec5c79
Compare
dgarske
left a comment
There was a problem hiding this comment.
Re-checked at e2c8a45. The full host suite and the ASan/UBSan runs pass. The wolfHSM-store double readback is gone: Program compares once, and Verify only checks the range. The other changes look good too: the stopped-store and lost-seal paths keep services up and launch no guest, a reformat happens only on a seal key and table mismatch, and the commit-twin write is safe because the slot was blank.

WT_NVM_STORE=wolfhsmbrings back the wolfHSM store, and the hsm engine always uses it.STM32L562 by category:
Every port: