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. |
||
|---|---|---|
| .. | ||
| otp | ||
| Makefile | ||
| README.md | ||
| keygen.c | ||
| keygen.py | ||
| sign.c | ||
| sign.py | ||
| user_settings.h | ||
| wolfBootKeyTools.sln | ||
| wolfBootKeygenTool.vcxproj | ||
| wolfBootSignTool.vcxproj | ||
README.md
Key Tools for signing and key generation
Sign
See code file ./tools/keytools/sign.c and documentation in docs/Signing.md.
KeyGen and KeyStore
See code file ./tools/keytools/keygen.c and documentation docs/keystore.md.
Flash OTP Keystore Generation, Primer, Startup
See documentation docs/flash-OTP.md.
Keystore Generation
Pack public keys into a single binary (otp.bin) formatted the way wolfBoot expects for
provisioning the device’s OTP/NVM keystore. No signing, no encryption—just a correctly laid-out image
with a header plus fixed-size "slots" for each key.
See code file ./tools/keytools/otp/otp-keystore-gen.c
Flash OTP Primer
See code file ./tools/keytools/otp/otp-keystore-primer.c
Flash OTP Startup
See code file ./tools/keytools/otp/startup.c
Quick Start (Linux)
make wolfboot_signing_private_key.der SIGN=ED25519
# or
./tools/keytools/keygen --ed25519 -g wolfboot_signing_private_key.der
Note the above example is a basic case where a single key is generated.
The tool supports multiple keys both with [-g privkey] and [-i pubkey] parameters.
See the local docs docs/keystore.md and the wolfBoot Keystore section of the manual for additional details.
Debugging and Development
DEBUG_SIGNTOOL
Enables additional diagnostic messages that may be useful during development and initial bring-up.
WOLFBOOT_SHOW_INCLUDE
Enables compile-time verbosity to indicate which user_settings.h file is being used.