diff --git a/.github/workflows/README.md b/.github/workflows/README.md
index 5aaa88221..43239eb17 100644
--- a/.github/workflows/README.md
+++ b/.github/workflows/README.md
@@ -17,6 +17,14 @@ and rejects an invalid capture. Keep submodules under `lib/` and enable
An accepted upload queues analysis; results appear after Coverity processes it.
+`docs-site.yml` builds the HTML and PDF manual with the shared
+`wolfSSL/documentation` tooling for documentation pull requests and merges to
+`main`. It includes every page in `mkdocs.yml`, including the generated port
+registry and board guides, and uploads the `wolftrust-manual` review artifact.
+After the companion documentation integration and website upload are enabled,
+the nightly documentation update will read merged pages from wolfTrust `main`.
+See [DOCS-BUILD.md](../../DOCS-BUILD.md).
+
## At a glance
| Tier | Trigger | Purpose |
diff --git a/.github/workflows/docs-site.yml b/.github/workflows/docs-site.yml
new file mode 100644
index 000000000..5538be136
--- /dev/null
+++ b/.github/workflows/docs-site.yml
@@ -0,0 +1,85 @@
+name: Build manual with documentation tooling
+
+on:
+ pull_request:
+ paths:
+ - 'README.md'
+ - 'AGENTS.md'
+ - 'docs/**'
+ - 'DOCS-BUILD.md'
+ - 'mkdocs.yml'
+ - 'tools/docs_manual.py'
+ - 'tools/docs-manual/**'
+ - 'docker/docs/**'
+ - '.github/workflows/docs-site.yml'
+ push:
+ branches: [main]
+ paths:
+ - 'README.md'
+ - 'AGENTS.md'
+ - 'docs/**'
+ - 'DOCS-BUILD.md'
+ - 'mkdocs.yml'
+ - 'tools/docs_manual.py'
+ - 'tools/docs-manual/**'
+ - 'docker/docs/**'
+ - '.github/workflows/docs-site.yml'
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ packages: read
+
+jobs:
+ build:
+ runs-on: ubuntu-24.04
+ timeout-minutes: 60
+ steps:
+ - uses: actions/checkout@v4
+ - name: Select documentation revision
+ id: documentation
+ run: echo "sha=$(cat tools/docs-manual/documentation-rev)" >> "$GITHUB_OUTPUT"
+ - uses: actions/checkout@v4
+ with:
+ repository: wolfSSL/documentation
+ ref: ${{ steps.documentation.outputs.sha }}
+ path: build/documentation
+ submodules: recursive
+ persist-credentials: false
+ - uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Pull documentation builder
+ run: |
+ set -euo pipefail
+ image_sha=$(sha256sum docker/docs/Dockerfile docker/docs/requirements.txt | sha256sum | cut -c1-16)
+ image="ghcr.io/wolfssl/wolftrust-docs:sha-$image_sha"
+ if ! docker pull "$image"; then
+ docker build --pull -t "$image" docker/docs
+ fi
+ echo "DOCS_IMAGE=$image" >> "$GITHUB_ENV"
+ - name: Build and validate HTML and PDF
+ run: |
+ tools/check-docs-no-internal-links.sh
+ docker run --rm --user "$(id -u):$(id -g)" --env HOME=/tmp \
+ --mount "type=bind,source=$GITHUB_WORKSPACE,target=/work/wolfTrust" \
+ --workdir /work/wolfTrust "$DOCS_IMAGE" \
+ sh -ec '
+ python3 tools/docs_manual.py build \
+ --documentation-root /work/wolfTrust/build/documentation \
+ --source-root /work/wolfTrust --target all
+ cd build/documentation/wolfTrust
+ mkdocs build --strict -f mkdocs.yml
+ '
+ test -s build/documentation/wolfTrust/html/index.html
+ test -s build/documentation/wolfTrust/wolfTrust-Manual.pdf
+ - uses: actions/upload-artifact@v4
+ with:
+ name: wolftrust-manual
+ path: |
+ build/documentation/wolfTrust/html/
+ build/documentation/wolfTrust/wolfTrust-Manual.pdf
+ if-no-files-found: error
+ retention-days: 14
diff --git a/.github/workflows/publish-docs-image.yml b/.github/workflows/publish-docs-image.yml
new file mode 100644
index 000000000..cc16abb20
--- /dev/null
+++ b/.github/workflows/publish-docs-image.yml
@@ -0,0 +1,42 @@
+name: Publish documentation image
+
+on:
+ push:
+ branches: [main]
+ paths:
+ - 'docker/docs/**'
+ - '.github/workflows/publish-docs-image.yml'
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ packages: write
+
+concurrency:
+ group: publish-wolftrust-docs-image
+ cancel-in-progress: false
+
+jobs:
+ publish:
+ if: github.repository == 'wolfSSL/wolfTrust'
+ runs-on: ubuntu-24.04
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v4
+ - name: Select image tag
+ id: image
+ run: |
+ image_sha=$(sha256sum docker/docs/Dockerfile docker/docs/requirements.txt | sha256sum | cut -c1-16)
+ echo "tag=ghcr.io/wolfssl/wolftrust-docs:sha-$image_sha" >> "$GITHUB_OUTPUT"
+ - uses: docker/setup-buildx-action@v3
+ - uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - uses: docker/build-push-action@v6
+ with:
+ context: docker/docs
+ file: docker/docs/Dockerfile
+ push: true
+ tags: ${{ steps.image.outputs.tag }}
diff --git a/.github/workflows/wiki-sync.yml b/.github/workflows/wiki-sync.yml
deleted file mode 100644
index 9938adbcb..000000000
--- a/.github/workflows/wiki-sync.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: Sync docs to wiki
-
-# The wiki is a generated mirror of docs/. Edit docs/ via pull requests;
-# this publishes them to the GitHub wiki on every merge to main.
-on:
- push:
- branches: [main]
- paths: ['docs/**']
- workflow_dispatch:
-
-permissions:
- contents: write
-
-concurrency:
- group: wiki-sync
- cancel-in-progress: true
-
-jobs:
- sync:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - name: Publish docs/ to wiki
- uses: Andrew-Chen-Wang/github-wiki-action@50650fccf3a10f741995523cf9708c53cec8912a # v4
- with:
- path: docs/
diff --git a/.gitmodules b/.gitmodules
index 71f4549c7..afc3da39a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -3,22 +3,22 @@
url = https://github.com/wolfSSL/wolfHSM.git
[submodule "lib/wolfSSL"]
path = lib/wolfSSL
- url = git@github.com:wolfSSL/wolfSSL.git
+ url = https://github.com/wolfSSL/wolfSSL.git
[submodule "lib/wolfhal"]
path = lib/wolfhal
- url = git@github.com:wolfSSL/wolfhal.git
+ url = https://github.com/wolfSSL/wolfhal.git
[submodule "lib/wolfPSA"]
path = lib/wolfPSA
url = https://github.com/wolfSSL/wolfPSA.git
[submodule "lib/wolfIP"]
path = lib/wolfIP
- url = git@github.com:wolfSSL/wolfip.git
+ url = https://github.com/wolfSSL/wolfip.git
[submodule "lib/wolfCOSE"]
path = lib/wolfCOSE
url = https://github.com/wolfSSL/wolfCOSE.git
[submodule "lib/wolfPKCS11"]
path = lib/wolfPKCS11
- url = git@github.com:wolfSSL/wolfPKCS11.git
+ url = https://github.com/wolfSSL/wolfPKCS11.git
[submodule "lib/wolfTPM"]
path = lib/wolfTPM
- url = git@github.com:wolfSSL/wolfTPM.git
+ url = https://github.com/wolfSSL/wolfTPM.git
diff --git a/AGENTS.md b/AGENTS.md
index ded9b4815..614652686 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -26,14 +26,14 @@ instructions, and take precedence over this file.
| `tests/firmware/` | the guest images |
| `tools/` | manifest generation, layout checks, guards, the new-port scaffold |
| `lib/` | submodules: wolfSSL, wolfHSM, wolfPSA, wolfCOSE, wolfHAL, wolfIP |
-| `docs/` | the published wiki pages |
+| `docs/` | the version-controlled manual source, with navigation in `mkdocs.yml` |
[docs/Project-Structure.md](docs/Project-Structure.md) has the full map.
## Build
Needs GNU Make, Python 3, the `arm-none-eabi-` toolchain, a native C compiler
-for host tests, and the submodules. Some submodule URLs use GitHub SSH.
+for host tests, and the submodules. Submodule URLs use public HTTPS.
```sh
git submodule update --init --recursive
@@ -73,7 +73,7 @@ targets report a skip, never a pass, without their emulator or board. See
workflows) makes it in the same PR and says why in the description.
- `docs/Ports.md` and the bug report's target list are generated: run
`python3 tools/gen-port-docs.py`, never edit them by hand.
-- `docs/` is published to the wiki: `tools/check-docs-no-internal-links.sh`
+- `docs/` is published as the manual: `tools/check-docs-no-internal-links.sh`
refuses internal ledgers and developer paths.
- Evidence is kept apart: a compile is not a test, a skip is not a pass, and
emulator results are never hardware results.
diff --git a/DOCS-BUILD.md b/DOCS-BUILD.md
new file mode 100644
index 000000000..71aecb6e2
--- /dev/null
+++ b/DOCS-BUILD.md
@@ -0,0 +1,97 @@
+# Building and publishing the wolfTrust manual
+
+`docs/` is the manual source. `mkdocs.yml` defines the page order and
+navigation. The adapter in `tools/docs_manual.py` passes those pages to the
+shared MkDocs theme and Pandoc/LaTeX PDF rules in
+[`wolfSSL/documentation`](https://github.com/wolfSSL/documentation). Keep manual
+content and its navigation in wolfTrust; generated files stay under `build/`.
+
+Keep documentation links in `README.md` pointed at the source pages under
+`docs/`. Within the manual, use relative links to other manual pages so the
+same source works on GitHub and in generated HTML and PDF. Link source files
+outside `docs/` to their location in the wolfTrust GitHub repository.
+
+Every top-level Markdown page in `docs/` must appear exactly once in
+`mkdocs.yml`. Add new guides and other pages to the README and manual index
+too. The adapter refuses missing or duplicate navigation entries; strict
+MkDocs builds check the generated HTML links, and PDF preparation checks
+manual heading references. The PDF layout reserves wider number columns
+for multi-digit subsection labels and limits image height to leave room for
+captions above the footer.
+
+## Local build
+
+Clone the documentation build tools at the revision used by wolfTrust CI:
+
+```sh
+git clone https://github.com/wolfSSL/documentation.git build/documentation
+git -C build/documentation checkout --detach "$(cat tools/docs-manual/documentation-rev)"
+git -C build/documentation submodule update --init --recursive
+docker build --pull -t wolftrust-docs:local docker/docs
+docker run --rm --user "$(id -u):$(id -g)" --env HOME=/tmp \
+ --mount "type=bind,source=$PWD,target=/work/wolfTrust" \
+ --workdir /work/wolfTrust wolftrust-docs:local \
+ python3 tools/docs_manual.py build \
+ --documentation-root /work/wolfTrust/build/documentation \
+ --source-root /work/wolfTrust --target all
+```
+
+The outputs are `build/documentation/wolfTrust/html/` and
+`build/documentation/wolfTrust/wolfTrust-Manual.pdf`. The container includes
+MkDocs, Pandoc, LaTeX, and the fonts used by the shared build rules. On a
+wolfTrust pull request, `docs-site.yml` checks out the pinned documentation
+revision, builds both outputs, runs MkDocs in strict mode, and uploads them
+as one artifact. It also runs after documentation changes merge to `main`.
+CI pulls the versioned builder image from GHCR, or builds it from
+`docker/docs/` if that image is unavailable. No host package installation or
+website credentials are needed for this check.
+
+For an HTML preview, first run the build above, then run:
+
+```sh
+docker run --rm --user "$(id -u):$(id -g)" --env HOME=/tmp -p 8000:8000 \
+ --mount "type=bind,source=$PWD,target=/work/wolfTrust" \
+ --workdir /work/wolfTrust/build/documentation/wolfTrust \
+ wolftrust-docs:local mkdocs serve -a 0.0.0.0:8000 -f mkdocs.yml
+```
+
+The architecture diagram is maintained in `docs/assets/architecture.mmd`.
+Regenerate its static image after editing it so HTML and PDF show the same
+labels:
+
+```sh
+npx --yes @mermaid-js/mermaid-cli@12.0.0 \
+ -i docs/assets/architecture.mmd \
+ -o docs/assets/architecture.png \
+ -b white -c docs/assets/architecture.config.json -s 2
+```
+
+## Website update
+
+The planned public locations are:
+
+- [Full wolfTrust manual (HTML)](https://www.wolfssl.com/documentation/manuals/wolftrust/)
+- [wolfTrust Manual (PDF)](https://www.wolfssl.com/documentation/manuals/wolftrust/wolfTrust-Manual.pdf)
+
+These links become the public copies after the integration and website upload
+are enabled. Before then, `docs/` and the `wolftrust-manual` CI artifact are
+the available documentation.
+
+The one-time integration in `wolfSSL/documentation` adds a `wolfTrust` manual
+target beside wolfBoot and wolfHSM
+([documentation PR #283](https://github.com/wolfSSL/documentation/pull/283)).
+It clones `wolfSSL/wolfTrust` **main**, runs
+the adapter from that checkout, and exports `wolfTrust-html/` and
+`wolfTrust-Manual.pdf` through the documentation repository's existing Docker
+build. Merge the wolfTrust adapter before that integration so its source is
+available on `main`.
+
+After both changes are merged, the existing nightly documentation build should
+pick up `wolftrust` through the documentation repository's `all` target. No
+manual trigger is needed for the normal update. Check the first nightly result
+at `https://www.wolfssl.com/documentation/manuals/wolftrust/` and its
+`wolfTrust-Manual.pdf`. The website upload rules are outside these public
+repositories; if the nightly publishes an explicit list of manuals instead of
+all build output, that list will need a one-time addition. Subsequent merged
+wolfTrust documentation changes are read from wolfTrust `main` on the next
+nightly run. Pull requests only build review artifacts.
diff --git a/README.md b/README.md
index 41af99bd6..a3a22b06d 100644
--- a/README.md
+++ b/README.md
@@ -7,13 +7,10 @@ common runtime provides interprocess communication (IPC) through the Arm
Platform Security Architecture (PSA) Firmware Framework for M (FF-M), manifest
policy, lifecycle management, scheduling, fault recovery, and PSA services.
-The only currently supported and validated reference implementation combines
-the Armv8-M adapter with the STM32H563 Cortex-M33 port. Support for additional
-Cortex-M ports is an intended extension point. Such ports may reuse the common
-runtime and, where applicable, the Armv8-M layer. Cortex-A support is an
-architectural goal, not a current capability. It will require a new adapter and
-changes to current internal execution and protection contracts; the design goal
-is to preserve the public manifest, service, IPC, and PSA API contracts.
+The Armv8-M adapter supports STM32H563, MIMXRT700, MCXN947, and STM32L562.
+They share the core runtime and architecture layer, with different device
+security controls, crypto-engine support, and validation coverage. See
+[Ports and supported targets](docs/Targets.md).
## Architecture
@@ -29,7 +26,7 @@ flowchart TB
subgraph PORT[Architecture and target ports]
GW[Client gateway
current: five Armv8-M CMSE veneers]
ARCH[Architecture adapter
current: Armv8-M]
- TARGET[Target and board port
current: STM32H563]
+ TARGET[Target and board port
STM32H563, MIMXRT700, MCXN947, or STM32L562]
GW --- ARCH
ARCH --- TARGET
end
@@ -37,7 +34,7 @@ flowchart TB
subgraph WT[wolfTrust policy and service runtime]
SPM[Secure Partition Manager
policy, identity, IPC, scheduling, lifecycle, recovery]
subgraph SP[Secure services]
- CR["Cryptography and hardware
security module (HSM)"]
+ CR["Secure crypto
PSA Crypto service or wolfHSM server"]
ST["Internal Trusted Storage (ITS),
Protected Storage, and vault"]
AT[Initial Attestation]
FW[Optional Firmware Update]
@@ -51,8 +48,8 @@ flowchart TB
end
subgraph LIBS[wolfSSL ecosystem components]
- PSA[wolfPSA
guest wolfCrypt and wolfHSM client]
- WC[Secure wolfCrypt and wolfHSM]
+ PSA[PSA Crypto front end
FF-M client or guest-local wolfPSA]
+ WC[Secure wolfCrypt
optional wolfHSM server]
COSE[wolfCOSE]
HAL[wolfHAL]
IP[wolfIP
optional bare-metal reference networking]
@@ -64,8 +61,8 @@ flowchart TB
GA -->|PSA Crypto| PSA
GB -->|PSA Crypto| PSA
PSA -->|protected operations over FF-M| GW
- GA -->|optional networking| IP
- GB -->|optional networking| IP
+ GA -->|bare-metal VNET guest only| IP
+ GB -->|bare-metal VNET guest only| IP
IP -->|VNet service over FF-M| GW
GW -->|validated requests| SPM
SPM -->|Secure execution operations| ARCH
@@ -77,13 +74,17 @@ flowchart TB
TARGET -->|current register and RNG access| HAL
```
+The optional wolfIP/VNET reference uses separate bare-metal guests, not the
+Zephyr and FreeRTOS PSA guest pair.
+
### Current reference port
On the STM32H563 reference chain, wolfBoot authenticates wolfTrust, Armv8-M
TrustZone isolates the Secure runtime from Non-secure guests, and STM32 Global
TrustZone Controller (GTZC) memory attribution isolates guest RAM. Zephyr and
-FreeRTOS reference guests use wolfPSA's PSA Crypto API through five Cortex-M
-Security Extensions (CMSE) gateway veneers. Those mechanisms describe the
+FreeRTOS reference guests call the Secure PSA Crypto service through the
+Cortex-M Security Extensions (CMSE) gateway. The Secure side meets PSA FF-M
+isolation level 3 ([Security Model](docs/Security-Model.md#ff-m-isolation-level-3)). Those mechanisms describe the
current reference port, not a requirement imposed on every intended port.
## Ports
@@ -100,25 +101,23 @@ engines, scenarios and hardware fixture.
## Quick start
For the initial Secure build and host tests, install GNU Make, Python 3, Git, a
-native C compiler, and an `arm-none-eabi-` toolchain. Configure GitHub SSH
-access before cloning because three configured submodule URLs use SSH. Guest
-setup, conformance tests, emulator runs, and fresh hardware builds require
-network access. See [Getting Started](docs/Getting-Started.md) for additional
-emulator and hardware prerequisites.
-
-The repository currently requires authorized GitHub access.
+native C compiler, and an `arm-none-eabi-` toolchain. The repository and its
+submodules use public HTTPS URLs; GitHub SSH setup is not required. Guest
+builds also need CMake and Ninja; target tests need M33MU or a provisioned
+NUCLEO-H563ZI with ST-Link, and the published hardware workflow uses Docker.
+These workflows may fetch dependencies on first use. See
+[Getting Started](docs/Getting-Started.md) for the full prerequisites.
```sh
git clone --recurse-submodules https://github.com/wolfSSL/wolfTrust.git
cd wolfTrust
-git submodule update --init --recursive
make
make test
```
The Secure build produces `build/wolftrust.elf`,
`build/wolftrust.bin`, and `build/secure_cmse_implib.o`. `make` builds the
-`default` profile: isolation level 3, one Non-secure guest, and the Crypto,
+`default` profile: isolation level 3, one Non-secure guest, and the Secure PSA Crypto,
ITS, Protected Storage and attestation services. Add-ons such as a second
guest (`WT_MAX_GUESTS=2`) or firmware update (`WT_FWU=1`) are one Make
variable each; see [Build profiles](docs/Macros.md#build-profiles).
@@ -142,6 +141,7 @@ make test
make test-target
make test-target TARGET=mimxrt700
make test-target TARGET=mcxn947
+make test-target TARGET=stm32l562
make test-conformance
make test-hardware TARGET=stm32h563
make test-hardware TARGET=mcxn947
@@ -151,8 +151,9 @@ make test-hardware TARGET=mcxn947
every scenario): the STM32H563 default skips explicitly when M33MU is
unavailable, and `TARGET=mimxrt700` or `TARGET=mcxn947` builds its pinned
emulator and wolfBoot first stage itself.
-`make test-conformance` instead runs its 20-test host subset and warns that it
-is not full emulator or hardware evidence. `make test-hardware` skips when
+`make test-conformance` runs the pinned FF-M IPC suite under M33MU when
+available. It falls back to a 20-test host subset with an explicit notice.
+See [Testing](docs/Testing.md) for the scope of each result. `make test-hardware` skips when
board detection fails; on hosts without `lsusb`, a missing ST-Link can instead
surface as a flash failure. The hardware target can flash and reset the
connected board. When the probe host has no cross toolchain, the published
@@ -161,7 +162,7 @@ host (`flash`) out of the same checkout.
## Documentation
-The version-controlled documentation in [`docs/`](docs/) is the primary
+The version-controlled documentation in [`docs/`](docs/index.md) is the primary
documentation source:
- [Getting Started](docs/Getting-Started.md)
@@ -170,17 +171,31 @@ documentation source:
- [Threat Model](docs/Threat-Model.md)
- [API Reference](docs/API-Reference.md)
- [Services](docs/Services.md)
-- [TF-M Compatibility](docs/TF-M-Compatibility.md)
+- [Standards and Claims](docs/Standards.md)
+- [FF-M Compatibility](docs/FF-M-Compatibility.md)
+- [PSA Compatibility](docs/PSA-Compatibility.md)
+- [Application Interface Profiles](docs/Interface-Profiles.md)
+- [Firmware TPM](docs/TPM.md) and [PKCS#11](docs/PKCS11.md)
- [Macros](docs/Macros.md)
- [Footprint](docs/Footprint.md)
+- [Footprint Comparison](docs/Footprint-Comparison.md)
+- [Crypto Engines](docs/Crypto-Engines.md)
- [Porting](docs/Porting.md)
- [Building](docs/Building.md)
- [Testing](docs/Testing.md)
- [Provisioning](docs/Provisioning.md)
- [Project Structure](docs/Project-Structure.md)
+- [Ports and supported targets](docs/Targets.md)
+- [Registered Ports](docs/Ports.md)
- [STM32H5 Guide](docs/STM32H5-Guide.md)
- [MIMXRT700 Guide](docs/MIMXRT700-Guide.md)
- [MCXN947 Guide](docs/MCXN947-Guide.md)
+- [STM32L562 Guide](docs/STM32L562-Guide.md)
+- [Coding Standard](docs/Coding-Standard.md)
+
+Once published, the [full wolfTrust manual](https://www.wolfssl.com/documentation/manuals/wolftrust/)
+will provide HTML documentation and a downloadable PDF. Until then, use the
+pages above or the manual artifacts attached to documentation CI runs.
The source tree is authoritative:
@@ -191,8 +206,10 @@ The source tree is authoritative:
| `port/` | Target policy, memory layout, flash, entropy, and hardware enforcement |
| `mk/` | Build configuration and linked-image checks |
-When enabled, the GitHub wiki is generated from the Markdown sources in
-`docs/`.
+`mkdocs.yml` defines the manual navigation. The shared
+[`wolfSSL/documentation`](https://github.com/wolfSSL/documentation) tooling
+builds HTML and PDF from these pages. [DOCS-BUILD.md](DOCS-BUILD.md) explains
+local previews and how merged changes reach the website.
## License
diff --git a/docker/docs/Dockerfile b/docker/docs/Dockerfile
new file mode 100644
index 000000000..319d8dd78
--- /dev/null
+++ b/docker/docs/Dockerfile
@@ -0,0 +1,15 @@
+FROM python:3.12-slim-bookworm
+
+LABEL org.opencontainers.image.source="https://github.com/wolfSSL/wolfTrust"
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+ bash git make patch perl \
+ pandoc texlive-xetex texlive-latex-extra texlive-fonts-recommended \
+ fonts-noto-core fonts-noto-mono lmodern \
+ && rm -rf /var/lib/apt/lists/*
+
+COPY requirements.txt /tmp/requirements-docs.txt
+RUN python -m pip install --no-cache-dir -r /tmp/requirements-docs.txt
+
+WORKDIR /work
diff --git a/docker/docs/requirements.txt b/docker/docs/requirements.txt
new file mode 100644
index 000000000..f2caded51
--- /dev/null
+++ b/docker/docs/requirements.txt
@@ -0,0 +1 @@
+mkdocs==1.6.1
diff --git a/docs/API-Reference.md b/docs/API-Reference.md
index 81a9d3629..41f00a059 100644
--- a/docs/API-Reference.md
+++ b/docs/API-Reference.md
@@ -3,7 +3,11 @@
This page describes the public client and Secure Partition interfaces present
in the repository. Header files are authoritative; algorithm availability in
PSA Crypto also depends on the selected wolfPSA and wolfCrypt build
-configuration.
+configuration. The default image provides Crypto, ITS, Protected Storage,
+and Initial Attestation; Firmware Update requires `WT_FWU=1`. See
+[FF-M Compatibility](FF-M-Compatibility.md) for the framework contract,
+[PSA Compatibility](PSA-Compatibility.md) for service deviations, and
+[Ports](Ports.md) for target capabilities.
## Table of Contents
@@ -31,7 +35,7 @@ configuration.
| Internal Trusted Storage | `include/psa/internal_trusted_storage.h` | 1.0 |
| Protected Storage | `include/psa/protected_storage.h` | 1.0 |
| Firmware Update | `include/psa/update.h` | 1.0 |
-| Initial Attestation | `lib/wolfPSA/wolfpsa/psa/initial_attestation.h` | 1.0 API operations; see [TF-M Compatibility](TF-M-Compatibility.md) for API and token-profile deviations |
+| Initial Attestation | `lib/wolfPSA/wolfpsa/psa/initial_attestation.h` | 1.0 API operations; see [PSA Compatibility](PSA-Compatibility.md) for API and token-profile deviations |
| Lifecycle | `include/psa/lifecycle.h` | FF-M 1.0, Secure Partition only |
| Gateway vector ABI | `include/wolftrust/ffm_veneer.h` | wolfTrust ABI |
@@ -88,10 +92,14 @@ struct psa_storage_info_t {
};
```
-Defined flags are `PSA_STORAGE_FLAG_NONE`,
-`PSA_STORAGE_FLAG_WRITE_ONCE`,
-`PSA_STORAGE_FLAG_NO_CONFIDENTIALITY`, and
-`PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION`.
+Defined flags are:
+
+```c
+PSA_STORAGE_FLAG_NONE
+PSA_STORAGE_FLAG_WRITE_ONCE
+PSA_STORAGE_FLAG_NO_CONFIDENTIALITY
+PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION
+```
### Firmware Update types
@@ -229,8 +237,10 @@ use may panic only that partition, after which the recovery policy applies.
wolfTrust vendors wolfPSA's PSA Crypto 1.4 header. The header is the complete
API contract; the functions below show the principal signatures used by the
reference guests. Declarations in the header do not guarantee implementation
-availability. The active `user_settings.h` controls which algorithms and
-optional extensions are built.
+availability. The Secure image's `WT_SECURE_PSA_PROFILE` selects the algorithms when it
+serves PSA Crypto. Guest-local builds select algorithms through the guest's
+wolfCrypt settings. See [Crypto Engines](Crypto-Engines.md) for profiles and
+engine-specific behavior.
### Initialization and key management
@@ -406,10 +416,12 @@ buffer, and its 24-byte request header caps one copied vault response at 1000
bytes. `data_offset` remains useful when the caller supplies an output buffer
smaller than the object. UID zero is invalid.
-The current ITS and Protected Storage paths always enforce
-`PSA_STORAGE_FLAG_WRITE_ONCE`, including during
-`PSA_ROT_PROVISIONING`. PSA Secure Storage 1.0 requires that flag not to be
-enforced in the provisioning lifecycle, so this is a known lifecycle deviation.
+The ITS path enforces `PSA_STORAGE_FLAG_WRITE_ONCE` when the caller sets it,
+including during `PSA_ROT_PROVISIONING`. Objects created without the flag can
+be updated or removed. PSA Secure Storage 1.0 section 3.2 requires ITS not to enforce
+the flag in the provisioning lifecycle, so this is a known lifecycle deviation.
+Protected Storage also enforces caller-selected `WRITE_ONCE`; section 3.2's lifecycle
+exception applies to ITS.
## Protected Storage
@@ -492,14 +504,15 @@ psa_status_t psa_initial_attest_get_token_size(
```
Accepted challenge sizes are 32, 48, and 64 bytes. The token is a tagged
-COSE_Sign1 object using ES256. The implementation limit is 640 bytes, although
+COSE_Sign1 object using ES256 with the default P-256 attestation key, or
+COSE_Mac0 with `WT_ATTEST_KEY=hmac`. The implementation limit is 640 bytes, although
the vendored public header does not currently define
`PSA_INITIAL_ATTEST_MAX_TOKEN_SIZE`. The size query returns the exact encoded
size without producing a signature. An undersized token buffer returns
`PSA_ERROR_BUFFER_TOO_SMALL`, including a non-NULL buffer with zero capacity.
The token advertises `tag:psacertified.org,2023:psa#tfm` but has the
-token-profile deviations listed in [TF-M Compatibility](TF-M-Compatibility.md) and must not be
+token-profile deviations listed in [PSA Compatibility](PSA-Compatibility.md) and must not be
represented as conformant with that profile. The only working Non-secure
attestation adapter currently resides at
`tests/firmware/zephyr-stm32h5/module/wolftrust-tee/src/wolftrust_attestation_client.c`.
@@ -589,4 +602,4 @@ vector layout is in `include/wolftrust/ffm_veneer.h`, and
| `PSA_ERROR_INSUFFICIENT_POWER` | -161 | Power is insufficient for the operation |
For service availability and deviations, see [Services](Services.md) and
-[TF-M Compatibility](TF-M-Compatibility.md).
+[PSA Compatibility](PSA-Compatibility.md).
diff --git a/docs/Architecture.md b/docs/Architecture.md
index 3aa5139df..401441d4c 100644
--- a/docs/Architecture.md
+++ b/docs/Architecture.md
@@ -7,12 +7,10 @@ Secure service dispatch. Architecture and target ports provide the execution,
memory-protection, interrupt, storage, entropy, and boot mechanisms needed to
enforce that policy.
-The only currently supported and validated reference implementation combines
-the Armv8-M adapter with the STM32H563 port. Its default configuration runs
-one Non-secure guest on one Cortex-M33 (two with `WT_MAX_GUESTS=2`, as the
-`extended` build profile does) and exposes Secure services only through FF-M IPC. These are current reference-port choices. The common policy and
-service design is intended for reuse, but current internal contracts still
-contain Armv8-M-specific types and assumptions.
+The Armv8-M adapter runs on STM32H563, STM32L562, MCXN947 and
+MIMXRT700. The STM32H563 is the reference port. A default build runs one
+Non-secure guest, with a second guest available through `WT_MAX_GUESTS=2`.
+See [Supported targets](Targets.md) for the validation scope of each port.
## Software stack
@@ -20,38 +18,42 @@ contain Armv8-M-specific types and assumptions.
| --- | --- |
| wolfBoot | Performs the BL2 secure-boot role, authenticates wolfTrust, passes the measured-boot handoff, and swaps authenticated update images. |
| wolfTrust | Configures isolation, validates the manifest at build time and the guest images at boot, schedules guests and Secure Partitions, implements FF-M IPC, and manages lifecycle and recovery. |
-| wolfPSA | Implements PSA Crypto entry points over wolfCrypt: in the crypto partition by default (`WT_SECURE_PSA=1`), or in the Non-secure guests with `WT_SECURE_PSA=0` or the wolfHSM engine. |
+| wolfPSA | Implements PSA Crypto entry points over wolfCrypt: in the crypto partition when `WT_SECURE_PSA=1`, or in the Non-secure guests with `WT_SECURE_PSA=0`. See [Target defaults](Macros.md#target-defaults). |
| wolfCrypt | Supplies cryptographic implementations used by wolfPSA and Secure services. The native engine dispatches it directly and, by default, backs wolfPSA in the crypto partition. |
| wolfHSM | Optional crypto engine providing the client/server key-management model and external-HSM integration path. Both engines use its NVM object-store subset. |
-| wolfCOSE | Encodes and signs COSE_Sign1 attestation tokens. |
+| wolfCOSE | Encodes attestation tokens as COSE_Sign1 with P-256 signatures or COSE_Mac0 with HMAC-SHA256. |
| wolfIP | Supplies the TCP/IP stack for the optional bare-metal reference guests; the Secure virtual Ethernet switch itself is implemented by wolfTrust. |
## Portability boundary
-Most policy and service code lives under `src/` outside `src/arch/`, but the
-current internal contracts still expose Armv8-M exception-frame and
-MPU-oriented types. `src/arch/armv8m/` supplies the CMSE gateway and pointer
-checks, Secure Partition coroutine switching, and the Secure SVC transport.
-The companion `port/stm32h563/` supplies device startup and guest exception
-paths, context handling, GTZC attribution, guest and Secure MPU programming,
-interrupt routing, flash, entropy, timers, and boot handoff.
+The architecture-neutral SPM core lives in `src/spm/core.c`. It reads
+the generated service, partition and IRQ policy and owns connection slots,
+messages, signals, and copied transfers. Service implementations live under
+`src/services/`.
+`src/arch/common/` supplies the shared SPM gate, scheduling, recovery, and PSA
+API bodies over `wolftrust/arch.h`. `src/arch/armv8m/` supplies CMSE checks,
+context switching, exception handling, timers, SAU/MPU programming, and the
+Secure SVC transport.
+
+`port/common/armv8m/` supplies the shared platform skeleton, partition tables,
+isolation-band layout, and linker script. Each `port//` supplies its
+registered device facts, memory map, fabric-attribution hooks, flash and RNG
+drivers, and target-specific checks. Manifests are rendered from the shared
+template under the selected build layout.
Additional Cortex-M ports may reuse the existing interfaces when their
-execution and protection models match. Cortex-A support is an architectural
-goal, not a current capability. It will require a new adapter and changes to
-current internal execution and protection contracts; the design goal is to
-preserve the public manifest, service, IPC, and PSA API contracts. See
-[Porting](Porting.md) for the current boundary.
+execution and protection models match. See [Porting](Porting.md) for the
+current boundary.
## Boot flow
1. wolfBoot verifies the wolfTrust image and transfers a measured-boot record
containing the Secure image measurement, lifecycle, and active image
version.
-2. wolfTrust configures the target's TrustZone, GTZC, Secure MPU, interrupt,
- and memory policies; binds the generated manifest, which the build has
- already validated against the port's capabilities; registers
- the FF-M services; seeds each guest context; and performs an initial
+2. wolfTrust configures the target's TrustZone, fabric attribution, Secure MPU, interrupt,
+ and memory policies, then binds the service and guest rows that the
+ manifest generator validated against the port's capabilities. It seeds
+ each guest context and performs an initial
signed-record, image-size, manifest-version, digest, and optional WRP check.
3. wolfTrust consumes the measured-boot handoff, initializes the selected
[crypto engine](Crypto-Engines.md) and shared persistent vault backend, and
@@ -61,7 +63,7 @@ preserve the public manifest, service, IPC, and PSA API contracts. See
all are idle. A partition that faults, or stops anywhere but `psa_wait`,
refuses boot.
5. Before an accepted guest's first dispatch, the monitor installs that
- guest's active GTZC, Non-secure MPU, and interrupt policy. With two guests
+ guest's fabric attribution, Non-secure MPU, and interrupt policy. With two guests
(`WT_MAX_GUESTS=2`) it first repeats its signed-record, image-size,
manifest-version, digest, and optional WRP checks, because the other guest
may have run in between.
@@ -85,24 +87,37 @@ The reference port combines several mechanisms:
- CMSE checks require every request pointer to be Non-secure and inside the
active guest's declared readable or writable window.
- The Secure MPU gives each Secure Partition thread shared read/execute image
- text, read-only constants, its private stack and data, and only its declared
- shared resources.
+ text, read-only constants, and its own stack and data band. Together these
+ meet FF-M isolation level 3; see
+ [Security Model](Security-Model.md#ff-m-isolation-level-3).
All shipped service loops are scheduled as unprivileged Secure coroutines.
Operations requiring wider Secure access, including flash programming, entropy,
NVM locking, and platform reset, trap through privileged SVC handlers that
verify the calling partition and operation.
-The single-image design shares executable text among Secure Partitions. The
-MPU isolates writable state, not code identity; this is an explicit difference
-from separately linked partition images.
-
Both guest images share one Non-secure flash attribution window, so a privileged
guest can read peer flash. Hardware write protection (STM32 WRP or the
MIMXRT700 guest fence) plus `WT_GUEST_FLASH_WRP=1` protects guest-flash
integrity but not confidentiality. Peripheral and Non-secure NVIC attribution
are deployment responsibilities; see [Threat Model](Threat-Model.md).
+## Generated policy and runtime state
+
+The build renders `manifest/base.json` and the selected overlay using the
+same memory map as the linker and ports. The generator validates the layout
+and writes constant service, partition, interrupt, and memory rows. The
+SPM uses those rows directly. They include service IDs and versions,
+Non-secure access, Secure Partition dependencies and signal masks, and
+the memory windows for each guest. Partition entry wrappers remain
+explicitly linked in the Secure image.
+
+The descriptive manifest is linked when `WT_MANIFEST_RUNTIME_CHECK=1`.
+That option also validates the manifest and its port binding at boot. The
+link-time placement checks and the enforcement of generated policy run in
+every build. See [Manifest generation](Building.md#manifest-generation)
+for the inputs and outputs.
+
## FF-M request path
A Non-secure client calls a standard PSA API or the generic FF-M client API:
@@ -128,7 +143,12 @@ adds its length to that guest's interrupt latency.
An entry that still arrives while another is in flight means that mask failed,
and the gateway stops the system rather than re-enter the core. Handles carry
ownership and generation state, and the SPM rejects stale, cross-owner, or invalid
-transitions.
+transitions. The core keeps one static slot per open connection and
+uses the same slot for its connect, call, and close messages. Only calls
+take a buffer from the shared transfer pool. The connection and message
+handles carry separate generations so a recycled slot can reject stale
+handles. The [FF-M compatibility register](FF-M-Compatibility.md#framework-differences)
+covers resource limits and fault cleanup.
The link step runs `arm-none-eabi-nm` and requires exactly five
Non-secure-callable symbols:
@@ -146,7 +166,7 @@ fails the build.
Connection-based services use `psa_wait`, `psa_get`,
`psa_read`, `psa_write`, and `psa_reply`. Each
-service has a statically allocated coroutine stack and blocks until its signal
+Secure Partition has a statically allocated coroutine stack and blocks until its signal
or interrupt is ready. The dispatcher continues running ready partitions until
the system is quiescent, which permits partition-to-partition IPC without
executing one partition on another partition's stack.
diff --git a/docs/Building.md b/docs/Building.md
index ff12c4214..318312836 100644
--- a/docs/Building.md
+++ b/docs/Building.md
@@ -1,10 +1,14 @@
# Building
-The supported Secure build tuple is Armv8-M on STM32H563. The root Makefile
-includes `mk/target-stm32h563.mk`, `mk/layout.mk`, `mk/arch-armv8m.mk`, and
-`mk/common.mk` (target facts, the resolved layout configuration, architecture
-facts, and the shared build in that order) and cross-compiles a freestanding
-Cortex-M33 image.
+The Secure build supports the Armv8-M ports listed in [Ports](Ports.md):
+STM32H563 (the default), MIMXRT700, MCXN947, and STM32L562. Select one with
+`TARGET=`. The root Makefile includes `mk/profile.mk`, `mk/target-.mk`,
+`mk/layout.mk`, `mk/arch-armv8m.mk`, and
+`mk/common.mk` (profile defaults, target facts, the resolved layout,
+architecture facts, and the shared build in that order) and cross-compiles a freestanding
+Cortex-M33 image. STM32L562 supports only `WT_ENGINE=native`; the other ports
+also support `WT_ENGINE=hsm`. Board guides describe each port's prerequisites
+and memory layout.
## Prerequisites
@@ -14,8 +18,8 @@ Cortex-M33 image.
- GNU Arm Embedded tools with the `arm-none-eabi-` prefix
- a native C compiler for host tests
-Some submodule URLs use GitHub SSH. Configure GitHub SSH access or an
-equivalent Git URL rewrite before initializing them.
+Submodules use public HTTPS URLs. An existing checkout with older URLs should
+run `git submodule sync --recursive` first.
```sh
git submodule update --init --recursive
@@ -47,19 +51,23 @@ make WT_FWU=1 secure-image # PSA Firmware Update
make WT_MANIFEST_RUNTIME_CHECK=1 secure-image # boot-time manifest check
make WT_SHA256_FAST=1 secure-image # unrolled SHA-256 transform
make WT_ENGINE=hsm secure-image # the wolfHSM engine
-make WT_PROFILE=extended secure-image # every add-on, extended PSA set
+make WT_PROFILE=extended secure-image # two guests, FWU, boot manifest check, fast SHA-256
make WT_PROFILE=small secure-image # one AEAD, no AES decryption
-make WT_PROFILE=tiny secure-image # no ECC: HMAC attestation key, no vault P-256
+make WT_PROFILE=tiny secure-image # native HMAC attestation, vault P-256 and restart off
```
-[Macros](Macros.md#build-profiles) lists what each add-on brings back and its
-measured cost.
+[Target defaults](Macros.md#target-defaults) and [Build profiles](Macros.md#build-profiles)
+list the values Make selects, the exclusions, and the cost of each add-on.
-The default uses the native crypto engine. Keep separate output directories
-when comparing or retaining both engine builds:
+The native engine is the default. It serves PSA Crypto from the Secure
+image on STM32H563, MIMXRT700 and MCXN947. STM32L562 sets
+`WT_SECURE_PSA=0` by default to keep PSA Crypto in the guest. Use the same
+engine and PSA placement for the Secure image and every guest. Keep separate
+output directories when comparing builds.
```sh
make secure-image WT_ENGINE=native BUILD_DIR=build-native
+make secure-image WT_SECURE_PSA=0 BUILD_DIR=build-guest-local-psa
make secure-image WT_ENGINE=hsm BUILD_DIR=build-hsm
```
@@ -102,23 +110,31 @@ The manifest is rendered into the build directory from the shared template
`manifest/base.json` under the build's layout configuration
(`tools/manifest/render.py`, `WT_LAYOUT_CFLAGS`), so every address and size
in it is the port's `memory_map.h` value for that build. `CONFIG_VNET=y`
-applies the `manifest/vnet.json` overlay and `WT_CONFORMANCE=1` the
-`manifest/conformance.json` overlay; a port registers the variants it
-supports in `port//port.json` (`build.variants`), and
-`build.variant_profiles` limits a variant to the profiles its layout fits.
+applies `manifest/vnet.json`, `WT_CONFORMANCE=1` applies
+`manifest/conformance.json`, `CONFIG_TPM=y` applies `manifest/tpm.json`,
+and `CONFIG_PKCS11=y` applies `manifest/pkcs11.json`. A port registers
+variants in `port//port.json` under `build.variants`. The target
+test matrix also uses `build.variant_profiles` to select the profiles
+qualified for a variant.
```sh
make CONFIG_VNET=y WT_MAX_GUESTS=2
-make WT_CONFORMANCE=1
+make test-conformance TARGET=stm32h563
```
The generator is constrained to FF-M framework version `0x0100`,
feature mask `0x1` (connection-based IPC), and 32-bit addresses.
Unsupported capabilities or an invalid resource layout stop the build.
-The generator also checks the manifest against the port's
-`platform_caps.h` limits and each partition stack against the linked level 3
-layout. Without `WT_FWU=1` it leaves the update partition out
-(`--exclude-partition PARTITION_FWU`).
+The generator also checks the manifest against the shared Armv8-M
+`port/common/armv8m/platform_caps.h` limits, any port overrides, and each
+partition stack against the linked level 3
+layout. It emits constant rows for service access, Secure Partition
+dependencies, interrupts and guest memory. The SPM reads those rows in
+every image. `WT_MANIFEST_RUNTIME_CHECK=1` also links the descriptive
+manifest and validates it against the platform at boot. The boot-time isolation
+proofs run when that check is enabled or in the conformance build. Outside the
+conformance variant, `WT_FWU=0` removes `PARTITION_FWU` from the
+generated policy.
## Build controls
@@ -174,30 +190,25 @@ make -C tests/firmware/zephyr-stm32h5 \
build-guest0-psa build-freertos-guest1
```
-`WT_ENGINE` must match the Secure image and every guest image. The guest build
-scripts default to `native` and pass the same selector through the Secure and
-guest builds:
+Match both `WT_ENGINE` and `WT_SECURE_PSA` across the Secure image and
+guests. The STM32H563 wrappers default to the native engine with Secure PSA
+Crypto. Pass the settings on the Make command line to select a configuration.
```sh
-WT_ENGINE=native make -C tests/firmware/zephyr-stm32h5 \
+make -C tests/firmware/zephyr-stm32h5 WT_ENGINE=native WT_SECURE_PSA=1 \
build-guest0-psa build-freertos-guest1
-WT_ENGINE=hsm make -C tests/firmware/zephyr-stm32h5 \
+make -C tests/firmware/zephyr-stm32h5 WT_ENGINE=native WT_SECURE_PSA=0 \
+ build-guest0-psa build-freertos-guest1
+make -C tests/firmware/zephyr-stm32h5 WT_ENGINE=hsm \
build-guest0-psa build-freertos-guest1
```
-For a direct Zephyr configuration rather than the wrapper script:
-
-- native uses `CONFIG_WOLFTRUST_NATIVE_CLIENT=y` and
- `CONFIG_WOLFTRUST_WOLFHSM_CLIENT=n`; and
-- hsm uses `CONFIG_WOLFTRUST_WOLFHSM_CLIENT=y` and leaves
- `CONFIG_WOLFTRUST_NATIVE_CLIENT` disabled.
-
-The native Zephyr module links guest wolfCrypt plus
-`src/client/crypto_native_client.c`. The wolfHSM module instead links the
-wolfHSM client, crypto-callback glue, and
-`src/client/hsm_psa_transport.c`. The FreeRTOS
-`build_freertos_guest.sh` script makes the same source and preprocessor choice
-from its `WT_ENGINE` environment variable.
+In a direct Zephyr build, set `CONFIG_WOLFTRUST_NATIVE_CLIENT=y` for
+the native engine. Use `CONFIG_WOLFTRUST_SECURE_PSA=y` for the Secure PSA
+client and `CONFIG_WOLFTRUST_SECURE_PSA=n` for guest-local wolfPSA. For
+wolfHSM, set `CONFIG_WOLFTRUST_WOLFHSM_CLIENT=y` and disable the native
+client. The FreeRTOS wrapper selects the equivalent sources from
+`WT_ENGINE` and `WT_SECURE_PSA`.
This produces:
diff --git a/docs/Coding-Standard.md b/docs/Coding-Standard.md
index c394c0d6b..19092046e 100644
--- a/docs/Coding-Standard.md
+++ b/docs/Coding-Standard.md
@@ -1,8 +1,8 @@
# C Coding Standard
wolfTrust adheres to the wolfSSL coding standards and targets ISO C99, with
-project-specific no-`goto` and no-standalone-scope rules. The aim is to keep
-the code straightforward to assess in a future MISRA C:2023 or DO-178 process.
+project-specific no-`goto` and no-standalone-scope rules. These rules make the
+code easier to assess in a future MISRA C:2023 or DO-178 process.
These checks improve readiness; they are not a claim of MISRA compliance or
certification evidence.
diff --git a/docs/Crypto-Engines.md b/docs/Crypto-Engines.md
index a5751c26c..17e8b1b49 100644
--- a/docs/Crypto-Engines.md
+++ b/docs/Crypto-Engines.md
@@ -18,13 +18,13 @@ builds. That value is wolfTrust's validated policy profile.
| | Native crypto engine | wolfHSM engine |
| --- | --- | --- |
| Selector | `WT_ENGINE=native` (default) | `WT_ENGINE=hsm` |
-| Guest PSA Crypto | wolfPSA and wolfCrypt execute in the Secure image and the guest links only a client (default). With `WT_SECURE_PSA=0` they execute in the Non-secure guest and only DRBG seed requests cross into the Secure vault | wolfPSA routes supported operations through the wolfHSM client and `SERVICE_HSM` to a per-guest Secure wolfHSM server |
+| Guest PSA Crypto | The guest calls wolfPSA and wolfCrypt in the Secure image. With `WT_SECURE_PSA=0`, they execute in the Non-secure guest and request DRBG seed material from the Secure vault | wolfPSA routes supported operations through the wolfHSM client and `SERVICE_HSM` to a per-guest Secure wolfHSM server |
| Secure key service | Native request format dispatches wolfCrypt directly; explicitly vault-backed keys are NVM objects | wolfHSM request format dispatches the wolfHSM server and its keystore |
| Guest volatile PSA keys | Held in the Secure image, or in the guest's Non-secure memory with `WT_SECURE_PSA=0` | Keys for supported offloaded operations are held by the Secure wolfHSM server |
| Persistent Secure keys | Native vault objects marked `SENSITIVE` and `NONEXPORTABLE` | wolfHSM server-keystore objects with wolfHSM key policy |
| Attestation IAK | Vault-backed P-256 key used directly by wolfCrypt; with `WT_ATTEST_KEY=hmac`, the port's HMAC key held by the attestation partition | Committed wolfHSM server-keystore key |
| External HSM path | Not provided by this engine | Available through the wolfHSM server model when a deployment configures a backend; the reference build uses software wolfCrypt |
-| Secure-image footprint | Lower | Adds the wolfHSM protocol, server, per-guest contexts, and per-guest server stacks |
+| Secure-image footprint | Depends on PSA Crypto placement and profile | Adds the wolfHSM protocol, server, per-guest contexts, and per-guest server stacks |
By default the native engine serves all of PSA Crypto, its keys and its
operation state from the Secure image
@@ -54,9 +54,11 @@ SPM: caller identity + manifest policy + copied IOVECs
v
SERVICE_HSM protocol-opaque relay
|
- +-- WT_ENGINE=native --> native request --> wolfCrypt + vault key backend
+ +-- WT_ENGINE=native
+ | +-- native key request --> wolfCrypt + vault key backend
+ | `-- PSA request --> wolfPSA (WT_SECURE_PSA=1)
|
- `-- WT_ENGINE=hsm ----> wolfHSM packet --> per-guest wolfHSM server
+ `-- WT_ENGINE=hsm --> wolfHSM packet --> per-guest wolfHSM server
```
The binding is the `wt_hsm_relay_set_submit()` call in
@@ -135,12 +137,13 @@ The header and operation values are declared in
## PSA Crypto in the Secure image (`WT_SECURE_PSA=1`)
-The native engine's default, `WT_SECURE_PSA=1`, links wolfPSA into the
-crypto partition and serves the whole PSA Crypto API from the Secure image.
-The wolfHSM engine defaults to `0` and refuses `1`. The guest links `src/client/psa_crypto_client.c` in place of wolfPSA:
-each `psa_*` call becomes one or more `SERVICE_HSM` requests with operation
-`WT_CRYPTO_OP_PSA`, and no key, operation state or intermediate secret is
-held in Non-secure memory.
+`WT_SECURE_PSA=1` links wolfPSA into the native crypto partition. The
+profile controls which PSA Crypto operations it serves. The guest links
+`src/client/psa_crypto_client.c` and sends `WT_CRYPTO_OP_PSA` requests
+through `SERVICE_HSM`. The Secure service holds the key and operation
+state. PSA calls that export key material or return derived bytes copy
+that output back to the caller. The wolfHSM engine requires
+`WT_SECURE_PSA=0`.
`make WT_SECURE_PSA=0 secure-image` opts out, and a port can set
`WT_SECURE_PSA ?= 0` in its `mk/target-.mk` when its Secure RAM cannot
@@ -337,11 +340,11 @@ three reasons, in rough order of how often they apply:
the wolfHSM client wire (`wh_Client_CryptoCb`), where reworking the guest to
the native request format is not worth it.
-If none of those apply, prefer the native engine: it is smaller, keeps keys
-non-exportable in the vault, and needs no wolfHSM server. The wolfHSM engine
-adds this key-management and offload model on top of the same isolation
-boundary. The native engine is not a weaker FF-M gateway or a reduced-isolation
-build.
+Use the native Secure PSA configuration for a standard PSA client with
+Secure key and operation state. If Secure memory is limited, the native
+guest-local configuration uses the least Secure RAM. Both engines use
+the same FF-M gateway and isolation policy. See [Footprint](Footprint.md)
+for the costs of each configuration.
## Selecting the engine
@@ -360,7 +363,8 @@ engine. The legacy selector remains accepted:
| `WT_ENGINE_HSM=0` | `WT_ENGINE=native` |
| `WT_ENGINE_HSM=1` | `WT_ENGINE=hsm` |
-The Secure image and both guest images must use the same engine. See
+Use the same `WT_ENGINE` and `WT_SECURE_PSA` settings for the Secure
+image and its guests. See
[Building](Building.md) for the Zephyr and FreeRTOS guest settings.
## Measured Secure-image cost
@@ -423,7 +427,7 @@ of allocation headroom over the tested peak. It is not a precise high-water
measurement or a guarantee for different workloads. This is a fixed
allocation, not a heap or a claim that every run consumes all 10 KiB.
-See [TF-M Compatibility](TF-M-Compatibility.md) for the complete local
+See [Footprint Comparison](Footprint-Comparison.md) for the complete local
footprint comparison and methodology.
## Build invariants
@@ -433,10 +437,15 @@ Both engine builds enforce the following after linking:
1. `mk/arch-armv8m.mk` runs `arm-none-eabi-nm` and writes the complete symbol
list to `BUILD_DIR/nsc-syms.txt`.
2. The link check rejects any `__acle_se_*` symbol outside this exact `nm`
- set: `__acle_se_WolfTrust_FFM_FrameworkVersion`,
- `__acle_se_WolfTrust_FFM_ServiceVersion`,
- `__acle_se_WolfTrust_FFM_Connect`, `__acle_se_WolfTrust_FFM_Call`, and
- `__acle_se_WolfTrust_FFM_Close`.
+ set:
+
+ ```text
+ __acle_se_WolfTrust_FFM_FrameworkVersion
+ __acle_se_WolfTrust_FFM_ServiceVersion
+ __acle_se_WolfTrust_FFM_Connect
+ __acle_se_WolfTrust_FFM_Call
+ __acle_se_WolfTrust_FFM_Close
+ ```
3. A separate count check requires exactly five `__acle_se_*` symbols, so a
missing veneer also fails the build.
4. The same symbol list is searched for `malloc`, `free`, `calloc`,
diff --git a/docs/FF-M-Compatibility.md b/docs/FF-M-Compatibility.md
new file mode 100644
index 000000000..fb7b50a54
--- /dev/null
+++ b/docs/FF-M-Compatibility.md
@@ -0,0 +1,78 @@
+# FF-M Compatibility
+
+wolfTrust targets conformance with the [Arm Firmware Framework for M (FF-M)
+1.0 specification](https://documentation-service.arm.com/static/64a2ed35df6cd61d528c4132).
+It is an alternative Secure Partition Manager and services runtime for supported
+Cortex-M systems, with its own image, manifest, build, and port integration.
+The STM32H563 is the reference port; [Ports and supported targets](Targets.md)
+covers MIMXRT700, MCXN947, and STM32L562 as well. Framework compatibility is
+with the Arm specification; wolfTrust has its own SPM and does not require the
+Trusted Firmware-M (TF-M) runtime or build system.
+
+This page records the implemented FF-M 1.0 surface and known differences. It is
+not a full conformance statement. The [PSA Compatibility](PSA-Compatibility.md)
+page covers Crypto, Storage, Attestation, and Firmware Update APIs separately.
+
+## Arm specification sections
+
+| Contract | Normative section | wolfTrust scope |
+| --- | --- | --- |
+| Isolation and protection domains | [FF-M sections 3.1.1 to 3.1.6](https://documentation-service.arm.com/static/64a2ed35df6cd61d528c4132#page=21) | STM32H563 TrustZone, Secure MPU, and Global TrustZone Controller (GTZC) enforcement, meeting isolation level 3; see [Security Model](Security-Model.md#ff-m-isolation-level-3) |
+| Secure Partition identity, manifest, and execution | [FF-M sections 3.2.1 to 3.2.4](https://documentation-service.arm.com/static/64a2ed35df6cd61d528c4132#page=26) and [section 4.1](https://documentation-service.arm.com/static/64a2ed35df6cd61d528c4132#page=49) | Generated wolfTrust manifest policy, scheduled Secure Partition entry, and lifecycle handling |
+| IPC, handles, and copied vectors | [FF-M sections 3.3.1 to 3.3.5](https://documentation-service.arm.com/static/64a2ed35df6cd61d528c4132#page=31) | Connection-based services with fixed buffer and vector limits |
+| Client and Secure Partition APIs | [FF-M section 4.4](https://documentation-service.arm.com/static/64a2ed35df6cd61d528c4132#page=64) and [section 4.5](https://documentation-service.arm.com/static/64a2ed35df6cd61d528c4132#page=70) | Implemented functions and limitations are listed in the register below |
+
+## Implemented framework interfaces
+
+| API or behavior | Version | Status | Repository evidence |
+| --- | --- | --- | --- |
+| FF-M client API | 1.0 with the scoped deviations below | Connection-based IPC is implemented | `include/psa/client.h` and `src/client/psa_ffm_client.c` |
+| Secure Partition IPC API | FF-M 1.0 plus a wolfTrust-specific backport of `psa_irq_enable()` from [Arm's FF-M 1.1 Extension Beta, Issue 0](https://developer.arm.com/documentation/aes0039/latest) | Supported for scheduled IPC partitions. The production build accepts FF-M 1.0 IPC metadata and advertises framework version `0x0100`. See [SPM switches](Macros.md#spm-switches) for optional API trims. | `include/psa/service.h`, `include/psa/client.h`, `src/arch/common/spm_sp_api.c`, `tools/manifest/generate.py`, and `src/spm/core.c` |
+| Framework and service discovery | 1.0 | Supported | `psa_framework_version` and `psa_version` |
+| Copied input and output vectors | FF-M 1.0 | Supported, with at most four vectors total and a 1024-byte aggregate budget across input bytes and declared output capacity | `include/wolftrust/spm_core.h` and `src/spm/core.c` |
+| Manifest validation | wolfTrust format 1 | Validated at build time and compiled into constant policy rows. An optional boot check validates the descriptive manifest. | `manifest/base.json`, its overlays, `tools/manifest/render.py`, `tools/manifest/generate.py`, and `src/manifest.c` |
+| Secure Partition hardware IRQ routing | Port-specific | Conformance builds route the configured `WT_CONF_IRQ`. The shipped production manifests leave partition IRQs empty. | `mk/layout.mk` and `tools/manifest/generate.py` |
+| Root of Trust (RoT) lifecycle query | FF-M 1.0 | Secure Partition only; there is no Non-secure adapter or veneer | `include/psa/lifecycle.h` and `src/arch/common/spm_sp_api.c` |
+| Secure Partition signals and IRQ APIs | FF-M 1.0 plus one wolfTrust-specific beta-extension backport | The 1.0 signal APIs and `psa_eoi` are supported; only `psa_irq_enable()` is backported from the [FF-M 1.1 Extension Beta, Issue 0](https://developer.arm.com/documentation/aes0039/latest), while `psa_irq_status_t`, `psa_irq_is_enabled`, `psa_irq_disable`, and `psa_irq_restore` are absent | `include/psa/service.h` and the Armv8-M supervisor-call (SVC) implementation |
+| Guest identity | Multi-guest extension | [FF-M 1.0 client identification](https://documentation-service.arm.com/static/64a2ed35df6cd61d528c4132#page=38) specifies one negative ID for all Non-secure connections when the SPM assigns it. wolfTrust assigns guest `N` the ID `-(N + 1)` to keep each guest's storage and key namespaces separate. A single-guest build uses `-1`. | `src/arch/common/ffm_gateway.c` |
+
+## Framework differences
+
+| Difference | Classification | Reason and impact |
+| --- | --- | --- |
+| wolfTrust exposes the FF-M Non-secure client API through one five-function Cortex-M Security Extensions (CMSE) gateway. | Implementation detail | The gateway exports framework version, service version, connect, call, and close; Secure Partition entry points are a separate manifest concern. |
+| Only connection-based IPC services are enabled. | Scoped | The shared manifest requests only `WT_MANIFEST_FEATURE_IPC`. Secure Function (SFN) partitions, stateless services, memory-mapped I/O vectors, and framework versions newer than `0x0100` are rejected during production manifest generation. |
+| IPC uses fixed copied buffers. | Scoped safety bound | Calls are limited to four vectors and a 1024-byte transfer budget. Services apply smaller bounds. Applications must chunk larger data. |
+| A Non-secure connect, call, or close cannot remain pending after the scheduler reaches quiescence for that dispatch. | Scoped deviation | An incomplete message becomes a client error. If already claimed, the service retains its message until reply or partition fault; late output is discarded. A late call reply releases the message, but the connection remains in error until the client requests close. If close was already requested, the late reply allows deferred disconnection to proceed. Shipped Non-secure-facing services reply within the dispatch; Secure Partition callers use the begin/finish path when scheduling another partition is required. |
+| Connection slots and copied transfers are fixed pools. | Resource bound | The runtime has 16 connection slots, of which four are reserved for Secure clients, and an eight-slot limit per client. Connect and close use connection slots only. Calls need an available transfer. See [SPM switches](Macros.md#spm-switches) for defaults. |
+| Caller memory is checked before a transfer is allocated. | Implementation detail | A call with an inaccessible vector fails with `PSA_ERROR_PROGRAMMER_ERROR`, even when the transfer pool is full. |
+| Failed service replies can discard staged output. | Isolation behavior | A reply with `PSA_ERROR_PROGRAMMER_ERROR` publishes no output. A partition fault also discards its staged output when completing affected calls. |
+| Connection and message handles carry a generation per slot. | Implementation detail | Reused slots reject stale handles. When a client departs and its connections are reclaimed, its handles stop resolving immediately. A server that already holds a message may finish it, with the reply discarded. |
+| Secure services are linked in one image. | Scoped isolation difference | Service writable state is isolated by unprivileged threads and Secure MPU domains, but executable text is shared rather than separately linked. |
+| All shipped service loops run as scheduled coroutines. | Implementation difference | Service code uses the standard Secure Partition API; privileged hardware access goes through identity-pinned SVC gates. |
+| Abnormal Non-secure guest termination reclaims the guest's connections without delivering `PSA_IPC_DISCONNECT` to the affected services. | Scoped deviation | Fault-handler cleanup cannot dispatch a Secure service inline without re-entering the scheduler. Shipped services do not use `psa_set_rhandle()` for per-connection cleanup, but a ported service that depends on disconnect cleanup must account for this behavior. |
+| SPM resources use fixed pools. | Resource bound | The SPM can refuse work when its static slots or transfer buffers are exhausted. Individual services may allocate within private, bounded arenas. |
+| Manifests use wolfTrust JSON and generated C. | Integration difference | Security resources and services must be represented in the wolfTrust schema. |
+| Secure Partition entry functions are bound at build time instead of being selected by each manifest's `entry_point` field. | Integration difference | The numeric field validates an executable window, but adding a service also requires a compiled entry wrapper and an explicit start call in `wt_ffm_boot_start_sched()`. |
+| Service IDs are generated from the selected manifest. | Integration difference | Applications should include generated `psa_manifest/sid.h` instead of hard-coding target-specific values. |
+
+## Isolation level
+
+wolfTrust implements FF-M isolation level 3 only, and refuses a manifest that
+declares level 1 or 2 or a privileged Secure Partition. The rule-by-rule
+mapping and the deviations are in
+[Security Model](Security-Model.md#ff-m-isolation-level-3).
+
+## Validation and claim boundary
+
+`make test` exercises native framework policy, IPC, and negative inputs.
+`make test-conformance` runs the pinned PSA architecture tests: with M33MU it
+exercises target FF-M IPC; without M33MU it runs only a host subset. The
+STM32H563 hardware runner tests the reference boot chain and selected behavior
+on a provisioned board. See [Testing](Testing.md) for commands and the limits
+of each environment. The differences above prevent a full FF-M conformance
+claim today.
+
+See [API Reference](API-Reference.md) for the client and Secure Partition APIs,
+[PSA Compatibility](PSA-Compatibility.md) for service APIs, and
+[Footprint Comparison](Footprint-Comparison.md) for dated size measurements.
diff --git a/docs/Footprint-Comparison.md b/docs/Footprint-Comparison.md
new file mode 100644
index 000000000..250547804
--- /dev/null
+++ b/docs/Footprint-Comparison.md
@@ -0,0 +1,261 @@
+# Footprint Comparison
+
+These are recorded local measurements, not compatibility or certification
+claims. [Footprint](Footprint.md) documents the wolfTrust size accounting,
+build options, and per-port measurements; [FF-M Compatibility](FF-M-Compatibility.md)
+records the framework contract separately.
+
+## STM32L562 comparison
+
+Both runtimes were built for STM32L562E-DK at isolation level 3 with
+Arm GNU 15.2.1. The wolfTrust runtime was remeasured with the SPM rewrite merged in [PR #97](https://github.com/wolfSSL/wolfTrust/pull/97). The TF-M and bootloader rows retain
+their recorded measurements. See the
+[STM32L562 Guide](STM32L562-Guide.md#status) for board validation.
+
+| Image | Flash | Secure RAM |
+| --- | ---: | ---: |
+| wolfTrust Secure runtime, guest-local PSA Crypto | 61,880 bytes | 37,680 bytes |
+| TF-M v2.3.1 `tfm_s`, level 3 | 79,680 bytes | 45,728 bytes |
+| wolfBoot, STM32L5 secure application handoff | 27,216 bytes | 2,104 bytes |
+| TF-M BL2 (MCUboot, EC-P256) | 38,744 bytes | 27,408 bytes |
+| Chain: wolfBoot + wolfTrust | 89,096 bytes | |
+| Chain: BL2 + TF-M | 118,424 bytes | |
+
+The measured wolfTrust runtime uses 17,800 fewer bytes of flash and 8,048
+fewer bytes of Secure RAM. The flash totals add the two component images.
+Each runtime reuses its bootloader's RAM. The cross-compile workflow applies
+TF-M's budget to the native guest-local PSA build on every port, with a
+separate allowance for any RAM code band. See [Footprint](Footprint.md).
+
+Both builds run one Non-secure application and provide Crypto, Internal
+Trusted Storage, Protected Storage and Initial Attestation. TF-M also
+includes its platform service. TF-M's STM32L5 profile runs its PSA Root of
+Trust partitions privileged. wolfTrust runs every Secure Partition
+unprivileged with its own MPU regions.
+
+### Secure PSA Crypto
+
+TF-M serves PSA Crypto from a Secure partition. The STM32L562 wolfTrust
+row above runs PSA Crypto in its guest. The STM32H563 native `default`
+profile with Secure PSA Crypto measures 86,091 bytes of flash and 39,744
+bytes of reserved Secure RAM. That is 6,411 bytes more flash and 5,984 bytes
+less RAM than the TF-M STM32L562 build. The boards, storage implementations,
+and selected algorithms differ. [Crypto Engines](Crypto-Engines.md) gives
+the other profiles and their measured sizes.
+
+### Non-crypto split
+
+`tools/footprint/classify.py` splits a non-LTO map by category with one rules
+file per project (`tools/footprint/wolftrust.rules` and `tfm.rules`). Every
+flash byte lands in a category, `fill` or `linker`, so the categories sum to
+`text + data`, and an object no rule matches fails the run. Crypto is the
+crypto library, the crypto partition and its client, key loaders and entropy
+glue on both sides; attestation includes its CBOR and COSE libraries; storage
+includes the flash drivers and NV counters; guest is the Non-secure guest
+management (TF-M's NS agent).
+
+| Category | wolfTrust STM32H563 | TF-M STM32L562 |
+| --- | ---: | ---: |
+| SPM | 10,871 | 7,548 |
+| Storage | 17,096 | 13,156 |
+| Attestation | 6,231 | 5,585 |
+| Guest management | 4,720 | 176 |
+| Platform | 4,350 | 9,104 |
+| Runtime, fill, linker | 503 | 1,689 |
+| **Non-crypto total** | **43,771** | **37,258** |
+| Crypto | 45,085 | 42,422 |
+
+```sh
+make TARGET=stm32h563 WT_ENGINE=native WT_ATTEST_COSE=1 WT_LTO=0 secure-image
+python3 tools/footprint/classify.py build/wolftrust.map \
+ --rules tools/footprint/wolftrust.rules --elf build/wolftrust.elf --objects
+python3 tools/footprint/classify.py tfm_s.map --rules tools/footprint/tfm.rules \
+ --elf tfm_s.elf
+```
+
+The cross-compile workflow holds each port's non-crypto and SPM flash under
+the ceilings in its `port.json` (`build.noncrypto_max`, `build.spm_max`),
+lowered as size work lands.
+
+### Methodology
+
+Footprint is read from the linked Secure ELF and its map:
+
+```text
+Flash = text + data
+Secure RAM = all RAM the Secure image reserves, partition stacks included
+```
+
+- TF-M places every partition stack and the SPM stack in sections
+ (`.ER_TFM_SP_*_BSS`, `.msp_stack`), so `data + bss` from
+ `arm-none-eabi-size` is its whole reservation.
+- wolfTrust's level 3 partition stacks and data bands are linker regions with
+ no section in them, which `data + bss` leaves out. `tools/secure_ram.py`
+ (printed by `make size-report`) adds them from the map: the SPM's
+ `.data` + `.bss`, the SPM main stack, and every band and stack at its full
+ length.
+- Neither figure counts Secure RAM a port leaves free.
+
+- wolfTrust STM32L562 uses the native engine, LTO and one guest. Build
+ with `make TARGET=stm32l562 WT_SECURE_PSA=0 secure-image` in
+ `ghcr.io/wolfssl/wolfboot-ci-m33mu:v1.25`.
+- wolfBoot: `config/examples/stm32l5-tz-wolftrust.config` (ECC256, SHA256,
+ `WOLFBOOT_SECURE_APP=1`).
+- TF-M: v2.3.1, platform `stm/stm32l562e_dk`, `TFM_ISOLATION_LEVEL=3`,
+ `CMAKE_BUILD_TYPE=MinSizeRel`, the TF-PSA-Crypto Medium profile
+ (`crypto_config_profile_medium.h`) with asymmetric encryption off,
+ `TFM_PARTITION_FIRMWARE_UPDATE=OFF`, SPM and partition logging off,
+ `CRYPTO_HW_ACCELERATOR=OFF`, BL2 with EC-P256 signatures.
+
+## Historical cross-platform comparison
+
+This earlier comparison uses `data + bss` for static RAM, which excludes
+wolfTrust linker-only stack and band reservations. Its RAM figures are not
+comparable to the complete Secure RAM accounting above.
+
+This is a dated local comparison, not a standards-compatibility claim.
+The wolfTrust rows use the STM32H563 reference manifest with
+`isolation_profile` set to 3 and include Internal Trusted Storage, Protected
+Storage, Firmware Update, vault services, and CBOR Object Signing and
+Encryption (COSE) attestation. The TF-M rows are the standard Small, Medium,
+and Large profiles built for AN521. The table
+lists selected services, not every service in those profiles.
+
+| Secure image | Profile and selected services | Flash | Static RAM |
+| --- | --- | ---: | ---: |
+| wolfTrust native | wolfTrust profile 3; Crypto, Internal Trusted Storage, Protected Storage, Firmware Update, vault, COSE attestation | 86,848 bytes | 27,253 bytes |
+| wolfTrust wolfHSM | Same services plus the wolfHSM server | 106,432 bytes | 59,073 bytes |
+| TF-M Small | Level 1; Crypto, Internal Trusted Storage, Initial Attestation; Protected Storage and Firmware Update off | 50,968 bytes | 14,296 bytes |
+| TF-M Medium | Level 2; Crypto, Internal Trusted Storage, Protected Storage, Initial Attestation; Firmware Update off | 67,332 bytes | 42,468 bytes |
+| TF-M Large | Level 3; Crypto, Internal Trusted Storage, Protected Storage, Initial Attestation; Firmware Update off | 115,460 bytes | 45,756 bytes |
+
+In these builds, native wolfTrust uses about 25% less flash than TF-M Large
+and less static RAM than TF-M Medium while also including firmware update.
+The wolfHSM engine remains smaller in flash than TF-M Large but uses more
+static RAM because it adds per-guest server state and stacks. These results do
+not imply that the projects, platforms, or enabled feature sets are identical.
+
+### Historical methodology
+
+All five images were built on `wolf-prec5560` with
+`arm-none-eabi-gcc (15:13.2.rel1-2) 13.2.1 20231009`. The wolfTrust builds
+used `-Os` without link-time optimization (LTO); the cited historical commit
+predates the later `WT_LTO=1` default. The TF-M `MinSizeRel` builds also did
+not use LTO. Footprint was read from the linked Secure Executable and Linkable
+Format (ELF) with `arm-none-eabi-size` and calculated as:
+
+```text
+Flash = text + data
+Static RAM = data + bss
+```
+
+Reproduction requires Git, GNU Make, CMake, Python 3, the GNU Arm toolchain,
+and network access for source checkouts. The commands use POSIX shell syntax;
+see the [TF-M build instructions](https://tf-m.docs.trustedfirmware.org/en/latest/building/tfm_build_instruction.html)
+for its remaining host prerequisites.
+
+The wolfTrust rows were measured on 2026-09-18 from this wolfTrust commit:
+
+```text
+c8baa2681b8b1e2ec57e5720cba28519bb306ab3
+```
+
+It records the dependency revisions below. Later commits may produce
+different sizes.
+
+- **wolfCOSE** (`v2.0.0`):
+
+ ```text
+ f907071b10127f3ae2dd7719749a91b039ff04a1
+ ```
+
+- **wolfHSM** (`wolfHSM-v1.4.0-171-ga032315`):
+
+ ```text
+ a0323156606282448f00473a3fcb7aaa69361921
+ ```
+
+- **wolfIP** (`v1.0-91-g146de4b`):
+
+ ```text
+ 146de4b6362c3a076787e27332f50daa0a445cf5
+ ```
+
+- **wolfPSA** (`v5.9.1-129-g1b9ec29`):
+
+ ```text
+ 1b9ec29706bc63f785682ad688350195a33b22e8
+ ```
+
+- **wolfSSL** (`v5.9.1-stable-1088-g22e505bcf`):
+
+ ```text
+ 22e505bcfad8ce21067ee4232128728543767a95
+ ```
+
+- **wolfHAL** (no reachable tag):
+
+ ```text
+ 2bc2938b0bbcc977177153a7f38393710702bf70
+ ```
+
+To reproduce the wolfTrust snapshot, use a separate checkout at that commit.
+Its historical `.gitmodules` has SSH URLs for three submodules; the one-time
+Git URL rewrite below fetches them over HTTPS. All other build variables
+retain their repository defaults:
+
+```sh
+git clone https://github.com/wolfSSL/wolfTrust.git wolftrust-footprint
+cd wolftrust-footprint
+git checkout c8baa2681b8b1e2ec57e5720cba28519bb306ab3
+git -c 'url.https://github.com/.insteadOf=git@github.com:' \
+ submodule update --init --recursive
+make BUILD_DIR=build_size_native WT_ENGINE=native secure-image
+make BUILD_DIR=build_size_hsm WT_ENGINE=hsm secure-image
+arm-none-eabi-size build_size_native/wolftrust.elf \
+ build_size_hsm/wolftrust.elf
+```
+
+The measured wolfTrust files were the two `wolftrust.elf` outputs.
+
+The TF-M source was the `TF-Mv2.1.1-LTS` tag at this commit:
+
+```text
+02bf279913439a07082dd581df033f370a8fbb92
+```
+
+In a separate directory, clone and check out that revision; run the remaining
+commands from its source root. These AN521 GNU Arm builds enable BL2 and no
+regression tests:
+
+```sh
+git clone https://github.com/TrustedFirmware-M/trusted-firmware-m.git tf-m
+cd tf-m
+git checkout 02bf279913439a07082dd581df033f370a8fbb92
+git submodule update --init --recursive
+for profile in small medium large; do
+ cmake -S . -B "build_${profile}" \
+ -DTFM_PLATFORM=arm/mps2/an521 \
+ -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake \
+ -DTFM_PROFILE="profile_${profile}" \
+ -DCMAKE_BUILD_TYPE=MinSizeRel \
+ -DBL2=ON
+ cmake --build "build_${profile}" --parallel
+done
+arm-none-eabi-size build_small/bin/tfm_s.elf \
+ build_medium/bin/tfm_s.elf \
+ build_large/bin/tfm_s.elf
+```
+
+The measured TF-M file in each case was `tfm_s.elf`.
+
+Only the Secure runtime ELF is counted. wolfBoot and Non-secure wolfTrust
+guests are excluded; TF-M BL2 and its Non-secure application are likewise
+excluded. Although the TF-M configurations had `BL2=ON`, the separate BL2
+image is not part of `tfm_s.elf` and therefore is not in the table.
+
+The TF-M builds target AN521 while wolfTrust targets STM32H563, and their
+profiles do not enable the same services. Treat the table as a historical local
+comparison, not a platform-normalized benchmark. See
+[Crypto Engines](Crypto-Engines.md) for the measured cost within wolfTrust,
+where the platform and feature set are held constant.
diff --git a/docs/Footprint.md b/docs/Footprint.md
index e6b0f3901..cc14ef9e0 100644
--- a/docs/Footprint.md
+++ b/docs/Footprint.md
@@ -88,7 +88,7 @@ With the wolfHSM engine, `WT_MAX_GUESTS=2` costs +2,536 bytes of flash and
Building out what an image does not need saves, on the same image:
`WT_SP_RESTART=0` 740 bytes of flash, `WT_GUEST_RESTART=0` 96, and the three
Secure Partition call trims (`WT_FFM_SP_DOORBELL=0 WT_FFM_SP_RHANDLE=0
-WT_FFM_SP_SKIP=0`) 96 together. See [Macros](Macros.md#build-selection).
+WT_FFM_SP_SKIP=0`) 96 together. See [SPM switches](Macros.md#spm-switches).
Each partition stack is sized from the high-water mark measured on M33MU
across the positive, restart, recovery, update and Arm conformance scenarios
diff --git a/docs/Getting-Started.md b/docs/Getting-Started.md
index a50ae58ec..d3d245dd4 100644
--- a/docs/Getting-Started.md
+++ b/docs/Getting-Started.md
@@ -1,7 +1,8 @@
# Getting Started
-This guide builds the currently supported STM32H563 Secure image, the Zephyr
-and FreeRTOS reference guests, and the host tests. See [Building](Building.md) for
+This guide starts with the STM32H563 Secure image, the Zephyr and FreeRTOS
+reference guests, and the host tests. Other registered ports are listed in
+[Ports and supported targets](Targets.md). See [Building](Building.md) for
build controls, and read [STM32H5 Guide](STM32H5-Guide.md) before flashing a
board.
@@ -34,9 +35,13 @@ access.
```sh
git clone --recurse-submodules https://github.com/wolfSSL/wolfTrust.git
cd wolfTrust
-git submodule update --init --recursive
```
+The repository and its pinned submodules are public and use HTTPS URLs.
+No GitHub account or SSH key is needed to clone them. If you already have a
+checkout with older submodule URLs, run `git submodule sync --recursive` before
+`git submodule update --init --recursive`.
+
## Build the Secure image
```sh
@@ -49,6 +54,11 @@ The default STM32H563 cross-build produces:
- `build/wolftrust.bin`
- `build/secure_cmse_implib.o`, used when linking Non-secure clients
+The default STM32H563 image serves PSA Crypto from the Secure image. It
+runs one guest and includes ITS, Protected Storage, and Initial Attestation.
+Enable Firmware Update with `WT_FWU=1` or a second guest with
+`WT_MAX_GUESTS=2`. See [Build profiles](Macros.md#build-profiles).
+
The standalone binary is not a complete authenticated boot chain. The target
runners patch guest measurement records into a copy of the Secure binary and
sign that image with wolfBoot.
@@ -56,8 +66,10 @@ sign that image with wolfBoot.
## Build both PSA guests
The reference pair is a Zephyr guest in slot 0 and a FreeRTOS guest in slot 1.
-Both use wolfPSA entry points and send protected operations through the FF-M
-gateway.
+Both use the standard PSA Crypto API. With the STM32H563 default, the
+guests link the PSA Crypto client and send requests through the FF-M gateway.
+Set `WT_SECURE_PSA=0` for both the Secure image and guests to keep PSA
+Crypto in the guest. See [Crypto Engines](Crypto-Engines.md) for migration.
```sh
make -C tests/firmware/zephyr-stm32h5 clone
@@ -67,7 +79,7 @@ make -C tests/firmware/zephyr-stm32h5 \
The first command creates ignored workspaces under
`tests/firmware/zephyr-stm32h5/.workspace/`. The second command also
-builds the matching Secure image and CMSE import library.
+builds the matching two-guest Secure image and CMSE import library.
## Run host tests
diff --git a/docs/Interface-Profiles.md b/docs/Interface-Profiles.md
index a8564855e..f76e9b8fe 100644
--- a/docs/Interface-Profiles.md
+++ b/docs/Interface-Profiles.md
@@ -9,7 +9,10 @@ verification. It also includes the key, session and token management needed to
use those operations. PKCS#11 retains PIN setup, login, attempt limits and
recovery. `config/crypto-profiles.json` is the explicit default operation list.
The extended profile retains the broader operations supported by the pinned
-libraries and this platform's algorithm and memory configuration.
+libraries and this platform's algorithm and memory configuration. See [Target defaults](Macros.md#target-defaults)
+for which targets and layouts support these builds. The
+[Secure PSA profiles](Crypto-Engines.md#psa-crypto-in-the-secure-image-wt_secure_psa1)
+select the algorithms for the PSA Crypto service separately.
## Select operations
diff --git a/docs/MIMXRT700-Guide.md b/docs/MIMXRT700-Guide.md
index 9aaf5c74b..d3e7a3713 100644
--- a/docs/MIMXRT700-Guide.md
+++ b/docs/MIMXRT700-Guide.md
@@ -20,7 +20,8 @@ Read the current state first and keep a development board recoverable.
through the veneers (`positive`); the isolation negative (`guestisoneg`) shows a
guest's store into the other guest's RAM refused by the SAU, contained by the
monitor, and the offender quarantined after its restart budget while the peer
- keeps running.
+ keeps running. The runner also carries the STM32H563 scenario matrix,
+ including every isolation level 3 negative and Arm's conformance suites.
- **Validated on the EVK:** the same two scenarios on both crypto engines
(`tests/target/run_hardware.sh mimxrt700`). In `guestisoneg`, guest0 disables its
Non-secure MPU and stores into guest1's RAM; the store faults, guest1's RAM
@@ -149,10 +150,9 @@ on), so the CPU's own attribution is the barrier: with the peer window Secure,
a guest's store into it faults even after the guest disables its own
Non-secure MPU, and the monitor contains the fault. `guestisoneg` shows exactly
that on the EVK and under M33MU.
-As on the STM32H563 (see [TF-M Compatibility](TF-M-Compatibility.md)), the
-manifest declares the guests unprivileged but the runtime launches them with
-`CONTROL_NS.nPRIV` clear. A guest's Non-secure MPU is therefore scheduling
-policy, not a boundary; the SAU window is the boundary. Fencing other bus masters (the sense M33, the DSPs, the NPU, and DMA) per
+As on the STM32H563 (see [Security Model](Security-Model.md)), the guests run
+privileged, with `CONTROL_NS.nPRIV` clear, and the manifest declares them so. A
+guest's Non-secure MPU is therefore scheduling policy, not a boundary; the SAU window is the boundary. Fencing other bus masters (the sense M33, the DSPs, the NPU, and DMA) per
master is not implemented.
## Silicon constraints for this port
diff --git a/docs/Macros.md b/docs/Macros.md
index 85e9d2924..f5a9479e6 100644
--- a/docs/Macros.md
+++ b/docs/Macros.md
@@ -2,31 +2,64 @@
The Secure build is configured through GNU Make variables. The build turns
selected values into C preprocessor defines. Defaults below come from
-`mk/target-stm32h563.mk`, `mk/layout.mk`, `mk/arch-armv8m.mk`, and
-`mk/common.mk`.
+`mk/profile.mk`, `mk/target-.mk`, `mk/layout.mk`,
+`mk/arch-armv8m.mk`, and `mk/common.mk`.
+
+## Target defaults
+
+With no arguments, `make` selects `ARCH=armv8m TARGET=stm32h563`.
+All four targets use Cortex-M33, isolation level 3, `WT_ENGINE=native`,
+`WT_PROFILE=default`, and COSE attestation (`WT_ATTEST_COSE=1`) when
+built directly. The `attest_cose` value in `port.json` selects a CI
+build configuration. It does not override the root Makefile default.
+
+| `TARGET` | Engines supported | Default PSA Crypto placement | Optional manifest variants |
+| --- | --- | --- | --- |
+| `stm32h563` | `native`, `hsm` | Secure (`WT_SECURE_PSA=1`) | Conformance, VNET, TPM, PKCS#11 |
+| `mimxrt700` | `native`, `hsm` | Secure (`WT_SECURE_PSA=1`) | Conformance, TPM, PKCS#11 |
+| `mcxn947` | `native`, `hsm` | Secure (`WT_SECURE_PSA=1`) | Conformance, TPM, PKCS#11 |
+| `stm32l562` | `native` | Guest-local (`WT_SECURE_PSA=0`) | Conformance, TPM and PKCS#11. The interface test and CI matrix uses `default` for TPM and PKCS#11. |
+
+`WT_ENGINE=hsm`, `CONFIG_TPM=y` and `CONFIG_PKCS11=y` each set
+`WT_SECURE_PSA=0` by default and reject `WT_SECURE_PSA=1`. Select at
+most one manifest variant. The corresponding switches are `WT_CONFORMANCE=1`,
+`CONFIG_VNET=y`, `CONFIG_TPM=y` and `CONFIG_PKCS11=y`. The STM32L562
+TPM and PKCS#11 layouts require `WT_FWU=0` because they use the
+update slot's space. See [Ports](Ports.md) and the board guides for
+layout and validation details. VNET is available on STM32H563 and requires
+`WT_MAX_GUESTS=2`. Use `make test-conformance TARGET=stm32h563` for the
+STM32H563 conformance image with the larger M33MU flash layout.
## Build profiles
-`WT_PROFILE` picks one of four build profiles, smallest first: `tiny`, `small`,
-`default` and `extended`. `make` with no options builds `default`: isolation
-level 3, one Non-secure image and four PSA services (Crypto, Internal Trusted
-Storage, Protected Storage and Initial Attestation), with the manifest checked
-at build time. A profile sets the defaults of the
-add-ons below and of [`WT_SECURE_PSA_PROFILE`](Crypto-Engines.md#psa-crypto-in-the-secure-image-wt_secure_psa1);
-a variable set explicitly still wins. No profile changes the isolation level.
-
-| `WT_PROFILE` | Secure PSA algorithm set | Flags it sets |
-| --- | --- | --- |
-| `tiny` | `tiny`: CCM, AES-CTR, SHA-256, HMAC and HKDF, no ECC in the PSA surface | `WT_ATTEST_KEY=hmac WT_VAULT_ECC=0` (native engine), so the image links no ECC; `WT_SP_RESTART=0 WT_GUEST_RESTART=0` |
-| `small` | `small`: one AEAD (CCM), AES-CTR, P-256 ECDSA and ECDH, SHA-256, HMAC and HKDF | none |
-| `default` | `default`: GCM and CCM, CTR, P-256 ECDSA and ECDH, SHA-256, HMAC and HKDF | none |
-| `extended` | `extended`: `default` plus CBC, ECB, PBKDF2, TLS 1.2 PRF, SP 800-108, CCM* and deterministic ECDSA | `WT_MAX_GUESTS=2 WT_MANIFEST_RUNTIME_CHECK=1 WT_FWU=1 WT_SHA256_FAST=1` |
+The `WT_PROFILE` preset sets the defaults below. An explicit Make
+variable overrides its preset, subject to the target and engine
+constraints. All profiles use isolation level 3, validate the manifest at
+build time, and keep Initial Attestation, Internal Trusted Storage, and
+Protected Storage enabled unless changed by an independent option.
+The Secure PSA algorithm set follows `WT_PROFILE` when Secure PSA is
+enabled. Set [`WT_SECURE_PSA_PROFILE`](Crypto-Engines.md#psa-crypto-in-the-secure-image-wt_secure_psa1)
+to change that set without changing the SPM feature defaults.
+
+| `WT_PROFILE` | `WT_MAX_GUESTS` | Boot manifest check | FWU | Fast SHA-256 | SP and guest restart | Attestation key / vault P-256 (native) |
+| --- | ---: | ---: | ---: | ---: | ---: | --- |
+| `tiny` | 1 | 0 | 0 | 0 | 0 | HMAC / off |
+| `small` | 1 | 0 | 0 | 0 | 1 | P-256 / on |
+| `default` | 1 | 0 | 0 | 0 | 1 | P-256 / on |
+| `extended` | 2 | 1 | 1 | 1 | 1 | P-256 / on |
+
+wolfHSM keeps P-256 attestation and vault operations enabled for every
+profile. The [Secure PSA algorithm table](Crypto-Engines.md#psa-crypto-in-the-secure-image-wt_secure_psa1)
+lists the algorithms separately from these build defaults. Inspect the
+resolved values with `make TARGET= WT_PROFILE= print-profile`.
+For TPM and PKCS#11, `WT_INTERFACE_PROFILE` selects the operation set.
+It defaults to `extended` under the `extended` build profile and to
+`default` otherwise.
`mk/profile.mk` holds this table for the build and
`tests/target/lib/profile.sh` the same one for the target runners.
-A profile is only a preset. Each flag it sets is an option of its own and works
-on every profile: `make WT_PROFILE=tiny WT_ATTEST_KEY=ecc WT_VAULT_ECC=1` is
+A profile is only a preset. Each flag it sets is an independent setting: `make WT_PROFILE=tiny WT_ATTEST_KEY=ecc WT_VAULT_ECC=1` is
`tiny` with the P-256 attestation key and vault keys back, and
`make WT_ATTEST_KEY=hmac` is `default` with an HMAC attestation key. See
[ECC options](#ecc-options).
@@ -49,7 +82,7 @@ on the STM32L562.
| [`WT_MANIFEST_RUNTIME_CHECK=1`](#wt_manifest_runtime_check-boot-time-manifest-check) | The boot-time manifest and port-binding validator, with the descriptive manifest it reads | +5,324 / +16 | +5,328 / +16 | `make WT_MANIFEST_RUNTIME_CHECK=1 secure-image` |
| [`WT_SHA256_FAST=1`](#wt_sha256_fast-unrolled-sha-256) | The unrolled SHA-256 transform, faster hashing for boot and guest measurement | +416 / 0 | +384 / 0 | `make WT_SHA256_FAST=1 secure-image` |
| [`WT_ENGINE=hsm`](#wt_enginehsm-the-wolfhsm-engine) | The wolfHSM server as the crypto engine | +28,384 / +34,620 | not supported | `make WT_ENGINE=hsm secure-image` |
-| [`WT_SECURE_PSA=0`](Crypto-Engines.md#psa-crypto-in-the-secure-image-wt_secure_psa1) | Removes PSA Crypto from the Secure image and runs wolfPSA in the guest again; saves 23,531 / 2,048 against the `default` algorithm set (35,253 / 3,072 against `extended`) | -23,563 / -2,048 | not measured | `make WT_SECURE_PSA=0 secure-image` |
+| [`WT_SECURE_PSA=0`](Crypto-Engines.md#psa-crypto-in-the-secure-image-wt_secure_psa1) | Removes PSA Crypto from the Secure image and runs wolfPSA in the guest again; see the [profile measurements](Footprint.md) for other configurations | -23,563 / -2,048 | not measured | `make WT_SECURE_PSA=0 secure-image` |
| `extended` add-ons | `WT_MAX_GUESTS=2 WT_MANIFEST_RUNTIME_CHECK=1 WT_FWU=1 WT_SHA256_FAST=1` together | +11,480 / +8,944 | +11,512 / +8,936 | `make WT_MAX_GUESTS=2 WT_MANIFEST_RUNTIME_CHECK=1 WT_FWU=1 WT_SHA256_FAST=1 secure-image` |
The RAM figures include every stack and band an option adds, the 4 KiB FWU
@@ -112,12 +145,10 @@ build `extended` only, because their checks assert both guests.
### `WT_MANIFEST_RUNTIME_CHECK`: boot-time manifest check
-- Default `0`. The manifest generator validates the manifest at build time
- against the platform capabilities (`port/common/armv8m/platform_caps.h`,
- passed from `mk/arch-armv8m.mk`) and the FF-M runtime limits, and the
- generated C asserts the port binding at compile time. Any manifest the
- boot-time checks would reject fails the build, so the default image does
- not repeat them.
+- Default `0` outside the `extended` profile. The manifest generator checks
+ the platform capabilities, FF-M limits and memory layout before emitting
+ the constant policy rows. Generated C asserts the port binding at compile
+ time. The default image uses the generated rows during boot and runtime.
- `1` links the boot-time validator back in: `wt_spm_init()` runs
`wt_manifest_validate()`, and the monitor runs
`wt_partitions_check_manifest()` (it rebuilds each guest row from the
@@ -244,10 +275,28 @@ resolved flags and `WT_NO_ECC`.
| `BUILD_DIR` | Secure build output directory; default `build`. | Must be writable. |
| `WT_LTO` | Enable Secure-image link-time optimization; default `1`. | Set to `0` for diagnostics or a non-LTO size comparison. The GNU Arm compiler must support `-flto=auto`. |
| `WT_ENGINE` | Secure crypto engine: `native` (default) dispatches wolfCrypt directly behind the SERVICE_HSM door with explicitly vault-backed keys stored as `SENSITIVE` and `NONEXPORTABLE` NVM objects; `hsm` links the wolfHSM server as a key-management add-on (server-keystore semantics and an external-HSM offload path). Legacy `WT_ENGINE_HSM=0/1` maps onto the selector. | Both engines share the identical FF-M surface (5 veneers, SIDs, manifest, and L3 bands) and run every applicable CI scenario. Guest builds must use the same engine as the Secure image. See [Crypto Engines](Crypto-Engines.md). |
-| `WT_SP_RESTART` | Restart a faulted Secure Partition under its manifest restart policy; default `1`, `0` in `tiny`. `0` saves 740 bytes of flash and 4 of RAM. | With `0` the recovery code is built out and any partition fault fails the platform closed through `wt_platform_all_guests_faulted()`. |
-| `WT_GUEST_RESTART` | Restart a faulted Non-secure guest under its restart policy; default `1`, `0` in `tiny`. `0` saves 96 bytes of flash and 4 of RAM. | With `0` a faulted guest is quarantined as `FAULTED` and never relaunched. |
-| `WT_FFM_FORENSICS` | Build the SPM forensic words a debugger reads after a fault (gate rejections, keystore failures, the full first-fault record); default `0`. `1` adds 480 bytes of flash and 104 of RAM. | Diagnostics only. The fault count, first CFSR and SPM fault latch the scenarios read are always built. |
-| `WT_FFM_SP_DOORBELL`, `WT_FFM_SP_RHANDLE`, `WT_FFM_SP_SKIP` | Build the Secure Partition calls no shipped service makes: `psa_notify` and `psa_clear`, `psa_set_rhandle`, and `psa_skip`; each defaults to `1`. `0` builds the call out of the SP API and the SPM gate, which refuses it; all three save 96 bytes of flash. | `0` or `1`. A partition that calls a trimmed function fails to link. `WT_CONFORMANCE=1` needs all three, because the Arm suite calls them. |
+
+## SPM switches
+
+These options apply across the four profiles. The SPM bounds its IPC
+state with 16 connection slots, four reserved for Secure clients, and
+an eight-slot limit per client. Each call transfers up to four vectors
+and 1,024 bytes in total, counting input bytes and declared output
+capacity. Connect and close allocate no transfer.
+
+| Option | Default | Effect |
+| --- | --- | --- |
+| `WT_SP_RESTART`, `WT_GUEST_RESTART` | `0` in `tiny`, `1` otherwise | Set individually to enable or disable fault restart. A disabled Secure Partition restart escalates to the fail-closed path. A guest with restart disabled remains faulted. |
+| `WT_FFM_SP_DOORBELL` | `1` | Set to `0` to omit `psa_notify()` and `psa_clear()`. |
+| `WT_FFM_SP_RHANDLE` | `1` | Set to `0` to omit `psa_set_rhandle()`. |
+| `WT_FFM_SP_SKIP` | `1` | Set to `0` to omit `psa_skip()`. |
+| `WT_FFM_FORENSICS` | `0` | Set to `1` for additional SWD-readable fault data. Basic fault counters and the first CFSR are always linked. |
+| `WT_SPM_TRANSFERS` | `4`, or `8` with two guests, VNET, or conformance | Number of shared call buffers. Override with, for example, `WT_EXTRA_CFLAGS=-DWT_SPM_TRANSFERS=6U`. Use a positive count and check reserved Secure RAM with `make size-report`. Pool exhaustion returns `PSA_ERROR_INSUFFICIENT_MEMORY`. |
+
+The three optional Secure Partition APIs must remain enabled with
+`WT_CONFORMANCE=1`. A custom partition that calls an omitted API fails
+to link. The [FF-M compatibility register](FF-M-Compatibility.md)
+describes connection and fault behavior.
## Core target configuration
@@ -255,7 +304,6 @@ resolved flags and `WT_NO_ECC`.
| --- | --- | --- |
| `WT_MAX_GUESTS` | Compiled guest contexts; default `1`, `2` adds guest-b (see [`WT_MAX_GUESTS`](#wt_max_guests-a-second-guest)). | Only `1` or `2`; any other value stops the build. The manifest keeps guest-b's domain declared either way. |
| `WT_TIMESLICE_MS` | Guest scheduler interval in milliseconds; default `2`. | Must be nonzero and supported by the target timer. |
-| `WT_SPM_TRANSFERS` | IPC transfers the SPM holds for requests in flight, each a 1,024-byte payload with its vector sizes; default `4`, or `8` with two guests, `CONFIG_VNET=y` or `WT_CONFORMANCE=1`. A C define: set it with `WT_EXTRA_CFLAGS=-DWT_SPM_TRANSFERS=U`. | At least `1`. A call that finds every transfer taken returns `PSA_ERROR_INSUFFICIENT_MEMORY`. Connections and closes take none. |
| `WT_GUEST_HANDLER_SLICE_LIMIT` | Consecutive slice expiries a guest may spend in a Non-secure handler before it is restarted (Secure calls made from that handler count); default `50`. A C define, not a Make variable: set it with `WT_EXTRA_CFLAGS=-DWT_GUEST_HANDLER_SLICE_LIMIT=`. | Must be 1 to `0xFFFFFFFF` (other values fail the build); size it above the longest legitimate guest interrupt handler. |
| `WT_CO_STACK_SIZE` | Default fixed coroutine stack size in bytes, including each per-guest wolfHSM server tasklet in the hsm engine; default `10240` (measured: the deep M33MU workloads pass at 8K with PSPLIM overflow detection armed, so 10K carries at least 2K margin). With two guests, the hsm-only server slots total 20,480 stack bytes plus 512 guard bytes. Manifest-sized Secure Partition stacks use their declared sizes instead. | Size from measured stack high-water marks and keep at least the scheduler minimum. |
| `WT_SHARED_UART` | Reference guest UART selection; default `3`. | Guest and Secure builds must use a consistent value. |
@@ -269,14 +317,14 @@ resolved flags and `WT_NO_ECC`.
| `WT_GUEST_FLASH_WRP` | When `1`, verify the port's hardware write protection of each guest window before launch; a port with no guest flash fence then refuses every guest. Default `0`. | Set to `1` for hardened images, after provisioning the port's fence as its guide describes. |
| `WT_ENGINE_HSM` | Legacy engine selector; unset by default. `0` maps to `WT_ENGINE=native` and `1` maps to `WT_ENGINE=hsm` when the public selector is not supplied. The build also derives this internal value from `WT_ENGINE`. | Prefer `WT_ENGINE` for new builds and do not supply conflicting selectors. The guest and Secure image must select the same engine. |
| `WT_ATTEST_COSE` | Build the COSE attestation token service; default `1`. CI compile-checks `0`, and builds each port with its `port.json` `attest_cose` value. | `1` requires the wolfCOSE submodule and the configured attestation key backend. |
-| `WT_SECURE_PSA` | When `1`, serve PSA Crypto from the Secure image: wolfPSA runs in the crypto partition and the guest links the PSA client instead of wolfPSA. Default `1` with the native engine and `0` with wolfHSM; a port may default it to `0` in its `mk/target-.mk`. See [Crypto Engines](Crypto-Engines.md#psa-crypto-in-the-secure-image-wt_secure_psa1). | `1` requires `WT_ENGINE=native`; build every guest with the Secure image's value. |
-| `WT_PROFILE` | Build profile: `tiny`, `small`, `default` (default) or `extended`. Sets the add-on defaults, `WT_SECURE_PSA_PROFILE` and `WT_INTERFACE_PROFILE`; see [Build profiles](#build-profiles). | Any other value stops the build. |
+| `WT_SECURE_PSA` | When `1`, serve PSA Crypto from the Secure image: wolfPSA runs in the crypto partition and the guest links the PSA client instead of wolfPSA. See [Target defaults](#target-defaults) for the port and application-variant defaults. See [Crypto Engines](Crypto-Engines.md#psa-crypto-in-the-secure-image-wt_secure_psa1). | `1` requires `WT_ENGINE=native`; build every guest with the Secure image's value. |
+| `WT_PROFILE` | Build profile: `tiny`, `small`, `default` (default) or `extended`. Sets the add-on defaults and `WT_SECURE_PSA_PROFILE`; see [Build profiles](#build-profiles). | Any other value stops the build. |
| `WT_SECURE_PSA_PROFILE` | Algorithm set of a `WT_SECURE_PSA=1` image: `tiny`, `small`, `default` or `extended`; follows `WT_PROFILE` unless set. | Any other value stops the build. |
| `WT_ATTEST_KEY` | Attestation key type: `ecc` (P-256, COSE_Sign1) or `hmac` (HMAC-SHA256, COSE_Mac0). Default `ecc`; `tiny` sets `hmac`. See [ECC options](#ecc-options). | `hmac` requires the native engine and a key from the port. Any other value stops the build. |
| `WT_ATTEST_DEV_KEY` | With `WT_ATTEST_KEY=hmac`, link the public development key of the reference boards; default `1`, with a build warning. | A product sets `0` and supplies `wt_port_attest_hmac_key()`. |
| `WT_VAULT_ECC` | Vault P-256 key operations; default `1`, `tiny` sets `0`. `0` returns `PSA_ERROR_NOT_SUPPORTED` for them. | `0` requires the native engine. Any other value stops the build. |
| `WT_PSA_POOL_BYTES` | Make variable: size of the crypto partition's private wolfPSA pool, split evenly into one arena per guest; empty keeps 2,048 bytes per guest. | A smaller arena fails calls that hold more with `PSA_ERROR_INSUFFICIENT_MEMORY`; below 1,536 bytes per guest stops the build. A pool past the crypto partition's band fails the link. |
-| `WT_PSA_KEY_SLOTS`, `WT_PSA_OP_SLOTS` | Make variables: volatile keys and live operations the Secure PSA service tracks, split evenly across the guests; empty keeps `16` and `8`. | Fewer slots than guests, more than 256 operation slots, or a non-number stops the build. Each slot's state is allocated from `WT_PSA_POOL_BYTES`. |
+| `WT_PSA_KEY_SLOTS`, `WT_PSA_OP_SLOTS` | Make variables: volatile keys and live operations the Secure PSA service tracks, split evenly across the guests; empty keeps `16` and `8`. | Fewer slots than guests, more than 256 operation slots, or a non-number stops the build. Slot tables use fixed storage in the crypto band. Allocations for key and operation data use `WT_PSA_POOL_BYTES`. |
| `WT_WOLFCRYPT_SP_ASM` | Enable wolfCrypt SP Cortex-M assembly; default `0`, the portable C `sp_c32.c`, which is smaller. `1` trades flash for faster ECC and raises the crypto partition stack to 9 KiB on either engine (from 5 KiB native, or 6 KiB in `extended` and with wolfHSM) for its deeper P-256 verify. | `1` requires compatible Armv8-M assembly sources and toolchain. |
| `WT_AEAD` | AES-256 AEAD of the vault encrypt service and sealed storage, and the one PSA AEAD of the `tiny` and `small` Secure PSA profiles: `gcm` or `ccm`, both with a 12-byte nonce and 16-byte tag. Empty picks `ccm` for the `tiny` and `small` Secure PSA profiles, where the vault shares the one PSA AEAD, and `gcm` for every other build, `WT_SECURE_PSA=0` included. `default` and `extended` offer both through PSA either way. CCM carries no GHASH, so `small` is 1,440 bytes smaller with `ccm` than with `gcm` on the STM32H563. | Data sealed or encrypted under one setting does not open under the other, so changing it on a deployed device means re-provisioning its sealed store and re-encrypting vault data. Any other value stops the build. |
| `WT_WOLFCRYPT_ARMASM` | Enable additional wolfCrypt Thumb-2 assembly; default `0`, portable C AES with small tables that touches every table line on each lookup. `1` trades flash for faster AES and SHA-256. | `1` requires a compatible GNU Arm toolchain and `WT_SECURE_PSA=0`: the Thumb-2 AES uses lookup tables and is not constant time, which wolfPSA refuses, and the vault seal key runs on it. [`WT_SHA256_FAST`](#wt_sha256_fast-unrolled-sha-256) picks the SHA-256 transform either way. |
@@ -316,7 +364,7 @@ guest linker files, measurement records, and flash commands consistent.
| Define | Description | Requirement |
| --- | --- | --- |
-| `CONFIG_VNET` | Select the VNET manifest and link the Secure switch when set to `y`; default `n`. | Both guests must use the matching VNET transport and memory layout. |
+| `CONFIG_VNET` | Select the VNET manifest and link the Secure switch when set to `y`; default `n`. | Requires `TARGET=stm32h563 WT_MAX_GUESTS=2` and matching VNET guest builds. |
| `WT_VNET_POOL_SLOTS` | Secure frame-pool slot count; default `8`. | Static VNET data must fit its manifest region. |
| `WT_VNET_FRAME_MAX` | Internal maximum Ethernet frame bytes; default `1536`. | Must be large enough for the selected link frame; PSA transport still limits the exposed MTU to 1000. |
| `WT_VNET_RX_QUEUE_DEPTH` | Per-port receive queue depth; default `8`. | Static queue storage must fit the VNET data region. |
diff --git a/docs/PSA-Compatibility.md b/docs/PSA-Compatibility.md
new file mode 100644
index 000000000..62d112d99
--- /dev/null
+++ b/docs/PSA-Compatibility.md
@@ -0,0 +1,112 @@
+# PSA Compatibility
+
+wolfTrust exposes selected [PSA APIs](https://arm-software.github.io/psa-api/)
+through its reference applications and Secure services. This page
+records the implemented Crypto, Secure Storage, Initial Attestation, and
+Firmware Update surface against the cited Arm specifications. Algorithms and
+features depend on the selected build. The known deviations below prevent a
+claim of full PSA API conformance or certification.
+
+The Secure Partition Manager and IPC contract are documented separately in
+[FF-M Compatibility](FF-M-Compatibility.md).
+
+[Ports](Ports.md) lists the crypto engines and test coverage available on each
+target. The default image includes Crypto, ITS, Protected Storage, and Initial
+Attestation. Firmware Update requires `WT_FWU=1`; VNET is an optional
+STM32H563 configuration. STM32L562 supports the native engine and
+defaults to guest-local PSA Crypto.
+
+## PSA specification sections
+
+| Contract | Normative section | wolfTrust scope |
+| --- | --- | --- |
+| PSA Crypto | [Crypto API 1.4, section 6.1.1](https://arm-software.github.io/psa-api/crypto/1.4/overview/implementation.html) | wolfPSA API with algorithms selected by the Secure profile or guest configuration |
+| Internal Trusted Storage and Protected Storage | [Secure Storage API 1.0, sections 5.3 to 5.4](https://arm-software.github.io/psa-api/storage/1.0/api/api.html) | Core operations; storage deviations are listed below |
+| Initial Attestation | [Attestation API 1.0, section 3](https://arm-software.github.io/psa-api/attestation/1.0/overview/report.html) and [section 4](https://arm-software.github.io/psa-api/attestation/1.0/api/api.html) | Token generation and token-size query operations with documented header, status, and token-profile deviations |
+| Firmware Update | [Firmware Update API 1.0, section 4](https://arm-software.github.io/psa-api/fwu/1.0/overview/programming-model.html) and [section 5](https://arm-software.github.io/psa-api/fwu/1.0/api/api.html) | Optional single-component staging and authenticated reboot with documented limits |
+
+## Implemented service APIs
+
+| API or behavior | Version | Status | Repository evidence |
+| --- | --- | --- | --- |
+| PSA Crypto | 1.4 header | Supported through wolfPSA with the Secure image's `WT_SECURE_PSA_PROFILE` or the guest's wolfCrypt settings | [Crypto Engines](Crypto-Engines.md) and `lib/wolfPSA/wolfpsa/psa/crypto.h` |
+| Internal Trusted Storage | 1.0 | Core set/get/get-info/remove subset; ordinary objects can be updated, while caller-selected `WRITE_ONCE` is enforced without a provisioning exception | `include/psa/internal_trusted_storage.h` and `src/services/storage_service.c` |
+| Protected Storage | 1.0 | Core set/get/get-info/remove subset; optional create/set-extended absent | `include/psa/protected_storage.h` and `src/services/storage_service.c` |
+| Initial Attestation | 1.0 API subset with a nonconformant RFC 9783-derived token | Token generation and token-size query are supported, but the advertised TF-M profile has the claim-semantic deviations below | `lib/wolfPSA/wolfpsa/psa/initial_attestation.h` and `src/services/initial_attestation.c` |
+| Firmware Update | 1.0 subset | Single-component staging and authenticated reboot when built with `WT_FWU=1` | `include/psa/update.h` and `src/services/fwu_service.c` |
+
+## Service API differences
+
+| Difference | Classification | Reason and impact |
+| --- | --- | --- |
+| PSA Crypto mechanisms are build-selected. | Implementation-profile behavior | The [PSA Crypto implementation profile](https://arm-software.github.io/psa-api/crypto/1.4/overview/implementation.html) may select an API and algorithm subset. The `WT_SECURE_PSA_PROFILE` setting selects the Secure service's algorithms. Guest-local and wolfHSM builds use the guest's wolfCrypt settings and, for wolfHSM, the enabled server operations. |
+| Protected Storage does not implement create or set-extended. | Scoped | `psa_ps_get_support()` returns zero and both optional operations return `PSA_ERROR_NOT_SUPPORTED`. |
+| Protected Storage applies confidentiality and replay protection even when the caller waives them. | Implementation policy | Objects remain sealed and counter-bound. `psa_ps_get_info()` reports the protection applied. |
+| Internal Trusted Storage enforces caller-selected `PSA_STORAGE_FLAG_WRITE_ONCE` during provisioning. | Known lifecycle deviation | Ordinary objects can be updated or removed. The ITS request path does not consult lifecycle state, so an object created with the flag cannot be changed during `PSA_ROT_PROVISIONING`, contrary to [PSA Secure Storage 1.0 section 3.2](https://arm-software.github.io/psa-api/storage/1.0/overview/requirements.html). The section 3.2 lifecycle exception is specific to ITS. |
+| Initial Attestation's public header omits `PSA_INITIAL_ATTEST_MAX_TOKEN_SIZE`. | Known header deviation | The service limit is 640 bytes, but callers cannot obtain that maximum from the public PSA header. |
+| The attestation token advertises `tag:psacertified.org,2023:psa#tfm` but does not implement that profile's claim semantics. | Known token-profile deviation | The signer ID and implementation ID are hashes of software labels. The profile defines them in terms of the signing identity and the immutable PSA RoT hardware assembly, respectively. A distinct derived profile identifier should be used until these claims conform to [RFC 9783 section 5.2](https://www.rfc-editor.org/rfc/rfc9783.html#section-5.2). |
+| Firmware Update has no persistent trial-accept flow. | Scoped | Installation commits only after wolfBoot authenticates the swapped image at reboot; `psa_fwu_accept()` returns `PSA_ERROR_NOT_SUPPORTED`. |
+| wolfTrust's Firmware Update adapter accepts a detached manifest only as a 32-bit version word. | Scoped integration | Passing `NULL, 0` instead binds the version from the staged wolfBoot header. Other manifest encodings require an adapter. |
+| Firmware Update pads unaligned block sizes. | Integration behavior | Padding follows the target flash backend's write alignment. |
+
+The attestation comparison uses the claim definitions for
+[Implementation ID](https://www.rfc-editor.org/rfc/rfc9783.html#section-4.2.2),
+[Boot Seed](https://www.rfc-editor.org/rfc/rfc9783.html#section-4.3.2), and
+[Software Components](https://www.rfc-editor.org/rfc/rfc9783.html#section-4.4.1)
+in RFC 9783. Its [derived-profile rules](https://www.rfc-editor.org/rfc/rfc9783.html#section-4.5.2.1)
+describe how to identify a different token profile.
+
+## Validation and claim boundary
+
+`make test` exercises native service behavior and negative inputs. Dedicated
+guest scenarios under M33MU exercise selected PSA Crypto, Secure Storage, and
+Initial Attestation APIs. The STM32H563 hardware runner checks selected
+end-to-end behavior on a provisioned board. See [Testing](Testing.md) for the
+commands and the scope of each result. These tests do not eliminate the API
+and token-profile deviations listed above.
+
+## Porting an existing PSA application
+
+1. Keep application calls on standard PSA headers where wolfTrust provides the
+ corresponding Non-secure adapter: FF-M client, Crypto, ITS, Protected
+ Storage, and Firmware Update. `psa_rot_lifecycle_state()` is available only
+ to scheduled Secure Partitions; there is no Non-secure client adapter for it.
+2. Link `src/client/psa_ffm_client.c` and the generated
+ `secure_cmse_implib.o` from the selected Secure-image `BUILD_DIR`, then add
+ the adapters for the required services.
+
+ - Default native Secure PSA (`WT_SECURE_PSA=1`) uses
+ `src/client/psa_crypto_client.c` and wolfPSA's `src/psa_api_stub.c`.
+ - Guest-local native PSA (`WT_SECURE_PSA=0`) uses wolfPSA plus
+ `src/client/crypto_native_client.c`. This is the STM32L562 default.
+ - The wolfHSM engine uses wolfPSA, the wolfHSM client and
+ `src/client/hsm_psa_transport.c`.
+ - Use `src/client/psa_storage_client.c` for ITS and Protected Storage,
+ `src/client/psa_fwu_client.c` for Firmware Update and
+ `src/client/vnet_psa_transport.c` for optional VNET.
+
+ Match the Secure image and guest build settings. See
+ [Crypto Engines](Crypto-Engines.md) for migration and the effects on keys.
+3. Initial Attestation currently has only the Zephyr-specific adapter at
+ `tests/firmware/zephyr-stm32h5/module/wolftrust-tee/src/wolftrust_attestation_client.c`.
+ The vendored `lib/wolfPSA/src/psa_attestation.c` is a stub that returns
+ `PSA_ERROR_NOT_SUPPORTED` and must not be linked instead of or alongside that
+ adapter.
+4. Include the `psa_manifest/sid.h` generated for the selected target
+ and manifest.
+5. Check data-size assumptions against the copied IPC and service limits.
+ Stream update images in blocks no larger than `PSA_FWU_MAX_WRITE_SIZE`.
+ For wolfTrust, the image offset must be aligned to
+ `1 << PSA_FWU_LOG2_WRITE_ALIGN`. An unaligned final block is padded by the
+ service to the backend write alignment.
+6. Check optional APIs before use. In particular, treat Protected Storage
+ create/set-extended and Firmware Update accept as unsupported.
+7. Express Secure services, dependencies, memory, interrupts, restart policy,
+ guest launch requirements, and minimum versions in the wolfTrust manifest.
+8. Use the wolfBoot and wolfTrust image assembly flow. Patch guest measurement
+ records before signing wolfTrust.
+9. Run host tests, target conformance under M33MU, and the hardware suite
+ separately. An emulator pass does not establish silicon attribution.
+
+See [API Reference](API-Reference.md), [FF-M Compatibility](FF-M-Compatibility.md),
+[Porting](Porting.md), and [Testing](Testing.md) for integration details.
diff --git a/docs/Porting.md b/docs/Porting.md
index d0b1c64e5..d9baf33cc 100644
--- a/docs/Porting.md
+++ b/docs/Porting.md
@@ -13,11 +13,13 @@ and board-specific execution. The registered ports, each with its guide and
its validation status, are in [Ports](Ports.md); every one reuses the Armv8-M
architecture adapter unchanged.
-Cortex-A support is an architectural goal, not a current capability. It will
-require a new adapter and changes to current internal execution and protection
-contracts. The design goal is to preserve the public manifest, service, IPC,
-and PSA API contracts. Every new port must report its actual capabilities and
-must not claim security properties until they are tested on that target.
+No AArch64 architecture adapter or target is implemented or validated in the
+current release. An AArch64 port needs a separate architecture layer and device
+port; the common contracts describe its intended boundary, not an available
+build.
+
+Every new port must report its actual capabilities and must not claim security
+properties until they are tested on that target.
## Port layers
@@ -419,6 +421,11 @@ A port is its own files and nothing else:
(`tools/gen-port-docs.py`), so a port PR carries their regenerated copies and
no other shared file.
+Add the board guide to `mkdocs.yml`, the documentation list in `README.md`,
+and the index at `docs/index.md` in the same change. Keep its evidence and
+limitations in the guide and link it from [supported targets](Targets.md).
+The manual adapter checks that every Markdown page appears in its navigation.
+
`tools/new-port/new-port.sh --from ` scaffolds every file from
the closest registered port with a stub on every value the reference manual
must settle, and `--check` reports the stubs still open and runs the registry
@@ -478,10 +485,10 @@ a `lock` step behind the typed acceptance, or refused outright by the port.
- Run `make test` for common policy and service behavior.
- Run `WT_SPLIT_STRICT=1 tools/check-core-port-split.sh` and resolve
hard core-to-architecture leaks (arch or port headers, CMSE, inline
- assembly, retired names, M-profile or A-profile register vocabulary in
+ assembly, retired names, architecture-specific register vocabulary in
core code, and `wt_arch_*` definitions inside a port).
-- Run `tools/check-docs-no-internal-links.sh`; `docs/` is published to the
- wiki and must not reference internal ledgers or developer paths.
+- Run `tools/check-docs-no-internal-links.sh`; `docs/` is published as the
+ manual and must not reference internal ledgers or developer paths.
- Cross-build the Secure image with warnings enabled.
- Boot the port once with `WT_MANIFEST_RUNTIME_CHECK=1`. The default image
skips the boot isolation proofs, so this is what checks the port's
diff --git a/docs/Project-Structure.md b/docs/Project-Structure.md
index 261d5dd2c..d2ab7ccd8 100644
--- a/docs/Project-Structure.md
+++ b/docs/Project-Structure.md
@@ -3,7 +3,11 @@
| Path | Contents |
| --- | --- |
| `README.md` | Repository overview and quick start |
-| `docs/` | Source pages published to the GitHub wiki |
+| `docs/` | Source pages for the HTML and PDF manual |
+| `mkdocs.yml` | Complete manual navigation and page order |
+| `DOCS-BUILD.md` | Local manual builds, CI artifacts, and website publishing |
+| `tools/docs_manual.py`, `tools/docs-manual/` | Adapter and pinned shared documentation tools for HTML/PDF generation |
+| `docker/docs/` | Manual builder image and Python requirements |
| `include/psa/` | FF-M client/service, status, storage, update, and lifecycle headers implemented by wolfTrust |
| `include/wolftrust/` | Domain, manifest, monitor, port, scheduler, IPC, service, and VNET contracts |
| `src/` | Architecture-neutral boot sequence, monitor, FF-M runtime, domains, manifests, verification, rollback, recovery, and the Secure Partition entry bodies |
@@ -12,7 +16,7 @@
| `src/arch/armv8m/` | Armv8-M mechanisms behind `wolftrust/arch.h`: reset entry, guest context switching, exception handlers, virtual SysTick, NVIC routing, table-driven SAU and MPU programming, the SVC trap decoder, the CMSE range checks, and the five NS veneers |
| `src/client/` | OS-neutral FF-M, storage, firmware-update, HSM, and VNET client transports |
| `src/sched/` | Static coroutine and tasklet scheduling |
-| `src/services/` | HSM relay, vault, storage, attestation, firmware update, and VNET service code |
+| `src/services/` | Crypto engines, vault, storage, attestation, firmware update, VNET, and application interface services |
| `src/sync/` | Synchronization primitives used by Secure services |
| `src/vnet/` | Secure virtual Ethernet data plane |
| `port//` | One registered port: `port.json`, the memory map and registers, the platform hooks with the SAU and MPU tables, the flash and RNG drivers and their chip drivers, and the object owners ([Ports](Ports.md) lists them) |
@@ -26,8 +30,8 @@
| `tests/target/` | The emulator runner, the hardware runner, the scenario table and judge, the port profiles and the provisioning control for every port |
| `tests/firmware/` | Bare-metal, Zephyr, FreeRTOS, conformance, and VNET guest images |
| `tests/upstream/` | Fetch and integration helpers for pinned external validation suites |
-| `lib/` | Git submodules for wolfSSL, wolfPSA, wolfHSM, wolfCOSE, wolfHAL, and wolfIP |
-| `.github/workflows/` | Build, test, dependency, fuzz, and wiki synchronization workflows |
+| `lib/` | Git submodules for wolfSSL, wolfPSA, wolfHSM, wolfCOSE, wolfHAL, wolfIP, wolfTPM, and wolfPKCS11 |
+| `.github/workflows/` | Build, test, dependency, fuzz, and manual publishing workflows |
Generated files belong under `build/`, guest build directories,
ignored workspaces, or `logs/`. Public APIs are declared in `include/`;
diff --git a/docs/Provisioning.md b/docs/Provisioning.md
index d6db48684..4bedc6207 100644
--- a/docs/Provisioning.md
+++ b/docs/Provisioning.md
@@ -224,7 +224,7 @@ list) live in `tests/target/provisioning/lib/provision_common.sh`.
## Testing
-`make test` runs `make test-provisioning`: every gate of the three ports
+`make test` runs `make test-provisioning`: the registered ports' gates
against stub vendor tools, from the generic refusals to the typed acceptance.
Nothing touches a board; the typed-acceptance cases need `expect` and skip
without it, unless `WT_REQUIRE_EXPECT=1` is set: then a skipped typed group
diff --git a/docs/STM32L562-Guide.md b/docs/STM32L562-Guide.md
index 6c5abb598..63cb08eb7 100644
--- a/docs/STM32L562-Guide.md
+++ b/docs/STM32L562-Guide.md
@@ -12,9 +12,9 @@ RDP. The only RDP write is a typed regression back to level 0.
## Status
- **Cross-build:** `make TARGET=stm32l562 secure-image` links both manifests
- on the native engine, and the layout check passes for each. Production is
- 96,804 bytes of flash (96,096 text, 708 data). Conformance is 150,456 bytes.
- `WT_ENGINE=hsm` stops at `port/stm32l562/memory_map.h` with an `#error`.
+ on the native engine, and the layout check passes for each. The default
+ keeps PSA Crypto in the guest (`WT_SECURE_PSA=0`). See
+ [Footprint](Footprint.md#measured-sizes) for current production sizes.
- **Host:** `make test` runs the shared `port_flash` suite over
`tests/host/port_flash/models/stm32l562.c`, plus the port's own suites:
- `stm32l562_flash`: program, page erase, ECC, bounded waits and the tamper
diff --git a/docs/Security-Model.md b/docs/Security-Model.md
index 657329bc8..d6ff680b9 100644
--- a/docs/Security-Model.md
+++ b/docs/Security-Model.md
@@ -8,6 +8,51 @@ RAM isolation. Its security properties come from the authenticated boot chain,
hardware attribution, SPM-owned identity, copied IPC, and service-specific
policy.
+## FF-M isolation level 3
+
+On the STM32H563, wolfTrust implements isolation level 3 of the PSA Firmware
+Framework for M 1.0 (Arm DEN 0063) and meets every mandatory isolation rule at
+that level, with either crypto engine. The rules are cited by number below;
+their text is in the specification.
+
+| Requirement | wolfTrust |
+| --- | --- |
+| I1, only Code is executable (section 3.1.2) | Partition tables map data execute-never, the SPM maps all writable Secure RAM execute-never, and the domain validator refuses a writable and executable resource. |
+| I2, only Private data is writable (section 3.1.2) | Code and constant data are read-only in every partition table; a partition can write only its own stack and data band. |
+| I3, NSPE to SPE (sections 3.1.3 and 3.1.4) | SAU/IDAU and GTZC attribution, five CMSE veneers, and copied IPC. HASH, RNG, and PKA are Secure-only and read back at boot, and Non-secure DMA cannot reach Secure memory. |
+| I3, Secure Partition to Secure Partition and to the SPM (sections 3.1.3 and 3.1.4) | Each partition runs unprivileged with its own MPU table. The link check places every writable object in its owner's band or in SPM-private RAM, and the generator rejects overlapping writable resources and SPM-private RAM grants. Conformance builds and builds with `WT_MANIFEST_RUNTIME_CHECK=1` also check the composed tables at boot. |
+| I3, indirect access (section 3.1.4) | A partition maps a peripheral only if the port assigns it one that is not a bus master and reads back Secure. |
+| Private runtime state (section 4.2.1) | A partition's writable state is its own stack and, where it has one, its own data band, restored from the link image when the partition restarts. There is no shared Secure heap. Services that allocate use private, bounded arenas. |
+| Violation handling (section 3.1.6) | A partition access that breaks a rule faults and terminates that partition. A fault in the SPM halts the platform. |
+
+### Deviations
+
+- Only level 3 is implemented. A manifest that declares level 1 or 2 is
+ refused.
+- Manifest `mmio_regions` are not supported, and no port assigns a peripheral
+ to a partition. Partitions reach hardware through SPM operations pinned to
+ the calling partition.
+- The PSA Root of Trust domain is the SPM and its privileged handlers. The
+ crypto, storage, attestation, and update services run as Secure Partitions
+ and are isolated like any other partition.
+- A faulted partition is restarted under its manifest restart policy, with a
+ bounded budget, instead of staying terminated.
+- Non-secure guests run privileged. Isolation between guests is a wolfTrust
+ hypervisor property outside FF-M; see [Guest isolation](#guest-isolation).
+- The claim covers the STM32H563 reference port. Other ports share the level 3
+ implementation, but their emulator and hardware evidence must be assessed
+ separately in [supported targets](Targets.md) and the board guides.
+
+### Evidence
+
+- The Arm psa-arch-tests FF-M IPC suite, pinned in
+ [`tests/upstream/psa-arch-tests.rev`](https://github.com/wolfSSL/wolfTrust/blob/main/tests/upstream/psa-arch-tests.rev),
+ passes 85 tests with 4 heap tests skipped, recorded test by test in
+ [`tests/target/ffm_ipc_results.txt`](https://github.com/wolfSSL/wolfTrust/blob/main/tests/target/ffm_ipc_results.txt).
+- The isolation negatives in [Testing](Testing.md#isolation-scenarios) run on
+ both engines under M33MU. The STM32H563 hardware suite runs the positive and
+ conformance scenarios and the negatives the emulator cannot show.
+
## Trusted computing base
The reference trusted computing base includes:
@@ -87,10 +132,9 @@ windows are non-overlapping and hardware-isolated by GTZC.
Guest flash windows are non-overlapping but share one Non-secure attribution
window and remain mutually readable. Hardware write protection (STM32 WRP or
-the MIMXRT700 guest fence) plus `WT_GUEST_FLASH_WRP=1` protects
-their integrity, not confidentiality. A hostile guest can also reach peripherals
-left Non-secure by the boot chain; manifest resource lists do not independently
-enforce peripheral ownership in the current port.
+the MIMXRT700 guest fence) plus `WT_GUEST_FLASH_WRP=1` protects their
+integrity, not confidentiality. A guest can also reach any peripheral the boot
+chain leaves Non-secure; the port does not assign peripherals between guests.
On a guest fault, wolfTrust captures the reason, masks its interrupts, and
applies the bounded restart policy. If restart is allowed, it clears RAM marked
@@ -113,52 +157,38 @@ overrun limit still applies.
## Secure Partition isolation
-Every shipped service loop runs as a scheduled unprivileged Secure coroutine.
-Its Secure MPU view contains:
-
-- shared read/execute Secure image text;
-- read-only Secure image constants; and
-- its private stack and its own writable data band.
-
-No two Secure Partitions share a writable byte (FF-M isolation level 3). The
-vault partition owns the NVM object store, its flash context, the sealer, and
-its DRBG; the crypto partition (`SERVICE_HSM`) owns the engine state and
-reaches persistent key objects only through `SERVICE_VAULT`'s keystore object
-door, an FF-M service that serves the registered crypto partition alone and
-only the ids and labels the keystore owns; the attestation partition owns the
-token state and holds no key material, obtaining every signature and the IAK
-public key from `SERVICE_HSM`'s attestation door. Each door client is
-confined to its door: the crypto partition's other vault requests and any
-Secure Partition's call on `SERVICE_HSM`'s ordinary crypto wire return
-`PSA_ERROR_NOT_PERMITTED`. The manifest generator refuses a level 3 manifest
-that shares a writable resource between partitions, so the split cannot regress
-silently; `WT_MANIFEST_RUNTIME_CHECK=1` repeats that check at boot.
-The keystore door hands the crypto partition the key objects it asks for.
-That is an IPC contract between two partitions, not shared memory.
-
-The tables the MPU is programmed from are checked again after they are
-composed. Before any partition runs, the SPM refuses to boot if a composed
-table grants write access to memory another partition can reach, or any access
-to SPM-private RAM. A request from a Secure Partition is checked against that
-partition's own composed table, and the SPM acts on one private copy of the
-request block, so the memory references it validated are the ones it uses.
+Each partition's MPU view holds the shared Secure text (read and execute), the
+Secure constants (read-only), its own stack, and its own data band. The vault
+owns the NVM store, the sealer, and its DRBG; the crypto partition
+(`SERVICE_HSM`) owns the engine state; the attestation partition owns the token
+state. Persistent keys cross between them only as FF-M IPC:
+
+- the crypto partition reads and writes key objects through the keystore door
+ on `SERVICE_VAULT`; and
+- the attestation partition obtains signatures and the IAK public key through
+ the attestation door on `SERVICE_HSM`.
+
+The keystore door accepts the crypto partition's key objects and rejects its
+other vault requests. The attestation door serves only the attestation
+partition. With the HMAC attestation option, that partition holds the HMAC
+key in its private data band and does not use the signing door.
+
+The manifest generator validates the policy before emitting constant rows.
+The [link-time ownership check](#link-time-optimization) verifies writable
+object placement against the port's Secure RAM layout. Conformance builds
+and builds with `WT_MANIFEST_RUNTIME_CHECK=1` also cross-check the composed
+MPU tables at boot. At runtime, an SPM gate checks a private copy of a
+partition request against that partition's composed table.
### Partition restart
-A restarted partition keeps nothing its previous instance held. The SPM:
-
-- fails every request the partition was serving and drops every connection to
- it to the error state;
-- releases every connection and request the partition held as a client, so a
- handle from the old instance is refused;
-- clears its asserted signals and masks its interrupt lines until the new
- instance enables them;
-- clears its stack and returns its data band to its link-time image; and
-- rebuilds the band with the setup boot ran, from inputs the SPM holds: the
- boot handoff, the attestation public key, and the contents of the store.
+A restarted partition keeps nothing from its previous instance. Requests it was
+serving fail, the connections and handles it held are released, its signals and
+interrupt lines are cleared and masked, its stack is cleared, and its band is
+restored from the link image and rebuilt from SPM-owned boot and key inputs.
+Only the NVM store persists.
-Persistent state is the NVM store alone. Nothing in a partition's RAM survives
-its restart.
+### Privileged hardware access
Privileged handlers retain the SPM view. Flash, entropy, NVM lock, and reset
operations are available only through narrow SVC operations that check the
@@ -253,7 +283,7 @@ assembly-referenced objects are compiled without LTO so their symbols and
calling conventions stay stable. State from an optimized link unit can only
land in SPM-private RAM.
-[`tools/secure_owners.txt`](../tools/secure_owners.txt) gives every linked
+[`tools/secure_owners.txt`](https://github.com/wolfSSL/wolfTrust/blob/main/tools/secure_owners.txt) gives every linked
object one owner: a partition, the SPM, or `shared` for code that runs in more
than one domain. The post-link layout check reads the linker map and rejects:
@@ -284,9 +314,9 @@ packet. In the native engine the same SPM-stamped identity becomes the vault
key namespace's delegated sub-owner. A client-provided communication ID
therefore cannot select another guest's key namespace in either engine.
-By default (`WT_SECURE_PSA=1`) the native engine runs wolfPSA in the crypto
-partition, so PSA key state, operation state and internal intermediate secrets
-stay in Secure memory. APIs whose contract returns secret material, such as
+With `WT_SECURE_PSA=1`, the native engine runs wolfPSA in the crypto
+partition, so PSA key state, operation state and intermediate secrets stay
+in Secure memory. APIs whose contract returns secret material, such as
`psa_export_key()` of an exportable key, `psa_raw_key_agreement()` and
`psa_key_derivation_output_bytes()`, still copy that output to the
Non-secure caller. Keys and operations are bound to the SPM-stamped client ID, handles
@@ -294,9 +324,10 @@ carry a per-boot nonce, and persistent key IDs are namespaced per client and
limited to the user range. A replacement image in the same guest slot owns
that slot's persistent keys, matching TF-M's client-ID ownership.
-With the `WT_SECURE_PSA=0` opt-out the native guests run wolfPSA and wolfCrypt
-locally. Their ordinary volatile PSA keys then live in Non-secure guest RAM;
-only DRBG seed requests and explicit native-wire vault-key requests cross the
+With `WT_SECURE_PSA=0` (the STM32L562 default), native guests run wolfPSA
+and wolfCrypt locally. Their ordinary volatile PSA keys live in Non-secure
+guest RAM.
+DRBG seed requests and explicit native-wire vault-key requests cross the
Secure boundary. In the hsm engine, supported guest PSA operations and their
private key state are routed to the Secure wolfHSM server.
@@ -381,23 +412,24 @@ fenced wolfBoot described in [MIMXRT700 Guide](MIMXRT700-Guide.md).
## Static memory
-The Secure wolfCrypt settings define both `NO_WOLFSSL_MEMORY` and
-`WOLFSSL_NO_MALLOC`. Stacks, IPC transfers, service state, selected-engine
-contexts, and cryptographic scratch space use fixed storage. Oversized requests
-fail instead of allocating. The link also rejects allocator symbols in both
-engine images.
+The SPM's stacks, connection slots, transfer buffers, and scheduler state
+use fixed storage. Secure PSA Crypto and the optional PKCS#11 provider
+allocate from private, bounded arenas. A service exhausts its own capacity
+when that arena is full. See [SPM switches](Macros.md#spm-switches) for IPC
+limits and [Crypto Engines](Crypto-Engines.md) for Secure PSA pool sizing.
## Source anchors
-- [FF-M gateway](../src/arch/armv8m/ffm_nsc.c)
-- [Secure Partition scheduler and SVC gates](../src/arch/armv8m/spm_svc.c)
-- [Secure stack sealing and context switch](../src/arch/armv8m/coroutine_armv8m.c)
-- [Secure fault attribution and SPM halt](../src/arch/armv8m/sp_fault_armv8m.c)
-- [Secure MPU tables and the SPM RAM cover](../src/arch/armv8m/mpu_armv8m.c)
-- [Guest verification](../src/guest_verify.c)
-- [HSM relay binding](../src/services/wolfhsm/wt_hsm.c)
-- [Native crypto dispatch](../src/services/native/crypto_native.c)
-- [Native vault key backend](../src/services/native/keyvault.c)
-- [Vault storage](../src/services/wolfhsm/wt_hsm_vault.c)
+- [SPM core](https://github.com/wolfSSL/wolfTrust/blob/main/src/spm/core.c)
+- FF-M gateway: [copied request handling](https://github.com/wolfSSL/wolfTrust/blob/main/src/arch/common/ffm_gateway.c) and [Armv8-M veneers](https://github.com/wolfSSL/wolfTrust/blob/main/src/arch/armv8m/ffm_nsc.c)
+- Secure Partition scheduling and SVC gates: [common gate](https://github.com/wolfSSL/wolfTrust/blob/main/src/arch/common/spm_gate_core.c) and [Armv8-M SVC](https://github.com/wolfSSL/wolfTrust/blob/main/src/arch/armv8m/spm_svc.c)
+- [Secure stack sealing and context switch](https://github.com/wolfSSL/wolfTrust/blob/main/src/arch/armv8m/coroutine_armv8m.c)
+- [Secure fault attribution and SPM halt](https://github.com/wolfSSL/wolfTrust/blob/main/src/arch/armv8m/sp_fault_armv8m.c)
+- [Secure MPU tables and the SPM RAM cover](https://github.com/wolfSSL/wolfTrust/blob/main/src/arch/armv8m/mpu_armv8m.c)
+- [Guest verification](https://github.com/wolfSSL/wolfTrust/blob/main/src/guest_verify.c)
+- [HSM relay binding](https://github.com/wolfSSL/wolfTrust/blob/main/src/services/hsm_relay_service.c)
+- Native crypto dispatch: [service](https://github.com/wolfSSL/wolfTrust/blob/main/src/services/native/crypto_native.c) and [wire protocol](https://github.com/wolfSSL/wolfTrust/blob/main/src/services/native/native_wire.c)
+- [Native vault key backend](https://github.com/wolfSSL/wolfTrust/blob/main/src/services/native/keyvault.c)
+- [Vault storage](https://github.com/wolfSSL/wolfTrust/blob/main/src/services/wolfhsm/wt_hsm_vault.c)
See [Threat Model](Threat-Model.md) for assumptions and residual risks.
diff --git a/docs/Services.md b/docs/Services.md
index ce1e3cc83..84afa1b15 100644
--- a/docs/Services.md
+++ b/docs/Services.md
@@ -42,10 +42,11 @@ Zephyr and FreeRTOS reference guests expose wolfPSA's PSA Crypto API. The
wired. Both engines use one input and one output vector, bounded to 384 bytes,
through the same copied FF-M call.
-With the default native engine, wolfPSA and wolfCrypt execute in the crypto
-partition (`WT_SECURE_PSA=1`) and each guest calls PSA Crypto through the
-client library. With `WT_SECURE_PSA=0` they execute in the Non-secure guest,
-and DRBG seed requests use the native client to reach the Secure vault RNG. The native wire also exposes explicit vault-backed P-256 and
+With `WT_SECURE_PSA=1`, wolfPSA and wolfCrypt execute in the Secure crypto
+partition and each guest links the PSA Crypto client. With
+`WT_SECURE_PSA=0`, the libraries execute in the Non-secure guest and reach
+the Secure vault RNG for DRBG seed material. The native wire also exposes
+explicit vault-backed P-256 and
AES-256 key operations, random generation, and SHA-256. Vault key objects are
namespaced by the SPM-stamped client ID and stored `SENSITIVE` and
`NONEXPORTABLE`.
@@ -57,12 +58,10 @@ wolfHSM NVM message groups. The reference build executes the server with
software wolfCrypt; deployments can configure wolfHSM's external-HSM path.
The cryptographic profile is the Secure image's `WT_SECURE_PSA_PROFILE`
-under `WT_SECURE_PSA=1`, and each guest's wolfCrypt `user_settings.h` under
-`WT_SECURE_PSA=0` or the wolfHSM engine. Consult the vendored
-`lib/wolfPSA/wolfpsa/psa/crypto.h` and the active guest configuration
-before assuming a particular algorithm is available. See
-[Crypto Engines](Crypto-Engines.md) for the protocol, key-protection, and
-footprint differences.
+under `WT_SECURE_PSA=1`. Guest-local and wolfHSM builds select algorithms
+through the guest's wolfCrypt configuration and the selected server
+operations. See [Crypto Engines](Crypto-Engines.md) for the supported
+profiles and key models.
## Vault
@@ -106,10 +105,12 @@ output buffer is smaller than the object. The write-once flag is enforced by
both the front end and checked NVM metadata. ITS data is held in Secure-only
storage, but ITS does not add the Protected Storage sealing flag.
-The current storage path always enforces `PSA_STORAGE_FLAG_WRITE_ONCE`,
-including during `PSA_ROT_PROVISIONING`. This differs from PSA Secure Storage
-1.0, which requires the flag not to be enforced in that lifecycle state. The
-same deviation applies to Protected Storage objects created with the flag.
+The ITS path enforces `PSA_STORAGE_FLAG_WRITE_ONCE` on objects created with
+that flag, including during `PSA_ROT_PROVISIONING`. Objects created without it
+can be updated or removed. This differs from PSA Secure Storage 1.0 section 3.2,
+which requires ITS not to enforce the flag in that lifecycle state. Protected
+Storage also enforces caller-selected `WRITE_ONCE`; section 3.2's lifecycle exception
+applies to ITS.
## Protected Storage
@@ -149,7 +150,7 @@ deviations from the profile's signer and hardware identity requirements.
[RFC 9783](https://www.rfc-editor.org/rfc/rfc9783.html)
The compatibility register records the token-profile and API deviations.
-[TF-M Compatibility](TF-M-Compatibility.md)
+[PSA Compatibility](PSA-Compatibility.md)
The EAT/PSA claim set binds:
diff --git a/docs/Standards.md b/docs/Standards.md
new file mode 100644
index 000000000..59186cce5
--- /dev/null
+++ b/docs/Standards.md
@@ -0,0 +1,37 @@
+# Standards and Claims
+
+wolfTrust targets the Arm Firmware Framework for M (FF-M) 1.0 contract and
+selected Platform Security Architecture (PSA) service APIs. The reference
+implementation is the STM32H563 Cortex-M33 port. MIMXRT700, MCXN947, and
+STM32L562 share the Armv8-M adapter; [supported targets](Targets.md) and their
+board guides record port-specific coverage. Compatibility is documented
+per interface, with its limits and test evidence; no full FF-M or PSA
+certification is claimed.
+
+| Standard or profile | Implemented scope and deviations |
+| --- | --- |
+| [Arm FF-M 1.0](https://documentation-service.arm.com/static/64a2ed35df6cd61d528c4132) | [FF-M Compatibility](FF-M-Compatibility.md) covers the client and Secure Partition APIs, manifests, IPC, isolation policy, and differences from the specification. One `psa_irq_enable()` operation is backported from an FF-M 1.1 beta extension. |
+| [PSA Crypto API 1.4](https://arm-software.github.io/psa-api/crypto/1.4/) | [PSA Compatibility](PSA-Compatibility.md) records the wolfPSA surface and configuration-dependent algorithm support. [Crypto Engines](Crypto-Engines.md) explains where keys and operations execute. |
+| [PSA Secure Storage API 1.0](https://arm-software.github.io/psa-api/storage/1.0/) | [PSA Compatibility](PSA-Compatibility.md) records the implemented ITS and Protected Storage operations and their flag and access-policy differences. |
+| [PSA Initial Attestation API 1.0](https://arm-software.github.io/psa-api/attestation/1.0/) and [RFC 9783](https://www.rfc-editor.org/rfc/rfc9783.html) | [PSA Compatibility](PSA-Compatibility.md) records the token API subset and token-profile deviations, including the currently advertised `tag:psacertified.org,2023:psa#tfm` profile. |
+| [PSA Firmware Update API 1.0](https://arm-software.github.io/psa-api/fwu/1.0/) | [PSA Compatibility](PSA-Compatibility.md) records the single-component update flow and unsupported trial-accept behavior. |
+
+On the STM32H563, wolfTrust meets FF-M isolation level 3;
+[Security Model](Security-Model.md#ff-m-isolation-level-3) maps each isolation
+rule and lists the deviations. The MIMXRT700 port links the same level 3 layer
+and runs every level 3 negative under M33MU; the
+[MIMXRT700 Guide](MIMXRT700-Guide.md) records its evidence. [Threat Model](Threat-Model.md) describes assumptions
+and residual risks. [Testing](Testing.md) separates host, emulator, and
+physical-board evidence.
+
+## Deviation register
+
+- [FF-M framework differences](FF-M-Compatibility.md#framework-differences)
+ lists the IPC, manifest, lifecycle, and integration differences.
+- [FF-M isolation level](FF-M-Compatibility.md#isolation-level) states the
+ implemented level and points to the rule mapping.
+- [PSA service API differences](PSA-Compatibility.md#service-api-differences)
+ lists storage, attestation, and firmware-update deviations.
+- [Validation and claim boundaries](FF-M-Compatibility.md#validation-and-claim-boundary)
+ and [PSA validation](PSA-Compatibility.md#validation-and-claim-boundary)
+ identify the evidence behind each claim.
diff --git a/docs/TF-M-Compatibility.md b/docs/TF-M-Compatibility.md
deleted file mode 100644
index f147bbc09..000000000
--- a/docs/TF-M-Compatibility.md
+++ /dev/null
@@ -1,226 +0,0 @@
-# TF-M Compatibility
-
-wolfTrust implements the PSA interfaces needed by its reference applications
-without linking the Trusted Firmware-M runtime. Compatibility is at the C API
-and service-behavior level; image layout, manifests, build integration, and
-the SPM implementation are wolfTrust-specific.
-
-This register describes the code in the repository. It is not a certification
-statement, and a declaration in a vendored header does not mean every optional
-algorithm or feature is enabled in every build.
-
-## Measured Secure-image footprint
-
-Both projects were built for the same board (STM32L562E-DK) at isolation
-level 3 with the same compiler (Arm GNU 15.2.1), each with its own size
-options. These are local builds, not published reference figures.
-
-| Image | Flash | Secure RAM |
-| --- | ---: | ---: |
-| wolfTrust Secure runtime, native default | 61,880 bytes | 37,680 bytes |
-| TF-M v2.3.1 `tfm_s`, level 3 | 79,680 bytes | 45,728 bytes |
-| wolfBoot, STM32L5 secure application handoff | 27,216 bytes | 2,104 bytes |
-| TF-M BL2 (MCUboot, EC-P256) | 38,744 bytes | 27,408 bytes |
-| Chain: wolfBoot + wolfTrust | 89,096 bytes | |
-| Chain: BL2 + TF-M | 118,424 bytes | |
-
-The wolfTrust runtime is 17,800 bytes smaller in flash and 8,048 bytes smaller
-in Secure RAM; the boot chain is 29,328 bytes smaller in flash. Both RAM
-figures include every partition stack (see Methodology). The bootloader's RAM
-is reused by the runtime, so the RAM figures are not summed. The
-cross-compile workflow fails if any port's native `WT_SECURE_PSA=0` image grows
-past TF-M's 79,680 bytes of flash or 45,728 bytes of Secure RAM, plus the RAM
-code band (`WT_RAMFUNC_SIZE`) of a port that runs code from RAM.
-
-Both images carry Crypto, Internal Trusted Storage, Protected Storage and
-Initial Attestation with one Non-secure image; TF-M also builds its platform
-service, and neither builds Firmware Update. They differ in how level 3 is applied: TF-M's
-STM32L5 port runs the PSA RoT partitions (Crypto, ITS, attestation,
-platform) privileged (`tfm_hal_isolation.c`), while wolfTrust runs every
-Secure Partition unprivileged with its own MPU regions. Each wolfTrust
-feature the default leaves out comes back with one Make variable; see
-[Build profiles](Macros.md#build-profiles) for each one's cost.
-
-The crypto split matches TF-M's: both serve PSA Crypto from a Secure crypto
-partition, which wolfTrust's native default does with `WT_SECURE_PSA=1` (see
-[Crypto Engines](Crypto-Engines.md#psa-crypto-in-the-secure-image-wt_secure_psa1)).
-That default is larger than TF-M in flash. On the STM32H563 the `default`
-profile is 86,091 bytes of flash and 39,744 bytes of Secure RAM: 6,411 bytes
-more flash and 5,984 bytes less RAM than the TF-M image above. The `small` profile (CCM
-as the one AEAD) is the closest to TF-M's Medium set: its crypto stack is
-40,443 bytes against 40,478 for TF-M's Crypto partition and Mbed TLS, where
-`default`'s is 43,567. The rest of the gap is the storage and SPM code
-outside the crypto stack. The
-`WT_SECURE_PSA=0` opt-out, which runs wolfPSA in the Non-secure guest instead,
-stays below the TF-M image in both flash and RAM.
-
-### Non-crypto split
-
-`tools/footprint/classify.py` splits a non-LTO map by category with one rules
-file per project (`tools/footprint/wolftrust.rules` and `tfm.rules`). Every
-flash byte lands in a category, `fill` or `linker`, so the categories sum to
-`text + data`, and an object no rule matches fails the run. Crypto is the
-crypto library, the crypto partition and its client, key loaders and entropy
-glue on both sides; attestation includes its CBOR and COSE libraries; storage
-includes the flash drivers and NV counters; guest is the Non-secure guest
-management (TF-M's NS agent).
-
-| Category | wolfTrust STM32H563 | TF-M STM32L562 |
-| --- | ---: | ---: |
-| SPM | 10,871 | 7,548 |
-| Storage | 17,096 | 13,156 |
-| Attestation | 6,231 | 5,585 |
-| Guest management | 4,720 | 176 |
-| Platform | 4,350 | 9,104 |
-| Runtime, fill, linker | 503 | 1,689 |
-| **Non-crypto total** | **43,771** | **37,258** |
-| Crypto | 45,085 | 42,422 |
-
-```sh
-make TARGET=stm32h563 WT_ENGINE=native WT_ATTEST_COSE=1 WT_LTO=0 secure-image
-python3 tools/footprint/classify.py build/wolftrust.map \
- --rules tools/footprint/wolftrust.rules --elf build/wolftrust.elf --objects
-python3 tools/footprint/classify.py tfm_s.map --rules tools/footprint/tfm.rules \
- --elf tfm_s.elf
-```
-
-The cross-compile workflow holds each port's non-crypto and SPM flash under
-the ceilings in its `port.json` (`build.noncrypto_max`, `build.spm_max`),
-lowered as size work lands.
-
-### Methodology
-
-Footprint is read from the linked Secure ELF and its map:
-
-```text
-Flash = text + data
-Secure RAM = all RAM the Secure image reserves, partition stacks included
-```
-
-- TF-M places every partition stack and the SPM stack in sections
- (`.ER_TFM_SP_*_BSS`, `.msp_stack`), so `data + bss` from
- `arm-none-eabi-size` is its whole reservation.
-- wolfTrust's level 3 partition stacks and data bands are linker regions with
- no section in them, which `data + bss` leaves out. `tools/secure_ram.py`
- (printed by `make size-report`) adds them from the map: the SPM's
- `.data` + `.bss`, the SPM main stack, and every band and stack at its full
- length.
-- Neither figure counts Secure RAM a port leaves free.
-
-- wolfTrust: the STM32L562 port, built with its defaults (native engine, LTO,
- one guest): `make TARGET=stm32l562 secure-image` in
- `ghcr.io/wolfssl/wolfboot-ci-m33mu:v1.25`. With `WT_SECURE_PSA=0`, the same
- defaults give 62,560 bytes of flash and 37,696 bytes of Secure RAM for
- `TARGET=stm32h563` in this tree; the `WT_SECURE_PSA=1` default gives 86,091
- and 39,744.
-- wolfBoot: `config/examples/stm32l5-tz-wolftrust.config` (ECC256, SHA256,
- `WOLFBOOT_SECURE_APP=1`).
-- TF-M: v2.3.1, platform `stm/stm32l562e_dk`, `TFM_ISOLATION_LEVEL=3`,
- `CMAKE_BUILD_TYPE=MinSizeRel`, the TF-PSA-Crypto Medium profile
- (`crypto_config_profile_medium.h`) with asymmetric encryption off,
- `TFM_PARTITION_FIRMWARE_UPDATE=OFF`, SPM and partition logging off,
- `CRYPTO_HW_ACCELERATOR=OFF`, BL2 with EC-P256 signatures.
-
-## Compatibility register
-
-| API or behavior | Version | Status | Repository evidence |
-| --- | --- | --- | --- |
-| FF-M client API | 1.0 with the scoped deviations below | Connection-based IPC is implemented | `include/psa/client.h` and `src/client/psa_ffm_client.c` |
-| Secure Partition IPC API | FF-M 1.0 plus a wolfTrust-specific backport of `psa_irq_enable()` from Arm's FF-M 1.1 Extension Beta, Issue 0 | Supported for scheduled IPC partitions; wolfTrust still reports framework version `0x0100` and does not accept 1.1 manifests | `include/psa/service.h`, `include/psa/client.h`, and `src/arch/common/spm_sp_api.c` |
-| Framework and service discovery | 1.0 | Supported | `psa_framework_version` and `psa_version` |
-| Copied input and output vectors | FF-M 1.0 | Supported, with at most four vectors total and a 1024-byte aggregate budget across input bytes and declared output capacity | `include/wolftrust/spm_core.h` and `src/spm/core.c` |
-| Manifest validation | wolfTrust format 1 | Supported for immutable generated C data | `tools/manifest/generate.py`, `src/manifest.c`, and `manifest/base.json` |
-| PSA Crypto | 1.4 header | Supported through wolfPSA; algorithms depend on the guest profile, or on `WT_SECURE_PSA_PROFILE` when `WT_SECURE_PSA=1` serves it from the Secure image | `lib/wolfPSA/wolfpsa/psa/crypto.h` and both reference guest settings |
-| Internal Trusted Storage | 1.0 | Core set/get/get-info/remove subset with the `WRITE_ONCE` lifecycle deviation below | `include/psa/internal_trusted_storage.h` and `src/services/wolfhsm/wt_hsm_vault.c` |
-| Protected Storage | 1.0 | Core set/get/get-info/remove subset; optional create/set-extended absent and the `WRITE_ONCE` lifecycle deviation below applies | `include/psa/protected_storage.h` and `src/services/storage_service.c` |
-| Initial Attestation | 1.0 API subset with a nonconformant RFC 9783-derived token | Token and exact-size operations are supported, but the advertised TF-M profile has the claim-semantic deviations below | `lib/wolfPSA/wolfpsa/psa/initial_attestation.h` and `src/services/initial_attestation.c` |
-| Firmware Update | 1.0 subset | Single-component staging and authenticated reboot supported | `include/psa/update.h` and `src/services/fwu_service.c` |
-| RoT lifecycle query | FF-M 1.0 | Secure Partition only; there is no Non-secure adapter or veneer | `include/psa/lifecycle.h` and `src/arch/common/spm_sp_api.c` |
-| Secure Partition signals and IRQ APIs | FF-M 1.0 plus one wolfTrust-specific beta-extension backport | The 1.0 signal APIs and `psa_eoi` are supported; only `psa_irq_enable()` is backported from the FF-M 1.1 Extension Beta, Issue 0, while `psa_irq_status_t`, `psa_irq_is_enabled`, `psa_irq_disable`, and `psa_irq_restore` are absent | `include/psa/service.h` and the Armv8-M SVC implementation |
-| Secure Partition hardware IRQ routing | Port-specific | Conformance builds route the port's `WT_CONF_IRQ`. Production manifests must leave partition IRQs empty. | `port/common/armv8m/platform_caps.h` and `tools/manifest/generate.py` |
-| Guest identity | Multi-guest extension | Non-secure guest `N` is client `-(N + 1)`. FF-M expects one negative ID for every SPM-assigned Non-secure connection, which would merge the guests' storage and network ownership; a one-guest build uses `-1` only | `src/arch/armv8m/ffm_nsc.c` |
-
-## Intentional differences
-
-| Difference | Classification | Reason and impact |
-| --- | --- | --- |
-| wolfTrust exposes the FF-M Non-secure client API through one five-function CMSE gateway. | Implementation detail | The gateway exports framework version, service version, connect, call, and close; Secure Partition entry points are a separate manifest concern. |
-| Only connection-based IPC services are enabled. | Scoped | The production manifest requests only `WT_MANIFEST_FEATURE_IPC`. SFN, stateless services, and memory-mapped I/O vectors are rejected when the manifest is generated, and the runtime refuses SFN partitions at activation. |
-| IPC uses fixed copied buffers. | Scoped safety bound | Calls are limited to four vectors and a 1024-byte transfer budget. Services apply smaller bounds. Applications must chunk larger data. |
-| A Non-secure connect, call, or close cannot remain pending after the scheduler reaches quiescence for that dispatch. | Scoped deviation | An incomplete message becomes a client error. If already claimed, the service retains its message until reply or partition fault; late output is discarded. A late call reply releases the message, but the connection remains in error until the client requests close. If close was already requested, the late reply allows deferred disconnection to proceed. Shipped Non-secure-facing services reply within the dispatch; Secure Partition callers use the begin/finish path when scheduling another partition is required. |
-| Connect and close never take a transfer buffer. | Stronger resource policy | Only a call holds one of the fixed transfers, so pool exhaustion can refuse a call but never a connect or a close. |
-| A call vector the caller cannot access is refused before a transfer is taken. | Implementation detail | The call returns `PSA_ERROR_PROGRAMMER_ERROR` and the connection enters its error state, even when every transfer is busy. |
-| A `PSA_ERROR_PROGRAMMER_ERROR` reply publishes no output, and a faulted server's staged output is discarded. | Stronger isolation policy | The caller receives the status with every output length zero, so a failing or restarted service cannot leak a partly written reply. |
-| A departed client's handles stop resolving as soon as the client is reclaimed. | Implementation detail | A service still holding that client's message finishes it; the reply is discarded and the connection is released afterwards. |
-| Connection and message handles carry a 24-bit generation per slot. | Implementation detail | A stale handle is refused until the same slot has been reused 16,777,216 times; a Secure caller that presents a refused handle is panicked as a programmer error. |
-| Secure services are linked in one image. | Scoped isolation difference | Service writable state is isolated by unprivileged threads and Secure MPU domains, but executable text is shared rather than separately linked. |
-| All shipped service loops run as scheduled coroutines. | Implementation difference | Service code uses the standard Secure Partition API; privileged hardware access goes through identity-pinned SVC gates. |
-| Abnormal Non-secure guest termination reclaims the guest's connections without delivering `PSA_IPC_DISCONNECT` to the affected services. | Scoped deviation | Fault-handler cleanup cannot dispatch a Secure service inline without re-entering the scheduler. Shipped services do not use `psa_set_rhandle()` for per-connection cleanup, but a ported service that depends on disconnect cleanup must account for this behavior. |
-| PSA Crypto mechanisms are build-selected. | Standard profile behavior | The wolfPSA 1.4 header is present, while each guest's wolfCrypt settings determine available keys and algorithms. |
-| Protected Storage does not implement create or set-extended. | Scoped | `psa_ps_get_support()` returns zero and both optional operations return `PSA_ERROR_NOT_SUPPORTED`. |
-| ITS and Protected Storage always enforce `PSA_STORAGE_FLAG_WRITE_ONCE`. | Known lifecycle deviation | The request path does not receive lifecycle state and always rejects modification or removal. PSA Secure Storage 1.0 requires the flag not to be enforced during `PSA_ROT_PROVISIONING`. |
-| Initial Attestation's public header omits `PSA_INITIAL_ATTEST_MAX_TOKEN_SIZE`. | Known header deviation | The service limit is 640 bytes, but callers cannot obtain that maximum from the public PSA header. |
-| The attestation token uses the `tag:psacertified.org,2023:psa#tfm` identifier. | Known token-profile deviation | The signer ID and implementation ID are software-label hashes. These claims are known deviations from the profile's signer and hardware identity requirements. A distinct derived profile identifier is required until these claims conform. [RFC 9783](https://www.rfc-editor.org/rfc/rfc9783.html) |
-| Firmware Update has no persistent trial-accept flow. | Scoped | Installation commits only after wolfBoot authenticates the swapped image at reboot; `psa_fwu_accept()` returns `PSA_ERROR_NOT_SUPPORTED`. |
-| The firmware-update detached manifest is a 32-bit version word. | Scoped integration | Passing `NULL, 0` instead binds the version from the staged wolfBoot header. Other manifest encodings require an adapter. |
-| Secure memory uses no dynamic allocation. | Stronger resource policy | Fixed pools and buffers can reject excess work rather than expanding at runtime. |
-| Manifests use wolfTrust JSON and generated C. | Integration difference | Existing TF-M manifests are not consumed directly. Security resources and services must be represented in the wolfTrust schema. |
-| Secure Partition entry functions are bound at build time instead of being selected by each manifest's `entry_point` field. | Integration difference | The numeric field validates an executable window, but adding a service also requires a compiled entry wrapper and an explicit start call in `wt_ffm_boot_start_sched()`. |
-| Service IDs are generated from the selected manifest. | Integration difference | Applications should include generated `psa_manifest/sid.h` instead of hard-coding target-specific values. |
-
-## Isolation-profile interpretation
-
-The STM32H563 manifest sets `isolation_profile` to
-`WT_ISOLATION_PROFILE_LEVEL_3` and declares the capabilities the manifest
-generator checks against the port's own. Only level 3 is implemented, so the
-generator and the optional boot-time validator refuse levels 1 and 2. The manifest declares its Non-secure guests
-privileged, matching the runtime, which initializes `CONTROL_NS.nPRIV` to zero.
-It declares every Secure Partition unprivileged, and the generator and the
-validator refuse a privileged one. TrustZone protects Secure state, GTZC isolates peer
-guest RAM, and unprivileged Secure threads use per-partition Secure MPU regions.
-The guest Non-secure MPU and interrupt masks are scheduling policy because a
-privileged guest can reprogram them.
-
-The current single-image layout still shares Secure executable text; every
-partition's writable state is its own, and the crypto, vault, and attestation
-partitions interact only through FF-M IPC. Treat the profile field as a
-requested and validated wolfTrust policy level, not by itself as proof of
-independent TF-M isolation certification. [Security Model](Security-Model.md) describes the
-actual boundary.
-
-## Migrating an application
-
-1. Keep application calls on standard PSA headers where wolfTrust provides the
- corresponding Non-secure adapter: FF-M client, Crypto, ITS, Protected
- Storage, and Firmware Update. The lifecycle function is Secure-Partition-only.
-2. Link `src/client/psa_ffm_client.c` and the generated
- `secure_cmse_implib.o` from the selected Secure-image `BUILD_DIR`, then add
- the adapter required by each API:
- wolfPSA plus `src/client/crypto_native_client.c` for the native Crypto
- configuration, or wolfPSA, the wolfHSM client, and
- `src/client/hsm_psa_transport.c` for the hsm configuration;
- `src/client/psa_storage_client.c` for ITS and Protected Storage,
- `src/client/psa_fwu_client.c` for Firmware Update, and
- `src/client/vnet_psa_transport.c` for optional VNET.
-3. Initial Attestation currently has only the Zephyr-specific adapter at
- `tests/firmware/zephyr-stm32h5/module/wolftrust-tee/src/wolftrust_attestation_client.c`.
- The vendored `lib/wolfPSA/src/psa_attestation.c` is a stub that returns
- `PSA_ERROR_NOT_SUPPORTED` and must not be linked instead of or alongside that
- adapter.
-4. Include the `psa_manifest/sid.h` generated for the selected target
- and manifest.
-5. Check data-size assumptions against the copied IPC and service limits.
- Stream update images in blocks no larger than `PSA_FWU_MAX_WRITE_SIZE`.
- For wolfTrust, the image offset must be aligned to
- `1 << PSA_FWU_LOG2_WRITE_ALIGN`. An unaligned final block is padded by the
- service to the backend write alignment.
-6. Check optional APIs before use. In particular, treat Protected Storage
- create/set-extended and Firmware Update accept as unsupported.
-7. Express Secure services, dependencies, memory, interrupts, restart policy,
- guest launch requirements, and minimum versions in the wolfTrust manifest.
-8. Replace TF-M build and image assembly with the wolfBoot and wolfTrust flow.
- Patch guest measurement records before signing wolfTrust.
-9. Run host tests, target conformance under M33MU, and the hardware suite
- separately. An emulator pass does not establish silicon attribution.
-
-See [API Reference](API-Reference.md), [Porting](Porting.md), and [Testing](Testing.md) for integration details.
diff --git a/docs/Targets.md b/docs/Targets.md
new file mode 100644
index 000000000..3b031345b
--- /dev/null
+++ b/docs/Targets.md
@@ -0,0 +1,78 @@
+# Ports and supported targets
+
+wolfTrust separates its common runtime, architecture adapter, and device port.
+STM32H563, MIMXRT700, MCXN947, and STM32L562 link the same core runtime,
+Armv8-M adapter, and shared isolation level 3 layer in `port/common/armv8m/`.
+The generated [Ports](Ports.md) page lists the registered boards, engines,
+build variants, CI labels, emulator tiers, hardware scenarios, and absent
+capabilities. This page explains their validation scope; each board guide
+holds its setup and current evidence.
+
+## Armv8-M
+
+### STM32H563 (supported reference port)
+
+The `armv8m-stm32h563` tuple has two validation environments:
+
+| Environment | What it exercises | Guide |
+| --- | --- | --- |
+| NUCLEO-H563ZI hardware | wolfBoot authenticates wolfTrust; Zephyr and FreeRTOS reference guests use the FF-M gateway. Board provisioning and flash protection are required for the hardened path. | [STM32H563 board guide](STM32H5-Guide.md) |
+| M33MU Cortex-M33 emulator | The authenticated chain and target scenarios without a physical board. Emulator results do not establish physical flash or debug-policy enforcement. | [Getting Started](Getting-Started.md#run-under-m33mu) and [Testing](Testing.md) |
+
+### MIMXRT700
+
+The `armv8m-mimxrt700` tuple (`TARGET=mimxrt700`) runs on the compute
+Cortex-M33 of the MIMXRT798S and executes in place from external XSPI0 NOR:
+
+| Environment | What it exercises | Guide |
+| --- | --- | --- |
+| MIMXRT700-EVK hardware | wolfBoot authenticates wolfTrust; bare-metal guests use the FF-M gateway. The suite covers the chain, guest RAM isolation, and the XSPI guest flash fence. `SERVICE_VNET` is not ported. | [MIMXRT700 board guide](MIMXRT700-Guide.md) |
+| M33MU RT700 model | The authenticated chain and registered FF-M, PSA, isolation, and recovery scenarios. The model has no DMA; the registry records other model limits. | [MIMXRT700 board guide](MIMXRT700-Guide.md) and [Testing](Testing.md) |
+
+### MCXN947
+
+The `armv8m-mcxn947` tuple (`TARGET=mcxn947`) runs on core 0 of the
+MCXN947 on FRDM-MCXN947. It boots wolfBoot and wolfTrust from internal flash
+and supports both crypto engines. Its registered M33MU scenarios cover the
+authenticated chain, FF-M IPC conformance, PSA services, isolation, and
+recovery. The board runner exercises the hardware minimum in the OEM_OPEN
+life cycle. Hardware guest-flash fencing is unavailable; a fence-required
+image refuses to launch guests. See the [MCXN947 Guide](MCXN947-Guide.md)
+for the current evidence and limitations.
+
+### STM32L562
+
+The `armv8m-stm32l562` tuple (`TARGET=stm32l562`) runs on STM32L562E-DK,
+using internal flash and GTZC guest-RAM attribution. It supports the native
+engine and defaults to guest-local PSA Crypto (`WT_SECURE_PSA=0`). The
+M33MU STM32L552 model runs the registered STM32L562 layout
+and conformance scenarios with a pinned model patch. The current flash
+layout has emulator evidence; earlier DK runs used a different layout and
+do not qualify the current one. See the [STM32L562 Guide](STM32L562-Guide.md)
+for the required provisioning and remaining hardware work.
+
+All ports share the manual life cycle flow in [Provisioning](Provisioning.md).
+
+### Additional Armv8-M devices
+
+Another Cortex-M33 device needs its own device port, memory layout, manifest,
+guest integration, and target validation before it can be listed as
+supported. It reuses the Armv8-M adapter and the shared level 3 layer if its
+execution and protection model fit the adapter contract. Add a board guide
+alongside this page when that port has a validated build and deployment path.
+
+## AArch64
+
+An AArch64 device, such as a future Versal target, requires an AArch64
+architecture adapter and a device port. No AArch64 build or hardware
+validation is currently claimed. Keep platform-specific setup in a separate
+board guide once the port exists; the common [Porting](Porting.md) page defines
+the contracts shared across architectures.
+
+Start with [Getting Started](Getting-Started.md) for prerequisites and a first
+build. See [Building](Building.md) for build controls and guest images, and
+[Porting](Porting.md) for a new device's required architecture and target
+contracts. [Security Model](Security-Model.md) describes the protection
+mechanisms of the STM32H563 reference implementation; the MIMXRT700 guide
+covers where that port differs. The MCXN947 and STM32L562 guides record the
+same distinctions for their boards.
diff --git a/docs/Testing.md b/docs/Testing.md
index f3e39a81e..38347d888 100644
--- a/docs/Testing.md
+++ b/docs/Testing.md
@@ -9,8 +9,13 @@ as a result from another.
| Environment | What it validates | What it does not validate |
| --- | --- | --- |
| Native host | State machines, manifests, IPC ownership, copied transfers, services, storage, crypto integration, recovery decisions, and negative inputs | Cortex-M exception return, CMSE, SAU, MPU, GTZC, or physical flash behavior |
-| M33MU | Cortex-M33 instruction flow, TrustZone transitions, CMSE gateway calls, MPU faults, guest scheduling, authenticated boot, and target service interactions | STM32H563 peripherals, real option bytes, WRP, ST-Link, or silicon timing |
+| M33MU | Cortex-M33 instruction flow, TrustZone transitions, CMSE gateway calls, MPU faults, guest scheduling, authenticated boot, and target service interactions | Physical peripheral, flash-fence, debug-policy, option-byte, or silicon-timing guarantees; each port records its model limits |
| STM32H563 | The actual NUCLEO-H563ZI boot chain, Secure/Non-secure attribution, faults, flash, UART, and selected end-to-end behavior | Other devices, other provisioning states, peer-flash confidentiality, or adversarial peripheral and Non-secure NVIC ownership |
+| MIMXRT700, MCXN947, STM32L562 hardware | The selected board's chain and scenario assertions, when run on that board and layout | Untested layouts, other life cycles, model-only results, or capabilities absent from the port |
+
+[Ports](Ports.md) lists the registered engines and scenarios. Each board guide
+records current results and open hardware work; in particular, earlier
+STM32L562 board results do not qualify its current layout.
## Host tests
@@ -20,9 +25,10 @@ Run the complete native set:
make test
```
-It ends with `make test-provisioning`: the production lock gates of both
-provisioning backends, run against stub vendor tools (see
-[Provisioning](Provisioning.md#testing)).
+It checks the port and scenario registries, generated port documentation,
+new-port scaffold, and guards, then runs the host suites, provisioning gates,
+and hardware-runner self-tests. Provisioning uses stub vendor tools (see
+[Provisioning](Provisioning.md#testing)); this command never runs a board.
The suite list is generated by:
@@ -192,29 +198,41 @@ hardware scenario. M33MU also drops `FAULTMASK_NS` writes, so the fixture's
guest IRQs are queued for retirement; the retiring exception return itself
runs only in the MIMXRT700 `handlerirqneg` hardware scenario.
-Five scenarios cover processor-state isolation, and the emulator proves less
-than their names suggest:
-
-- `fpneg` proves containment only. A floating-point instruction in the
- SERVICE_HSM partition takes the NOCP UsageFault and does not escalate.
- M33MU ends the run when it raises NOCP, so partition restart and guest
- survival are not shown here; the STM32H563 `fpneg` run checks them.
-- `sealneg` and `sealhaltneg` prove only the SPM's software check. In
- `sealneg` a partition overwrites its own stack-top seal, that partition alone
- faults at its next resume, and the guests keep running. In `sealhaltneg` a
- partition's seal is overwritten before its first dispatch (the same check
- runs on every dispatch) and the platform halts before that partition runs.
- No architectural unstack fault is exercised, on the emulator or by the
- STM32H563 `sealneg` run; M33MU models neither the seal nor the function
- return integrity check.
-- `sealbootneg` damages one main-stack seal word in the reset path; the boot
- halts on the production panic before any partition or guest runs.
-- `sealpivotneg` issues a partition's blocking wait with the stack pointer
- parked on its stack top, so the exception frame lands on the seal words;
- that partition alone faults and restarts, and the guests keep running.
-
-`bandneg1` through `bandneg6` prove the vault, attestation, and crypto
-partitions cannot reach each other's data band:
+### Isolation scenarios
+
+These scenarios back the [level 3 claim](Security-Model.md#ff-m-isolation-level-3).
+Each runs on both engines unless marked.
+
+| Scenario | Proves |
+| --- | --- |
+| `crossdomain` | A partition read of SPM-private RAM faults. |
+| `keystoreneg` | A partition without a keystore band cannot read the vault's band. |
+| `bandneg1`-`bandneg6` | Each pair of the vault, attestation, and crypto partitions can neither read nor write the other's band. |
+| `restartneg1`-`restartneg3` | A restarted partition starts from its band's link image. |
+| `deputyneg` | The privileged flash handler ignores a partition-rewritten flash context. |
+| `hsmpinneg` (hsm) | wolfHSM server pointers are pinned before the relay runs. |
+| `manifestneg`, `manifestneg2`, `manifestneg3` | Boot refuses a manifest with a missing feature, at level 2, or with a composed table that reaches another band. |
+| `periphneg` | Non-secure access to the SPM's RNG and Non-secure DMA out of Secure memory are blocked. |
+| `periphspneg` (M33MU) | A partition read of an SPM peripheral faults. |
+| `fpneg` | A partition FP instruction faults without escalating. |
+| `sealneg`, `sealpivotneg` | A damaged partition stack seal faults only that partition. |
+| `sealhaltneg`, `sealbootneg` | A seal damaged before dispatch, or the main-stack seal, halts the platform. |
+| `mspovfneg` | An SPM stack overflow hits `MSPLIM_S` and halts. |
+| `xnneg` | Privileged execution from SPM RAM is denied. |
+| `svcneg` | A partition that issues the guest-return SVC is panicked alone. |
+| `busfaultneg`, `nsbusfaultneg` (STM32H563 only) | A partition or guest bus error is contained to its owner. |
+
+The registry records capability-based exemptions for each port. A scenario's
+name does not imply that every environment proves its full hardware behavior:
+
+- M33MU ends `fpneg` when it raises NOCP; the STM32H563 hardware run also
+ checks partition restart and guest survival.
+- `sealneg` and `sealhaltneg` exercise the SPM's software seal checks.
+ M33MU models neither the processor's stack-seal check nor function-return
+ integrity, and the hardware `sealneg` run does not exercise architectural
+ unstack faults.
+- `sealbootneg` checks the boot-time main-stack seal; `sealpivotneg` makes a
+ partition's exception frame overwrite its seal and checks containment.
| Scenario | Prober | Band touched |
| --- | --- | --- |
@@ -304,18 +322,22 @@ that exact attack surface does not exist there. Native key and namespace
behavior remains covered by the common positive, cross-domain, keystore,
storage, attestation, and Crypto-validation rows.
-Validation of the engine split completed under both engines with:
+The engine split is exercised under both engines by:
- the applicable M33MU scenario matrix;
- the Arm FF-M IPC suite at 85 passed, 4 heap-dependent tests skipped, and
0 failed, test for test as recorded in
- [`tests/target/ffm_ipc_results.txt`](../tests/target/ffm_ipc_results.txt);
+ [`tests/target/ffm_ipc_results.txt`](https://github.com/wolfSSL/wolfTrust/blob/main/tests/target/ffm_ipc_results.txt);
- the current dev_apis Crypto schedule at 64 passed, 13 skipped, and 0 failed
(77 scheduled tests; c047 is configuration-skipped in addition to the
upstream schedule); and
- the STM32H563 positive, restart, cross-domain, and conformance hardware
suite.
+Pass and skip counts depend on the build and test revisions. Use the logs from
+the selected CI run for exact results; the runner checks the scheduled test
+total and treats failures as failures.
+
The engine dimension changes crypto dispatch, not what M33MU proves. Emulator
results still do not establish STM32 attribution or physical flash behavior.
@@ -481,6 +503,11 @@ The workflows under `.github/workflows/` separately run:
- fuzz targets;
- selected and nightly M33MU scenarios for every registered port, each under
its own pinned emulator image ([Ports](Ports.md)).
+- strict HTML and PDF manual builds for documentation changes, with all pages
+ taken from `mkdocs.yml` and uploaded as the `wolftrust-manual` artifact.
+
+For a local manual build, see
+[DOCS-BUILD.md](https://github.com/wolfSSL/wolfTrust/blob/main/DOCS-BUILD.md).
### Trigger routing
diff --git a/docs/Threat-Model.md b/docs/Threat-Model.md
index baf1e1dce..b8a9e10a8 100644
--- a/docs/Threat-Model.md
+++ b/docs/Threat-Model.md
@@ -78,6 +78,7 @@ images.
| Caller-ID spoofing | The gateway derives identity from the monitor's active guest; service payloads cannot override it. |
| Pointer substitution or overflow | The vector descriptor is copied once; counts, arithmetic, CMSE attributes, and active-guest windows are checked before copying bytes. |
| Stale or stolen handles | Handle ownership, type, generation, and state transitions are checked by the SPM. |
+| Cross-partition or partition-to-SPM access | FF-M isolation level 3; see [Security Model](Security-Model.md#ff-m-isolation-level-3). |
| Cross-guest RAM access | GTZC MPCBB attribution closes the full guest-RAM extent and reopens only the scheduled guest's writable SRAM blocks. Per-guest Non-secure MPU and interrupt state are restored scheduling policy, not adversarial boundaries against privileged guests. |
| Inactive-guest flash modification | Signature-covered guest digests and runtime verification detect changes; hardened builds also require complete hardware write protection (STM32H563 WRP, MIMXRT700 XSPI guest fence). |
| Cross-guest key use | The SPM-stamped identity selects the native vault sub-owner; the hsm relay maps guest `N` to forced wolfHSM client ID `N + 1`; with `WT_SECURE_PSA=1` every PSA key and operation is owned by the SPM-stamped client ID and another guest's handle is rejected. |
@@ -113,13 +114,6 @@ claim resistance to a physical adversary that can restore a mutually
consistent historical snapshot of the entire NVM pool. A target requiring
that property needs rollback-resistant monotonic storage in its port.
-### Secure code is shared
-
-Secure Partition writable state is narrowed by the Secure MPU to one private
-band per partition, but all service threads execute shared read/execute text
-from one linked image. A defect in trusted shared code can therefore affect
-more than one service.
-
### Privileged handlers remain security-critical
Unprivileged service threads request flash, entropy, locking, and reset through
@@ -135,17 +129,15 @@ leave a guest or service unavailable. With Secure PSA a guest's crypto runs in
the Secure image, so a guest that loops on ECC operations, or keeps relaunching
through them, can take most of the CPU from its peers.
-### Non-secure peripheral and interrupt attribution is inherited
-
-The STM32H563 reference port exposes the `0x40000000-0x4FFFFFFF` peripheral
-aperture as Non-secure and explicitly leaves USART2 and USART3 Non-secure. It
-does not program RCC security attribution. A privileged Non-secure guest can
-reprogram `MPU_NS`, alter Non-secure NVIC state, and access any peripheral left
-Non-secure by the boot chain. Manifest resource lists therefore do not enforce
-adversarial peripheral or interrupt ownership in the current port. Deployments
-must configure and validate device-specific peripheral security and privilege
-attribution before claiming those boundaries. In particular, access to shared
-clock controls can disrupt Secure execution or deny service to peer guests.
+### Non-secure peripherals are shared between guests
+
+The STM32H563 port makes HASH, RNG, and PKA Secure-only and leaves the rest of
+the `0x40000000-0x4FFFFFFF` aperture, including USART2, USART3, and RCC,
+Non-secure. A privileged guest can reach any of those peripherals and its own
+Non-secure NVIC state; the port does not assign peripherals or interrupts
+between guests. A deployment that needs that separation must attribute the
+device's peripherals itself. Shared clock controls in particular can deny
+service to the Secure side or to the other guest.
### Development lifecycle permits recovery
diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md
deleted file mode 100644
index 550771e21..000000000
--- a/docs/_Sidebar.md
+++ /dev/null
@@ -1,23 +0,0 @@
-**wolfTrust**
-
-- [[Home]]
-- [[Getting Started]]
-- [[Architecture]]
-- [[Crypto Engines]]
-- [[Security Model]]
-- [[Threat Model]]
-- [[API Reference]]
-- [[Services]]
-- [[TPM]]
-- [[PKCS11]]
-- [[Interface Profiles]]
-- [[TF-M Compatibility]]
-- [[Macros]]
-- [[Footprint]]
-- [[Porting]]
-- [[Building]]
-- [[Testing]]
-- [[Provisioning]]
-- [[Coding Standard]]
-- [[Project Structure]]
-- [[Ports]]
diff --git a/docs/assets/architecture.config.json b/docs/assets/architecture.config.json
new file mode 100644
index 000000000..9dffb4c82
--- /dev/null
+++ b/docs/assets/architecture.config.json
@@ -0,0 +1,5 @@
+{
+ "flowchart": {
+ "htmlLabels": false
+ }
+}
diff --git a/docs/assets/architecture.mmd b/docs/assets/architecture.mmd
new file mode 100644
index 000000000..c38824189
--- /dev/null
+++ b/docs/assets/architecture.mmd
@@ -0,0 +1,22 @@
+flowchart TB
+ BOOT["wolfBoot authenticated loader"]
+ ZEPHYR["Guest A: Zephyr, FreeRTOS, or bare metal"]
+ FREERTOS["Optional guest B"]
+ CLIENT["PSA Crypto client"]
+ GATE["FF-M client gateway"]
+ SPM["wolfTrust SPM: identity, policy, IPC"]
+ SERVICES["Secure wolfPSA and wolfCrypt, storage and attestation
Optional firmware update"]
+ PORT["Armv8-M and selected target port"]
+
+ ZEPHYR --> CLIENT
+ FREERTOS --> CLIENT
+ CLIENT --> GATE
+ GATE --> SPM
+ BOOT --> SPM
+ SPM --> SERVICES
+ SPM --> PORT
+
+ classDef secure fill:#eefbfc,stroke:#1fbeca,color:#111;
+ classDef nonsecure fill:#fff6ed,stroke:#c46715,color:#111;
+ class SPM,GATE,SERVICES,PORT secure;
+ class ZEPHYR,FREERTOS,CLIENT nonsecure;
diff --git a/docs/assets/architecture.png b/docs/assets/architecture.png
new file mode 100644
index 000000000..13114035e
Binary files /dev/null and b/docs/assets/architecture.png differ
diff --git a/docs/assets/logo.png b/docs/assets/logo.png
new file mode 100644
index 000000000..4f4db6034
Binary files /dev/null and b/docs/assets/logo.png differ
diff --git a/docs/assets/skin.css b/docs/assets/skin.css
new file mode 100644
index 000000000..3ad8a7eff
--- /dev/null
+++ b/docs/assets/skin.css
@@ -0,0 +1,25 @@
+/* Match the public wolfSSL manual colors without depending on its build repo. */
+.md-header {
+ background-color: #fff;
+ color: #1fbeca;
+}
+
+.md-header__title,
+.md-nav__link--active {
+ color: #1fbeca;
+}
+
+.md-typeset a,
+.md-nav__link {
+ color: #c46715;
+}
+
+.md-typeset a:hover,
+.md-nav__link:hover {
+ color: #1fbeca;
+}
+
+.md-header__button.md-logo img {
+ height: 2.5rem;
+ width: auto;
+}
diff --git a/docs/Home.md b/docs/index.md
similarity index 52%
rename from docs/Home.md
rename to docs/index.md
index 8ea85a50f..de40cea5a 100644
--- a/docs/Home.md
+++ b/docs/index.md
@@ -7,83 +7,36 @@ common runtime implements Arm Platform Security Architecture (PSA) Firmware
Framework for M (FF-M) interprocess communication (IPC), manifest policy,
scheduling, lifecycle management, fault recovery, and services.
-The only currently supported and validated reference implementation combines
-the Armv8-M adapter with the STM32H563 Cortex-M33 port. Support for additional
-Cortex-M ports is an intended extension point. Such ports may reuse the common
-runtime and, where applicable, the Armv8-M layer. Cortex-A support is an
-architectural goal, not a current capability. It will require a new adapter and
-changes to current internal execution and protection contracts; the design goal
-is to preserve the public manifest, service, IPC, and PSA API contracts.
+The Armv8-M adapter supports STM32H563, MIMXRT700, MCXN947, and STM32L562.
+They share the common runtime and isolation layer; [supported targets](Targets.md)
+and the board guides record each port's engines, capabilities, and validation.
+STM32H563 is the reference implementation. The default image runs one guest;
+`WT_MAX_GUESTS=2` adds the second guest.
-## Architecture
-
-```mermaid
-flowchart TB
- BOOT[Trusted first-stage loader
current reference: wolfBoot]
+The version-controlled pages in this directory are the primary documentation
+source. Once published, the [full wolfTrust manual](https://www.wolfssl.com/documentation/manuals/wolftrust/)
+will also be available as HTML and a
+[downloadable PDF](https://www.wolfssl.com/documentation/manuals/wolftrust/wolfTrust-Manual.pdf).
+Before publication, documentation CI provides both formats as review artifacts.
- subgraph APP[Application domains]
- GA[Cortex-M client A
Zephyr, FreeRTOS, or bare metal]
- GB[Optional Cortex-M client B
Zephyr, FreeRTOS, or bare metal]
- end
-
- subgraph PORT[Architecture and target ports]
- GW[Client gateway
current: five Armv8-M CMSE veneers]
- ARCH[Architecture adapter
current: Armv8-M]
- TARGET[Target and board port
current: STM32H563]
- GW --- ARCH
- ARCH --- TARGET
- end
+## Architecture
- subgraph WT[wolfTrust policy and service runtime]
- SPM[Secure Partition Manager
policy, identity, IPC, scheduling, lifecycle, recovery]
- subgraph SP[Secure services]
- CR["Selected crypto engine
native or wolfHSM"]
- ST["Internal Trusted Storage (ITS),
Protected Storage, and vault"]
- AT[Initial Attestation]
- FW[Optional Firmware Update]
- VN[Optional virtual networking]
- end
- SPM --> CR
- SPM --> ST
- SPM --> AT
- SPM --> FW
- SPM --> VN
- end
+
- subgraph LIBS[wolfSSL ecosystem components]
- PSA[wolfPSA
guest wolfCrypt; optional wolfHSM client]
- WC[Secure wolfCrypt
optional wolfHSM server]
- COSE[wolfCOSE]
- HAL[wolfHAL]
- IP[wolfIP
optional bare-metal reference networking]
- end
+The diagram shows the STM32H563 default. STM32L562 keeps PSA Crypto in the
+guest by default. [Crypto Engines](Crypto-Engines.md) describes the
+guest-local and wolfHSM configurations.
- BOOT -->|authenticated measurement, lifecycle, and version handoff| SPM
- GA -->|generic FF-M client API| GW
- GB -->|generic FF-M client API| GW
- GA -->|PSA Crypto| PSA
- GB -->|PSA Crypto| PSA
- PSA -->|protected operations over FF-M| GW
- GA -->|optional networking| IP
- GB -->|optional networking| IP
- IP -->|VNet service over FF-M| GW
- GW -->|validated requests| SPM
- SPM -->|Secure execution operations| ARCH
- SPM -->|platform callbacks| TARGET
- CR --> WC
- ST --> WC
- AT --> COSE
- AT --> WC
- TARGET -->|current register and RNG access| HAL
-```
+The optional wolfIP/VNET reference uses separate bare-metal guests, not the
+Zephyr and FreeRTOS PSA guest pair.
### Current reference port
In the STM32H563 reference chain, wolfBoot authenticates wolfTrust, TrustZone
isolates the Secure runtime from Non-secure guests, and STM32 Global TrustZone
Controller (GTZC) memory attribution isolates guest RAM. The Zephyr and
-FreeRTOS reference guests use wolfPSA's PSA Crypto API through the Armv8-M
-port's five CMSE gateway veneers.
+FreeRTOS reference guests call the Secure PSA Crypto service through the
+Armv8-M port's five CMSE gateway veneers.
## Key Features
@@ -92,29 +45,41 @@ port's five CMSE gateway veneers.
| Authenticated chain | The boot port supplies authenticated measurement, lifecycle, and version data. The reference integration uses wolfBoot and signature-covered guest records. |
| One mediated client boundary | Application domains reach services only through the client gateway supplied by the architecture port. The current Armv8-M image exports exactly five `WolfTrust_FFM_*` veneers. |
| Caller-bound IPC | wolfTrust derives the PSA client identity from the active application domain, copies vector descriptors, checks every range, and enforces manifest access policy. |
-| Port-defined isolation | Each port declares and enforces the protection capabilities required by its manifest. The STM32H563 reference uses TrustZone, the Secure MPU, and GTZC MPCBB attribution; its exact limits are documented in [Security Model](Security-Model.md). |
-| PSA cryptography | Zephyr and FreeRTOS reference guests call wolfPSA's PSA Crypto API. The default native engine serves PSA Crypto from the Secure image's crypto partition, and `WT_SECURE_PSA=0` runs wolfCrypt in each guest with DRBG seeds from the Secure vault; the optional wolfHSM engine routes supported operations to per-guest Secure server namespaces. |
+| Port-defined isolation | Each port declares and enforces the protection capabilities required by its manifest. The STM32H563 reference uses TrustZone, the Secure MPU, and GTZC MPCBB attribution and meets FF-M isolation level 3; see [Security Model](Security-Model.md#ff-m-isolation-level-3). |
+| PSA cryptography | Zephyr and FreeRTOS reference guests call wolfPSA's PSA Crypto API. The native engine serves PSA Crypto from the Secure crypto partition by default on STM32H563, MIMXRT700 and MCXN947. With `WT_SECURE_PSA=0`, each guest runs wolfPSA and wolfCrypt with DRBG seeds from the Secure vault. The wolfHSM engine routes supported operations through per-guest Secure server namespaces. |
| Secure services | Connection-based services provide the selected crypto engine, attestation, Internal Trusted Storage (ITS), Protected Storage, and two add-ons: firmware update (`WT_FWU=1`) and a Secure virtual Ethernet switch (`CONFIG_VNET=y`). The optional bare-metal networking guests run wolfIP outside the Secure image. |
| Fault containment | A guest fault either restarts the guest within policy limits or leaves it quarantined. A Secure Partition fault releases synchronization state before failing affected calls. Restart paths scrub declared private writable memory before rearming; forbidden, exhausted, or failed recovery escalates to the port's fail-closed path. |
-| Static Secure memory | The Secure image is built with `WOLFSSL_NO_MALLOC` and `NO_WOLFSSL_MEMORY`; service buffers, stacks, and state are statically allocated. |
+| Bounded Secure memory | The SPM uses fixed connection slots, transfer buffers and stacks. Services with dynamic allocation use bounded private arenas. |
## Documentation
| Page | Contents |
| --- | --- |
| [Getting Started](Getting-Started.md) | Prerequisites, checkout, first builds, emulator use, and hardware entry points |
+| [Ports and supported targets](Targets.md) | Supported Armv8-M environments and architecture groups for future ports |
| [Architecture](Architecture.md) | Boot flow, isolation layers, FF-M IPC, services, and scheduling |
| [Crypto Engines](Crypto-Engines.md) | Native and wolfHSM engine behavior, selection, key models, and measured cost |
| [Security Model](Security-Model.md) | Trust boundaries and enforced security properties |
| [Threat Model](Threat-Model.md) | Protected assets, attacker capabilities, controls, and residual risks |
| [API Reference](API-Reference.md) | PSA client, service, storage, update, lifecycle, attestation, and gateway APIs |
| [Services](Services.md) | Behavior and access policy for each Secure service |
-| [TF-M Compatibility](TF-M-Compatibility.md) | Supported interfaces, intentional differences, and migration guidance |
+| [Application Interface Profiles](Interface-Profiles.md) | PSA, TPM and PKCS#11 build choices |
+| [Firmware TPM](TPM.md) | TPM client integration, build and limits |
+| [PKCS#11](PKCS11.md) | PKCS#11 client integration, build and limits |
+| [Standards and Claims](Standards.md) | Arm specifications, implemented scope, deviations, and claim boundaries |
+| [FF-M Compatibility](FF-M-Compatibility.md) | Arm FF-M requirements, implemented framework interfaces, and known deviations |
+| [PSA Compatibility](PSA-Compatibility.md) | PSA service APIs, implemented subsets, known deviations, and porting guidance |
+| [Footprint Comparison](Footprint-Comparison.md) | Dated local Secure-image measurements and methodology |
| [Macros](Macros.md) | Supported build and manifest configuration |
| [Footprint](Footprint.md) | Measured image sizes and the options that change them |
| [Porting](Porting.md) | Architecture and target port contracts |
| [Building](Building.md) | Build targets, outputs, and cross-build options |
-| [Testing](Testing.md) | Host, M33MU, and STM32H563 validation |
+| [Testing](Testing.md) | Host, M33MU, and hardware validation for registered ports |
| [Provisioning](Provisioning.md) | Rehearse, validate, then lock: the production life cycle flow for every port |
| [Project Structure](Project-Structure.md) | Repository layout |
| [Ports](Ports.md) | Every registered port with its board guide, CI, emulator and hardware tiers (generated) |
+| [STM32H5 Guide](STM32H5-Guide.md) | NUCLEO-H563ZI setup and validation |
+| [MIMXRT700 Guide](MIMXRT700-Guide.md) | MIMXRT700-EVK setup and validation |
+| [MCXN947 Guide](MCXN947-Guide.md) | FRDM-MCXN947 setup and validation |
+| [STM32L562 Guide](STM32L562-Guide.md) | STM32L562E-DK layouts, native-engine build, and validation |
+| [Coding Standard](Coding-Standard.md) | C source rules and local checks |
diff --git a/mkdocs.yml b/mkdocs.yml
new file mode 100644
index 000000000..d86f6dba1
--- /dev/null
+++ b/mkdocs.yml
@@ -0,0 +1,76 @@
+site_name: wolfTrust Manual
+site_description: Secure Partition Manager and services runtime for Cortex-M
+site_url: https://www.wolfssl.com/documentation/manuals/wolftrust/
+repo_url: https://github.com/wolfSSL/wolfTrust
+edit_uri: edit/main/docs/
+docs_dir: docs
+site_dir: build/docs-site
+copyright: Copyright © 2026 wolfSSL Inc.
+use_directory_urls: false
+
+nav:
+ - Overview:
+ - wolfTrust: index.md
+ - Architecture: Architecture.md
+ - Security Model: Security-Model.md
+ - Threat Model: Threat-Model.md
+ - Get started:
+ - Getting Started: Getting-Started.md
+ - Building: Building.md
+ - Testing: Testing.md
+ - Ports:
+ - Supported targets: Targets.md
+ - Registered ports: Ports.md
+ - Provisioning: Provisioning.md
+ - STM32H563 board guide: STM32H5-Guide.md
+ - MIMXRT700 board guide: MIMXRT700-Guide.md
+ - MCXN947 board guide: MCXN947-Guide.md
+ - STM32L562 board guide: STM32L562-Guide.md
+ - Use wolfTrust:
+ - Services: Services.md
+ - API Reference: API-Reference.md
+ - Crypto Engines: Crypto-Engines.md
+ - Application Interface Profiles: Interface-Profiles.md
+ - Firmware TPM: TPM.md
+ - PKCS#11: PKCS11.md
+ - Build Options: Macros.md
+ - Footprint: Footprint.md
+ - Specifications and deviations:
+ - Standards and Claims: Standards.md
+ - FF-M Compatibility: FF-M-Compatibility.md
+ - PSA Compatibility: PSA-Compatibility.md
+ - Footprint Comparison: Footprint-Comparison.md
+ - Porting and development:
+ - Porting: Porting.md
+ - Project Structure: Project-Structure.md
+ - C Coding Standard: Coding-Standard.md
+
+theme:
+ name: material
+ logo: assets/logo.png
+ favicon: assets/logo.png
+ features:
+ - navigation.sections
+ - navigation.top
+ - content.code.copy
+ palette:
+ primary: white
+ accent: deep orange
+
+extra_css:
+ - assets/skin.css
+
+markdown_extensions:
+ - tables
+ - admonition
+ - pymdownx.details
+ - pymdownx.superfences
+ - toc:
+ permalink: true
+
+validation:
+ links:
+ anchors: warn
+
+plugins:
+ - search
diff --git a/tools/check-docs-no-internal-links.sh b/tools/check-docs-no-internal-links.sh
index 1ba4a50dc..773390f7d 100755
--- a/tools/check-docs-no-internal-links.sh
+++ b/tools/check-docs-no-internal-links.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Docs guard. docs/ is published to the wiki, so the public tree must never
+# Docs guard. docs/ is published as the manual, so the public tree must never
# point at the internal ledger or at a developer's home directory.
#
# tools/check-docs-no-internal-links.sh [path...]
diff --git a/tools/docs-manual/Makefile b/tools/docs-manual/Makefile
new file mode 100644
index 000000000..93eb012a1
--- /dev/null
+++ b/tools/docs-manual/Makefile
@@ -0,0 +1,15 @@
+.DEFAULT_GOAL := all
+include ../common/common.am
+include build/order.mk
+
+SRC := src
+PDF := wolfTrust-Manual.pdf
+
+.PHONY: all html-prep pdf-prep
+all: pdf html
+
+html-prep:
+ @true
+
+pdf-prep:
+ python3 "$(WT_SOURCE)/tools/docs_manual.py" pdf-links --documentation-root ..
diff --git a/tools/docs-manual/documentation-rev b/tools/docs-manual/documentation-rev
new file mode 100644
index 000000000..d1348be0f
--- /dev/null
+++ b/tools/docs-manual/documentation-rev
@@ -0,0 +1 @@
+a97222f3a9eba5f0cdd5eef93076771d12647644
diff --git a/tools/docs_manual.py b/tools/docs_manual.py
new file mode 100644
index 000000000..347612301
--- /dev/null
+++ b/tools/docs_manual.py
@@ -0,0 +1,189 @@
+#!/usr/bin/env python3
+"""Build the wolfTrust manual with wolfSSL/documentation's shared tooling."""
+
+import argparse
+import json
+import re
+import shutil
+import subprocess
+from pathlib import Path
+
+import yaml
+from markdown.extensions.toc import slugify, unique
+
+
+MANUAL = "wolfTrust"
+PDF = "wolfTrust-Manual.pdf"
+HEADING = re.compile(r"^(#{1,6})[ \t]+(.+?)[ \t]*#*[ \t]*$")
+LINK = re.compile(r"\]\((?:([^)#]+\.md))?(?:#([^)]+))?\)")
+
+
+def pages_from_nav(value):
+ if isinstance(value, str):
+ yield value
+ elif isinstance(value, list):
+ for item in value:
+ yield from pages_from_nav(item)
+ elif isinstance(value, dict):
+ for item in value.values():
+ yield from pages_from_nav(item)
+
+
+def page_key(filename):
+ return "wt-" + slugify(Path(filename).stem, "-")
+
+
+def heading_slug(title):
+ title = re.sub(r"[`*]", "", title)
+ title = re.sub(r"\[([^]]+)\]\([^)]+\)", r"\1", title)
+ return slugify(title, "-")
+
+
+def stage(documentation_root, source_root):
+ manual = documentation_root / MANUAL
+ source_docs = source_root / "docs"
+ shared = documentation_root / "common" / "common.am"
+ if not source_docs.is_dir() or not shared.is_file():
+ raise RuntimeError("wolfTrust docs or documentation/common.am is missing")
+
+ config = yaml.safe_load((source_root / "mkdocs.yml").read_text())
+ pages = list(pages_from_nav(config["nav"]))
+ if not pages or pages[0] != "index.md" or len(set(pages)) != len(pages):
+ raise RuntimeError("manual navigation must start at index.md and contain unique pages")
+ source_pages = {path.name for path in source_docs.glob("*.md")}
+ if set(pages) != source_pages:
+ raise RuntimeError(
+ f"manual navigation mismatch: missing={sorted(source_pages - set(pages))}, "
+ f"unknown={sorted(set(pages) - source_pages)}"
+ )
+
+ manual.mkdir(exist_ok=True)
+ for name in ("src", "build", "html"):
+ path = manual / name
+ if path.exists():
+ shutil.rmtree(path)
+ shutil.copytree(source_docs, manual / "src")
+ shutil.copyfile(manual / "src" / "index.md", manual / "src" / "Home.md")
+ (manual / "build").mkdir()
+ ordered_sources = ["Home.md" if page == "index.md" else page for page in pages]
+ (manual / "build" / "order.mk").write_text(
+ "SOURCES := " + " ".join(ordered_sources) + "\nAPPENDIX :=\n"
+ )
+ (manual / "build" / "order.json").write_text(json.dumps(pages) + "\n")
+ shutil.copyfile(source_root / "tools" / "docs-manual" / "Makefile", manual / "manual.generated.mk")
+
+ config["docs_dir"] = "build/html"
+ config["site_dir"] = "html"
+ config["theme"] = {
+ "name": None,
+ "custom_dir": "../mkdocs-material/material",
+ "language": "en",
+ "palette": {"primary": "indigo", "accent": "indigo"},
+ "font": {"text": "Roboto", "code": "Roboto Mono"},
+ "icon": "logo.png",
+ "logo": "logo.png",
+ "favicon": "logo.png",
+ "feature": {"tabs": True},
+ }
+ config["extra_css"] = ["skin.css"]
+ config["markdown_extensions"] = ["tables", "fenced_code", "toc"]
+ config["plugins"] = ["search"]
+ config["use_directory_urls"] = False
+ (manual / "mkdocs.yml").write_text(yaml.safe_dump(config, sort_keys=False))
+
+ header = (documentation_root / "wolfBoot" / "header.txt").read_text()
+ header = header.replace("wolfBoot Documentation", "wolfTrust Manual")
+ header = re.sub(r"(\\copyright\s+)\d{4}", r"\g<1>2026", header)
+ # Wrap inline code, leave room for multi-digit contents labels, and keep
+ # tall figures clear of their captions and the page footer.
+ header = header.replace(
+ "header-includes:\n",
+ "header-includes:\n"
+ r" - \usepackage{seqsplit}" "\n"
+ r" - \DeclareRobustCommand{\texttt}[1]{{\ttfamily\seqsplit{#1}}}" "\n"
+ r" - \makeatletter" "\n"
+ r" - \renewcommand{\l@subsection}{\@dottedtocline{2}{1.5em}{3.5em}}" "\n"
+ r" - \renewcommand{\l@subsubsection}{\@dottedtocline{3}{5em}{4.5em}}" "\n"
+ r" - \def\maxheight{\ifdim\Gin@nat@height>0.8\textheight0.8\textheight"
+ r"\else\Gin@nat@height\fi}" "\n"
+ r" - \makeatother" "\n",
+ )
+ (manual / "header.txt").write_text(header)
+ return manual
+
+
+def prepare_pdf(documentation_root):
+ manual = documentation_root / MANUAL
+ pdf_dir = manual / "build" / "pdf"
+ pages = json.loads((manual / "build" / "order.json").read_text())
+ headers = {}
+ for page in pages:
+ staged = pdf_dir / ("Home.md" if page == "index.md" else page)
+ found = set()
+ in_fence = False
+ for line in staged.read_text().splitlines():
+ if line.lstrip().startswith(("```", "~~~")):
+ in_fence = not in_fence
+ if not in_fence:
+ match = HEADING.match(line)
+ if match:
+ unique(heading_slug(match.group(2)), found)
+ headers[page] = found
+
+ for page in pages:
+ staged = pdf_dir / ("Home.md" if page == "index.md" else page)
+ output = [f"[]{{#{page_key(page)}}}\n\n"]
+ in_fence = False
+ seen = set()
+ for line in staged.read_text().splitlines(keepends=True):
+ if line.lstrip().startswith(("```", "~~~")):
+ in_fence = not in_fence
+ anchor = ""
+ if not in_fence:
+ match = HEADING.match(line.rstrip("\n"))
+ if match:
+ heading_id = unique(heading_slug(match.group(2)), seen)
+ anchor = f"[]{{#{page_key(page)}-{heading_id}}}\n\n"
+
+ def rewrite(link):
+ md = link.group(1)
+ fragment = link.group(2)
+ if md is None and fragment is None:
+ return link.group(0)
+ target = page if md is None else md.removeprefix("./")
+ if target not in headers:
+ return link.group(0)
+ if fragment and fragment not in headers[target]:
+ raise RuntimeError(f"unresolved PDF link: {page} -> {target}#{fragment}")
+ anchor = page_key(target) + (f"-{fragment}" if fragment else "")
+ return f"](#{anchor})"
+
+ line = LINK.sub(rewrite, line)
+ output.append(anchor + line)
+ staged.write_text("".join(output))
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("command", choices=("build", "pdf-links"))
+ parser.add_argument("--documentation-root", required=True, type=Path)
+ parser.add_argument("--source-root", type=Path)
+ parser.add_argument("--target", choices=("all", "html", "pdf"), default="all")
+ args = parser.parse_args()
+ documentation_root = args.documentation_root.resolve()
+ if args.command == "pdf-links":
+ prepare_pdf(documentation_root)
+ return
+ if args.source_root is None:
+ parser.error("build requires --source-root")
+ source_root = args.source_root.resolve()
+ manual = stage(documentation_root, source_root)
+ subprocess.run(
+ ["make", "-C", str(manual), "-f", "manual.generated.mk", args.target,
+ f"WT_SOURCE={source_root}"],
+ check=True,
+ )
+
+
+if __name__ == "__main__":
+ main()