%global watchdog_timeout_sec 60
%global watchdog_notify_sec 20
%global tz_backend_enabled %{?tz_backend:%tz_backend}%{!?tz_backend:OFF}
+%global se_backend_enabled %{?se_backend:%se_backend}%{!?se_backend:OFF}
+%{!?build_type:%global build_type RELEASE}
+%global coverage_only 0
+%if %{build_type} == COVERAGE_ONLY
+ %global build_type COVERAGE
+ %global coverage_only 1
+%endif
Name: key-manager
Summary: Central Key Manager and utilities
-Version: 0.1.26
+Version: 0.1.63
Release: 1
Group: Security/Secure Storage
License: Apache-2.0 and BSD-3-Clause
BuildRequires: cmake
BuildRequires: zip
BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(openssl)
+BuildRequires: pkgconfig(openssl3)
BuildRequires: libattr-devel
BuildRequires: pkgconfig(libsmack)
-BuildRequires: pkgconfig(libsystemd-daemon)
-BuildRequires: pkgconfig(libsystemd-journal)
+BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(security-manager)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(pkgmgr)
BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(sqlcipher)
%if 0%{?watchdog_enabled}
BuildRequires: pkgconfig(argos_watchdog)
%endif
BuildRequires: key-manager-ta-serialization-devel
BuildRequires: pkgconfig(tef-libteec)
%endif
+%if %{se_backend_enabled} == ON
+BuildRequires: pkgconfig(key-manager-se-backend)
+%endif
Requires: libkey-manager-common = %{version}-%{release}
+%if "%{build_type}" == "COVERAGE"
+BuildRequires: lcov
+%endif
+BuildRequires: pkgconfig(capi-system-resource)
%{?systemd_requires}
%global old_rw_data_dir /opt/data/ckm
%global rw_data_dir %{?TZ_SYS_DATA:%TZ_SYS_DATA/ckm}%{!?TZ_SYS_DATA:%old_rw_data_dir}
%global ro_data_dir %{?TZ_SYS_RO_SHARE:%TZ_SYS_RO_SHARE/ckm}%{!?TZ_SYS_RO_SHARE:%_datadir/ckm}
-%global test_dir %{?TZ_SYS_DATA:%TZ_SYS_DATA/ckm-tests-internal}%{!?TZ_SYS_DATA:%/opt/data/ckm-tests-internal}
+%global unit_tests_dir %{?TZ_SYS_DATA:%TZ_SYS_DATA/ckm-unit-tests}%{!?TZ_SYS_DATA:%/opt/data/ckm-unit-tests}
+%global misc_dir %{?TZ_SYS_DATA:%TZ_SYS_DATA/ckm-misc}%{!?TZ_SYS_DATA:%/opt/data/ckm-misc}
+%global coverage_dir %{?TZ_SYS_DATA:%TZ_SYS_DATA/ckm-coverage}%{!?TZ_SYS_DATA:%/opt/data/ckm-coverage}
%global bin_dir %{?TZ_SYS_BIN:%TZ_SYS_BIN}%{!?TZ_SYS_BIN:%_bindir}
-# image creation error occured if /usr/sbin used for ldconfig
-#%global sbin_dir %{?TZ_SYS_SBIN:%TZ_SYS_SBIN}%{!?TZ_SYS_SBIN:%_sbindir}
-%global sbin_dir /sbin
%global ro_etc_dir %{?TZ_SYS_RO_ETC:%TZ_SYS_RO_ETC}%{!?TZ_SYS_RO_ETC:/etc}
%global run_dir %{?TZ_SYS_RUN:%TZ_SYS_RUN}%{!?TZ_SYS_RUN:/var/run}
%global initial_values_dir_ro %{ro_data_dir}/initial_values
%global initial_values_dir_rw %{rw_data_dir}/initial_values
%global ca_certs_dir %{?TZ_SYS_CA_CERTS:%TZ_SYS_CA_CERTS}%{!?TZ_SYS_CA_CERTS:%ro_etc_dir/ssl/certs}
+%global dump_legacy_db_libname key-manager-dump-legacy-database
%description
Central Key Manager daemon could be used as secure storage
Summary: Central Key Manager (common libraries)
Group: Security/Libraries
License: Apache-2.0
-Requires(post): %{sbin_dir}/ldconfig
-Requires(postun): %{sbin_dir}/ldconfig
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
%description -n libkey-manager-common
Central Key Manager package (common library)
License: Apache-2.0
Requires: key-manager = %{version}-%{release}
Requires: libkey-manager-common = %{version}-%{release}
-Requires(post): %{sbin_dir}/ldconfig
-Requires(postun): %{sbin_dir}/ldconfig
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
%description -n libkey-manager-client
Central Key Manager package (client)
%description -n libkey-manager-client-devel
Central Key Manager package (client-devel)
-%package -n key-manager-tests
-Summary: Internal test for key-manager
+%package -n key-manager-unit-tests
+Summary: Unit tests for key-manager
Group: Security/Testing
License: Apache-2.0 and BSL-1.0
BuildRequires: pkgconfig(libxml-2.0)
Requires: boost-test
+
+%description -n key-manager-unit-tests
+Unit tests for key-manager.
+
+%package -n key-manager-misc
+Summary: Miscellaneous tools and tests for key-manager
+Group: Security/Testing
+License: Apache-2.0 and BSL-1.0
+Requires: boost-test
Requires: key-manager = %{version}-%{release}
-%description -n key-manager-tests
-Internal test for key-manager implementation.
+%description -n key-manager-misc
+Miscellaneous tools and tests for key-manager.
%package -n key-manager-pam-plugin
Summary: CKM login/password module to PAM
License: Apache-2.0
BuildRequires: pam-devel
Requires: key-manager = %{version}-%{release}
-Requires(post): %{sbin_dir}/ldconfig
-Requires(postun): %{sbin_dir}/ldconfig
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
%description -n key-manager-pam-plugin
CKM login/password module to PAM. Used to monitor user login/logout
Group: Security/Libraries
License: Apache-2.0
BuildRequires: cmake
-BuildRequires: pkgconfig(openssl)
+BuildRequires: pkgconfig(openssl3)
BuildRequires: pkgconfig(libxml-2.0)
-Requires(post): %{sbin_dir}/ldconfig
-Requires(postun): %{sbin_dir}/ldconfig
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
%description -n key-manager-initial-values
Includes ckm_initial_values tool for initial values XML generation
+%if "%{build_type}" == "COVERAGE"
+
+%package -n key-manager-coverage
+Summary: Central Key Manager code coverage data
+Group: Security/Testing
+License: Apache-2.0
+Requires: key-manager-unit-tests = %{version}-%{release}
+Requires: key-manager-debugsource = %{version}-%{release}
+Requires: lcov
+Requires: gcc
+
+%description -n key-manager-coverage
+Central Key Manager code coverage data
+
+%endif
+
%prep
%setup -q
%build
-%if 0%{?sec_build_binary_debug_enable}
- export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
- export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
- export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
-%endif
-
-export LDFLAGS+="-Wl,--rpath=%{_libdir},-Bsymbolic-functions "
+export LDFLAGS+="-Wl,--rpath=%{_libdir},-Bsymbolic-functions"
%cmake . -DVERSION=%{version} \
- -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}%{!?build_type:RELEASE} \
+ -DCMAKE_BUILD_TYPE=%{build_type} \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DSYSTEMD_UNIT_DIR=%{_unitdir} \
-DSYSTEMD_ENV_FILE=%{ro_etc_dir}"/sysconfig/central-key-manager" \
%else
-DTZ_BACKEND_ENABLED=OFF \
%endif
- -DTEST_DIR=%{test_dir}
+%if %{se_backend_enabled} == ON
+ -DSE_BACKEND_ENABLED=ON \
+%else
+ -DSE_BACKEND_ENABLED=OFF \
+%endif
+ -DUNIT_TESTS_DIR=%{unit_tests_dir} \
+ -DMISC_DIR=%{misc_dir} \
+ -DCOVERAGE_DIR=%{coverage_dir} \
+%if %{coverage_only}
+ -DCOVERAGE_ONLY=ON \
+%endif
+ -DDUMP_LEGACY_DB_LIBNAME=%{dump_legacy_db_libname}
make %{?jobs:-j%jobs}
%install
%make_install
+
+%if ! %{coverage_only}
+
%install_service multi-user.target.wants central-key-manager.service
%install_service sockets.target.wants central-key-manager-api-control.socket
%install_service sockets.target.wants central-key-manager-api-storage.socket
%install_service sockets.target.wants central-key-manager-api-encryption.socket
cp -a %{SOURCE1001} %{SOURCE1002} %{SOURCE1003} %{SOURCE1004} %{buildroot}%{_datadir}/
+%endif
+
%pre
# tzplatform-get sync breaked because of on-development situation. comment out just for temporary
# fail if runtime dir variable is different than compilation time variable
#
#id -u %{user_name} > /dev/null 2>&1
#if [ $? -eq 1 ]; then
-# useradd -d /var/lib/empty -s %{sbin_dir}/nologin -r -g %{group_name} %{user_name} > /dev/null 2>&1
+# useradd -d /var/lib/empty -s /sbin/nologin -r -g %{group_name} %{user_name} > /dev/null 2>&1
#fi
%post
systemctl daemon-reload
fi
-%post -n libkey-manager-common -p %{sbin_dir}/ldconfig
-%post -n libkey-manager-client -p %{sbin_dir}/ldconfig
-%postun -n libkey-manager-common -p %{sbin_dir}/ldconfig
-%postun -n libkey-manager-client -p %{sbin_dir}/ldconfig
+%post -n libkey-manager-common -p /sbin/ldconfig
+%post -n libkey-manager-client -p /sbin/ldconfig
+%postun -n libkey-manager-common -p /sbin/ldconfig
+%postun -n libkey-manager-client -p /sbin/ldconfig
+
+%if ! %{coverage_only}
%files -n key-manager
%manifest key-manager.manifest
%license LICENSE
%license LICENSE.BSD-3-Clause
%{bin_dir}/key-manager
+%{_libdir}/lib%{dump_legacy_db_libname}.so
%{_unitdir}/multi-user.target.wants/central-key-manager.service
%{_unitdir}/central-key-manager.service
-%{_unitdir}/central-key-manager.target
%{_unitdir}/sockets.target.wants/central-key-manager-api-control.socket
%{_unitdir}/central-key-manager-api-control.socket
%{_unitdir}/sockets.target.wants/central-key-manager-api-storage.socket
%dir %attr(770, %{user_name}, %{group_name}) %{rw_data_dir}
%dir %attr(550, %{user_name}, %{group_name}) %{initial_values_dir_ro}
%dir %attr(770, %{user_name}, %{group_name}) %{initial_values_dir_rw}
+%attr(755,root,root) /usr/share/upgrade/scripts/295.key-manager_upgrade.sh
%{ro_etc_dir}/gumd/userdel.d/10_key-manager.post
%{bin_dir}/ckm_tool
%{_includedir}/ckm/ckmc/ckmc-type.h
%{_libdir}/pkgconfig/*.pc
-%files -n key-manager-tests
-%manifest key-manager-tests.manifest
+%files -n key-manager-initial-values
+%license LICENSE
+%{bin_dir}/ckm_initial_values
+
+%files -n key-manager-misc
+%manifest key-manager-misc.manifest
%license LICENSE
%license LICENSE.BSL-1.0
-%{bin_dir}/ckm-tests-internal
+%{bin_dir}/ckm-scheme-test
%{bin_dir}/ckm_so_loader
%{bin_dir}/ckm_db_tool
%{bin_dir}/ckm_db_merge
%{bin_dir}/ckm_generate_db
-%test_dir
+%{bin_dir}/ckm_db_perf
+%{bin_dir}/ckm_enc_perf
+%misc_dir
-%files -n key-manager-initial-values
+%endif
+
+%files -n key-manager-unit-tests
+%manifest key-manager-unit-tests.manifest
%license LICENSE
-%{bin_dir}/ckm_initial_values
+%license LICENSE.BSL-1.0
+%{bin_dir}/ckm-unit-tests
+%unit_tests_dir
+
+%if "%{build_type}" == "COVERAGE"
+
+%files -n key-manager-coverage
+%license LICENSE
+%{bin_dir}/key-manager-coverage.sh
+%coverage_dir
+
+%endif