puf: fix transmit-only UART HAL and add an interactive INTERACTIVE=1 demo mode - #623
puf: fix transmit-only UART HAL and add an interactive INTERACTIVE=1 demo mode#623dgarske wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the PUF STM32H5 example to support a UART RX path (previously TX-only) and introduces an optional interactive demo build mode (INTERACTIVE=1) that provides a UART-driven menu for stepping through enrollment/reconstruction and a controlled noise sweep.
Changes:
- Extend the bare-metal USART3 HAL to configure RX (PD9), enable RE, and add blocking
uart_getc()plusuart_drain(). - Add a new interactive demo program (
main_interactive.c) and a Makefile switch to build it. - Document the new interactive mode and its behavior in
puf/README.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| puf/stm32.c | Adds USART3 RX support (PD9 AF7 + RE) and input helpers for interactive UART menu. |
| puf/README.md | Documents INTERACTIVE=1 build and the interactive UART menu/demo behavior. |
| puf/Makefile | Adds INTERACTIVE switch to select main_interactive.c and forces PUF_TEST=1 when interactive. |
| puf/main_interactive.c | New UART-driven interactive PUF demo with enrollment, reconstruction, helper dump, and noise sweep. |
Suppressed comments (2)
puf/main_interactive.c:269
wolfCrypt_Init()return value is ignored; if initialization fails, the demo continues and calls wolfCrypt/PUF APIs in an undefined state. Capture and handle the error (at least print and halt) likemain.cdoes.
hal_init();
wolfCrypt_Init();
puf/main_interactive.c:196
- Return values from the two
wc_PufDeriveKey()calls are ignored. If derivation fails, the demo prints/uses whatever is left ink1/k2. Propagate and handle the error before printing the keys.
wc_PufDeriveKey(&ctx, (const byte*)"nv-integrity", 12, k1, sizeof(k1));
wc_PufDeriveKey(&ctx, (const byte*)"device-identity", 15, k2, sizeof(k2));
printf(" same silicon, same helper data, two HKDF contexts:\r\n");
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| wc_PufGetHelperData(&ctx, g_helper, sizeof(g_helper)); | ||
| wc_PufGetIdentity(&ctx, g_id, sizeof(g_id)); | ||
| wc_PufDeriveKey(&ctx, (const byte*)"nv-integrity", 12, key, sizeof(key)); | ||
|
|
5ebd9b9 to
3ba6cda
Compare
aidangarske
left a comment
There was a problem hiding this comment.
Skoll Code Review
Scan type: review
Overall recommendation: REQUEST_CHANGES
Findings: 10 total — 9 posted, 1 skipped
9 finding(s) posted as inline comments (see file-level comments below)
Posted findings
- [High] Mode switching can silently leave the wrong firmware in Build —
puf/Makefile:64-68 - [High] INTERACTIVE does not override a command-line PUF_TEST=0 —
puf/Makefile:37 - [High] Interactive mode does not build with the supported stable wolfSSL —
puf/main_interactive.c:84 - [High] Rejected blobs are committed as enrolled global state —
puf/main_interactive.c:314-345 - [Medium] A loaded prior-boot blob invalidates the controlled noise sweep —
puf/main_interactive.c:155-170 - [Medium] The recovery checksum is never verified —
puf/main_interactive.c:292-318 - [Medium] A health-band pass is presented as proof of a cold-boot readout —
puf/main_interactive.c:396-397 - [Medium] The new interactive target is not compiled by CI —
puf/Makefile:64-65 - [Low] README lists option 4 twice —
puf/README.md:81-82
Skipped findings
- [Medium]
wolfCrypt initialization failure is ignored
Review generated by Skoll
aidangarske
left a comment
There was a problem hiding this comment.
Do we want to add some CI for the PUF work we have now or at least build it in CI?
3ba6cda to
67b04e3
Compare
No description provided.