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.

Role: contributor C, wolfCrypt, TrustZone, STM32H5 wolfSSL/wolfHSM
01 / What I built

Main changes

02 / Design

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.

03 / Debugging

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)

04 / Verification

How it was checked

PREvidence
#348New host unit test in a CI lane with ASAN, plus an end-to-end run on a NUCLEO-H563ZI.
#455Found and reproduced on real H5 hardware, where it failed the client config test.
#524The 8-byte unit stays the default, so existing builds are unchanged.
05 / Limits

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.

All my merged pull requests 5 in wolfSSL/wolfHSM
  • #524Support 128-bit flash programming units
  • #425wolfHSM Hardening Fixes
  • #455Restore SHA3 client state when the server cannot offload
  • #348Add stm32H5 TrustZone wolfHSM Port
  • #35Grammar fix on the README.md for wolfhsm.

all work view the repository