%build
export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib"
+# password protection enabled
+%define ckm_password_protection_disable 1
+
cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DDPL_LOG="ON" \
-DVERSION=%{version} \
%if "%{sec_product_feature_security_mdfpp_enable}" == "1"
-DSECURITY_MDFPP_STATE_ENABLE=1 \
%endif
+%if 0%{?ckm_password_protection_disable}
+ -DPASSWORD_PROTECTION_DISABLE=1 \
+%endif
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCYNARA_DB_DIR=%{_localstatedir}/cynara/db \
-DAPP_USER="security_test_user"
MESSAGE("SECURITY_MDFPP_STATE_ENABLE DISABLED !")
ENDIF (DEFINED SECURITY_MDFPP_STATE_ENABLED)
+# password protection flag
+IF (DEFINED PASSWORD_PROTECTION_DISABLE)
+ MESSAGE("PASSWORD_PROTECTION_DISABLE ENABLED !")
+ ADD_DEFINITIONS("-DPASSWORD_PROTECTION_DISABLE")
+ENDIF (DEFINED PASSWORD_PROTECTION_DISABLE)
+
# Dependencies
PKG_CHECK_MODULES(CKM_DEP
libsmack
char *password = NULL;
ckmc_key_s *test_key = NULL;
+#ifndef PASSWORD_PROTECTION_DISABLE
RUNNER_ASSERT_MSG(
CKMC_ERROR_DB_LOCKED == (temp = ckmc_get_key(alias.c_str(), password, &test_key)),
CKMCReadableError(temp));
RUNNER_ASSERT_MSG(NULL == test_key, "Key value should not be changed");
+#else
+ RUNNER_ASSERT_MSG(
+ CKMC_ERROR_DB_ALIAS_UNKNOWN == (temp = ckmc_get_key(alias.c_str(), password, &test_key)),
+ CKMCReadableError(temp));
+#endif
}
RUNNER_TEST(T3204_deinit)
RUNNER_ASSERT_MSG(
CKM_API_SUCCESS == (temp = control->lockUserKey(USER_APP_2)),
"Error=" << CKM::ErrorToString(temp));
+#ifndef PASSWORD_PROTECTION_DISABLE
RUNNER_ASSERT_MSG(
CKM_API_ERROR_AUTHENTICATION_FAILED == (temp = control->unlockUserKey(USER_APP_2, "incorrect-password")),
"Error=" << CKM::ErrorToString(temp));
+#endif
RUNNER_ASSERT_MSG(
CKM_API_SUCCESS == (temp = control->removeUserData(USER_APP_2)),
"Error=" << CKM::ErrorToString(temp));
int status1 = manager->getKey(CKM::Alias("CertEEE"), CKM::Password(), ptr);
+#ifndef PASSWORD_PROTECTION_DISABLE
RUNNER_ASSERT_MSG(
CKM_API_ERROR_DB_LOCKED == status1,
"Could not get key from locked database. Error=" << CKM::ErrorToString(status1));
+#else
+ RUNNER_ASSERT_MSG(
+ CKM_API_ERROR_DB_ALIAS_UNKNOWN == status1,
+ "Could not get key with a wrong alias. Error=" << CKM::ErrorToString(status1));
+#endif
}
RUNNER_TEST(T1905_deinit)