Downloadable TA support 53/170253/7
authorKrzysztof Dynowski <k.dynowski@samsung.com>
Thu, 15 Feb 2018 12:13:27 +0000 (13:13 +0100)
committerKrzysztof Dynowski <k.dynowski@samsung.com>
Tue, 27 Feb 2018 13:29:23 +0000 (14:29 +0100)
Change-Id: Ic80740993dd815b6acffd42241046f934249ae03

include/include/config.h
simulatordaemon/inc/SecurityContext.h
simulatordaemon/src/SecurityContext.cpp
simulatordaemon/src/TABinaryManager/TABinaryManager.cpp

index e10eb5c..32c8bf3 100644 (file)
@@ -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/"
index 645a110..8f1f8c7 100644 (file)
@@ -29,8 +29,6 @@
 #include <config.h>
 #include <cynara/cynara-client.h>
 
-#define TA_LOCAL_PATH "/res/tee"
-
 class SecurityContext {
 private:
        int m_connFd;
index 70b867f..66d6759 100644 (file)
@@ -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;
index 1a37cfb..7fbcb80 100644 (file)
@@ -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<string> 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/";