ADD_DEFINITIONS("-D_ARCH_=${ARCH}")
ADD_DEFINITIONS(-DTEE_TASTORE_ROOT="${TASTORE_DIR}/")
+ADD_DEFINITIONS(-DTEE_EXTRACT_ROOT="${EXTRACT_DIR}/")
ADD_DEFINITIONS(-DTEE_SS_ROOT="${STORAGE_DIR}/")
ADD_DEFINITIONS(-DTEE_TALOG_ROOT="${TALOG_DIR}/")
switch ((uintptr_t)propSet) {\r
case TEE_PROPSET_CURRENT_TA: {\r
newEnumHandle->property = new TAProperty(\r
- string(TEE_TASTORE_ROOT) + thisTAUUIDGlobal + "-ext/"\r
+ string(TEE_EXTRACT_ROOT) + thisTAUUIDGlobal + "-ext/"\r
+ thisTAUUIDGlobal + ".manifest");\r
break;\r
}\r
#endif
#endif
+#ifndef TEE_EXTRACT_ROOT
+#define TEE_EXTRACT_ROOT "/opt/usr/apps/ta_sdk/extract/"
+#endif
+
#ifndef TEE_SS_ROOT
#define TEE_SS_ROOT "/opt/usr/apps/ta_sdk/data/"
#endif
#define TEE_TALOG_ROOT "/var/log/ta/"
#endif
+
//keep in sync with systemd/tef-simulator.socket
#define SIMDAEMON_SOCK_PATH "/var/run/simdaemon"
%define tastore_dir /opt/usr/apps/ta_sdk/tee
%endif
%define storage_dir /opt/usr/apps/ta_sdk/data
+%define extract_dir /opt/usr/apps/ta_sdk/extract
%define talog_dir /var/log/ta
%define build_bin_dir %{buildroot}%{bin_dir}
-DDATA_DIR=%{build_data_dir} \
-DINCLUDE_DIR=%{build_include_dir} \
-DTASTORE_DIR=%{tastore_dir} \
+ -DEXTRACT_DIR=%{extract_dir} \
-DSTORAGE_DIR=%{storage_dir} \
-DTALOG_DIR=%{talog_dir} \
-DSYSTEMD_UNIT_DIR=%{build_unit_dir} \
%attr(755,security_fw,security_fw) %{lib_dir}/tef/simulator/libteec.so
%attr(770,root,security_fw) %{talog_dir}
%attr(770,root,security_fw) %{storage_dir}
+%attr(770,root,security_fw) %{extract_dir}
%files -n %{name}-devkit
%license LICENSE
INSTALL(TARGETS ${TARGET_TEF_SIMULATOR_DAEMON} DESTINATION ${BIN_DIR})
INSTALL(DIRECTORY DESTINATION ${BUILD_ROOT}${TASTORE_DIR})
+INSTALL(DIRECTORY DESTINATION ${BUILD_ROOT}${EXTRACT_DIR})
INSTALL(DIRECTORY DESTINATION ${BUILD_ROOT}${STORAGE_DIR})
bool TABinaryManager::unpackBinary(const string &uuid, StructBinaryInfo& info) {
TAUnpack* unpacker = TAUnpack::getInstance();
bool ret = false;
- if (0 == unpacker->unpackTA(string(TEE_TASTORE_ROOT), uuid)) {
+ if (0 == unpacker->unpackTA(TEE_TASTORE_ROOT, uuid)) {
LOGD(SIM_DAEMON, "Unpacked, filling info");
// 1. Set binary info
info.path = string(TEE_TASTORE_ROOT) + uuid;
- info.extractpath = string(TEE_TASTORE_ROOT) + uuid + "-ext/";
+ info.extractpath = string(TEE_EXTRACT_ROOT) + uuid + "-ext/";
info.imagePath = info.extractpath + uuid + ".image";
info.manifestPath = info.extractpath + uuid + ".manifest";
// 2. Parse manifest and store results
* @param uuid uuid of package
* @return -1 on error otherwise 0
*/
-int TAUnpack::unpackTA(string path, string uuid) {
+int TAUnpack::unpackTA(const string& path, const string& uuid) {
LOGD(SIM_DAEMON, "");
TAPackageHeaderV2 packageHeader;
memset(&packageHeader, 0, sizeof(TAPackageHeaderV2));
- // Open file
- string path_to_file = path + uuid;
- ifstream tapackage(path_to_file.c_str(), ios::in | ios::binary);
- // Create directory for UUID
- string extract_dir_path = path + uuid + "-ext/";
+
+ // Create directory for TA extracted files
+ string extract_dir_path = TEE_EXTRACT_ROOT + uuid + "-ext/";
struct stat info;
if (stat(extract_dir_path.c_str(), &info) != 0) {
if (0 != mkdir(extract_dir_path.c_str(), 0777)) {
}
}
+ // Open TA package file
+ string path_to_file = path + uuid;
+ ifstream tapackage(path_to_file.c_str(), ios::in | ios::binary);
if (!tapackage.is_open()) {
- LOGE(SIM_DAEMON, "Already open - failed");
+ LOGE(SIM_DAEMON, "Cannot open ta: %s", path_to_file.c_str());
return -1; //> unable to open file
}
// 1. Read header
unsigned int paddedSize);
public:
static TAUnpack* getInstance();
- int unpackTA(string path, string uuid);
+ int unpackTA(const string& path, const string& uuid);
virtual ~TAUnpack();
};