summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongsun Lee <ds73.lee@samsung.com>2016-06-21 04:04:32 (GMT)
committerDongsun Lee <ds73.lee@samsung.com>2016-06-21 04:04:32 (GMT)
commitd1da2aa31e64a93d1e1f5b3c7586c6a4186df4f3 (patch)
treeeadb6a840a65a49cd766e33182486735a623e0ee
parentdaa79b8ea309dbf39dcd47cce82cee0e3ba1e4c9 (diff)
downloadlibwebappenc-accepted/tizen/common/20160621.184344.zip
libwebappenc-accepted/tizen/common/20160621.184344.tar.gz
libwebappenc-accepted/tizen/common/20160621.184344.tar.bz2
Change-Id: I1522806cb2b7511455821134f8ae42a53a575e6e Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
-rw-r--r--srcs/key_handler.c23
-rw-r--r--srcs/key_handler.h2
-rw-r--r--tests/wae_tests.c8
3 files changed, 13 insertions, 20 deletions
diff --git a/srcs/key_handler.c b/srcs/key_handler.c
index 714be0f..4a8ee53 100644
--- a/srcs/key_handler.c
+++ b/srcs/key_handler.c
@@ -35,7 +35,7 @@
#define APP_DEK_KEK_PRIKEY_PASSWORD "wae_appdek_kek_1q2w3e4r"
-#define WRT_INSTALLER_LABEL "/User"
+#define WRT_INSTALLER_LABEL "/System"
typedef struct _dek_cache_element{
char pkgId[MAX_PKGID_LEN];
@@ -139,22 +139,15 @@ int _get_random(size_t length, unsigned char* random)
return WAE_ERROR_NONE;
}
-void _get_alias(const char* pPkgId, wae_app_type_e appType, int forSave, char* alias, size_t buff_len)
+void _get_alias(const char* pPkgId, wae_app_type_e appType, char* alias, size_t buff_len)
{
if(appType == WAE_DOWNLOADED_NORMAL_APP) {
- if(forSave == WAE_TRUE) {
- snprintf(alias, buff_len, "%s%s",
- APP_DEK_ALIAS_PFX,
- pPkgId);
- }else{
- snprintf(alias, buff_len, "%s%s%s%s",
+ snprintf(alias, buff_len, "%s%s%s%s",
WRT_INSTALLER_LABEL,
ckmc_owner_id_separator,
APP_DEK_ALIAS_PFX,
pPkgId);
- }
}else { // system alias
- (void) appType;
snprintf(alias, buff_len, "%s%s%s%s",
ckmc_owner_id_system,
ckmc_owner_id_separator,
@@ -208,7 +201,7 @@ int _add_dek_to_key_manager(const char* pPkgId, wae_app_type_e appType, const un
policy.extractable = true;
// save app_dek in key_manager
- _get_alias(pPkgId, appType, WAE_TRUE, alias, sizeof(alias));
+ _get_alias(pPkgId, appType, alias, sizeof(alias));
// even if it fails to remove, ignore it.
ret = _to_wae_error( ckmc_remove_alias(alias));
@@ -367,12 +360,12 @@ int get_app_dek(const char* pPkgId, wae_app_type_e appType, unsigned char** ppDe
cached_dek = _get_app_dek_from_cache(pPkgId);
if(cached_dek == NULL) {
// get APP_DEK from system database
- _get_alias(pPkgId, appType, WAE_FALSE, alias, sizeof(alias));
+ _get_alias(pPkgId, appType, alias, sizeof(alias));
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",
- pPkgId, alias, ret);
+ WAE_SLOGI("WAE: Fail to get APP_DEK from key-manager. pkgId=%s, alias=%s, appType=%d, ret=%d",
+ pPkgId, alias, appType, ret);
goto error;
}
}
@@ -765,7 +758,7 @@ int remove_app_dek(const char* pPkgId, wae_app_type_e appType)
int ret = CKMC_ERROR_NONE;
char alias[MAX_ALIAS_LEN] = {0,};
- _get_alias(pPkgId, appType, WAE_TRUE, alias,sizeof(alias));
+ _get_alias(pPkgId, appType, alias,sizeof(alias));
ret = _to_wae_error(ckmc_remove_alias(alias));
if(ret != WAE_ERROR_NONE) {
diff --git a/srcs/key_handler.h b/srcs/key_handler.h
index a417fdd..a8e4012 100644
--- a/srcs/key_handler.h
+++ b/srcs/key_handler.h
@@ -54,7 +54,7 @@ unsigned char* _get_app_dek_from_cache(const char* pkgId);
void _add_app_dek_to_cache(const char* pkgId, unsigned char* dek);
void _remove_app_dek_from_cache(const char* pkgId);
int _get_random(size_t length, unsigned char* random);
-void _get_alias(const char* pPkgId, wae_app_type_e appType, int forSave, char* alias, size_t buff_len);
+void _get_alias(const char* pPkgId, wae_app_type_e appType, char* alias, size_t buff_len);
void _get_dek_kek_alias(char* alias, size_t buff_len);
void _get_dek_loading_done_alias(char* alias, size_t buff_len);
const char* _get_dek_kek_pub_key_path();
diff --git a/tests/wae_tests.c b/tests/wae_tests.c
index a40b301..eb90bdf 100644
--- a/tests/wae_tests.c
+++ b/tests/wae_tests.c
@@ -336,16 +336,16 @@ int wae_tc_get_alias()
const char* pkgId = "TEST_PKG_ID";
char alias[256] = {0, };
- _get_alias(pkgId, WAE_DOWNLOADED_NORMAL_APP, WAE_TRUE, alias, sizeof(alias));
+ _get_alias(pkgId, WAE_DOWNLOADED_NORMAL_APP, alias, sizeof(alias));
FPRINTF("...pkgid=%s, alias for normal for save. app=%s\n", pkgId, alias);
- _get_alias(pkgId, WAE_DOWNLOADED_NORMAL_APP, WAE_FALSE, alias, sizeof(alias));
+ _get_alias(pkgId, WAE_DOWNLOADED_NORMAL_APP, alias, sizeof(alias));
FPRINTF("...pkgid=%s, alias for normal for get. app=%s\n", pkgId, alias);
- _get_alias(pkgId, WAE_DOWNLOADED_GLOBAL_APP, WAE_TRUE, alias, sizeof(alias));
+ _get_alias(pkgId, WAE_DOWNLOADED_GLOBAL_APP, alias, sizeof(alias));
FPRINTF("...pkgid=%s, alias for global app=%s\n", pkgId, alias);
- _get_alias(pkgId, WAE_PRELOADED_APP, WAE_TRUE, alias, sizeof(alias));
+ _get_alias(pkgId, WAE_PRELOADED_APP, alias, sizeof(alias));
FPRINTF("...pkgid=%s, alias for preloaded app=%s\n", pkgId, alias);
return ret;