From f151676ae6f242b34b9d8c7ae8d2815ab3f89f22 Mon Sep 17 00:00:00 2001 From: "Maciej J. Karpiuk" Date: Wed, 18 Feb 2015 12:49:18 +0100 Subject: [PATCH] CKM: tests adjusted to tizenorg. --- tests/ckm/async-api.cpp | 21 +++++----- tests/ckm/capi-access_control.cpp | 18 ++------- tests/ckm/capi-certificate-chains.cpp | 32 +++++++-------- tests/ckm/capi-testcases.cpp | 7 ++-- tests/ckm/ckm-common.h | 2 +- tests/ckm/main.cpp | 74 +++++++++++++++++------------------ tests/ckm/password-integration.cpp | 50 +++++++++++------------ 7 files changed, 93 insertions(+), 111 deletions(-) diff --git a/tests/ckm/async-api.cpp b/tests/ckm/async-api.cpp index d4de100..9b200dd 100644 --- a/tests/ckm/async-api.cpp +++ b/tests/ckm/async-api.cpp @@ -411,7 +411,9 @@ RUNNER_TEST(TA0000_init) int temp; ControlShPtr control = Control::create(); RUNNER_ASSERT_MSG(CKM_API_SUCCESS == (temp = control->removeUserData(APP_UID)), - "Error=" << ErrorToString(temp)); + "Error=" << ErrorToString(temp)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == (temp = control->unlockUserKey(APP_UID, TEST_PASS)), + "Error=" << ErrorToString(temp)); } // saveKey @@ -1187,7 +1189,6 @@ RUNNER_CHILD_TEST(TA1720_ocsp_check_negative) RUNNER_CHILD_TEST(TA1750_ocsp_check_positive) { - RUNNER_IGNORED_MSG("Fixed in next version of ckm!"); switch_to_storage_ocsp_user(TEST_LABEL); DBCleanup dbc; @@ -1298,27 +1299,26 @@ RUNNER_TEST(TA2000_PKCS_add_bundle_with_chain_certs) memcpy(buffer.data(), buff.data(), buff.size()); auto pkcs = CKM::PKCS12::create(buffer, CKM::Password()); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( NULL != pkcs.get(), "Error in PKCS12::create()"); auto cert = pkcs->getCertificate(); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( NULL != cert.get(), "Error in PKCS12::getCertificate()"); auto key = pkcs->getKey(); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( NULL != key.get(), "Error in PKCS12::getKey()"); auto caVector = pkcs->getCaCertificateShPtrVector(); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( 2 == caVector.size(), "Wrong size of vector"); // save to the CKM - int tmp; CKM::Policy exportable; CKM::Policy notExportable(CKM::Password(), false); @@ -1350,7 +1350,6 @@ RUNNER_TEST(TA2000_PKCS_add_bundle_with_chain_certs) RUNNER_TEST(TA2010_PKCS_get) { DBCleanup dbc; - int temp; auto manager = CKM::Manager::create(); // fail - no entry @@ -1375,17 +1374,17 @@ RUNNER_TEST(TA2010_PKCS_get) CKM::Password()); auto cert = obs->m_pkcs->getCertificate(); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( NULL != cert.get(), "Error in PKCS12::getCertificate()"); auto key = obs->m_pkcs->getKey(); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( NULL != key.get(), "Error in PKCS12::getKey()"); auto caVector = obs->m_pkcs->getCaCertificateShPtrVector(); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( 2 == caVector.size(), "Wrong size of vector"); } diff --git a/tests/ckm/capi-access_control.cpp b/tests/ckm/capi-access_control.cpp index 9295a07..ca3d3da 100644 --- a/tests/ckm/capi-access_control.cpp +++ b/tests/ckm/capi-access_control.cpp @@ -108,18 +108,6 @@ void check_read_allowed(const char* alias) check_read_allowed(alias, TEST_DATA); } -void check_read_denied(const char* alias) -{ - // try to read previously saved data - label taken implicitly - { - ckmc_raw_buffer_s* buffer = NULL; - int ret = ckmc_get_data(alias, NULL, &buffer); - RUNNER_ASSERT_MSG(CKMC_ERROR_PERMISSION_DENIED == ret, - "App with different label shouldn't have rights to read this data. Error: " << ret); - ckmc_buffer_free(buffer); - } -} - void check_read_not_visible(const char* alias) { // try to read previously saved data - label taken implicitly @@ -135,7 +123,7 @@ void check_read_not_visible(const char* alias) void allow_access_deprecated(const char* alias, const char* accessor, ckmc_access_right_e accessRights) { int ret = ckmc_allow_access(alias, accessor, accessRights); - RUNNER_ASSERT_MSG_BT(CKMC_ERROR_NONE == ret, "Trying to allow access returned: " << ret); + RUNNER_ASSERT_MSG(CKMC_ERROR_NONE == ret, "Trying to allow access returned: " << ret); } void allow_access(const char* alias, const char* accessor, int permissionMask) @@ -154,7 +142,7 @@ void allow_access_negative(const char* alias, const char* accessor, int permissi void deny_access(const char* alias, const char* accessor) { - int ret = ckmc_deny_access(alias, accessor); + int ret = ckmc_set_permission(alias, accessor, CKMC_PERMISSION_NONE); RUNNER_ASSERT_MSG(CKMC_ERROR_NONE == ret, "Denying access failed. Error: " << ret); } @@ -168,7 +156,7 @@ void allow_access_deprecated_by_adm(const char* alias, const char* accessor, ckm { // data removal should revoke this access int ret = ckmc_allow_access_by_adm(USER_ROOT, get_label().get(), alias, accessor, accessRights); - RUNNER_ASSERT_MSG_BT(CKMC_ERROR_NONE == ret, "Trying to allow access returned: " << ret); + RUNNER_ASSERT_MSG(CKMC_ERROR_NONE == ret, "Trying to allow access returned: " << ret); } void allow_access_by_adm(const char* alias, const char* accessor, int permissionMask) diff --git a/tests/ckm/capi-certificate-chains.cpp b/tests/ckm/capi-certificate-chains.cpp index 49a366a..cf25f65 100644 --- a/tests/ckm/capi-certificate-chains.cpp +++ b/tests/ckm/capi-certificate-chains.cpp @@ -235,7 +235,7 @@ typedef std::unique_ptr AliasLi ckmc_cert_s* create_cert(CertIdx idx) { size_t size = sizeof(CERT)/sizeof(CERT[0]); - RUNNER_ASSERT_MSG_BT(idx < size, "Certificate index out of range: " << idx << ">=" << size); + RUNNER_ASSERT_MSG(idx < size, "Certificate index out of range: " << idx << ">=" << size); ckmc_cert_s* cert = NULL; assert_positive(ckmc_cert_new, @@ -244,7 +244,7 @@ ckmc_cert_s* create_cert(CertIdx idx) { CKMC_FORM_PEM, &cert); - RUNNER_ASSERT_MSG_BT(cert != NULL, "Cert is NULL"); + RUNNER_ASSERT_MSG(cert != NULL, "Cert is NULL"); return cert; } @@ -253,7 +253,6 @@ void save_cert(const ckmc_cert_s* cert, const char* alias) { policy.password = NULL; policy.extractable = 1; - int tmp; assert_positive(ckmc_save_cert, alias, *cert, policy); } @@ -270,11 +269,11 @@ AliasListPtr create_alias_list(const char* alias, ...) { ckmc_alias_list_s* tmp = NULL; assert_positive(ckmc_alias_list_new, strdup(a), &tmp); aliasList = AliasListPtr(tmp, ckmc_alias_list_all_free); - RUNNER_ASSERT_MSG_BT(!!aliasList, "Alias list is NULL"); + RUNNER_ASSERT_MSG(!!aliasList, "Alias list is NULL"); last = aliasList.get(); } else { assert_positive(ckmc_alias_list_add, last, strdup(a), &last); - RUNNER_ASSERT_MSG_BT(last != NULL, "Last alias on the list is NULL"); + RUNNER_ASSERT_MSG(last != NULL, "Last alias on the list is NULL"); } } va_end(ap); @@ -295,11 +294,11 @@ CertListPtr create_cert_list(ckmc_cert_s* cert, ...) { ckmc_cert_list_s* tmp = NULL; assert_positive(ckmc_cert_list_new, c, &tmp); certList = CertListPtr(tmp, ckmc_cert_list_all_free); - RUNNER_ASSERT_MSG_BT(!!certList, "Cert list is NULL"); + RUNNER_ASSERT_MSG(!!certList, "Cert list is NULL"); last = certList.get(); } else { assert_positive(ckmc_cert_list_add, last, c, &last); - RUNNER_ASSERT_MSG_BT(last != NULL, "Last cert on the list is NULL"); + RUNNER_ASSERT_MSG(last != NULL, "Last cert on the list is NULL"); } } va_end(ap); @@ -450,14 +449,14 @@ void ChainVerifier::addCert(ckmc_cert_list_s*& list, ckmc_cert_s* cert) if (!list) { ckmc_cert_list_s* tmp = NULL; assert_positive(ckmc_cert_list_new, cert, &tmp); - RUNNER_ASSERT_MSG_BT(!!tmp, "Cert list is NULL"); + RUNNER_ASSERT_MSG(!!tmp, "Cert list is NULL"); list = tmp; } else { ckmc_cert_list_s* last = list; while(last->next) last = last->next; assert_positive(ckmc_cert_list_add, last, cert, &last); - RUNNER_ASSERT_MSG_BT(last != NULL, "Last cert on the list is NULL"); + RUNNER_ASSERT_MSG(last != NULL, "Last cert on the list is NULL"); } } @@ -467,14 +466,14 @@ void ChainVerifier::addAlias(ckmc_alias_list_s*& list, const char* alias) if (!list) { ckmc_alias_list_s* tmp = NULL; assert_positive(ckmc_alias_list_new, strdup(alias), &tmp); - RUNNER_ASSERT_MSG_BT(!!tmp, "Alias list is NULL"); + RUNNER_ASSERT_MSG(!!tmp, "Alias list is NULL"); list = tmp; } else { ckmc_alias_list_s* last = list; while(last->next) last = last->next; assert_positive(ckmc_alias_list_add, last, strdup(alias), &last); - RUNNER_ASSERT_MSG_BT(last != NULL, "Last alias on the list is NULL"); + RUNNER_ASSERT_MSG(last != NULL, "Last alias on the list is NULL"); } } @@ -495,7 +494,7 @@ void ChainVerifier::verifyPositive(CertIdx idx, size_t expected) size_t size = list_size(chain); ckmc_cert_list_all_free(chain); chain = NULL; - RUNNER_ASSERT_MSG_BT(size == expected, "Expected chain size: " << expected << " got: " << size); + RUNNER_ASSERT_MSG(size == expected, "Expected chain size: " << expected << " got: " << size); assert_positive(T::createChainWithAlias, cert, @@ -507,7 +506,7 @@ void ChainVerifier::verifyPositive(CertIdx idx, size_t expected) size = list_size(chain); ckmc_cert_list_all_free(chain); chain = NULL; - RUNNER_ASSERT_MSG_BT(size == expected, "Expected chain size: " << expected << " got: " << size); + RUNNER_ASSERT_MSG(size == expected, "Expected chain size: " << expected << " got: " << size); ckmc_cert_free(cert); } @@ -525,7 +524,7 @@ void ChainVerifier::verifyNegative(CertIdx idx, int error) m_trustedCerts, m_system, &chain); - RUNNER_ASSERT_MSG_BT(chain == NULL, "Chain is not empty"); + RUNNER_ASSERT_MSG(chain == NULL, "Chain is not empty"); assert_result(error, T::createChainWithAlias, @@ -535,7 +534,7 @@ void ChainVerifier::verifyNegative(CertIdx idx, int error) m_system, &chain); - RUNNER_ASSERT_MSG_BT(chain == NULL, "Chain is not empty"); + RUNNER_ASSERT_MSG(chain == NULL, "Chain is not empty"); ckmc_cert_free(cert); } @@ -545,7 +544,6 @@ RUNNER_TEST_GROUP_INIT(T307_CKMC_CAPI_CERTIFICATE_CHAINS); RUNNER_TEST(TCCH_0000_init) { - int temp; assert_positive(ckmc_unlock_user_key, 0, "test-pass"); } @@ -764,8 +762,6 @@ RUNNER_TEST(TCCH_0200_get_certificate_chain_all) RUNNER_TEST(TCCH_9999_deinit) { - int temp; - assert_positive(ckmc_lock_user_key, 0); assert_positive(ckmc_remove_user_data, 0); } diff --git a/tests/ckm/capi-testcases.cpp b/tests/ckm/capi-testcases.cpp index d1aa73c..4674a5c 100644 --- a/tests/ckm/capi-testcases.cpp +++ b/tests/ckm/capi-testcases.cpp @@ -2285,7 +2285,6 @@ RUNNER_TEST(T3103_CAPI_PKCS12_add_bundle_with_chain_certs) RUNNER_ASSERT_MSG(NULL != ppkcs12->ca_chain, "no chain certificates in PKCS12"); // save to the CKM - int tmp; ckmc_policy_s exportable; exportable.password = NULL; exportable.extractable = 1; @@ -2340,21 +2339,21 @@ RUNNER_TEST(T3103_CAPI_PKCS12_get_PKCS) // fail - no entry RUNNER_ASSERT_MSG( - CKMC_ERROR_DB_ALIAS_UNKNOWN == (temp = ckmc_get_pkcs12("i-do-not-exist", &pkcs)), + CKMC_ERROR_DB_ALIAS_UNKNOWN == (temp = ckmc_get_pkcs12("i-do-not-exist", NULL, NULL, &pkcs)), CKMCReadableError(temp)); ckmc_pkcs12_free(pkcs); pkcs = NULL; // fail - not exportable RUNNER_ASSERT_MSG( - CKMC_ERROR_NOT_EXPORTABLE == (temp = ckmc_get_pkcs12(alias_PKCS_not_exportable, &pkcs)), + CKMC_ERROR_NOT_EXPORTABLE == (temp = ckmc_get_pkcs12(alias_PKCS_not_exportable, NULL, NULL, &pkcs)), CKMCReadableError(temp)); ckmc_pkcs12_free(pkcs); pkcs = NULL; // success - exportable RUNNER_ASSERT_MSG( - CKMC_ERROR_NONE == (temp = ckmc_get_pkcs12(alias_PKCS_exportable, &pkcs)), + CKMC_ERROR_NONE == (temp = ckmc_get_pkcs12(alias_PKCS_exportable, NULL, NULL, &pkcs)), CKMCReadableError(temp)); RUNNER_ASSERT_MSG(NULL != pkcs->cert, "no certificate in PKCS12"); diff --git a/tests/ckm/ckm-common.h b/tests/ckm/ckm-common.h index 3b0d514..8372653 100644 --- a/tests/ckm/ckm-common.h +++ b/tests/ckm/ckm-common.h @@ -36,7 +36,7 @@ template void assert_result(int expected, F&& func, Args... args) { int ret = func(args...); - RUNNER_ASSERT_MSG_BT(ret == expected, "Expected " << expected << " got: " << ret); + RUNNER_ASSERT_MSG(ret == expected, "Expected " << expected << " got: " << ret); } template diff --git a/tests/ckm/main.cpp b/tests/ckm/main.cpp index 45705f8..b78531e 100644 --- a/tests/ckm/main.cpp +++ b/tests/ckm/main.cpp @@ -102,31 +102,31 @@ RUNNER_TEST(T0014_Control) { int temp; auto control = CKM::Control::create(); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = control->removeUserData(14)), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = control->resetUserPassword(14, "simple-password")), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = control->resetUserPassword(14, "something")), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = control->unlockUserKey(14, "test-pass")), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = control->lockUserKey(14)), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_ERROR_BAD_REQUEST == (temp = control->resetUserPassword(14, "something")), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = control->removeUserData(14)), "Error=" << CKM::ErrorToString(temp)); } @@ -153,19 +153,19 @@ RUNNER_TEST(T0016_Control_negative_wrong_password) { int temp; auto control = CKM::Control::create(); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = control->unlockUserKey(20, "test-pass")), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = control->changeUserPassword(20, "test-pass", "new-pass")), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = control->lockUserKey(20)), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_ERROR_AUTHENTICATION_FAILED == (temp = control->unlockUserKey(20, "incorrect-password")), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = control->removeUserData(20)), "Error=" << CKM::ErrorToString(temp)); } @@ -560,7 +560,7 @@ RUNNER_TEST(T1031_save_get_bin_data) buffer == buffer2, "Data corrupted"); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = manager->getData("data2", CKM::Password("Password"), buffer)), "The wrong password should be ignored because non was used in saveData. Error=" << CKM::ErrorToString(temp)); } @@ -645,19 +645,19 @@ RUNNER_TEST(T1034_getData_wrong_password) CKM::RawBuffer buffer1(binData1.begin(), binData1.end()); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = manager->saveData("data4", buffer1, CKM::Policy("CorrectPassword"))), "Error=" << CKM::ErrorToString(temp)); CKM::RawBuffer buffer; - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = manager->getData("data4", CKM::Password("CorrectPassword"), buffer)), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( buffer == buffer1, "Data corrupted"); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_ERROR_AUTHENTICATION_FAILED == (temp = manager->getData("data4", CKM::Password("WrongPassword"), buffer)), "Error=" << CKM::ErrorToString(temp)); } @@ -1405,7 +1405,7 @@ RUNNER_TEST(T1312_get_chain) EMPTY_CERT_VECTOR, true, certChain); - RUNNER_ASSERT_MSG_BT(CKM_API_ERROR_VERIFICATION_FAILED == tmp, + RUNNER_ASSERT_MSG(CKM_API_ERROR_VERIFICATION_FAILED == tmp, "Error=" << CKM::ErrorToString(tmp)); RUNNER_ASSERT_MSG( @@ -1413,7 +1413,7 @@ RUNNER_TEST(T1312_get_chain) "Wrong size of certificate chain."); tmp = manager->getCertificateChain(cert, certVector, EMPTY_CERT_VECTOR, true, certChain); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == tmp, "Error=" << CKM::ErrorToString(tmp)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == tmp, "Error=" << CKM::ErrorToString(tmp)); RUNNER_ASSERT_MSG( 3 == certChain.size(), @@ -1508,7 +1508,7 @@ RUNNER_TEST(T1313_get_chain_with_alias) RUNNER_ASSERT_MSG(NULL != cert1.get(), "Certificate should not be empty"); tmp = manager->getCertificateChain(cert, aliasVector, EMPTY_ALIAS_VECTOR, true, certChain); - RUNNER_ASSERT_MSG_BT(CKM_API_ERROR_VERIFICATION_FAILED == tmp, + RUNNER_ASSERT_MSG(CKM_API_ERROR_VERIFICATION_FAILED == tmp, "Error=" << CKM::ErrorToString(tmp)); RUNNER_ASSERT_MSG( @@ -1522,9 +1522,9 @@ RUNNER_TEST(T1313_get_chain_with_alias) aliasVector.push_back(full_address); tmp = manager->getCertificateChain(cert, aliasVector, EMPTY_ALIAS_VECTOR, true, certChain); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == tmp, "Error=" << CKM::ErrorToString(tmp)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == tmp, "Error=" << CKM::ErrorToString(tmp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( 3 == certChain.size(), "Wrong size of certificate chain."); } @@ -1616,7 +1616,7 @@ RUNNER_TEST(T1314_ocsp_check) RUNNER_ASSERT_MSG(NULL != cert1.get(), "Certificate should not be empty"); tmp = manager->getCertificateChain(cert, EMPTY_CERT_VECTOR, EMPTY_CERT_VECTOR, true, certChain); - RUNNER_ASSERT_MSG_BT(CKM_API_ERROR_VERIFICATION_FAILED == tmp, + RUNNER_ASSERT_MSG(CKM_API_ERROR_VERIFICATION_FAILED == tmp, "Error=" << CKM::ErrorToString(tmp)); RUNNER_ASSERT_MSG( @@ -1624,9 +1624,9 @@ RUNNER_TEST(T1314_ocsp_check) "Wrong size of certificate chain."); tmp = manager->getCertificateChain(cert, certVector, EMPTY_CERT_VECTOR, true, certChain); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == tmp, "Error=" << CKM::ErrorToString(tmp)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == tmp, "Error=" << CKM::ErrorToString(tmp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( 3 == certChain.size(), "Wrong size of certificate chain."); @@ -3596,7 +3596,7 @@ RUNNER_TEST(T1810_verify_get_certificate_chain) EMPTY_ALIAS_VECTOR, true, certChain); - RUNNER_ASSERT_MSG_BT(CKM_API_ERROR_VERIFICATION_FAILED == tmp, + RUNNER_ASSERT_MSG(CKM_API_ERROR_VERIFICATION_FAILED == tmp, "Error=" << CKM::ErrorToString(tmp)); RUNNER_ASSERT_MSG( @@ -3606,10 +3606,10 @@ RUNNER_TEST(T1810_verify_get_certificate_chain) aliasVector.push_back(alias_PKCS_exportable); tmp = manager->getCertificateChain(cert, EMPTY_ALIAS_VECTOR, aliasVector, false, certChain); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == tmp, "Error=" << CKM::ErrorToString(tmp)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == tmp, "Error=" << CKM::ErrorToString(tmp)); // 1(cert) + 1(pkcs12 cert) + 2(pkcs12 chain cert) = 4 - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( 4 == certChain.size(), "Wrong size of certificate chain: " << certChain.size()); } @@ -3665,37 +3665,37 @@ RUNNER_TEST(T1812_get_pkcs12_password_tests) memcpy(buffer.data(), buff.data(), buff.size()); auto pkcs = CKM::PKCS12::create(buffer, CKM::Password()); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( NULL != pkcs.get(), "Error in PKCS12::create()"); int temp; - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = manager->savePKCS12(alias, pkcs, CKM::Policy(pass1), CKM::Policy(pass2))), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_ERROR_AUTHENTICATION_FAILED == (temp = manager->getPKCS12(alias, pkcs)), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_ERROR_AUTHENTICATION_FAILED == (temp = manager->getPKCS12(alias, CKM::Password(), CKM::Password(), pkcs)), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_ERROR_AUTHENTICATION_FAILED == (temp = manager->getPKCS12(alias, pass1, CKM::Password(), pkcs)), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_ERROR_AUTHENTICATION_FAILED == (temp = manager->getPKCS12(alias, CKM::Password(), pass2, pkcs)), "Error=" << CKM::ErrorToString(temp)); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = manager->getPKCS12(alias, pass1, pass2, pkcs)), "Error=" << CKM::ErrorToString(temp)); CKM::CertificateShPtr cert; - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_SUCCESS == (temp = manager->getCertificate(alias, pass2, cert)), "Error=" << CKM::ErrorToString(temp)); @@ -3703,7 +3703,7 @@ RUNNER_TEST(T1812_get_pkcs12_password_tests) CKM::AliasVector certVect; certVect.push_back(alias); - RUNNER_ASSERT_MSG_BT( + RUNNER_ASSERT_MSG( CKM_API_ERROR_AUTHENTICATION_FAILED == (temp = manager->getCertificateChain(cert, certVect, certVect, true, certChain)), "Error=" << CKM::ErrorToString(temp)); } diff --git a/tests/ckm/password-integration.cpp b/tests/ckm/password-integration.cpp index 18324d3..7e816de 100644 --- a/tests/ckm/password-integration.cpp +++ b/tests/ckm/password-integration.cpp @@ -63,7 +63,7 @@ RUNNER_TEST(T4010_INIT) unsigned int attempt, max_attempt, expire_sec; int ret = security_server_chk_pwd(NULL, &attempt, &max_attempt, &expire_sec); - RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, ""); + RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, ""); } RUNNER_CHILD_TEST(T4011_ADD_DATA) @@ -73,7 +73,7 @@ RUNNER_CHILD_TEST(T4011_ADD_DATA) auto mgr = CKM::Manager::create(); int ret = mgr->saveData(CKM_ALIAS1, BIN_DATA1, CKM::Policy()); - RUNNER_ASSERT_MSG_BT(ret == CKM_API_SUCCESS, ""); + RUNNER_ASSERT_MSG(ret == CKM_API_SUCCESS, ""); } RUNNER_TEST(T4012_CLOSE_CKM_DB) @@ -81,7 +81,7 @@ RUNNER_TEST(T4012_CLOSE_CKM_DB) auto ctl = CKM::Control::create(); int ret = ctl->lockUserKey(USER_APP); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); } RUNNER_CHILD_TEST(T4013_GET_DATA) @@ -94,7 +94,7 @@ RUNNER_CHILD_TEST(T4013_GET_DATA) // CKM will automaticly unlock with empty password int ret = mgr->getData(CKM_ALIAS1, CKM::Password(), buffer); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); } RUNNER_TEST(T4014_UNLOCK_DATABASE_WITH_SECURITY_SERVER) @@ -104,7 +104,7 @@ RUNNER_TEST(T4014_UNLOCK_DATABASE_WITH_SECURITY_SERVER) usleep(PASSWORD_RETRY_TIMEOUT_US); int ret = security_server_chk_pwd(NULL, &attempt, &max_attempt, &expire_sec); - RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, ""); + RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, ""); } RUNNER_CHILD_TEST(T4015_GET_DATA) @@ -114,9 +114,9 @@ RUNNER_CHILD_TEST(T4015_GET_DATA) CKM::RawBuffer buffer; int ret = mgr->getData(CKM_ALIAS1, CKM::Password(), buffer); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); - RUNNER_ASSERT_MSG_BT(buffer == BIN_DATA1, "Data mismatch"); + RUNNER_ASSERT_MSG(buffer == BIN_DATA1, "Data mismatch"); } RUNNER_TEST_GROUP_INIT(T402_SECURITY_SERVER_PASSWORD_INTEGRATION); @@ -126,7 +126,7 @@ RUNNER_TEST(T4020_INIT) reset_security_server(); int ret = security_server_set_pwd(NULL, PASSWORD1, 10, 10); - RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, ""); + RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, ""); } RUNNER_CHILD_TEST(T4021_ADD_DATA) @@ -136,7 +136,7 @@ RUNNER_CHILD_TEST(T4021_ADD_DATA) auto mgr = CKM::Manager::create(); int ret = mgr->saveData(CKM_ALIAS1, BIN_DATA1, CKM::Policy()); - RUNNER_ASSERT_MSG_BT(ret == CKM_API_SUCCESS, ""); + RUNNER_ASSERT_MSG(ret == CKM_API_SUCCESS, ""); } RUNNER_TEST(T4022_CLOSE_CKM_DB) @@ -146,16 +146,16 @@ RUNNER_TEST(T4022_CLOSE_CKM_DB) auto ctl = CKM::Control::create(); int ret = ctl->lockUserKey(USER_APP); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); usleep(PASSWORD_RETRY_TIMEOUT_US); // login with current password to get rid of invalid "NULL" DKEK ret = security_server_chk_pwd(PASSWORD1, &attempt, &max, &expire); - RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "Error=" << ret); + RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "Error=" << ret); ret = ctl->lockUserKey(USER_APP); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); } RUNNER_CHILD_TEST(T4023_GET_DATA_NEGATIVE) @@ -166,7 +166,7 @@ RUNNER_CHILD_TEST(T4023_GET_DATA_NEGATIVE) CKM::RawBuffer buffer; int ret = mgr->getData(CKM_ALIAS1, CKM::Password(), buffer); - RUNNER_ASSERT_MSG_BT(CKM_API_ERROR_DB_LOCKED == ret, "Error=" << CKM::ErrorToString(ret)); + RUNNER_ASSERT_MSG(CKM_API_ERROR_DB_LOCKED == ret, "Error=" << CKM::ErrorToString(ret)); } RUNNER_TEST(T4024_UNLOCK_DATABASE_WITH_SECURITY_SERVER) @@ -175,7 +175,7 @@ RUNNER_TEST(T4024_UNLOCK_DATABASE_WITH_SECURITY_SERVER) usleep(PASSWORD_RETRY_TIMEOUT_US); int ret = security_server_chk_pwd(PASSWORD1, &attempt, &max, &expire); - RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "Error =" << ret); + RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "Error =" << ret); } RUNNER_CHILD_TEST(T4025_GET_DATA) @@ -186,9 +186,9 @@ RUNNER_CHILD_TEST(T4025_GET_DATA) CKM::RawBuffer buffer; int ret = mgr->getData(CKM_ALIAS1, CKM::Password(), buffer); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); - RUNNER_ASSERT_MSG_BT(buffer == BIN_DATA1, "Data missmatch"); + RUNNER_ASSERT_MSG(buffer == BIN_DATA1, "Data missmatch"); } RUNNER_TEST_GROUP_INIT(T403_SECURITY_SERVER_PASSWORD_INTEGRATION); @@ -198,7 +198,7 @@ RUNNER_TEST(T4030_INIT) reset_security_server(); int ret = security_server_set_pwd(NULL, PASSWORD1, 10, 10); - RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, ""); + RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, ""); } RUNNER_CHILD_TEST(T4031_ADD_DATA) @@ -208,7 +208,7 @@ RUNNER_CHILD_TEST(T4031_ADD_DATA) auto mgr = CKM::Manager::create(); int ret = mgr->saveData(CKM_ALIAS1, BIN_DATA1, CKM::Policy()); - RUNNER_ASSERT_MSG_BT(ret == CKM_API_SUCCESS, ""); + RUNNER_ASSERT_MSG(ret == CKM_API_SUCCESS, ""); } RUNNER_TEST(T4032_CLOSE_CKM_DB) @@ -218,16 +218,16 @@ RUNNER_TEST(T4032_CLOSE_CKM_DB) auto ctl = CKM::Control::create(); int ret = ctl->lockUserKey(USER_APP); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); usleep(PASSWORD_RETRY_TIMEOUT_US); // login with current password to get rid of invalid "NULL" DKEK ret = security_server_chk_pwd(PASSWORD1, &attempt, &max, &expire); - RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "Error=" << ret); + RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "Error=" << ret); ret = ctl->lockUserKey(USER_APP); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); } RUNNER_CHILD_TEST(T4033_GET_DATA_NEGATIVE) @@ -238,7 +238,7 @@ RUNNER_CHILD_TEST(T4033_GET_DATA_NEGATIVE) CKM::RawBuffer buffer; int ret = mgr->getData(CKM_ALIAS1, CKM::Password(), buffer); - RUNNER_ASSERT_MSG_BT(CKM_API_ERROR_DB_LOCKED == ret, "Error=" << CKM::ErrorToString(ret)); + RUNNER_ASSERT_MSG(CKM_API_ERROR_DB_LOCKED == ret, "Error=" << CKM::ErrorToString(ret)); } RUNNER_TEST(T4034_UNLOCK_DATABASE_WITH_SECURITY_SERVER) @@ -246,7 +246,7 @@ RUNNER_TEST(T4034_UNLOCK_DATABASE_WITH_SECURITY_SERVER) usleep(PASSWORD_RETRY_TIMEOUT_US); int ret = security_server_set_pwd(PASSWORD1, PASSWORD2, 10, 10); - RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "Error=" << ret); + RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "Error=" << ret); } RUNNER_CHILD_TEST(T4035_GET_DATA) @@ -257,9 +257,9 @@ RUNNER_CHILD_TEST(T4035_GET_DATA) CKM::RawBuffer buffer; int ret = mgr->getData(CKM_ALIAS1, CKM::Password(), buffer); - RUNNER_ASSERT_MSG_BT(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); + RUNNER_ASSERT_MSG(CKM_API_SUCCESS == ret, "Error=" << CKM::ErrorToString(ret)); - RUNNER_ASSERT_MSG_BT(buffer == BIN_DATA1, "Data mismatch"); + RUNNER_ASSERT_MSG(buffer == BIN_DATA1, "Data mismatch"); } -- 2.7.4