wolfHSM
wolfHSM is an HSM library built on wolfCrypt. I added a TrustZone transport so a non-secure STM32H5 app can use a wolfHSM server in the secure world, then fixed bugs found on the board.
Main changes
- Added a portable TrustZone non-secure-callable bridge transport for ARMv8-M, with a host unit test and an ASAN CI lane.#348
- Added configurable 8-byte and 16-byte flash programming units, since STM32H563 programs flash in 128-bit quadwords.#524
- Fixed a SHA3 client bug that returned a wrong digest when the server could not offload.#455
- Landed a set of hardening fixes from static analysis findings.#425
One design choice
The TrustZone bridge is synchronous. A client Send calls a host-supplied veneer inline and caches the response, and the first Recv returns it. A request and response never need a second world switch or a shared queue, and keys stay in the secure world.
A bug I fixed
On real STM32H5 hardware, SHA3 digests were wrong, for example SHA3-224 at length 145. The client changed the hash state before the server answered NOT_COMPILED_IN, so the software fallback absorbed the tail twice. I snapshot the state before the offload and restore it on failure. (#455)
How it was checked
| PR | Evidence |
|---|---|
| #348 | New host unit test in a CI lane with ASAN, plus an end-to-end run on a NUCLEO-H563ZI. |
| #455 | Found and reproduced on real H5 hardware, where it failed the client config test. |
| #524 | The 8-byte unit stays the default, so existing builds are unchanged. |
What is not done yet
The bridge is synchronous and holds one request in a static context, so only one request can be outstanding. The STM32 glue lives in wolfBoot.