summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyungwook Tak <k.tak@samsung.com>2016-07-15 06:01:54 (GMT)
committerKyungwook Tak <k.tak@samsung.com>2016-07-15 06:01:54 (GMT)
commitf4b4d4ebf5a8d8c40e060238856a6560a2e20e1d (patch)
treecb814d6a191fecd56c5e0436bdec2ff504ce4614
parent99523c9b37751cc9188dacc2d24fd775da02e180 (diff)
downloadlibwebappenc-f4b4d4ebf5a8d8c40e060238856a6560a2e20e1d.zip
libwebappenc-f4b4d4ebf5a8d8c40e060238856a6560a2e20e1d.tar.gz
libwebappenc-f4b4d4ebf5a8d8c40e060238856a6560a2e20e1d.tar.bz2
Add test manifest for exec labelingrefs/changes/84/80184/1
Change-Id: Ib54e8558417b8f32782c7ada3d6bdda8999a5b0f Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
-rw-r--r--CMakeLists.txt8
-rw-r--r--packaging/libwebappenc-test.manifest.in (renamed from packaging/libwebappenc.manifest)2
-rw-r--r--packaging/libwebappenc.manifest.in5
-rw-r--r--packaging/libwebappenc.spec20
-rw-r--r--resources/CMakeLists.txt2
-rw-r--r--srcs/key_handler.c9
6 files changed, 29 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c5a1bb..8d396a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,12 +55,17 @@ STRING(REGEX MATCH "([^.]*)" API_VERSION "${VERSION}")
ADD_DEFINITIONS("-DAPI_VERSION=\"$(API_VERSION)\"")
ADD_DEFINITIONS("-DSMACK_ENABLED")
ADD_DEFINITIONS("-DSQLCIPHER_HAS_CODEC")
+ADD_DEFINITIONS("-DBINDIR=\"${BINDIR}\"")
+ADD_DEFINITIONS("-DINSTALLER_LABEL=\"${INSTALLER_LABEL}\"")
# IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
ADD_DEFINITIONS("-DTIZEN_DEBUG_ENABLE")
ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
# ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
+CONFIGURE_FILE(packaging/lib${PROJECT_NAME}.manifest.in lib${PROJECT_NAME}.manifest @ONLY)
+CONFIGURE_FILE(packaging/lib${PROJECT_NAME}-test.manifest.in lib${PROJECT_NAME}-test.manifest @ONLY)
+
################# common configurations for srcs and test ######################
SET(DEPENDENTS "openssl dlog key-manager libtzplatform-config")
PKG_CHECK_MODULES(WEB_APP_ENC_DEPS
@@ -70,12 +75,11 @@ PKG_CHECK_MODULES(WEB_APP_ENC_DEPS
############################ For PC file setting ################################
-SET(PC_NAME ${PROJECT_NAME})
+SET(PC_NAME lib${PROJECT_NAME})
SET(PC_REQUIRED ${DEPENDENTS})
SET(PC_LDFLAGS -l${PROJECT_NAME})
#SET(PC_CFLAGS -I\${includedir})
-
############################ Target Setting ################################
SET(TARGET_WEBAPPENC ${PROJECT_NAME})
SET(TARGET_WAE_INITIALIZER wae_initializer)
diff --git a/packaging/libwebappenc.manifest b/packaging/libwebappenc-test.manifest.in
index 226aaa0..13d4d92 100644
--- a/packaging/libwebappenc.manifest
+++ b/packaging/libwebappenc-test.manifest.in
@@ -3,6 +3,6 @@
<domain name="_" />
</request>
<assign>
- <filesystem path="/var/libwebappenc/" label="System" />
+ <filesystem path="@BINDIR@/wae_tests" label="_" exec_label="@INSTALLER_LABEL@" />
</assign>
</manifest>
diff --git a/packaging/libwebappenc.manifest.in b/packaging/libwebappenc.manifest.in
new file mode 100644
index 0000000..86dbb26
--- /dev/null
+++ b/packaging/libwebappenc.manifest.in
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
diff --git a/packaging/libwebappenc.spec b/packaging/libwebappenc.spec
index 342d1f3..a3e95b4 100644
--- a/packaging/libwebappenc.spec
+++ b/packaging/libwebappenc.spec
@@ -5,7 +5,6 @@ Release: 1
Group: Security/Libraries
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
-Source1001: %{name}.manifest
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
@@ -35,9 +34,12 @@ Requires: %{name} = %{version}-%{release}
%description test
Web application encryption and decryption service (test)
+%define installer_label "User"
+%define bin_dir %TZ_SYS_BIN
+%define rw_share_dir %TZ_SYS_SHARE
+
%prep
%setup -q
-cp %{SOURCE1001} .
%build
%{!?build_type:%define build_type "Release"}
@@ -45,10 +47,11 @@ cp %{SOURCE1001} .
-DEXEC_PREFIX=%{_exec_prefix} \
-DINCLUDEDIR=%{_includedir} \
-DLIBDIR=%{_libdir} \
- -DBINDIR=%TZ_SYS_BIN \
-DSYSTEMD_UNIT_DIR=%{_unitdir} \
-DCMAKE_BUILD_TYPE=%{build_type} \
- -DTZ_SYS_SHARE=%TZ_SYS_SHARE
+ -DRW_SHARE_DIR=%rw_share_dir \
+ -DBINDIR=%bin_dir \
+ -DINSTALLER_LABEL=%installer_label
make %{?jobs:-j%jobs}
@@ -82,9 +85,9 @@ fi
%{_libdir}/%{name}.so.*
%{_unitdir}/webappenc-initializer.service
%{_unitdir}/multi-user.target.wants/webappenc-initializer.service
-%{TZ_SYS_BIN}/wae_initializer
-%{TZ_SYS_SHARE}/wae/app_dek/WAE_APPDEK_KEK_PrivateKey.pem
-%{TZ_SYS_SHARE}/wae/app_dek/WAE_APPDEK_KEK_PublicKey.pem
+%{bin_dir}/wae_initializer
+%{rw_share_dir}/wae/app_dek/WAE_APPDEK_KEK_PrivateKey.pem
+%{rw_share_dir}/wae/app_dek/WAE_APPDEK_KEK_PublicKey.pem
%files devel
%{_includedir}/*
@@ -92,4 +95,5 @@ fi
%{_libdir}/%{name}.so
%files test
-%{TZ_SYS_BIN}/wae_tests
+%manifest %{name}-test.manifest
+%{bin_dir}/wae_tests
diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
index 4462cee..ae2bc8b 100644
--- a/resources/CMakeLists.txt
+++ b/resources/CMakeLists.txt
@@ -5,7 +5,7 @@
INSTALL(FILES
${PROJECT_SOURCE_DIR}/resources/WAE_APPDEK_KEK_PublicKey.pem
${PROJECT_SOURCE_DIR}/resources/WAE_APPDEK_KEK_PrivateKey.pem
- DESTINATION ${TZ_SYS_SHARE}/wae/app_dek/
+ DESTINATION ${RW_SHARE_DIR}/wae/app_dek/
PERMISSIONS OWNER_READ
OWNER_WRITE
)
diff --git a/srcs/key_handler.c b/srcs/key_handler.c
index 929d282..15dc96f 100644
--- a/srcs/key_handler.c
+++ b/srcs/key_handler.c
@@ -35,7 +35,6 @@
#include "crypto_service.h"
#define RANDOM_FILE "/dev/urandom"
-#define WRT_INSTALLER_LABEL "/User"
#define APP_DEK_KEK_PRIKEY_PASSWORD "wae_appdek_kek_1q2w3e4r"
#define APP_DEK_ALIAS_PFX "APP_DEK_"
#define APP_DEK_LOADING_DONE_ALIAS "APP_DEKS_LOADING_FINISHED"
@@ -168,8 +167,8 @@ void _get_alias(const char *pPkgId, wae_app_type_e appType, bool forSave, char *
APP_DEK_ALIAS_PFX,
pPkgId);
} else {
- snprintf(alias, buff_len, "%s%s%s%s",
- WRT_INSTALLER_LABEL,
+ snprintf(alias, buff_len, "%c%s%s%s%s",
+ '/', INSTALLER_LABEL,
ckmc_owner_id_separator,
APP_DEK_ALIAS_PFX,
pPkgId);
@@ -400,13 +399,13 @@ int get_app_dek(const char *pPkgId, wae_app_type_e appType, unsigned char **ppDe
ret = _to_wae_error(ckmc_get_data(alias, password, &pDekBuffer));
if (ret != WAE_ERROR_NONE) {
- WAE_SLOGI("WAE: Fail to get APP_DEK from key-manager. pkgId=%s, alias=%s, ret=%d",
+ WAE_SLOGE("WAE: Fail to get APP_DEK from key-manager. pkgId=%s, alias=%s, ret=%d",
pPkgId, alias, ret);
goto error;
}
}
- pDek = (unsigned char *) malloc(DEK_LEN);
+ pDek = (unsigned char *)malloc(DEK_LEN);
if (pDek == NULL) {
WAE_SLOGE("Fail to allocate a memory");