From: Krzysztof Dynowski Date: Thu, 15 Feb 2018 12:13:27 +0000 (+0100) Subject: Downloadable TA support X-Git-Tag: submit/tizen/20180412.092951~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2fe168c38a00a38c7339b8824b97880ce979b76c;p=platform%2Fcore%2Fsecurity%2Ftef-simulator.git Downloadable TA support Change-Id: Ic80740993dd815b6acffd42241046f934249ae03 --- diff --git a/include/include/config.h b/include/include/config.h index e10eb5c..32c8bf3 100644 --- a/include/include/config.h +++ b/include/include/config.h @@ -34,6 +34,7 @@ #endif #define TEE_EMBEDDED_TASTORE_ROOT "/usr/apps/tee/" +#define TEE_DOWNLOADED_TA_SUFFIX "res/tee/" #ifndef TEE_EXTRACT_ROOT #define TEE_EXTRACT_ROOT "/opt/usr/apps/ta_sdk/extract/" diff --git a/simulatordaemon/inc/SecurityContext.h b/simulatordaemon/inc/SecurityContext.h index 645a110..8f1f8c7 100644 --- a/simulatordaemon/inc/SecurityContext.h +++ b/simulatordaemon/inc/SecurityContext.h @@ -29,8 +29,6 @@ #include #include -#define TA_LOCAL_PATH "/res/tee" - class SecurityContext { private: int m_connFd; diff --git a/simulatordaemon/src/SecurityContext.cpp b/simulatordaemon/src/SecurityContext.cpp index 70b867f..66d6759 100644 --- a/simulatordaemon/src/SecurityContext.cpp +++ b/simulatordaemon/src/SecurityContext.cpp @@ -95,7 +95,6 @@ bool SecurityContext::clientHasCynaraPermission(const std::string &privelege) { RETURN_UNLOCK(true, cynara_mutex); } - cynara* SecurityContext::initCynara() { int ret = -1; cynara_configuration *p_conf = nullptr; diff --git a/simulatordaemon/src/TABinaryManager/TABinaryManager.cpp b/simulatordaemon/src/TABinaryManager/TABinaryManager.cpp index 1a37cfb..7fbcb80 100644 --- a/simulatordaemon/src/TABinaryManager/TABinaryManager.cpp +++ b/simulatordaemon/src/TABinaryManager/TABinaryManager.cpp @@ -164,15 +164,18 @@ TABinaryManager* TABinaryManager::getInstance() { bool TABinaryManager::initTA(const string &uuid) { LOGD(SIM_DAEMON, "Entry"); - string tapath; - const char * paths[] = { TEE_TASTORE_ROOT, TEE_EMBEDDED_TASTORE_ROOT, NULL }; + std::vector paths; + paths.push_back(TEE_TASTORE_ROOT); + paths.push_back(TEE_EMBEDDED_TASTORE_ROOT); + paths.push_back(TEE_TASTORE_ROOT TEE_DOWNLOADED_TA_SUFFIX); - for (int i = 0; paths[i] != NULL; ++i) { - if (*paths[i] == '\0') continue; // ignore empty paths - string path_to_file = paths[i] + uuid; + string tapath; + for(auto const& p: paths) { + if (p.empty()) continue; // ignore empty paths + string path_to_file = p + uuid; boost::system::error_code ec; if (fs::exists(path_to_file, ec)) { - tapath = paths[i]; + tapath = p; break; } } @@ -269,7 +272,7 @@ bool TABinaryManager::unpackBinary(const string &uuid, const string& tapath, Str TAUnpack* unpacker = TAUnpack::getInstance(); bool ret = false; if (0 == unpacker->unpackTA(tapath, uuid)) { - LOGD(SIM_DAEMON, "Unpacked, filling info"); + LOGD(SIM_DAEMON, "Unpacked TA %s from %s", uuid.c_str(), tapath.c_str()); // 1. Set binary info info.path = tapath + uuid; info.extractpath = string(TEE_EXTRACT_ROOT) + uuid + "-ext/";