Fix build break due to warnings on Release configuration 10/150110/2
authorLukasz Kostyra <l.kostyra@samsung.com>
Thu, 14 Sep 2017 08:40:25 +0000 (10:40 +0200)
committerLukasz Kostyra <l.kostyra@samsung.com>
Thu, 14 Sep 2017 09:19:25 +0000 (11:19 +0200)
Change-Id: Ie27c9585ea7ac2f775a89a88a447e7ef01055d51

simulatordaemon/CMakeLists.txt
simulatordaemon/inc/ResponseCommands/ResMakeCommand.h
simulatordaemon/inc/TAInstance.h
simulatordaemon/src/ClientCommands/CommandFinContext.cpp
simulatordaemon/src/TABinaryManager/TABinaryManager.cpp
simulatordaemon/src/TABinaryManager/TAUnpack.cpp

index d2916a2..e5e2897 100644 (file)
@@ -24,6 +24,11 @@ PKG_CHECK_MODULES(DAEMON_DEPS REQUIRED
                   security-manager
                   libsystemd-daemon
                   libtzplatform-config
+                  )
+
+# We require tef-libteec only for tee_client_api.h header
+# to prevent linking with tef-libteec, we must keep the module separate
+PKG_CHECK_MODULES(DAEMON_LIBTEEC_DEP REQUIRED
                   tef-libteec
                   )
 
@@ -81,6 +86,7 @@ INCLUDE_DIRECTORIES(
     ${LOG_PATH}
     ${OSAL_PATH}
     ${DAEMON_DEPS_INCLUDE_DIRS}
+    ${DAEMON_LIBTEEC_DEP_INCLUDE_DIRS}
     )
 
 LINK_DIRECTORIES(
index de80cdd..0561bf7 100644 (file)
@@ -1,4 +1,3 @@
-/*
 /**
  * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved
  *
index c1ff0f1..fce9c31 100644 (file)
@@ -1,4 +1,3 @@
-/*
 /**
  * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved
  *
index fb91f32..17fff38 100644 (file)
@@ -307,14 +307,15 @@ void TABinaryManager::decryptImage(StructBinaryInfo& info) {
        string keyhashFilename = info.imagePath + ".keyhash";
        secret.erase(secret.size()-2);
        string keyHash = "echo -n " + secret + " | openssl dgst -sha256 | awk '{print $2}' > " + keyhashFilename;
-       cout << keyHash << endl;
-       system(keyHash.c_str());
+       int result = system(keyHash.c_str());
+       if (result != 0) {
+               LOGE(SIM_DAEMON, "Hashing key failed");
+       }
 
        string line;
        ifstream myfile(keyhashFilename.c_str());
        if (myfile.is_open()) {
                getline(myfile, line);
-               //cout << "line " << line << endl;
                myfile.close();
        }
 
@@ -322,17 +323,28 @@ void TABinaryManager::decryptImage(StructBinaryInfo& info) {
        string dec_command = "openssl enc " + cipher + " -d -nopad -nosalt -K " + secret
                + " -in " + info.imagePath + " -out " + info.imagePath
                + "_dec -iv 0000000000000000";
-       //std::cout << dec_command << std::endl;
-       system(dec_command.c_str());
+       result = system(dec_command.c_str());
+       if (result != 0) {
+               LOGE(SIM_DAEMON, "Image decryption failed");
+       }
+
        string removeEncImage = "rm -f " + info.imagePath;
-       //std::cout << removeEncImage << std::endl;
-       system(removeEncImage.c_str());
+       result = system(removeEncImage.c_str());
+       if (result != 0) {
+               LOGE(SIM_DAEMON, "Post decryption operations failed");
+       }
+
        string renameDecImage = "mv " + info.imagePath + "_dec " + info.imagePath;
-       //std::cout << renameDecImage << std::endl;
-       system(renameDecImage.c_str());
+       result = system(renameDecImage.c_str());
+       if (result != 0) {
+               LOGE(SIM_DAEMON, "Post decryption operations failed");
+       }
+
        string removeKeyHash = "rm -f " + keyhashFilename;
-       //std::cout << removeEncImage << std::endl;
-       system(removeKeyHash.c_str());
+       result = system(removeKeyHash.c_str());
+       if (result != 0) {
+               LOGE(SIM_DAEMON, "Post decryption operations failed");
+       }
 }
 
 /**
@@ -365,7 +377,10 @@ bool TABinaryManager::unpackBinary(const string &uuid, const string &path, Struc
                  decryptImage(info);
 
                string s = "chmod +x " + info.imagePath;
-               system(s.c_str());
+               int result = system(s.c_str());
+               if (result != 0) {
+                       LOGE(SIM_DAEMON, "Unpacking executable TA failed");
+               }
 
                ret = true;
        }
index bd184f8..f759477 100644 (file)
@@ -100,7 +100,11 @@ int TAUnpack::unpackTA(string path, string uuid) {
                        return -1;
                }
                string removeImage = "rm -f " + extract_dir_path + uuid + ".image";
-               system(removeImage.c_str());
+               int result = system(removeImage.c_str());
+               if (result != 0) {
+                       LOGE(SIM_DAEMON, "Failed to remove existing TA image");
+               }
+
                ofstream image((extract_dir_path + uuid + ".image").c_str(),
                    ios::out | ios::binary);
                ofstream manifest((extract_dir_path + uuid + ".manifest").c_str(),