Skip to content

Add SE05x lifecycle, policy, SCP03, and attestation APIs - #11377

Open
LinuxJedi wants to merge 4 commits into
wolfSSL:masterfrom
LinuxJedi:se05x-api-improvements
Open

Add SE05x lifecycle, policy, SCP03, and attestation APIs#11377
LinuxJedi wants to merge 4 commits into
wolfSSL:masterfrom
LinuxJedi:se05x-api-improvements

Conversation

@LinuxJedi

Copy link
Copy Markdown
Member

Description

Extend the SE05x port with application-facing APIs for:

  • owned and externally supplied session lifecycle, configuration access, and serialization
  • policy-aware ECC/RSA key insertion and persistent on-chip key generation
  • binary object insertion, object attributes, and explicit object deletion
  • runtime Platform SCP03 credentials, deterministic HKDF-SHA256 key derivation, and authenticated key rotation
  • nonce-bound object attestation retrieval and host verification

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() so WOLFSSL_RSA_VERIFY_ONLY builds do not retain an unresolved reference.

Testing

  • ./configure --disable-shared && make -j2 && make -j2 check
    • 5 passed, 5 skipped, 0 failed
  • Platform-SCP03 SE050 simulator focused test
    • runtime credential setup and deterministic derivation
    • explicit and seed-based key rotation
    • lifecycle, session access, and locking
    • chunked binary and ECC/RSA policy insertion
    • ECC and RSA policy-aware on-chip generation, binding, and deletion
  • Configured SE05x WOLFSSL_RSA_VERIFY_ONLY object build
    • confirmed no undefined wc_RsaFlattenPublicKey reference
  • git diff --check

Checklist

  • added targeted simulator coverage
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread wolfcrypt/src/port/nxp/se050_port.c
Comment thread wolfcrypt/src/port/nxp/se050_port.c Outdated

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread wolfssl/wolfcrypt/settings.h
Comment thread wolfcrypt/src/port/nxp/se050_port.c Outdated
Comment thread wolfcrypt/src/port/nxp/se050_port.c
Comment thread wolfcrypt/src/port/nxp/se050_port.c
Comment thread wolfcrypt/src/port/nxp/se050_port.c Outdated
Comment thread wolfssl/wolfcrypt/settings.h
Comment thread wolfcrypt/src/port/nxp/se050_port.c
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.
@LinuxJedi
LinuxJedi force-pushed the se05x-api-improvements branch from c84c764 to d8cc9c7 Compare September 4, 2026 14:04
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.
@LinuxJedi
LinuxJedi force-pushed the se05x-api-improvements branch from d8cc9c7 to 3ec3f79 Compare September 4, 2026 14:09
@LinuxJedi
LinuxJedi dismissed wolfSSL-Fenrir-bot’s stale review September 4, 2026 14:40

Findings addressed, re-review would trigger a new scan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants