Repository navigation
pkcs11: test context authentication and PIN lockout - #853
Conversation
etienne-lms
left a comment
There was a problem hiding this comment.
Thanks for the test. LGTM with suggestions.
Could you update the commit message header line, like the below?
-pkcs11: test context authentication and PIN lockout
+xtest: pkcs11: test context authentication and PIN lockout
| if (!ADBG_EXPECT_CK_OK(c, rv)) | ||
| goto out; | ||
|
|
||
| Do_ADBG_Log("Ordinary key"); |
There was a problem hiding this comment.
Suggestion: use Do_ADBG_BeginSubCase(c, ...)/Do_ADBG_EndSubCase(c, ...) to enhance separation of the test cases.
| (CKF_USER_PIN_LOCKED | CKF_USER_PIN_FINAL_TRY | | ||
| CKF_USER_PIN_COUNT_LOW)))) |
There was a problem hiding this comment.
Could you indent to the opening parenthesis to ease readibility?
| (CKF_USER_PIN_LOCKED | CKF_USER_PIN_FINAL_TRY | | |
| CKF_USER_PIN_COUNT_LOW)))) | |
| (CKF_USER_PIN_LOCKED | CKF_USER_PIN_FINAL_TRY | | |
| CKF_USER_PIN_COUNT_LOW)))) |
| cleanup_context_auth_token(c, slot, token_initialized); | ||
| rv = close_lib(); | ||
| ADBG_EXPECT_CK_OK(c, rv); | ||
| } |
There was a problem hiding this comment.
I would be nice we also test CKA_ALWAYS_AUTHENTICATE against ACL_AUTH case. That would need to cover only the "Missing context login" and "Context login" sub-cases.
We can postponed that to a later P-R.
9aac31e to
5d836f8
Compare
|
Thank you for the detailed review, @etienne-lms . I've split the PIN scenarios into ADBG subcases, aligned the flag checks, and added a second C_Sign() call after a rejected signature to verify CKR_OPERATION_NOT_INITIALIZED. I also included the two ACL_AUTH scenarios, reusing the existing identity setup helpers. Validated with OP-TEE/optee_os#8172, the full default-level PKCS#11 suite passes 35 cases and 6,021 subtests on AArch64 QEMU. The new ACL test also fails as expected against the pre-context-login-fix TA. All test commit subjects now use the requested xtest: pkcs11: prefix. Could you please take another look when you have a chance? |
etienne-lms
left a comment
There was a problem hiding this comment.
Reviewed-by: Etienne Carriere <etienne.carriere@st.com>
The pending review comments are non-blocking.
|
Thank you for the All four pending review items (converting the PIN scenarios to I will consolidate the fixup/formatting commits and add the |
Check context login for CKA_ALWAYS_AUTHENTICATE private keys. Cover valid and invalid PINs, retries on an active operation, operation and session isolation, and signing with ordinary keys. Verify signatures with the public key and check that rejected signing ends the operation. Check that context PIN lockout returns sessions to the public state and terminates their operations. Use the token's final-try flag and restore the test token after each PIN case, including failure paths. In ACL_AUTH mode, cover rejected signing without context login and successful signing after context login using the existing TEE identity setup. Keep the generated keys local to the test session. Link: OP-TEE/optee_os#8161 Signed-off-by: Yilin Li <mu_lyl@163.com> Reviewed-by: Etienne Carriere <etienne.carriere@st.com> Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Tested-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
Check explicit and default CKA_ALWAYS_AUTHENTICATE/CKA_PRIVATE combinations when importing private keys and generating key pairs. Cover attribute readback and copy inheritance. Check the existing restrictions on changing the attributes through C_SetAttributeValue and C_CopyObject. Signed-off-by: Yilin Li <mu_lyl@163.com> Reviewed-by: Etienne Carriere <etienne.carriere@st.com> Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Tested-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
0a3dda7 to
276eac3
Compare
Add context-login tests for correct and incorrect PINs, retry on an active
operation, isolation between operations and sessions, and ordinary-key
behavior. Verify successful signatures with the public key.
Also test that context PIN lockout makes both sessions public and
terminates their active operations. Restore the test token and PIN after
each case, including failure paths. Keep the existing no-active-operation
check in case 1003 unchanged.
Requires the companion OS fix: OP-TEE/optee_os#8172.
Validation: AArch64 QEMU using OS
f54190f22611, clientda81fb7b3078and test baseline179740b43809. Case 1031 fails onthe original TA; the patched default-level suite passes all 33 cases
and 5856 subtests.
Assisted by AI.