CKM:Add compilation flag for MDPP
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 27 Jan 2015 09:45:28 +0000 (10:45 +0100)
committerMaciej J. Karpiuk <m.karpiuk2@samsung.com>
Wed, 18 Feb 2015 09:46:20 +0000 (10:46 +0100)
[Issue#] N/A
[Feature/Bug] N/A
[Problem] Failing CC mode tests
[Cause] Compilation flag that disables MDPP logic has been introduced in
key-manager
[Solution] The same flag added to tests. When MDPP is disabled we expect
reading private keys to succeed.

[Verification] Compile and install key-manager and tests. Run:
ckm-tests --group=CKM_CC_MODE

Change-Id: I497c703108b6e2ee21599311beaa0d153c147d13

packaging/security-tests.spec
tests/ckm/CMakeLists.txt
tests/ckm/cc-mode.cpp

index 0978f8d..00f4cc6 100644 (file)
@@ -45,6 +45,9 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
         -DDPL_LOG="ON"                    \
         -DVERSION=%{version}              \
         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}%{!?build_type:DEBUG} \
+%if "%{sec_product_feature_security_mdfpp_enable}" == "1"
+        -DSECURITY_MDFPP_STATE_ENABLE=1 \
+%endif
         -DCMAKE_VERBOSE_MAKEFILE=ON       \
         -DCYNARA_DB_DIR=%{_localstatedir}/cynara/db \
         -DAPP_USER=security-tests-app
index 66e51d8..d4c0c9f 100644 (file)
 
 INCLUDE(FindPkgConfig)
 
+# mdpp flag
+IF (DEFINED SECURITY_MDFPP_STATE_ENABLED)
+    MESSAGE("SECURITY_MDFPP_STATE_ENABLE ENABLED !")
+    ADD_DEFINITIONS("-DSECURITY_MDFPP_STATE_ENABLE")
+ELSE (DEFINED SECURITY_MDFPP_STATE_ENABLE)
+    MESSAGE("SECURITY_MDFPP_STATE_ENABLE DISABLED !")
+ENDIF (DEFINED SECURITY_MDFPP_STATE_ENABLE)
+
 # Dependencies
 PKG_CHECK_MODULES(CKM_DEP
     libsmack
index dd79f1d..d740e75 100644 (file)
@@ -145,6 +145,10 @@ void read_key(ManagerShPtr& manager, const Alias& alias, int expected) {
 
 void read_keys(int expected)
 {
+// if mdpp is disabled at compilation time we expect that read_key always succeeds
+#ifndef DSECURITY_MDFPP_STATE_ENABLE
+    expected = CKM_API_SUCCESS;
+#endif
     auto manager = Manager::create();
 
     read_key(manager, rsa_pri_alias, expected);