From: Lukasz Kostyra Date: Thu, 14 Sep 2017 08:40:25 +0000 (+0200) Subject: Fix build break due to warnings on Release configuration X-Git-Tag: submit/tizen/20170914.115510~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F150110%2F2;p=platform%2Fcore%2Fsecurity%2Ftef-simulator.git Fix build break due to warnings on Release configuration Change-Id: Ie27c9585ea7ac2f775a89a88a447e7ef01055d51 --- diff --git a/simulatordaemon/CMakeLists.txt b/simulatordaemon/CMakeLists.txt index d2916a2..e5e2897 100644 --- a/simulatordaemon/CMakeLists.txt +++ b/simulatordaemon/CMakeLists.txt @@ -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( diff --git a/simulatordaemon/inc/ResponseCommands/ResMakeCommand.h b/simulatordaemon/inc/ResponseCommands/ResMakeCommand.h index de80cdd..0561bf7 100644 --- a/simulatordaemon/inc/ResponseCommands/ResMakeCommand.h +++ b/simulatordaemon/inc/ResponseCommands/ResMakeCommand.h @@ -1,4 +1,3 @@ -/* /** * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved * diff --git a/simulatordaemon/inc/TAInstance.h b/simulatordaemon/inc/TAInstance.h index c1ff0f1..fce9c31 100644 --- a/simulatordaemon/inc/TAInstance.h +++ b/simulatordaemon/inc/TAInstance.h @@ -1,4 +1,3 @@ -/* /** * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved * diff --git a/simulatordaemon/src/ClientCommands/CommandFinContext.cpp b/simulatordaemon/src/ClientCommands/CommandFinContext.cpp index 4603a64..b5a87f4 100644 --- a/simulatordaemon/src/ClientCommands/CommandFinContext.cpp +++ b/simulatordaemon/src/ClientCommands/CommandFinContext.cpp @@ -1,4 +1,3 @@ -/* /** * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved * diff --git a/simulatordaemon/src/TABinaryManager/TABinaryManager.cpp b/simulatordaemon/src/TABinaryManager/TABinaryManager.cpp index fb91f32..17fff38 100644 --- a/simulatordaemon/src/TABinaryManager/TABinaryManager.cpp +++ b/simulatordaemon/src/TABinaryManager/TABinaryManager.cpp @@ -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; } diff --git a/simulatordaemon/src/TABinaryManager/TAUnpack.cpp b/simulatordaemon/src/TABinaryManager/TAUnpack.cpp index bd184f8..f759477 100644 --- a/simulatordaemon/src/TABinaryManager/TAUnpack.cpp +++ b/simulatordaemon/src/TABinaryManager/TAUnpack.cpp @@ -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(),