Open
Conversation
Contributor
Author
|
Jenkins retest this please |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds SRAM PUF support to wolfCrypt, including a BCH(127,64,t=10) fuzzy extractor and HKDF-based key derivation, plus build-system integration, docs, and CI coverage.
Changes:
- Introduces new public PUF API (
wc_Puf*) with context structure, enrollment/reconstruction, key derivation, identity, and zeroization. - Adds BCH codec + PUF implementation and wires it into Autotools/CMake builds and new error codes/strings.
- Adds host-side test (synthetic SRAM mode), Doxygen grouping/docs, README blurb, and a GitHub Actions workflow.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfssl/wolfcrypt/puf.h | New public header declaring the PUF API and constants/ctx layout. |
| wolfssl/wolfcrypt/include.am | Installs puf.h as a public header. |
| wolfssl/wolfcrypt/error-crypt.h | Adds PUF-specific error codes and updates span “last” markers. |
| wolfcrypt/src/error.c | Adds human-readable strings for new PUF error codes. |
| wolfcrypt/test/test.c | Adds puf_test() and invokes it from the main test runner when enabled. |
| wolfcrypt/src/puf.c | Implements SRAM PUF, BCH codec, identity hash, and HKDF key derivation. |
| src/include.am | Adds puf.c to lib sources when BUILD_PUF is enabled. |
| configure.ac | Adds --enable-puf and --enable-puf-test, enables HKDF automatically, defines build conditional. |
| cmake/functions.cmake | Adds PUF source inclusion when BUILD_PUF is set. |
| CMakeLists.txt | Adds WOLFSSL_PUF/WOLFSSL_PUF_TEST options and enables HKDF when PUF is on. |
| .wolfssl_known_macro_extras | Registers WC_PUF_SHA3 as a known macro. |
| doc/dox_comments/header_files/puf.h | Adds Doxygen API docs for PUF functions. |
| doc/dox_comments/header_files/doxygen_groups.h | Adds a Doxygen “PUF” group. |
| README.md | Mentions --enable-puf and links to the example. |
| .github/workflows/puf.yml | Adds CI job to configure/build/run wolfCrypt tests with PUF enabled. |
Comments suppressed due to low confidence (2)
wolfcrypt/test/test.c:1
- As written,
puf_test()returns success without running any assertions unlessWOLFSSL_PUF_TEST && HAVE_HKDF && !NO_SHA256are all set. However, the main test runner prints “PUF test passed!” wheneverWOLFSSL_PUFis enabled, which can mask missing coverage in common build configurations (e.g.,--enable-pufwithout--enable-puf-test). Consider compiling/registeringpuf_test()only when the full test dependencies are present, or returning a distinct “skipped” result that the harness prints as skipped instead of passed.
wolfcrypt/test/test.c:1 - As written,
puf_test()returns success without running any assertions unlessWOLFSSL_PUF_TEST && HAVE_HKDF && !NO_SHA256are all set. However, the main test runner prints “PUF test passed!” wheneverWOLFSSL_PUFis enabled, which can mask missing coverage in common build configurations (e.g.,--enable-pufwithout--enable-puf-test). Consider compiling/registeringpuf_test()only when the full test dependencies are present, or returning a distinct “skipped” result that the harness prints as skipped instead of passed.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add SRAM PUF (Physically Unclonable Function) support to wolfCrypt. Derives device-unique cryptographic keys from the power-on state of SRAM memory using a BCH(127,64,t=10) fuzzy extractor with HKDF key derivation. - **wolfCrypt PUF API** (`wolfcrypt/src/puf.c`, `wolfssl/wolfcrypt/puf.h`) - `wc_PufInit`, `wc_PufReadSram`, `wc_PufEnroll`, `wc_PufReconstruct` - `wc_PufDeriveKey` (HKDF-SHA256), `wc_PufGetIdentity` (SHA-256 device fingerprint) - `wc_PufZeroize` (secure context cleanup) - `wc_PufSetTestData` (synthetic SRAM for testing without hardware) - **BCH(127,64,t=10) error-correcting codec** - corrects up to 10 bit flips per 127-bit codeword across 16 codewords - **`WC_PUF_SHA3` build option** - select SHA3-256 instead of SHA-256 for identity hash and HKDF (default: SHA-256) - **Precomputed GF(2^7) tables** - `const` arrays in `.rodata` (no runtime init, thread-safe, flash-resident on embedded) - `./configure --enable-puf` (auto-enables HKDF dependency) - CMake: `WOLFSSL_PUF=yes` - `WOLFSSL_USER_SETTINGS`: define `WOLFSSL_PUF` and `WOLFSSL_PUF_SRAM` - See wolfssl-examples/puf for example implementation on STM32 NUCLEO-H563ZI (Cortex-M33, STM32H563ZI) - Supports test mode (synthetic SRAM) - Builds to ~13KB `.elf` - Tested on NUCLEO-H563ZI: enrollment, noisy reconstruction, key derivation all pass - `.github/workflows/puf.yml`: host build + test workflow for PUF feature - Doxygen API docs for all 8 public functions - PUF group added to `doxygen_groups.h`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
wolfCrypt SRAM PUF Support
Add SRAM PUF (Physically Unclonable Function) support to wolfCrypt. Derives device-unique cryptographic keys from the power-on state of SRAM memory using a BCH(127,64,t=10) fuzzy extractor with HKDF key derivation.
wolfcrypt/src/puf.c,wolfssl/wolfcrypt/puf.h)wc_PufInit,wc_PufReadSram,wc_PufEnroll,wc_PufReconstructwc_PufDeriveKey(HKDF-SHA256),wc_PufGetIdentity(SHA-256 device fingerprint)wc_PufZeroize(secure context cleanup)wc_PufSetTestData(synthetic SRAM for testing without hardware)WC_PUF_SHA3build option - select SHA3-256 instead of SHA-256 for identity hash and HKDF (default: SHA-256)constarrays in.rodata(no runtime init, thread-safe, flash-resident on embedded)./configure --enable-puf(auto-enables HKDF dependency)WOLFSSL_PUF=yesWOLFSSL_USER_SETTINGS: defineWOLFSSL_PUFandWOLFSSL_PUF_SRAM.elf.github/workflows/puf.yml: host build + test workflow for PUF featuredoxygen_groups.hSee example at: wolfSSL/wolfssl-examples#565