Skip to content

ta: pkcs11: add CKM_AES_GCM key wrap/unwrap - #7864

Merged
jenswikl merged 1 commit into
OP-TEE:masterfrom
Hussainity:hm/gcm-keywrap
Aug 12, 2026
Merged

ta: pkcs11: add CKM_AES_GCM key wrap/unwrap#7864
jenswikl merged 1 commit into
OP-TEE:masterfrom
Hussainity:hm/gcm-keywrap

Conversation

@Hussainity

@Hussainity Hussainity commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

This PR enables using AES GCM for Key Wrapping:

  • Permit CKM_AES_GCM in C_WrapKey/C_UnwrapKey: switch the token capability flag from CKFM_CIPHER to CKFM_CIPHER_WRAP
  • list the mechanism in check_created_attrs_against_processing()
  • handle it in wrap_data_by_symm_enc() by driving the active AE operation and reporting plaintext+tag as the required output size. The tag length is exposed via a new tee_ae_tag_size() helper.

@Hussainity

Hussainity commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Implements #7853

@etienne-lms

Copy link
Copy Markdown
Contributor

Hello @Hussainity,
Sorry, i'm off for a few days. I'll review this P-R when l’m back.

@etienne-lms etienne-lms left a comment

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.

LGTM. A minor comment. Also, could you wrap lines in the commit message to 72 char/line max?

Comment thread ta/pkcs11/src/processing_symm.c Outdated
enum pkcs11_rc rc = PKCS11_CKR_OK;
size_t final_sz = 0;
size_t update_sz = 0;
size_t required = data_sz + tee_ae_tag_size(session);

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.

I'm not fund of braces in a case instruction block. Could you move these variable to the function entry? Or alternatively implement this sequence as a local function.

@Hussainity

Copy link
Copy Markdown
Contributor Author

@etienne-lms , thanks for the review, I addressed your comments and confirmed against OP-TEE/optee_test#822

@Hussainity
Hussainity requested a review from etienne-lms August 9, 2026 22:07

@etienne-lms etienne-lms left a comment

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.

Reviewed-by: Etienne Carriere <etienne.carriere@st.com>

Permit CKM_AES_GCM in C_WrapKey/C_UnwrapKey: switch the token
capability flag from CKFM_CIPHER to CKFM_CIPHER_WRAP, list the
mechanism in check_created_attrs_against_processing(), and handle it in
wrap_data_by_symm_enc() by driving the active AE operation and
reporting plaintext+tag as the required output size.
The tag length is exposed via a new tee_ae_tag_size() helper.

Signed-off-by: Hussain Miyaziwala <hussain_miya@hotmail.com>
Reviewed-by: Etienne Carriere <etienne.carriere@st.com>
@Hussainity

Copy link
Copy Markdown
Contributor Author

@jenswikl ready for merge

@jenswikl

Copy link
Copy Markdown
Contributor

I'll merge this when the CI tests have passed.

@jenswikl
jenswikl merged commit 0bddb60 into OP-TEE:master Aug 12, 2026
57 checks passed
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.

3 participants