refactor(fw): move hmac_hash to the shared ddi layer - #579
Closed
vsonims wants to merge 1 commit into
Closed
Conversation
Relocate the `HsmVaultKeyKind -> HsmHashAlgo` HMAC mapping out of the MBOR-only `mbor::from_pal` module up to the codec-neutral `ddi` module (alongside `recover_bk_boot`), so the upcoming TBOR HMAC commands can reuse it without depending on `mbor`. Pure refactor: MBOR's `Hmac` handler now calls `crate::ddi::hmac_hash`; behavior is unchanged. Validation: MBOR HMAC emu 36/36 (fixed + var-len HMAC, all SHA variants, sign-permission, KBKDF-derived, masked-key HMAC); fmt + clippy clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0b09e50a-a9be-4bae-b347-d42dc775a258
Collaborator
Author
|
Folded into #583, which is now based on |
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
Groundwork for the TBOR HMAC command family (step 1 of the series; stacked on #578).
Relocates the
HsmVaultKeyKind → HsmHashAlgoHMAC mapping (hmac_hash) out of the MBOR-onlymbor::from_palmodule up to the codec-neutralddimodule (alongsiderecover_bk_boot), so the upcoming TBOR HMAC handlers can reuse it viacrate::ddi::hmac_hashwithout depending onmbor— matching the existing "shared helpers live at the command level, keepingtborindependent ofmbor" convention.Pure refactor — MBOR's
Hmachandler now callscrate::ddi::hmac_hash; behavior is unchanged.Note on
resolve_masking_keyThe originally-planned scope resolver is deferred to the next PR (with the first HMAC handler that consumes it). The existing masking-key call sites are intentionally key-id-based (they carry the
CopyHsmKeyIdacross awaits/closures and fetch material at the use site to avoid borrow-checker conflicts), so a material-returning resolver fits the new handlers rather than a refactor of existing code — and adding it now would be dead code.Validation
cargo check+clippyclean; nightlyfmtclean.Base: #578 (
tbor/session-mk-32). Will auto-retarget tomainwhen #578 merges.