feat(fw): implement DDI DeleteKey handler#431
Open
jaygmsft wants to merge 1 commit into
Open
Conversation
Wire up the previously-unimplemented DeleteKey (1014) DDI op in the firmware application layer: within an open session, delete a vault-resident key by id and return an empty success response. - Internal device keys (anything carrying the `internal` attribute — the partition unwrapping key, session and credential keys) cannot be destroyed by the host and are rejected with CannotDeleteInternalKeys, matching the reference firmware. - An unknown key_id is rejected with KeyNotFound. - Session validation is framework-level (DeleteKey -> InSession), so a missing/mismatched session returns FileHandleSessionIdDoesNotMatch. The handler is synchronous: the `internal`-attribute check and the vault deletion have no yield point between them, so no partition_lock is needed. New: delete_key.rs handler; mod.rs dispatch wiring; delete_key_smoke.rs smoke tests (delete + reuse, unknown-key, and double-delete idempotency using an app AES key, so they run on both backends). Validation: - emu delete_key_smoke 3/3; mock 3/3. - mock delete_key integration 8/8 (includes CannotDeleteInternalKeys for the unwrapping key). On emu the core delete_key integration tests pass (6/8); the unwrapping-key and bulk-import cases are setup-blocked by GetUnwrappingKey / RsaUnwrap, which are not yet implemented on main (a pre-existing limitation, not this handler) — the internal-key path is exercised on mock instead. - emu smoke 33/33 (no regression). - cargo xtask clippy clean; clippy --tests clean under emu and mock; fmt and copyright clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements the MBOR DDI DeleteKey (op 1014) firmware handler, wiring it into the firmware dispatcher and adding end-to-end smoke tests to validate delete behavior across both mock and emu backends.
Changes:
- Added a new synchronous firmware handler to delete a vault-resident key by id, rejecting internal keys and unknown ids with the expected DDI statuses.
- Wired
DeleteKeyinto the MBOR module exports and dispatch table. - Added integration smoke tests covering delete+reuse, unknown key deletion, and double-delete behavior; registered the new test module.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| fw/core/lib/src/ddi/mbor/mod.rs | Exposes the new handler and routes DdiOp::DeleteKey to it in the dispatcher. |
| fw/core/lib/src/ddi/mbor/delete_key.rs | Implements the firmware-side DeleteKey operation (internal-key rejection, vault delete, empty success response). |
| ddi/mbor/types/tests/integration/delete_key_smoke.rs | Adds backend-agnostic smoke tests for delete semantics using an app AES key. |
| ddi/mbor/types/tests/azihsm_ddi_tests.rs | Registers the new delete_key_smoke integration test module. |
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.
Wire up the previously-unimplemented DeleteKey (1014) DDI op in the firmware application layer: within an open session, delete a vault-resident key by id and return an empty success response.
internalattribute — the partition unwrapping key, session and credential keys) cannot be destroyed by the host and are rejected with CannotDeleteInternalKeys, matching the reference firmware.The handler is synchronous: the
internal-attribute check and the vault deletion have no yield point between them, so no partition_lock is needed.New: delete_key.rs handler; mod.rs dispatch wiring; delete_key_smoke.rs smoke tests (delete + reuse, unknown-key, and double-delete idempotency using an app AES key, so they run on both backends).
Validation: