Skip to content

xtest: include tests for HKDF_DERIVE#819

Open
Hussainity wants to merge 1 commit into
OP-TEE:masterfrom
Hussainity:hm/hkdf
Open

xtest: include tests for HKDF_DERIVE#819
Hussainity wants to merge 1 commit into
OP-TEE:masterfrom
Hussainity:hm/hkdf

Conversation

@Hussainity

Copy link
Copy Markdown

Test HKDF_DERIVE in PKCS#11 TA using RFC 5869 test vectors.

Test HKDF_DERIVE in PKCS#11 TA using RFC 5869 test vectors.

Signed-off-by: Hussain Miyaziwala <hussain_miya@hotmail.com>

@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.

Thanks for this test series.
I think it would be nice to have a few tests on reference keys access permissions (base key & salt key). Could be added in a later change.

Could you mention in the commit message that only some of the RFC 5869 test vectors are exercised? It also would be nice to provide an URL for the test vector location in the commit message, e.g. Link: https://www.rfc-editor.org/info/rfc5869/#appendix-A.

Comment thread host/xtest/pkcs11_1000.c
Comment on lines +10320 to +10325
if (derived_key != CK_INVALID_HANDLE)
ADBG_EXPECT_CK_OK(c, C_DestroyObject(session, derived_key));
if (base_key != CK_INVALID_HANDLE)
ADBG_EXPECT_CK_OK(c, C_DestroyObject(session, base_key));
derived_key = CK_INVALID_HANDLE;
base_key = CK_INVALID_HANDLE;

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.

Destroying object could be factorized in hkdf_derive_and_get() as well as derived_key and base_key local variables.

Comment thread host/xtest/pkcs11_1000.c
ADBG_EXPECT_CK_OK(c, close_lib());
}
ADBG_CASE_DEFINE(pkcs11, 1031, xtest_pkcs11_test_1031,
"PKCS11: HKDF derive (RFC 5869 A.1-A.4, extract/expand modes, salt-as-key, negatives)");

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.

Suggestion: test case summary could be shorten to ease adding other tests.

Suggested change
"PKCS11: HKDF derive (RFC 5869 A.1-A.4, extract/expand modes, salt-as-key, negatives)");
"PKCS11: HKDF derive (RFC 5869 test vectors based and negative tests)");

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