diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/certificate.c | 12 | ||||
-rw-r--r-- | src/module.c | 4 | ||||
-rw-r--r-- | src/p11-tests.c | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/certificate.c b/src/certificate.c index ce4cac3..acb7b37 100644 --- a/src/certificate.c +++ b/src/certificate.c @@ -237,7 +237,7 @@ test_x509_certificate(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE object) attr.ulValueLen = sizeof(java_midp); rv = (p11t_module_funcs->C_GetAttributeValue)(session, object, &attr, 1); P11T_CHECK_RV("CKA_JAVA_MIDP_SECURITY_DOMAIN", rv, CKR_OK); - if(java_midp != 0 || java_midp != 1 || java_midp != 2 || java_midp != 3) + if(java_midp != 0 && java_midp != 1 && java_midp != 2 && java_midp != 3) P11T_CHECK_FAIL_MSG("CKA_JAVA_MIDP_SECURITY_DOMAIN", "Unrecognized value"); /* CKA_ID */ @@ -251,7 +251,7 @@ test_x509_certificate(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE object) } test_x509_cross_search(session, object, CKA_ID, CK_INVALID, "CKA_ID"); - test_x509_cross_search(session, object, CKA_ID, CK_INVALID, "CKA_SERIAL_NUMBER, CKA_ISSUER"); + test_x509_cross_search(session, object, CKA_SERIAL_NUMBER, CKA_ISSUER, "CKA_SERIAL_NUMBER, CKA_ISSUER"); X509_free(cert); free(der_value); @@ -293,7 +293,7 @@ test_certificate_object(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE object) attr.pValue = &category; rv = (p11t_module_funcs->C_GetAttributeValue)(session, object, &attr, 1); P11T_CHECK_RV("CKA_CERTIFICATE_CATEGORY", rv, CKR_OK); - if(category != 1 && category != 2 && category != 3) + if(category != 1 && category != 2 && category != 3 && category != 0) P11T_CHECK_FAIL_MSG("CKA_CERTIFICATE_CATEGORY", "invalid value"); attr.type = CKA_CHECK_VALUE; @@ -309,14 +309,16 @@ test_certificate_object(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE object) attr.pValue = &start_date; rv = (p11t_module_funcs->C_GetAttributeValue)(session, object, &attr, 1); P11T_CHECK_RV("CKA_START_DATE", rv, CKR_OK); - P11T_CHECK_DATE("CKA_START_DATE", &start_date); + if(attr.ulValueLen) + P11T_CHECK_DATE("CKA_START_DATE", &start_date); attr.type = CKA_END_DATE; attr.ulValueLen = sizeof(end_date); attr.pValue = &end_date; rv = (p11t_module_funcs->C_GetAttributeValue)(session, object, &attr, 1); P11T_CHECK_RV("CKA_END_DATE", rv, CKR_OK); - P11T_CHECK_DATE("CKA_END_DATE", &end_date); + if(attr.ulValueLen) + P11T_CHECK_DATE("CKA_END_DATE", &end_date); } test_x509_certificate(session, object); diff --git a/src/module.c b/src/module.c index 7dec518..b7a715b 100644 --- a/src/module.c +++ b/src/module.c @@ -283,13 +283,13 @@ p11t_module_load(const char *filename) module = LoadLibrary(filename); if(!module) - p11t_msg_fatal("couldn't load library: %s: %s", filename, p11t_msg_lasterr()); + p11t_msg_fatal("couldn't load library: %s: %s", filename, p11t_msg_os()); /* Lookup the appropriate function in the library */ get_function_list = (CK_C_GetFunctionList)GetProcAddress(module, "C_GetFunctionList"); if(!get_function_list) p11t_msg_fatal("C_GetFunctionList: couldn't find function in library: %s: %s", - filename, p11t_msg_lasterr()); + filename, p11t_msg_os()); #else /* !_WIN32 */ diff --git a/src/p11-tests.c b/src/p11-tests.c index e4e4110..0d54172 100644 --- a/src/p11-tests.c +++ b/src/p11-tests.c @@ -63,8 +63,8 @@ main(int argc, char* argv[]) p11t_slot_tests(); p11t_session_tests(); p11t_object_tests(); - p11t_rsa_tests(); p11t_certificate_tests(); + p11t_rsa_tests(); /* Remaining module tests */ p11t_module_finalize(); |