Add SE05x lifecycle, policy, SCP03, and attestation APIs - #11377
Add SE05x lifecycle, policy, SCP03, and attestation APIs#11377LinuxJedi wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The updated SE05x binary-object read path can call middleware keystore init with a NULL session pointer (crash risk) and should be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR extends the NXP SE05x (SE050) wolfCrypt port with new application-facing APIs covering session lifecycle/config access, policy-aware object/key provisioning and on-chip key generation, Platform SCP03 runtime credentials + deterministic derivation + destructive rotation, and nonce-bound object attestation with host-side verification.
Changes:
- Add public SE05x session/config access + locking helpers, plus new policy/attestation/SCP03 API surface in the SE05x port header and implementation.
- Update wolfCrypt global init/cleanup to preserve an already-configured SE05x session and to close wolfSSL-owned sessions safely.
- Document new build flags and API usage (policies, runtime SCP03, attestation) in the SE05x port README and enable the hw mutex by default for threaded SE05x builds.
File summaries
| File | Description |
|---|---|
| wolfssl/wolfcrypt/settings.h | Enables the wolfCrypt hardware mutex by default for threaded SE05x builds so SE05x locking/serialization is effective. |
| wolfssl/wolfcrypt/port/nxp/se050_port.h | Adds public policy flags, SCP03 key struct, attestation result type, and new SE05x APIs (config/session/lock/close, policy provisioning, SCP03, attestation). |
| wolfcrypt/src/wc_port.c | Preserves pre-configured SE05x sessions during wolfCrypt_Init() and closes wolfSSL-owned SE05x sessions during wolfCrypt_Cleanup(). |
| wolfcrypt/src/port/nxp/se050_port.c | Implements the new SE05x APIs: runtime SCP03 init/derive/rotate, policy handling, object attribute read, attestation retrieval and verification, and persistent key generation/insertion variants. |
| wolfcrypt/src/port/nxp/README_SE050.md | Updates tested middleware version and documents new flags/APIs for policies, runtime SCP03, session access/locking, and attestation verification. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11377
Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Findings: 7
7 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Add guarded lifecycle and locking APIs, policy-aware object insertion, SCP03 key rotation, session access, and nonce-bound attestation verification. Keep host-side key wrapping in software and preserve middleware chunking and object setup behavior.
Reject object reads before passing a null session into the NXP keystore API, and classify erase requests without an active session consistently as a state error.
c84c764 to
d8cc9c7
Compare
Avoid nested hardware mutex acquisition in AES key replacement and SE05x TRNG seeding. Keep SCP03 key wrapping in host AES, require AES direct support, and bind attestation validation to a caller-provided challenge.
d8cc9c7 to
3ec3f79
Compare
Findings addressed, re-review would trigger a new scan.
Description
Extend the SE05x port with application-facing APIs for:
The SCP03 path keeps DEK wrapping in host software, uses aligned AES staging buffers, validates PUT KEY responses, and avoids in-place APDU padding overflow. Provisioning retains middleware chunking and curve-creation behavior for large binary, RSA, and ECC objects.
The RSA attestation component path is also gated consistently with
wc_RsaFlattenPublicKey()soWOLFSSL_RSA_VERIFY_ONLYbuilds do not retain an unresolved reference.Testing
./configure --disable-shared && make -j2 && make -j2 checkWOLFSSL_RSA_VERIFY_ONLYobject buildwc_RsaFlattenPublicKeyreferencegit diff --checkChecklist