diff options
-rw-r--r-- | src/key.c | 20 | ||||
-rw-r--r-- | src/session.c | 16 |
2 files changed, 36 insertions, 0 deletions
@@ -113,6 +113,26 @@ test_rsa_public(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE object) P11T_SECTION("CKK_RSA Public"); + /* + * These attribute buffer codes have already been tested here and there, but + * do it again since sometimes the big num code is different from general attrs. + */ + if(p11t_test_unexpected) { + + /* Too small */ + attr.type = CKA_MODULUS; + attr.pValue = modulus; + attr.ulValueLen = 4; + rv = (p11t_module_funcs->C_GetAttributeValue)(session, object, &attr, 1); + P11T_CHECK_RV("CKA_MODULUS", rv, CKR_BUFFER_TOO_SMALL); + + /* No buffer */ + attr.type = CKA_MODULUS; + attr.pValue = NULL; + rv = (p11t_module_funcs->C_GetAttributeValue)(session, object, &attr, 1); + P11T_CHECK_RV("CKA_MODULUS", rv, CKR_OK); + } + attr.type = CKA_MODULUS; attr.pValue = modulus; attr.ulValueLen = sizeof(modulus); diff --git a/src/session.c b/src/session.c index 20524b9..6c3b4b1 100644 --- a/src/session.c +++ b/src/session.c @@ -109,6 +109,12 @@ test_session_user_login(CK_SLOT_ID slot) test_session_info(session_ro, slot, CKF_SERIAL_SESSION, CKS_RO_PUBLIC_SESSION); test_session_info(session_rw, slot, CKF_SERIAL_SESSION | CKF_RW_SESSION, CKS_RW_PUBLIC_SESSION); + if(p11t_test_unexpected) + { + rv = (p11t_module_funcs->C_Logout)(session_rw); + P11T_CHECK_RV("Double logout", rv, CKR_USER_NOT_LOGGED_IN); + } + return CONTINUE; } @@ -219,6 +225,16 @@ test_session_main(CK_SLOT_ID slot) test_session_info(session_ro2, slot, CKF_SERIAL_SESSION, CKS_RO_PUBLIC_SESSION); test_session_info(session_rw, slot, CKF_SERIAL_SESSION | CKF_RW_SESSION, CKS_RW_PUBLIC_SESSION); + /* These functions should return errors */ + P11T_SECTION("C_GetFunctionStatus"); + rv = (p11t_module_funcs->C_GetFunctionStatus) (session_ro); + P11T_CHECK_RV("Should return error", rv, CKR_FUNCTION_NOT_PARALLEL); + + P11T_SECTION("C_CancelFunction"); + rv = (p11t_module_funcs->C_CancelFunction) (session_ro); + P11T_CHECK_RV("Should return error", rv, CKR_FUNCTION_NOT_PARALLEL); + + P11T_SECTION("C_CloseSession"); if(p11t_test_unexpected) |