path += "/" + std::string(pkgid) + TA_LOCAL_PATH;
LOGD(SIM_DAEMON, "Path: %s", path.c_str());
+ if (!fs::exists(path)) {
+ LOGE(SIM_DAEMON, "Path: %s not found", path.c_str());
+ return "";
+ }
return path;
}
return false;
}
-/* Now it searches client’s TA recursively in subdirectories of it. Maybe
- * in future we will know exact predefined subdirectories or even
- * map Client <-> allowed directories for it*/
- for(fs::recursive_directory_iterator end, dir(ca_pkg_path); dir != end; ++dir){
- std::string ta_full_path = dir->path().filename().string() + "/" + ta_name;
- if(fs::exists(ta_full_path)){
- allowed_path = dir->path().filename().string();
- return true;
- }
+ if (!fs::exists(ca_pkg_path + "/" + ta_name)) {
+ LOGE(SIM_DAEMON, "TA %s not found in res/tee/", ta_name.c_str());
+ return false;
}
- return false;
+ allowed_path = ca_pkg_path + "/";
+ return true;
}
* @return On successful completion of above operations returns true else false.
*/
bool TABinaryManager::initTAatPath(const string &path, const string &uuid) {
- LOGD(SIM_DAEMON, "");
+ LOGD(SIM_DAEMON, "Entry");
pthread_rwlock_wrlock(&binaryMapLock);
StructBinaryInfo value;
bool TABinaryManager::unpackBinary(const string &uuid, const string &path, StructBinaryInfo& info) {
TAUnpack* unpacker = TAUnpack::getInstance();
bool ret = false;
- LOGE(SIM_DAEMON, "Unpacking TA %s in %s", uuid.c_str(), path.c_str());
+ LOGD(SIM_DAEMON, "Unpacking TA %s in %s", uuid.c_str(), path.c_str());
if (0 == unpacker->unpackTA(path, uuid)) {
- LOGE(SIM_DAEMON, "Unpacked, filling info");
+ LOGD(SIM_DAEMON, "Unpacked, filling info");
// 1. Set binary info
info.path = path + uuid;
info.extractpath = path + uuid + "-ext/";
// 2. Parse manifest and store results
info.manifest.processXML(info.manifestPath);
- LOGE(SIM_DAEMON, "Decrypting");
+ LOGD(SIM_DAEMON, "Decrypting");
// 3. Decrypt image using secret value in manifest
if (info.manifest.properties.extension.launchMode == "debug")
decryptImage(info);
int32_t result = -1;
pthread_t thread;
LOGD(SIM_DAEMON, "Entry");
+ LOGD(SIM_DAEMON, "Path: %s", path.c_str());
// Get TABinaryManager instance
TABinaryManager *TABin = TABinaryManager::getInstance();
string argvPath = "";
if (TABin->initTAatPath(path, TAUUID)) {
argvPath = TABin->getImagePath(TAUUID);
+ LOGD(SIM_DAEMON, "argvPath: ", argvPath.c_str());
}
if ("" == argvPath) {
LOGE(SIM_DAEMON, "Trusted Application does not exist");