CKM: Split signture tests into two groups.
[platform/core/test/security-tests.git] / tests / ckm / main.cpp
index 45705f8..f723677 100644 (file)
@@ -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.");
 
@@ -2296,6 +2296,8 @@ RUNNER_TEST(T1420_deinit)
         "Error=" << CKM::ErrorToString(temp));
 }
 
+RUNNER_TEST_GROUP_INIT(T1418_signature_tests);
+
 RUNNER_TEST(T14180_init)
 {
     int temp;
@@ -3596,7 +3598,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 +3608,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 +3667,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 +3705,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));
 }