Skip to content

Conversation

@pamaury
Copy link
Contributor

@pamaury pamaury commented Dec 27, 2025

Backport #26565

The HSM used in provisioning infrastructure uses a custom mechanism
identifier (`CKM_AES_KWP = (CKM_VENDOR_DEFINED + 0x171)`) even though
the implementation follows the RFC 3394 and 5649 specifations.

The `CKM_AES_KWP` implemented by Thales is also equivalent to the KWP
algorithm specified by NIST SP 800-38F.

This change adds a custom `Wrap::VendorThalesAesKwp` mechanism to
`hsmtool` to be able to wrap/unwrap private keys with `AES_KWP`.

Signed-off-by: Miguel Osorio <miguelosorio@google.com>
(cherry picked from commit a1feef4)
@pamaury pamaury requested a review from a team as a code owner December 27, 2025 10:51
@pamaury pamaury requested review from jwnrt and removed request for a team December 27, 2025 10:51
let wrapper = Wrap::AesKeyWrapPad;
let wrapper: Wrap = self
.wrap_mechanism
.ok_or(anyhow!("wrap_mechanism is required when wrap is specified"))?
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: normally written .context("wrap_mechanism is required when wrap is specified")?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I added a commit to make the code more idiomatic

Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
@pamaury pamaury requested review from cfrantz and moidx January 5, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants