${DAEMON_PATH}/src/UUIDConfig.cpp
${DAEMON_PATH}/src/UUIDConfigManager.cpp
${DAEMON_PATH}/src/UUIDComparator.cpp
+ ${DAEMON_PATH}/src/UUIDUtils.cpp
${DAEMON_PATH}/src/ClientCommands/CommandCloseSession.cpp
${DAEMON_PATH}/src/ClientCommands/CommandCloseTASession.cpp
${DAEMON_PATH}/src/ClientCommands/CommandFinContext.cpp
#ifndef UUIDUTILS_H_
#define UUIDUTILS_H_
+#include <string>
+#include "tee_client_api.h"
+
+std::string UUIDToString(TEEC_UUID uuid);
+
class UUIDComparator {
public:
bool operator() (const TEEC_UUID &u1, const TEEC_UUID &u2);
#include "log.h"
#include "ControlConnectionHandler.h"
#include "IConnectionWriter.h"
+#include "UUIDUtils.h"
void ControlConnectionHandler::setWriter(IConnectionWriter<enum ControlCommand> &writer)
{
std::memcpy(&cmd, data.data(), sizeof(cmd));
std::string portString = std::to_string(cmd.port);
- std::string uuidString = binaryManager->getUUIDAsString(cmd.uuid);
+ std::string uuidString = UUIDToString(cmd.uuid);
ret = binaryManager->setPort(uuidString, portString);
if (!ret) {
reply.status = CTL_REPLY_SUCCESS;
#include "TAFactory.h"
#include "TEEContext.h"
#include "TEEConnectionHandler.h"
+#include "UUIDConfigManager.h"
/*-----------------------------------------------------------------------------
* Member functions
// Update member variable mSessionID with the assigned session ID
mSessionID = data.sessionID;
- //Check if the TA is to be launched in Debug mode, Kill alive TA process
- TAInstancePtr TAInst;
-
TABinaryManager *TABin = TABinaryManager::getInstance();
if(TABin == NULL) {
LOGE(SIM_DAEMON, "Creating TABinaryManager Instance FAILED - ");
return TEEC_ERROR_GENERIC;
}
- string TAUUID = TABin->getUUIDAsString(data.uuid);
+ string TAUUID = UUIDToString(data.uuid);
string argvPort = TABin->getPort(TAUUID);
string TAName(TAUUID);
#include <algorithm>
#include <boost/filesystem.hpp>
#include <config.h>
+#include "UUIDUtils.h"
namespace fs = boost::filesystem;
/*-----------------------------------------------------------------------------
return ret;
}
-/**
- * Converts UUID from TEEC_UUID to a string
- * @return string of TEEC_UUID
- */
-string TABinaryManager::getUUIDAsString(TEEC_UUID uuid) {
- // E.g. returns a string in the format 79B7778897894a7aA2BEB60155EEF5F3
- std::stringstream strStream;
- strStream << IntToHex(uuid.timeLow);
- strStream << IntToHex(uuid.timeMid);
- strStream << IntToHex(uuid.timeHiAndVersion);
- for (int i = 0; i < 8; i++) {
- strStream << IntToHex((short)uuid.clockSeqAndNode[i], 2);
- }
- return strStream.str();
-}
-
-
TABinaryManager::~TABinaryManager() {
pthread_rwlock_destroy(&binaryMapLock);
pthread_mutex_destroy(&taLock);
map<string, StructBinaryInfo> binaryMap;
TABinaryManager();
bool unpackBinary(const string &uuid, const string& tapath, StructBinaryInfo& info);
- template<typename T>
- std::string IntToHex(T i, int width = sizeof(T) * 2) {
- std::stringstream stream;
- stream << std::setfill('0') << std::setw(width) << std::hex << i;
- return stream.str();
- }
void decryptImage(StructBinaryInfo& info);
string base64_decode(std::string const& encoded_string);
bool is_base64(unsigned char c);
int isMultipleSession(string uuid, bool &MultipleSession);
string getImagePath(string uuid);
const TAManifest* getManifest(string uuid);
- string getUUIDAsString(TEEC_UUID uuid);
string getPort(string uuid);
int isKeepAlive(string uuid, bool &KeepAlive);
/**
- * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015-2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*-----------------------------------------------------------------------------*/
#include "TAFactory.h"
#include "SecurityContext.h"
+#include "UUIDUtils.h"
#include "ResponseCommands/ResMakeCommand.h"
+
/*-----------------------------------------------------------------------------
* Globals
*-----------------------------------------------------------------------------*/
// Get TA Binary Manager instance
TABinaryManager *TABin = TABinaryManager::getInstance();
// Get TEEC_UUID format uuid converted to string form
- string TAUUID = TABin->getUUIDAsString(uuid);
+ string TAUUID = UUIDToString(uuid);
// Change to upper char. TA list has upper char.
locale loc;
#include "TEEContext.h"
#include "TABinaryManager.h"
#include "TEEConnectionHandler.h"
+#include "UUIDUtils.h"
/*-----------------------------------------------------------------------------
* Globals
memcpy(&src, &data.source, sizeof(TEEC_UUID));
memcpy(&dst, &data.destination, sizeof(TEEC_UUID));
- source_uuid = TABin->getUUIDAsString(src);
- dest_uuid = TABin->getUUIDAsString(dst);
+ source_uuid = UUIDToString(src);
+ dest_uuid = UUIDToString(dst);
std::transform(source_uuid.begin(), source_uuid.end(), source_uuid.begin(), ::toupper);
std::transform(dest_uuid.begin(), dest_uuid.end(), dest_uuid.begin(), ::toupper);
--- /dev/null
+/**
+ * Copyright (c) 2015-2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * @author Igor Kotrasinski (i.kotrasinsk@partner.samsung.com)
+ * @brief Useful functions for dealing with UUIDs
+ */
+
+#include <string>
+#include <sstream>
+#include <iomanip>
+
+#include "tee_client_api.h"
+
+template<typename T>
+static std::string IntToHex(T i, int width = sizeof(T) * 2) {
+ std::stringstream stream;
+ stream << std::setfill('0') << std::setw(width) << std::hex << std::uppercase << i;
+ return stream.str();
+}
+
+std::string UUIDToString(TEEC_UUID uuid) {
+ std::stringstream strStream;
+ strStream << IntToHex(uuid.timeLow);
+ strStream << IntToHex(uuid.timeMid);
+ strStream << IntToHex(uuid.timeHiAndVersion);
+ for (int i = 0; i < 8; i++) {
+ strStream << IntToHex((short)uuid.clockSeqAndNode[i], 2);
+ }
+ return strStream.str();
+}