mirror of https://github.com/wolfSSL/wolfBoot.git
The keytools read and write private keys through fully buffered stdio streams: for key files smaller than the stdio buffer, libc copies the raw key bytes into its internal FILE buffer, and fclose() frees that buffer without scrubbing it, so a copy of every key survives the explicit zero_and_free()/wc_ForceZero() wipes. Open every secret-material stream unbuffered with setvbuf(f, NULL, _IONBF, 0) right after fopen(): - sign.c load_key(): the private key file. Also close the stream on the short-read failure path, which previously leaked it. - sign.c make_header_ex(): the firmware encryption key/IV file. - keygen.c: the five private-key write sites (RSA, ECC, Ed25519, Ed448, ML-DSA). - lms_common.h / xmss_common.h: the LMS/XMSS private-state write, verify-read and read callbacks. Public-key export streams are left buffered: not secret. Host-side hardening only: whoever can read the tool heap can read the key file too. |
||
|---|---|---|
| .. | ||
| 0001-Patch-to-support-wolfBoot-LMS-build.patch | ||
| lms_common.h | ||
| lms_siglen.sh | ||