wolfBoot/tools/keytools/otp
Daniele Lacamera 8df96895f6 F-6408: zeroize UDS from OTP keystore generator's heap and stack buffers
otp-keystore-gen.c reads the device root UDS into the stack buffer
`uds` and copies it into the heap buffer `otp_buf` at OTP_UDS_OFFSET,
then on every exit path calls free(otp_buf) without wiping it first,
and never clears `uds`. Both copies of the highest-value device secret
remain in the host process's freed heap chunk and stack frame.

Add a local secure_zero() helper (no wolfSSL dependency, matching this
standalone host tool's existing bare-gcc build) and call it on the
success path and on the write-failure/short-UDS-read error paths,
before free()/exit(), mirroring the zeroize-before-release pattern
already used elsewhere in this tree (src/x86/ata.c,
src/x86/ahci.c). Paths that exit before `uds` is populated are left
untouched since there is no secret to wipe yet.
2026-07-02 14:56:48 +02:00
..
Makefile
README.md
otp-keystore-gen.c F-6408: zeroize UDS from OTP keystore generator's heap and stack buffers 2026-07-02 14:56:48 +02:00
otp-keystore-primer.c Preparing release v2.8.0 + update copyright 2026-04-16 13:11:56 +02:00
startup.c Preparing release v2.8.0 + update copyright 2026-04-16 13:11:56 +02:00
target.ld

README.md

OTP keystore primer application

This application is used to provision the public keys into a dedicated FLASH OTP area. For more information about its usage, please refer to /docs/flash-OTP.md.

Attestation UDS storage

For targets that support it (for example STM32H5), wolfBoot can store a random UDS for DICE attestation in OTP using the primer app. This is the default approach when OBKeys secure storage is not available or not provisioned.

If you have access to STM32H5 OBKeys secure storage, prefer that for production iRoT key material. Enable WOLFBOOT_UDS_OBKEYS=1 and provision OBKeys via STM32TrustedPackageCreator/STM32CubeProgrammer (see docs/DICE.md). OTP should be used for development or as a fallback when OBKeys is unavailable.