Extend SE050 simulator coverage for SE05x APIs - #19
Open
LinuxJedi wants to merge 2 commits into
Open
Conversation
Model the policy, object, session, attestation, and SCP03 behaviors needed by the improved wolfSSL SE05x APIs. Add SDK and end-to-end regression coverage for rotation, large objects, RSA-4096, lifecycle guards, and raw-key attestation.
There was a problem hiding this comment.
🔵 Needs a closer look
The changes span protocol handling (SCP03/PUT KEY), persistence formats, and policy enforcement across multiple handlers, so it warrants final human review despite added tests.
Pull request overview
This PR extends the SE050 simulator to better match updated wolfSSL SE05x provisioning APIs by modeling object policies/origin metadata, adding Platform SCP03 key-rotation support via GlobalPlatform PUT KEY (with persistence), and expanding end-to-end regression coverage via new focused wolfCrypt + SDK tests.
Changes:
- Add policy-aware object creation/overwrite/delete/read enforcement and implement ReadObjectAttributes reporting policy+origin.
- Implement Platform SCP03 key rotation flow (SSD selection gating + PUT KEY parsing/unwrapping + persisted rotated key state).
- Add/expand regression tests for the above behaviors (new wolfCrypt smoke test and an SDK test case).
File summaries
| File | Description |
|---|---|
| SE050Sim/wolfcrypt-test/test_api_improvements.c | Adds an end-to-end smoke test covering SCP03 rotation, sessions, and policy-aware provisioning flows. |
| SE050Sim/se050-sim/src/t1.rs | Tracks SSD selection state, routes INITIALIZE UPDATE with persisted SCP config, and intercepts PUT KEY inside SCP03. |
| SE050Sim/se050-sim/src/scp03/mod.rs | Factors INITIALIZE UPDATE to allow injecting a stored SCP03 config. |
| SE050Sim/se050-sim/src/scp03/keys.rs | Adds PUT KEY payload parsing, DEK unwrapping, KCV validation, and serialization support for persisted config. |
| SE050Sim/se050-sim/src/policy.rs | Adds creation_policy() validation/copy helper plus explicit READ/WRITE/DELETE policy bits. |
| SE050Sim/se050-sim/src/object_store/types.rs | Introduces persisted object metadata (policy + origin) with defaults. |
| SE050Sim/se050-sim/src/object_store/mod.rs | Persists metadata and rotated platform SCP keysets; enforces policy checks via policy_allows(). |
| SE050Sim/se050-sim/src/handlers/session.rs | Adds SSD AID selection support and tightens SE050 AID matching. |
| SE050Sim/se050-sim/src/handlers/rsa.rs | Enforces write-policy semantics while allowing multi-APDU RSA import staging; records creation metadata. |
| SE050Sim/se050-sim/src/handlers/object_mgmt.rs | Enforces read/write/delete policy for objects, adds ReadObjectAttributes (v7 only), records creation metadata. |
| SE050Sim/se050-sim/src/handlers/ec.rs | Enforces write-policy on EC key updates and records policy/origin metadata. |
| SE050Sim/se050-sim/src/handlers/aes.rs | Enforces write-policy, records policy/origin, and refines empty-policy handling for HMAC derive-target. |
| SE050Sim/se050-sim/src/dispatch.rs | Adds policy enforcement for RSA component reads through the crypto read path. |
| SE050Sim/se050-sim/src/apdu.rs | Adds the P2_ATTRIBUTES constant for ReadObjectAttributes routing. |
| SE050Sim/sdk-test/test_se050.c | Adds an SDK-level test validating immutable policy behavior and attributes reporting (v7.2+). |
| SE050Sim/README.md | Updates documented feature set, test counts, and documents persisted PUT KEY / platform SCP behavior. |
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Require a host-supplied freshness challenge and verify object operations reject use after SE05x cleanup.
LinuxJedi
force-pushed
the
se05x-api-improvements
branch
from
September 4, 2026 14:07
a07e7b0 to
11fc044
Compare
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.
Summary
Related: wolfSSL/wolfssl#11377
Testing
cargo test --all-targets -- --test-threads=1(128 passed: 100 unit, 14 integration, 14 SCP03)git diff --check upstream/main...HEADFormatting note
cargo fmt --all -- --checkis not clean on the current repository baseline; it reports repository-wide differences, including the localnxp-se050path dependency.