Skip to content

bootutil: crypto: Add PSA crypto implementation for AES-KW - #2791

Open
tpambor wants to merge 1 commit into
mcu-tools:mainfrom
tpambor:aes-kw-psa
Open

bootutil: crypto: Add PSA crypto implementation for AES-KW#2791
tpambor wants to merge 1 commit into
mcu-tools:mainfrom
tpambor:aes-kw-psa

Conversation

@tpambor

@tpambor tpambor commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Add a PSA crypto implementation for AES-KW. This implementation uses the PSA Crypto API to perform AES key unwrapping operations.

Support for key wrapping was added in version 1.4 of the PSA Crypto API specification.

This implementation has been tested with TF-M, which also provides a implementation in its thin_psa_crypto_core layer.

Add a PSA crypto implementation for AES-KW. This implementation
uses the PSA Crypto API to perform AES key unwrapping operations.

Support for key wrapping was added in version 1.4 of the PSA
Crypto API specification.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
@tpambor
tpambor requested a review from davidvincze as a code owner July 15, 2026 06:29
@nordicjm
nordicjm requested a review from d3zd3z July 16, 2026 07:18
psa_set_key_algorithm(&attributes, PSA_ALG_CTR);
psa_set_key_bits(&attributes, key_len * 8);

status = psa_unwrap_key(&attributes, ctx->key_id, PSA_ALG_ECB_NO_PADDING,

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.

As far as I can tell psa_unwrap_key is only implemented in the thin_psa_crypto_core.c you mentioned and that's only built when MCUboot is built as part of the TF-M build. TBH I don't know how common it is to encrypt images in devices which are not also using TF-M, but if that's possible shouldn't we add some guard to ensure that this block is not compiled when MCUboot is built without TF-M? Wdyt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No strong opinion here, but I don't think it is necessary as one can select PSA or another crypto implementation and whether to use KW or ECIES, etc. tf-psa-crypto currently does not implement it, but there are other PSA implementations like Oberon PSA that also have support for AES-KW (https://github.com/nrfconnect/sdk-oberon-psa-crypto/blob/87917371cc6f3883dbdf0c7751c48a358ab8920a/core/psa_crypto.c#L6041)

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.

2 participants