Remove "secret" key for software backend
[platform/core/security/key-manager.git] / src / CMakeLists.txt
1 IF (DEFINED WATCHDOG_ENABLED)
2 SET(EXTRA_KM_DEPS argos_watchdog)
3 ELSE (DEFINED WATCHDOG_ENABLED)
4 SET(EXTRA_KM_DEPS)
5 ENDIF (DEFINED WATCHDOG_ENABLED)
6
7 IF (TZ_BACKEND_ENABLED)
8 SET(EXTRA_KM_DEPS
9     ${EXTRA_KM_DEPS}
10     tef-libteec
11     )
12 ENDIF()
13
14 PKG_CHECK_MODULES(KEY_MANAGER_DEP
15     REQUIRED
16     dlog
17     glib-2.0
18     openssl
19     libsmack
20     libsystemd-daemon
21     capi-base-common
22     capi-system-info
23     libxml-2.0
24     security-manager
25     cynara-client-async
26     cynara-creds-socket
27     pkgmgr
28     vconf
29     ${EXTRA_KM_DEPS}
30     )
31 FIND_PACKAGE(Threads REQUIRED)
32
33 SET(KEY_MANAGER_SRC_PATH ${PROJECT_SOURCE_DIR}/src)
34 SET(KEY_MANAGER_PATH ${PROJECT_SOURCE_DIR}/src/manager)
35
36 SET(KEY_MANAGER_SOURCES
37     ${KEY_MANAGER_PATH}/main/cynara.cpp
38     ${KEY_MANAGER_PATH}/main/generic-socket-manager.cpp
39     ${KEY_MANAGER_PATH}/main/key-manager-main.cpp
40     ${KEY_MANAGER_PATH}/main/smack-check.cpp
41     ${KEY_MANAGER_PATH}/main/socket-2-id.cpp
42     ${KEY_MANAGER_PATH}/main/socket-manager.cpp
43     ${KEY_MANAGER_PATH}/main/thread-service.cpp
44     ${KEY_MANAGER_PATH}/service/access-control.cpp
45     ${KEY_MANAGER_PATH}/service/certificate-config.cpp
46     ${KEY_MANAGER_PATH}/service/certificate-store.cpp
47     ${KEY_MANAGER_PATH}/service/ckm-logic.cpp
48     ${KEY_MANAGER_PATH}/service/ckm-service.cpp
49     ${KEY_MANAGER_PATH}/service/crypto-logic.cpp
50     ${KEY_MANAGER_PATH}/service/db-crypto.cpp
51     ${KEY_MANAGER_PATH}/service/encryption-logic.cpp
52     ${KEY_MANAGER_PATH}/service/encryption-service.cpp
53     ${KEY_MANAGER_PATH}/service/file-lock.cpp
54     ${KEY_MANAGER_PATH}/service/file-system.cpp
55     ${KEY_MANAGER_PATH}/service/for-each-file.cpp
56     ${KEY_MANAGER_PATH}/service/glib-logic.cpp
57     ${KEY_MANAGER_PATH}/service/glib-service.cpp
58     ${KEY_MANAGER_PATH}/service/key-provider.cpp
59     ${KEY_MANAGER_PATH}/service/ocsp.cpp
60     ${KEY_MANAGER_PATH}/service/ocsp-logic.cpp
61     ${KEY_MANAGER_PATH}/service/ocsp-service.cpp
62     ${KEY_MANAGER_PATH}/service/ss-migrate.cpp
63     ${KEY_MANAGER_PATH}/service/ss-crypto.cpp
64     ${KEY_MANAGER_PATH}/service/permission.cpp
65     ${KEY_MANAGER_PATH}/initial-values/parser.cpp
66     ${KEY_MANAGER_PATH}/initial-values/BufferHandler.cpp
67     ${KEY_MANAGER_PATH}/initial-values/CertHandler.cpp
68     ${KEY_MANAGER_PATH}/initial-values/DataHandler.cpp
69     ${KEY_MANAGER_PATH}/initial-values/KeyHandler.cpp
70     ${KEY_MANAGER_PATH}/initial-values/PermissionHandler.cpp
71     ${KEY_MANAGER_PATH}/initial-values/InitialValueHandler.cpp
72     ${KEY_MANAGER_PATH}/initial-values/InitialValuesFile.cpp
73     ${KEY_MANAGER_PATH}/initial-values/NoCharactersHandler.cpp
74     ${KEY_MANAGER_PATH}/initial-values/xml-utils.cpp
75     ${KEY_MANAGER_PATH}/initial-values/initial-value-loader.cpp
76     ${KEY_MANAGER_PATH}/dpl/core/src/assert.cpp
77     ${KEY_MANAGER_PATH}/dpl/db/src/sql_connection.cpp
78     ${KEY_MANAGER_PATH}/dpl/db/src/naive_synchronization_object.cpp
79     ${KEY_MANAGER_PATH}/sqlcipher/sqlcipher.c
80     ${KEY_MANAGER_PATH}/crypto/sw-backend/obj.cpp
81     ${KEY_MANAGER_PATH}/crypto/sw-backend/internals.cpp
82     ${KEY_MANAGER_PATH}/crypto/sw-backend/store.cpp
83     ${KEY_MANAGER_PATH}/crypto/platform/decider.cpp
84     ${SECURITY_MANAGER_WRAPPER_PATH}
85     ${CYNARA_WRAPPER_PATH}
86     )
87
88 IF(TZ_BACKEND_ENABLED)
89 SET(KEY_MANAGER_SOURCES
90     ${KEY_MANAGER_SOURCES}
91     ${KEY_MANAGER_PATH}/crypto/tz-backend/obj.cpp
92     ${KEY_MANAGER_PATH}/crypto/tz-backend/store.cpp
93     ${KEY_MANAGER_PATH}/crypto/tz-backend/internals.cpp
94     ${KEY_MANAGER_PATH}/crypto/tz-backend/tz-context.cpp
95     ${KEY_MANAGER_PATH}/crypto/tz-backend/tz-memory.cpp
96     )
97 ENDIF()
98
99 SET_SOURCE_FILES_PROPERTIES(
100     ${KEY_MANAGER_SOURCES}
101     PROPERTIES
102         COMPILE_FLAGS "-D_GNU_SOURCE -fvisibility=hidden")
103
104 INCLUDE_DIRECTORIES(SYSTEM
105     ${KEY_MANAGER_DEP_INCLUDE_DIRS}
106     )
107
108 INCLUDE_DIRECTORIES(
109     ${KEY_MANAGER_SRC_PATH}/include
110     ${KEY_MANAGER_PATH}/main
111     ${KEY_MANAGER_PATH}/common
112     ${KEY_MANAGER_PATH}/service
113     ${KEY_MANAGER_PATH}/initial-values
114     ${KEY_MANAGER_PATH}/sqlcipher
115     ${KEY_MANAGER_PATH}/dpl/core/include
116     ${KEY_MANAGER_PATH}/dpl/log/include
117     ${KEY_MANAGER_PATH}/dpl/db/include
118     ${KEY_MANAGER_PATH}/crypto
119     )
120
121 LINK_DIRECTORIES(${KEY_MANAGER_DEP_LIBRARY_DIRS})
122
123 ADD_EXECUTABLE(${TARGET_KEY_MANAGER} ${KEY_MANAGER_SOURCES})
124
125 IF(TZ_BACKEND_ENABLED)
126 SET(KM_LINK_EXTRA_DEPS
127     ${KM_LINK_EXTRA_DEPS}
128     km_serialization
129     )
130 ENDIF()
131
132 TARGET_LINK_LIBRARIES(${TARGET_KEY_MANAGER}
133     ${CMAKE_THREAD_LIBS_INIT}
134     ${KEY_MANAGER_DEP_LIBRARIES}
135     ${TARGET_KEY_MANAGER_COMMON}
136     ${KM_LINK_EXTRA_DEPS}
137     -ldl
138     )
139 ################################################################################
140
141 SET(KEY_MANAGER_CLIENT_VERSION_MAJOR 1)
142 SET(KEY_MANAGER_CLIENT_VERSION ${KEY_MANAGER_CLIENT_VERSION_MAJOR}.0.1)
143
144 SET(KEY_MANAGER_CLIENT_SRC_PATH ${KEY_MANAGER_PATH}/client)
145 SET(KEY_MANAGER_CLIENT_ASYNC_SRC_PATH ${KEY_MANAGER_PATH}/client-async)
146 SET(KEY_MANAGER_CLIENT_CAPI_SRC_PATH ${KEY_MANAGER_PATH}/client-capi)
147
148 INCLUDE_DIRECTORIES(
149     ${KEY_MANAGER_PATH}/client
150     ${KEY_MANAGER_PATH}/client-async
151     ${KEY_MANAGER_PATH}/client-capi
152     ${KEY_MANAGER_PATH}/common
153     ${KEY_MANAGER_PATH}/dpl/core/include
154     ${KEY_MANAGER_PATH}/dpl/log/include
155     )
156
157 SET(KEY_MANAGER_CLIENT_SOURCES
158     ${KEY_MANAGER_CLIENT_SRC_PATH}/client-common.cpp
159     ${KEY_MANAGER_CLIENT_SRC_PATH}/client-manager.cpp
160     ${KEY_MANAGER_CLIENT_SRC_PATH}/client-manager-impl.cpp
161     ${KEY_MANAGER_CLIENT_ASYNC_SRC_PATH}/client-manager-async.cpp
162     ${KEY_MANAGER_CLIENT_ASYNC_SRC_PATH}/client-manager-async-impl.cpp
163     ${KEY_MANAGER_CLIENT_ASYNC_SRC_PATH}/connection-thread.cpp
164     ${KEY_MANAGER_CLIENT_ASYNC_SRC_PATH}/async-request.cpp
165     ${KEY_MANAGER_CLIENT_ASYNC_SRC_PATH}/service.cpp
166     ${KEY_MANAGER_CLIENT_ASYNC_SRC_PATH}/storage-receiver.cpp
167     ${KEY_MANAGER_CLIENT_ASYNC_SRC_PATH}/ocsp-receiver.cpp
168     ${KEY_MANAGER_CLIENT_ASYNC_SRC_PATH}/encryption-receiver.cpp
169     ${KEY_MANAGER_CLIENT_ASYNC_SRC_PATH}/descriptor-set.cpp
170     ${KEY_MANAGER_CLIENT_CAPI_SRC_PATH}/ckmc-type.cpp
171     ${KEY_MANAGER_CLIENT_CAPI_SRC_PATH}/ckmc-manager.cpp
172     ${KEY_MANAGER_CLIENT_CAPI_SRC_PATH}/ckmc-type-converter.cpp
173     )
174
175 ADD_LIBRARY(${TARGET_KEY_MANAGER_CLIENT} SHARED ${KEY_MANAGER_CLIENT_SOURCES})
176
177 SET_TARGET_PROPERTIES(
178     ${TARGET_KEY_MANAGER_CLIENT}
179     PROPERTIES
180         COMPILE_FLAGS "-D_GNU_SOURCE -fvisibility=hidden -Wno-deprecated-declarations"
181         SOVERSION ${KEY_MANAGER_CLIENT_VERSION_MAJOR}
182         VERSION ${KEY_MANAGER_CLIENT_VERSION}
183     )
184
185 TARGET_LINK_LIBRARIES(${TARGET_KEY_MANAGER_CLIENT}
186     ${KEY_MANAGER_DEP_LIBRARIES}
187     ${TARGET_KEY_MANAGER_COMMON}
188     )
189
190 ################################################################################
191
192 SET(KEY_MANAGER_CONTROL_CLIENT_VERSION_MAJOR 1)
193 SET(KEY_MANAGER_CONTROL_CLIENT_VERSION ${KEY_MANAGER_CONTROL_CLIENT_VERSION_MAJOR}.0.1)
194
195 SET(KEY_MANAGER_CONTROL_CLIENT_SRC_PATH ${KEY_MANAGER_PATH}/client)
196 SET(KEY_MANAGER_CONTROL_CLIENT_CAPI_SRC_PATH ${KEY_MANAGER_PATH}/client-capi)
197
198 INCLUDE_DIRECTORIES(
199     ${KEY_MANAGER_PATH}/client
200     ${KEY_MANAGER_PATH}/client-capi
201     ${KEY_MANAGER_PATH}/common
202     ${KEY_MANAGER_PATH}/dpl/core/include
203     ${KEY_MANAGER_PATH}/dpl/log/include
204     )
205
206 SET(KEY_MANAGER_CONTROL_CLIENT_SOURCES
207     ${KEY_MANAGER_CONTROL_CLIENT_SRC_PATH}/client-control.cpp
208     ${KEY_MANAGER_CONTROL_CLIENT_SRC_PATH}/client-common.cpp
209     ${KEY_MANAGER_CONTROL_CLIENT_CAPI_SRC_PATH}/ckmc-control.cpp
210     ${KEY_MANAGER_CONTROL_CLIENT_CAPI_SRC_PATH}/ckmc-type-converter.cpp
211     )
212
213 ADD_LIBRARY(${TARGET_KEY_MANAGER_CONTROL_CLIENT} SHARED ${KEY_MANAGER_CONTROL_CLIENT_SOURCES})
214
215 SET_TARGET_PROPERTIES(
216     ${TARGET_KEY_MANAGER_CONTROL_CLIENT}
217     PROPERTIES
218         COMPILE_FLAGS "-D_GNU_SOURCE -fvisibility=hidden  -Wno-deprecated-declarations"
219         SOVERSION ${KEY_MANAGER_CONTROL_CLIENT_VERSION_MAJOR}
220         VERSION ${KEY_MANAGER_CONTROL_CLIENT_VERSION}
221     )
222
223 TARGET_LINK_LIBRARIES(${TARGET_KEY_MANAGER_CONTROL_CLIENT}
224     ${KEY_MANAGER_DEP_LIBRARIES}
225     ${TARGET_KEY_MANAGER_COMMON}
226     )
227
228 ################################################################################
229 INSTALL(TARGETS ${TARGET_KEY_MANAGER_CLIENT} DESTINATION ${LIB_INSTALL_DIR})
230 INSTALL(TARGETS ${TARGET_KEY_MANAGER_CONTROL_CLIENT} DESTINATION ${LIB_INSTALL_DIR})
231
232 INSTALL(TARGETS ${TARGET_KEY_MANAGER} DESTINATION ${BIN_DIR})
233
234
235 INSTALL(FILES
236     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-manager.h
237     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-manager-async.h
238     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-certificate.h
239     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-control.h
240     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-error.h
241     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-key.h
242     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-password.h
243     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-pkcs12.h
244     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-raw-buffer.h
245     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-type.h
246     DESTINATION /usr/include/ckm/ckm
247     )
248 INSTALL(FILES
249     ${KEY_MANAGER_SRC_PATH}/include/ckmc/ckmc-manager.h
250     ${KEY_MANAGER_SRC_PATH}/include/ckmc/ckmc-control.h
251     ${KEY_MANAGER_SRC_PATH}/include/ckmc/ckmc-error.h
252     ${KEY_MANAGER_SRC_PATH}/include/ckmc/ckmc-type.h
253     DESTINATION /usr/include/ckm/ckmc
254     )
255 ################################################################################
256
257 ADD_SUBDIRECTORY(manager)
258 ADD_SUBDIRECTORY(pam_plugin)