diff options
-rw-r--r-- | src/key.c | 2 | ||||
-rw-r--r-- | src/object.c | 6 |
2 files changed, 6 insertions, 2 deletions
@@ -457,7 +457,7 @@ p11t_key_tests(void) { slot = p11t_slot_get_id(j); session = p11t_session_open(slot, 0); - if(!session) + if(session == CK_INVALID) continue; klass = CKO_PUBLIC_KEY; diff --git a/src/object.c b/src/object.c index c30348e..c0b8aa6 100644 --- a/src/object.c +++ b/src/object.c @@ -98,7 +98,7 @@ test_find_objects(CK_SESSION_HANDLE session) rv = (p11t_module_funcs->C_FindObjectsInit)((CK_SESSION_HANDLE)-99, &dummy, 0); P11T_CHECK_RV("Invalid session", rv, CKR_SESSION_HANDLE_INVALID); - rv = (p11t_module_funcs->C_FindObjectsInit)((CK_SESSION_HANDLE)-99, NULL, 1); + rv = (p11t_module_funcs->C_FindObjectsInit)(session, NULL, 1); P11T_CHECK_RV("Attribute count without buffer", rv, CKR_ARGUMENTS_BAD); } @@ -181,6 +181,7 @@ test_get_attribute_value(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE object) P11T_SECTION("C_GetAttributeValue"); + memset(&attrs, 0, sizeof(attrs)); attrs[0].type = CKA_CLASS; if(p11t_test_unexpected) @@ -438,6 +439,9 @@ p11t_object_find_one(CK_SESSION_HANDLE session, CK_ATTRIBUTE_PTR attrs, if((p11t_module_funcs->C_FindObjects)(session, &object, 1, &count) != CKR_OK) return CK_INVALID; + if((p11t_module_funcs->C_FindObjectsFinal)(session) != CKR_OK) + return CK_INVALID; + if(count != 1) return CK_INVALID; |