Skip to content

libckteec: add CKM_HKDF_DERIVE mechanism support - #420

Merged
jenswikl merged 1 commit into
OP-TEE:masterfrom
Hussainity:hm/hkdf-001
Aug 11, 2026
Merged

libckteec: add CKM_HKDF_DERIVE mechanism support#420
jenswikl merged 1 commit into
OP-TEE:masterfrom
Hussainity:hm/hkdf-001

Conversation

@Hussainity

Copy link
Copy Markdown
Contributor

Define CK_HKDF_PARAMS from PKCS#11 v3.0 and serialize it into the wire format expected by the TA.

@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. It would be nice the updates in pkcs11_ta.h in OP-TEE OS are also reported here in libckteec/include/pkcs11_ta.h. Not a blocking issue, could be added later.

Comment on lines +554 to +561
if (params->ulSaltLen > UINT32_MAX ||
params->ulInfoLen > UINT32_MAX ||
params->ulSaltLen >
UINT32_MAX - params->ulInfoLen - 7 * sizeof(uint32_t))
return CKR_ARGUMENTS_BAD;

params_size = 7 * sizeof(uint32_t) + params->ulSaltLen +
params->ulInfoLen;

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.

Suggested change
if (params->ulSaltLen > UINT32_MAX ||
params->ulInfoLen > UINT32_MAX ||
params->ulSaltLen >
UINT32_MAX - params->ulInfoLen - 7 * sizeof(uint32_t))
return CKR_ARGUMENTS_BAD;
params_size = 7 * sizeof(uint32_t) + params->ulSaltLen +
params->ulInfoLen;
if (ADD_OVERFLOW(7 * sizeof(uint32_t), params->ulSaltLen, &params_size) ||
ADD_OVERFLOW(params_size, params->ulInfoLen, &params_size))
return CKR_ARGUMENTS_BAD;

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.

ADD_OVERFLOW is part of the TA build, not here in OPTEE Client

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.

My mistake, it's under review (#417). Discard my comment. If that P-R is not merge before yours, we will update the code later to use ADD_OVERFLOW().

@Hussainity

Copy link
Copy Markdown
Contributor Author

@etienne-lms Address your feedback.

@github-actions

Copy link
Copy Markdown

This pull request has been marked as a stale pull request because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment, otherwise this pull request will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions Bot added the Stale label Jul 27, 2026
@etienne-lms

Copy link
Copy Markdown
Contributor

Keep alive

@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.
Reviewed-by: Etienne Carriere <etienne.carriere@st.com>

Comment on lines +554 to +561
if (params->ulSaltLen > UINT32_MAX ||
params->ulInfoLen > UINT32_MAX ||
params->ulSaltLen >
UINT32_MAX - params->ulInfoLen - 7 * sizeof(uint32_t))
return CKR_ARGUMENTS_BAD;

params_size = 7 * sizeof(uint32_t) + params->ulSaltLen +
params->ulInfoLen;

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.

My mistake, it's under review (#417). Discard my comment. If that P-R is not merge before yours, we will update the code later to use ADD_OVERFLOW().

@github-actions github-actions Bot removed the Stale label Jul 28, 2026
@jenswikl

jenswikl commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Please apply the tag so I can merge this.

Define CK_HKDF_PARAMS from PKCS#11 v3.0 and serialize it into the
wire format expected by the TA.

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 done!

@jenswikl

Copy link
Copy Markdown
Contributor

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

@jenswikl
jenswikl merged commit ab96380 into OP-TEE:master Aug 11, 2026
2 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