Rename module enum elements to avoid conflicts 03/179603/3
authorIgor Kotrasinski <i.kotrasinsk@partner.samsung.com>
Tue, 8 May 2018 10:17:35 +0000 (12:17 +0200)
committerIgor Kotrasinski <i.kotrasinsk@partner.samsung.com>
Mon, 4 Jun 2018 10:14:02 +0000 (12:14 +0200)
Change-Id: Ie65e88f0956ce133e3cfcf6ac9d6fde65fcae628
Signed-off-by: Igor Kotrasinski <i.kotrasinsk@partner.samsung.com>
47 files changed:
TEECLib/src/teec_api.c
TEECLib/src/teec_connection.c
TEEStub/PropertyAccess/TAProperty.cpp
TEEStub/PropertyAccess/TEEProperty.cpp
TEEStub/TACommands/CommandCloseSession.cpp
TEEStub/TACommands/CommandCreateEntryPoint.cpp
TEEStub/TACommands/CommandDestroyEntryPoint.cpp
TEEStub/TACommands/CommandInvoke.cpp
TEEStub/TACommands/CommandOpenSession.cpp
TEEStub/TACommands/SharedMemoryMap.cpp
TEEStub/TEEStubServer/ConnectionSession.cpp
TEEStub/TEEStubServer/TEEStubServer.cpp
TEEStub/TaskStrategy/TaskQueuedStrategy.cpp
TEEStub/teestubmain.cpp
log/log.c
log/log.h
osal/OsaCommon.c
osal/OsaIpc.c
osal/OsaQueue.c
osal/OsaSem.c
osal/OsaSignal.c
osal/OsaTask.c
simulatordaemon/src/ClientCommands/CommandRegSharedMem.cpp
simulatordaemon/src/ClientCommands/CommandRelSharedMem.cpp
simulatordaemon/src/ClientCommands/MakeCommand.cpp
simulatordaemon/src/ConnectionSession.cpp
simulatordaemon/src/ControlConnectionHandler.cpp
simulatordaemon/src/ResponseCommands/ResCommandCloseSession.cpp
simulatordaemon/src/ResponseCommands/ResCommandInvokeCommand.cpp
simulatordaemon/src/ResponseCommands/ResCommandOpenSession.cpp
simulatordaemon/src/ResponseCommands/ResMakeCommand.cpp
simulatordaemon/src/Session.cpp
simulatordaemon/src/SimulatorDaemon.cpp
simulatordaemon/src/TABinaryManager/TABinaryManager.cpp
simulatordaemon/src/TABinaryManager/TAUnpack.cpp
simulatordaemon/src/TABinaryManager/TestMain.cpp
simulatordaemon/src/TAFactory.cpp
simulatordaemon/src/TAInstance.cpp
simulatordaemon/src/TEEConnectionHandler.cpp
simulatordaemon/src/TEEContext.cpp
ssflib/dep/time/ssf_time.cpp
ssflib/inc/permission.h
ssflib/src/ssf_arithmetic.cpp
ssflib/src/ssf_client.cpp
ssflib/src/ssf_crypto.cpp
ssflib/src/ssf_crypto_openssl.cpp
ssflib/src/ssf_lib.cpp

index 33d4af1..b82a13f 100644 (file)
@@ -105,7 +105,7 @@ static int32_t set_shm_permissions(int fd_shm, const char *shm_name)
 
        res = fchmod(fd_shm, SHM_FILE_MODE);
        if (res == -1) {
-               LOGE(TEEC_LIB,
+               LOGE(MODULE_TEEC_LIB,
                     "Cannot change permission of the %s shared memory file, error: %s",
                     shm_name, strerror(errno));
                     return TEEC_ERROR_GENERIC;
@@ -115,11 +115,11 @@ static int32_t set_shm_permissions(int fd_shm, const char *shm_name)
        tee_group = getgrnam(TEE_USER_GROUP_NAME);
        if (!tee_group) {
                if (!errno) {
-                       LOGE(TEEC_LIB,
+                       LOGE(MODULE_TEEC_LIB,
                             "Failed to get TEE group: group %s does not exist",
                             TEE_USER_GROUP_NAME);
                } else {
-                       LOGE(TEEC_LIB,
+                       LOGE(MODULE_TEEC_LIB,
                             "Failed to set TEE group, error: %s",
                             strerror(errno));
                }
@@ -127,7 +127,7 @@ static int32_t set_shm_permissions(int fd_shm, const char *shm_name)
        }
        res = fchown(fd_shm, -1, tee_group->gr_gid);
        if (res == -1) {
-               LOGE(TEEC_LIB,
+               LOGE(MODULE_TEEC_LIB,
                     "Failed to set TEE group of the %s shared memory file, error: %s",
                     shm_name, strerror(errno));
                return errno == EPERM ? TEEC_ERROR_ACCESS_DENIED : TEEC_ERROR_GENERIC;
@@ -146,7 +146,7 @@ static int32_t set_shm_permissions(int fd_shm, const char *shm_name)
  */
 static int32_t allocateSharedMemory(TEEC_SharedMemory *shm)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_SharedMemoryImp *sharedMem_imp = (TEEC_SharedMemoryImp *)shm->imp;
        int32_t tee_result = TEEC_SUCCESS;
        int32_t memKey = 0;
@@ -158,14 +158,14 @@ static int32_t allocateSharedMemory(TEEC_SharedMemory *shm)
        while (fd_shm < 0 && memKey < SHM_MAX_ID) {
                res = snprintf(shm_name, sizeof(shm_name), SHM_NAME_PREFIX "%d", memKey);
                if (res == sizeof(shm_name)) {
-                       LOGE(TEEC_LIB, "the shm object name is too long");
+                       LOGE(MODULE_TEEC_LIB, "the shm object name is too long");
                        tee_result = TEEC_ERROR_GENERIC;
                        goto exit;
                }
 
                fd_shm = shm_open(shm_name, O_RDWR | O_CREAT | O_EXCL, SHM_FILE_MODE);
                if (fd_shm < 0 && errno != EEXIST) {
-                       LOGE(TEEC_LIB, "Cannot create shared memory object '%s', error: %s",
+                       LOGE(MODULE_TEEC_LIB, "Cannot create shared memory object '%s', error: %s",
                             shm_name, strerror(errno));
                        tee_result = TEEC_ERROR_GENERIC;
                        goto exit;
@@ -175,7 +175,7 @@ static int32_t allocateSharedMemory(TEEC_SharedMemory *shm)
        }
 
        if (fd_shm < 0) {
-               LOGE(TEEC_LIB, "Cannot find free shared memory slot");
+               LOGE(MODULE_TEEC_LIB, "Cannot find free shared memory slot");
                tee_result = TEEC_ERROR_GENERIC;
                goto exit;
        }
@@ -186,7 +186,7 @@ static int32_t allocateSharedMemory(TEEC_SharedMemory *shm)
 
        size = alignSize(size);
        if (ftruncate(fd_shm, size) == -1) {
-               LOGE(TEEC_LIB, "ftruncate failed, error: %s", strerror(errno));
+               LOGE(MODULE_TEEC_LIB, "ftruncate failed, error: %s", strerror(errno));
                tee_result = TEEC_ERROR_OUT_OF_MEMORY;
                goto cleanup_shm;
        }
@@ -195,7 +195,7 @@ static int32_t allocateSharedMemory(TEEC_SharedMemory *shm)
                                    fd_shm, 0);
 
        if (shm->buffer == MAP_FAILED) {
-               LOGE(TEEC_LIB, "shmat failed, error: %s", strerror(errno));
+               LOGE(MODULE_TEEC_LIB, "shmat failed, error: %s", strerror(errno));
                tee_result = TEEC_ERROR_OUT_OF_MEMORY;
                goto cleanup_shm;
        }
@@ -225,25 +225,25 @@ exit:
  */
 static void freeSharedMemory(TEEC_SharedMemory *shm)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        char shm_name[NAME_MAX];
        int ret;
 
        TEEC_SharedMemoryImp *sharedMem_imp = (TEEC_SharedMemoryImp *)shm->imp;
 
        if (munmap(sharedMem_imp->allocPtr, sharedMem_imp->size) == -1) {
-               LOGE(TEEC_LIB, "munmap failed, error: %s", strerror(errno));
+               LOGE(MODULE_TEEC_LIB, "munmap failed, error: %s", strerror(errno));
                return;
        }
 
        ret = snprintf(shm_name, sizeof(shm_name), SHM_NAME_PREFIX "%d", sharedMem_imp->shmKey);
        if (ret == sizeof(shm_name)) {
-               LOGE(TEEC_LIB, "the shm object name is too long");
+               LOGE(MODULE_TEEC_LIB, "the shm object name is too long");
                return;
        }
 
        if (shm_unlink(shm_name) == -1) {
-               LOGE(TEEC_LIB, "shm_unlink failed for %s, error: %s", shm_name,
+               LOGE(MODULE_TEEC_LIB, "shm_unlink failed for %s, error: %s", shm_name,
                         strerror(errno));
                return;
        }
@@ -263,7 +263,7 @@ static void freeSharedMemory(TEEC_SharedMemory *shm)
 static TEEC_Result getMemoryKey(TEEC_SharedMemory *shm)
 {
        TEEC_Result result;
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_SharedMemory sharedmem;
        sharedmem.imp = shm->imp;
        sharedmem.size = shm->size;
@@ -291,7 +291,7 @@ static TEEC_Result getMemoryKey(TEEC_SharedMemory *shm)
  */
 static uint32_t checkContext(TEEC_Context *context)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
 
        TEEC_ContextList *pContext;
        uint32_t found = 0;
@@ -313,7 +313,7 @@ static uint32_t checkContext(TEEC_Context *context)
 TEEC_Result tempSharedMemAllocate(TEEC_SharedMemory** tmpSharedMem, uint32_t type,
                                                                  TEEC_Context* context, TEEC_Parameter param)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Result result;
        *tmpSharedMem = (TEEC_SharedMemory *)OsaMalloc(sizeof(TEEC_SharedMemory));
        if (!*tmpSharedMem)
@@ -364,7 +364,7 @@ static TEEC_Result preProcessOperation(TEEC_Session *session,
                                                                           TEEC_Operation *operation, OperationData *op,
                                                                           TEEC_SharedMemory *tmpSharedMem[4])
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Context *context = NULL;
        TEEC_RegisteredMemoryReference *memref;
        TEEC_SharedMemoryImp *memref_imp;
@@ -373,7 +373,7 @@ static TEEC_Result preProcessOperation(TEEC_Session *session,
 
        // Check if Session is valid
        if (!session) {
-               LOGE(TEEC_LIB, "Bad parameters");
+               LOGE(MODULE_TEEC_LIB, "Bad parameters");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -438,7 +438,7 @@ static TEEC_Result preProcessOperation(TEEC_Session *session,
                        if ((NULL == memref) || (NULL == memref->parent)
                                        || (((TEEC_SharedMemoryImp *)memref->parent->imp)->context->imp
                                                != context->imp)) {
-                               LOGE(TEEC_LIB, "Bad parameters");
+                               LOGE(MODULE_TEEC_LIB, "Bad parameters");
                                result = TEEC_ERROR_BAD_PARAMETERS;
                                goto cleanup;
                        }
@@ -462,7 +462,7 @@ static TEEC_Result preProcessOperation(TEEC_Session *session,
                        if ((NULL == memref) || (NULL == memref->parent)
                                        || (((TEEC_SharedMemoryImp *)memref->parent->imp)->context->imp
                                                != context->imp)) {
-                               LOGE(TEEC_LIB, "Bad parameters");
+                               LOGE(MODULE_TEEC_LIB, "Bad parameters");
                                result = TEEC_ERROR_BAD_PARAMETERS;
                                goto cleanup;
                        }
@@ -485,7 +485,7 @@ static TEEC_Result preProcessOperation(TEEC_Session *session,
                        break;
 
                default:
-                       LOGE(TEEC_LIB, "Bad parameters");
+                       LOGE(MODULE_TEEC_LIB, "Bad parameters");
                        result = TEEC_ERROR_BAD_PARAMETERS;
                        goto cleanup;
                }
@@ -513,7 +513,7 @@ cleanup:
 static void postProcessOperation(TEEC_Operation *operation, OperationData *op,
                                                                 TEEC_SharedMemory *tmpSharedMem[4])
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        uint32_t i, type;
        TEEC_RegisteredMemoryReference *memref;
        TEEC_SharedMemoryImp *memref_imp;
@@ -587,7 +587,7 @@ static void postProcessOperation(TEEC_Operation *operation, OperationData *op,
 
 TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Result result = TEEC_SUCCESS;
        TEEC_ContextImp *context_imp = NULL;
        TEEC_ContextList *pContext = NULL;
@@ -595,7 +595,7 @@ TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context)
 
        // Check if the context is valid
        if (!context) {
-               LOGE(TEEC_LIB, "NULL Context");
+               LOGE(MODULE_TEEC_LIB, "NULL Context");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -604,7 +604,7 @@ TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context)
        context_imp = (TEEC_ContextImp *)context->imp;
 
        if (!context_imp) {
-               LOGE(TEEC_LIB, "context_imp malloc failed");
+               LOGE(MODULE_TEEC_LIB, "context_imp malloc failed");
                return TEEC_ERROR_OUT_OF_MEMORY;
        }
 
@@ -621,7 +621,7 @@ TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context)
        if (ctx.nameLength > MAX_CONTEXT_NAME_LEN) {
                OsaFree(context_imp);
                context->imp = NULL;
-               LOGE(TEEC_LIB, "TEE name length exceeding");
+               LOGE(MODULE_TEEC_LIB, "TEE name length exceeding");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -633,7 +633,7 @@ TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context)
        if (conn_result != TEEC_SUCCESS) {
                OsaFree(context_imp);
                context->imp = NULL;
-               LOGE(TEEC_LIB, "Unable to connect to Simulator daemon");
+               LOGE(MODULE_TEEC_LIB, "Unable to connect to Simulator daemon");
                return conn_result;
        }
 
@@ -651,7 +651,7 @@ TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context)
 
                OsaFree(context_imp);
                context->imp = NULL;
-               LOGE(TEEC_LIB, "sendCommand to Simulator Daemon failed");
+               LOGE(MODULE_TEEC_LIB, "sendCommand to Simulator Daemon failed");
                return result;
        }
 
@@ -661,7 +661,7 @@ TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context)
 
                OsaFree(context_imp);
                context->imp = NULL;
-               LOGE(TEEC_LIB, "Simulator Daemon Initialize context returned failure");
+               LOGE(MODULE_TEEC_LIB, "Simulator Daemon Initialize context returned failure");
                return ctx.returnValue;
        }
 
@@ -672,7 +672,7 @@ TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context)
        pContext = (TEEC_ContextList *)OsaMalloc(sizeof(TEEC_ContextList));
 
        if (!pContext) {
-               LOGE(TEEC_LIB, "pContext malloc failed");
+               LOGE(MODULE_TEEC_LIB, "pContext malloc failed");
                return TEEC_ERROR_OUT_OF_MEMORY;
        }
 
@@ -694,7 +694,7 @@ TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context)
  */
 void TEEC_FinalizeContext(TEEC_Context *context)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Result result = TEEC_SUCCESS;
        FinalizeContextData ctx;
        TEEC_ContextList *pContext;
@@ -702,7 +702,7 @@ void TEEC_FinalizeContext(TEEC_Context *context)
 
        // Check if the Context is valid
        if (!context) {
-               LOGE(TEEC_LIB, "NULL context");
+               LOGE(MODULE_TEEC_LIB, "NULL context");
                return;
        }
 
@@ -719,7 +719,7 @@ void TEEC_FinalizeContext(TEEC_Context *context)
        pthread_rwlock_unlock(&context_list_lock);
 
        if (!context_initialized) {
-               LOGE(TEEC_LIB, "Invalid Context");
+               LOGE(MODULE_TEEC_LIB, "Invalid Context");
                return;
        }
 
@@ -727,7 +727,7 @@ void TEEC_FinalizeContext(TEEC_Context *context)
        TEEC_ContextImp *context_imp = (TEEC_ContextImp *)context->imp;
 
        if (!context_imp) {
-               LOGE(TEEC_LIB, "NULL context_imp");
+               LOGE(MODULE_TEEC_LIB, "NULL context_imp");
                return;
        }
 
@@ -742,7 +742,7 @@ void TEEC_FinalizeContext(TEEC_Context *context)
        pthread_mutex_unlock(&context_imp->lock);
 
        if (result != TEEC_SUCCESS) // Communication Failure
-               LOGE(TEEC_LIB, "sendCommand to Simulator Daemon failed");
+               LOGE(MODULE_TEEC_LIB, "sendCommand to Simulator Daemon failed");
 
        // Disconnect from Simulator Daemon
        disconnectfromServer(context_imp->sockfd);
@@ -770,19 +770,19 @@ void TEEC_FinalizeContext(TEEC_Context *context)
 TEEC_Result TEEC_RegisterSharedMemory(TEEC_Context *context,
                                                                          TEEC_SharedMemory *sharedMem)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Result result = TEEC_SUCCESS;
        RegSharedMemData regmem;
 
        // Check if the Context is valid
        if (!context) {
-               LOGE(TEEC_LIB, "NULL context");
+               LOGE(MODULE_TEEC_LIB, "NULL context");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
        // Check if the context is initialized
        if (!checkContext(context)) {
-               LOGE(TEEC_LIB, "Invalid context");
+               LOGE(MODULE_TEEC_LIB, "Invalid context");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -790,20 +790,20 @@ TEEC_Result TEEC_RegisterSharedMemory(TEEC_Context *context,
        TEEC_ContextImp *context_imp = (TEEC_ContextImp *)context->imp;
 
        if (!context_imp) {
-               LOGE(TEEC_LIB, "NULL context_imp");
+               LOGE(MODULE_TEEC_LIB, "NULL context_imp");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
        // Check if the socket is valid
        if (context_imp->sockfd < 0) {
-               LOGE(TEEC_LIB, "Bad parameter context_imp->sockfd = %d",
+               LOGE(MODULE_TEEC_LIB, "Bad parameter context_imp->sockfd = %d",
                         context_imp->sockfd);
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
        // Check if shared memory pointer is valid
        if (!sharedMem) {
-               LOGE(TEEC_LIB, "Shared Memory is NULL");
+               LOGE(MODULE_TEEC_LIB, "Shared Memory is NULL");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -812,20 +812,20 @@ TEEC_Result TEEC_RegisterSharedMemory(TEEC_Context *context,
         * TEEC_CONFIG_SHAREDMEM_MAX_SIZE and less than PAGE_SIZE.
         */
        if (sharedMem->size > TEEC_CONFIG_SHAREDMEM_MAX_SIZE) {
-               LOGE(TEEC_LIB, "Shared Memory size is too large %u > %u", sharedMem->size, TEEC_CONFIG_SHAREDMEM_MAX_SIZE);
+               LOGE(MODULE_TEEC_LIB, "Shared Memory size is too large %u > %u", sharedMem->size, TEEC_CONFIG_SHAREDMEM_MAX_SIZE);
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
        // Check if the Shared Memory Buffer is valid
        if (!sharedMem->buffer) {
-               LOGE(TEEC_LIB, "Shared Memory buffer is NULL");
+               LOGE(MODULE_TEEC_LIB, "Shared Memory buffer is NULL");
                return TEEC_ERROR_NO_DATA;
        }
 
        // Check if the Shared memory flags are valid
        if ((sharedMem->flags == 0)
                        || (sharedMem->flags > (TEEC_MEM_INPUT | TEEC_MEM_OUTPUT))) {
-               LOGE(TEEC_LIB, "Shared Memory flag is a bad parameter");
+               LOGE(MODULE_TEEC_LIB, "Shared Memory flag is a bad parameter");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -849,14 +849,14 @@ TEEC_Result TEEC_RegisterSharedMemory(TEEC_Context *context,
        result = getMemoryKey(sharedMem);
 
        if (result != TEEC_SUCCESS) { // Memory allocation Failure
-               LOGE(TEEC_LIB, "Memory alocation failed");
+               LOGE(MODULE_TEEC_LIB, "Memory alocation failed");
                OsaFree(sharedMem_imp);
                return result;
        }
 
        // Check if the obained shared memory is valid
        if (sharedMem_imp->shmKey == -1) {
-               LOGE(TEEC_LIB, "Failed to get MemoryID");
+               LOGE(MODULE_TEEC_LIB, "Failed to get MemoryID");
                OsaFree(sharedMem_imp);
                return TEEC_ERROR_GENERIC;
        }
@@ -870,7 +870,7 @@ TEEC_Result TEEC_RegisterSharedMemory(TEEC_Context *context,
        pthread_mutex_unlock(&context_imp->lock);
 
        if (result != TEEC_SUCCESS) { // Communication Failure
-               LOGE(TEEC_LIB, "sendCommand to Simulator Daemon failed");
+               LOGE(MODULE_TEEC_LIB, "sendCommand to Simulator Daemon failed");
                OsaFree(sharedMem_imp);
                return result;
        }
@@ -878,7 +878,7 @@ TEEC_Result TEEC_RegisterSharedMemory(TEEC_Context *context,
        result = regmem.returnValue;
 
        if (result != TEEC_SUCCESS) { // Command Failure
-               LOGE(TEEC_LIB, "Simulator Daemon Register Shared Memory returned failure");
+               LOGE(MODULE_TEEC_LIB, "Simulator Daemon Register Shared Memory returned failure");
                OsaFree(sharedMem_imp);
                return result;
        }
@@ -906,7 +906,7 @@ TEEC_Result TEEC_RegisterSharedMemory(TEEC_Context *context,
 TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context,
                                                                          TEEC_SharedMemory *sharedMem)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Result result = TEEC_SUCCESS;
        TEEC_ContextImp *context_imp;
        RegSharedMemData regmem;
@@ -917,13 +917,13 @@ TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context,
 
        // Check if the Context is valid
        if (!context) {
-               LOGE(TEEC_LIB, "context is NULL");
+               LOGE(MODULE_TEEC_LIB, "context is NULL");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
        // Check if the Context is initialized
        if (!checkContext(context)) {
-               LOGE(TEEC_LIB, "Invalid context");
+               LOGE(MODULE_TEEC_LIB, "Invalid context");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -931,20 +931,20 @@ TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context,
        context_imp = (TEEC_ContextImp *)context->imp;
 
        if (!context_imp) {
-               LOGE(TEEC_LIB, "context_imp is not found");
+               LOGE(MODULE_TEEC_LIB, "context_imp is not found");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
        // Check if the socket is valid
        if (context_imp->sockfd < 0) {
-               LOGE(TEEC_LIB, "Bad parameter context_imp->sockfd = %d",
+               LOGE(MODULE_TEEC_LIB, "Bad parameter context_imp->sockfd = %d",
                         context_imp->sockfd);
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
        // Check if shared memory pointer is valid
        if (!sharedMem) {
-               LOGE(TEEC_LIB, "Shared Memory is NULL");
+               LOGE(MODULE_TEEC_LIB, "Shared Memory is NULL");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -953,14 +953,14 @@ TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context,
         * TEEC_CONFIG_SHAREDMEM_MAX_SIZE and less than PAGE_SIZE.
         */
        if (sharedMem->size > TEEC_CONFIG_SHAREDMEM_MAX_SIZE) {
-               LOGE(TEEC_LIB, "Shared Memory size is too large 0x%x", sharedMem->size);
+               LOGE(MODULE_TEEC_LIB, "Shared Memory size is too large 0x%x", sharedMem->size);
                return TEEC_ERROR_OUT_OF_MEMORY;
        }
 
        // Check if the Shared memory flags are valid
        if ((sharedMem->flags == 0)
                        || (sharedMem->flags > (TEEC_MEM_INPUT | TEEC_MEM_OUTPUT))) {
-               LOGE(TEEC_LIB, "Shared Memory flag is a bad parameter");
+               LOGE(MODULE_TEEC_LIB, "Shared Memory flag is a bad parameter");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -980,14 +980,14 @@ TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context,
        result = allocateSharedMemory(sharedMem);
 
        if (result != TEEC_SUCCESS) { // Memory Allocation Failure
-               LOGE(TEEC_LIB, "allocateSharedMemory failed");
+               LOGE(MODULE_TEEC_LIB, "allocateSharedMemory failed");
                OsaFree(sharedMem_imp);
                return result;
        }
 
        // Check if the obtained key is valid
        if (sharedMem_imp->shmKey == -1) {
-               LOGE(TEEC_LIB, "allocateSharedMemory failed");
+               LOGE(MODULE_TEEC_LIB, "allocateSharedMemory failed");
                OsaFree(sharedMem_imp);
                return TEEC_ERROR_GENERIC;
        }
@@ -1008,7 +1008,7 @@ TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context,
        pthread_mutex_unlock(&context_imp->lock);
 
        if (result != TEEC_SUCCESS) { // Communication Failure
-               LOGE(TEEC_LIB, "sendCommand to Simulator Daemon failed");
+               LOGE(MODULE_TEEC_LIB, "sendCommand to Simulator Daemon failed");
                sharedMem->buffer = NULL;
                OsaFree(sharedMem_imp);
                return result;
@@ -1017,7 +1017,7 @@ TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context,
        result = regmem.returnValue;
 
        if (result != TEEC_SUCCESS) { // Command Failure
-               LOGE(TEEC_LIB, "Simulator Daemon Allocate Shared Memory returned failure");
+               LOGE(MODULE_TEEC_LIB, "Simulator Daemon Allocate Shared Memory returned failure");
                OsaFree(sharedMem_imp);
                return result;
        }
@@ -1034,7 +1034,7 @@ TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context,
  */
 void TEEC_ReleaseSharedMemory(TEEC_SharedMemory *sharedMem)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Result result = TEEC_SUCCESS;
        TEEC_Context *context;
        TEEC_ContextImp *context_imp;
@@ -1042,7 +1042,7 @@ void TEEC_ReleaseSharedMemory(TEEC_SharedMemory *sharedMem)
 
        // Check if the Shared Memory is valid
        if (!sharedMem) {
-               LOGE(TEEC_LIB, "SharedMem is NULL");
+               LOGE(MODULE_TEEC_LIB, "SharedMem is NULL");
                return;
        }
 
@@ -1050,7 +1050,7 @@ void TEEC_ReleaseSharedMemory(TEEC_SharedMemory *sharedMem)
        TEEC_SharedMemoryImp *sharedMem_imp = (TEEC_SharedMemoryImp *)sharedMem->imp;
 
        if (!sharedMem_imp) {
-               LOGE(TEEC_LIB, "NULL sharedMem_imp");
+               LOGE(MODULE_TEEC_LIB, "NULL sharedMem_imp");
                return;
        }
 
@@ -1058,13 +1058,13 @@ void TEEC_ReleaseSharedMemory(TEEC_SharedMemory *sharedMem)
        context = sharedMem_imp->context;
 
        if (!context) {
-               LOGE(TEEC_LIB, "context is NULL");
+               LOGE(MODULE_TEEC_LIB, "context is NULL");
                return;
        }
 
        // Check if the Context is initialized
        if (!checkContext(context)) {
-               LOGE(TEEC_LIB, "Invalid context");
+               LOGE(MODULE_TEEC_LIB, "Invalid context");
                return;
        }
 
@@ -1073,7 +1073,7 @@ void TEEC_ReleaseSharedMemory(TEEC_SharedMemory *sharedMem)
        context_imp = (TEEC_ContextImp *)context->imp;
 
        if (!context_imp) {
-               LOGE(TEEC_LIB, "context_imp is NULL");
+               LOGE(MODULE_TEEC_LIB, "context_imp is NULL");
                return;
        }
 
@@ -1092,7 +1092,7 @@ void TEEC_ReleaseSharedMemory(TEEC_SharedMemory *sharedMem)
        pthread_mutex_unlock(&context_imp->lock);
 
        if (result != TEEC_SUCCESS) { // Communication Failure
-               LOGE(TEEC_LIB, "sendCommand to Simulator Daemon failed");
+               LOGE(MODULE_TEEC_LIB, "sendCommand to Simulator Daemon failed");
                return;
        }
 
@@ -1136,7 +1136,7 @@ TEEC_Result TEEC_OpenSession(TEEC_Context *context, TEEC_Session *session,
                                                         uint32_t *returnOrigin)
 {
 
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Result result = TEEC_SUCCESS;
        OpenSessionData os;
        OperationData op;
@@ -1152,13 +1152,13 @@ TEEC_Result TEEC_OpenSession(TEEC_Context *context, TEEC_Session *session,
 
        // Check if the context, session and UUID is valid
        if (!session || !context || !destination) {
-               LOGE(TEEC_LIB, "Invalid input parameters");
+               LOGE(MODULE_TEEC_LIB, "Invalid input parameters");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
        // Check if the context is initialized
        if (!checkContext(context)) {
-               LOGE(TEEC_LIB, "Invalid context");
+               LOGE(MODULE_TEEC_LIB, "Invalid context");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -1166,7 +1166,7 @@ TEEC_Result TEEC_OpenSession(TEEC_Context *context, TEEC_Session *session,
        TEEC_ContextImp *context_imp = (TEEC_ContextImp *)context->imp;
 
        if (!context_imp) {
-               LOGE(TEEC_LIB, "NULL context_imp");
+               LOGE(MODULE_TEEC_LIB, "NULL context_imp");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -1209,7 +1209,7 @@ TEEC_Result TEEC_OpenSession(TEEC_Context *context, TEEC_Session *session,
        TEEC_SessionImp *session_imp = (TEEC_SessionImp *)session->imp;
 
        if (!session_imp) {
-               LOGE(TEEC_LIB, "NULL session_imp");
+               LOGE(MODULE_TEEC_LIB, "NULL session_imp");
                return TEEC_ERROR_OUT_OF_MEMORY;
        }
 
@@ -1220,7 +1220,7 @@ TEEC_Result TEEC_OpenSession(TEEC_Context *context, TEEC_Session *session,
                result = preProcessOperation(session, operation, &op, tmpSharedMem);
 
                if (result != TEEC_SUCCESS) {
-                       LOGE(TEEC_LIB, "preProcessOperation failed");
+                       LOGE(MODULE_TEEC_LIB, "preProcessOperation failed");
                        OsaFree(session_imp);
                        session->imp = NULL;
 
@@ -1248,7 +1248,7 @@ TEEC_Result TEEC_OpenSession(TEEC_Context *context, TEEC_Session *session,
        pthread_mutex_unlock(&context_imp->lock);
 
        if (result != TEEC_SUCCESS) { // Communication Failure
-               LOGE(TEEC_LIB, "sendCommand to Simulator Daemon failed");
+               LOGE(MODULE_TEEC_LIB, "sendCommand to Simulator Daemon failed");
 
                if (returnOrigin) *returnOrigin = TEEC_ORIGIN_COMMS;
 
@@ -1274,7 +1274,7 @@ TEEC_Result TEEC_OpenSession(TEEC_Context *context, TEEC_Session *session,
        result = os.returnValue;
 
        if (result != TEEC_SUCCESS) { // Command Failure
-               LOGE(TEEC_LIB, "Simulator Daemon Open Session returned failure");
+               LOGE(MODULE_TEEC_LIB, "Simulator Daemon Open Session returned failure");
                OsaFree(session_imp);
                session->imp = NULL;
 
@@ -1320,13 +1320,13 @@ TEEC_Result TEEC_OpenSession(TEEC_Context *context, TEEC_Session *session,
 void TEEC_CloseSession(TEEC_Session *session)
 {
 
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Result result = TEEC_SUCCESS;
        CloseSessionData cs;
 
        // Check if Session is valid
        if (!session) {
-               LOGE(TEEC_LIB, "NULL session");
+               LOGE(MODULE_TEEC_LIB, "NULL session");
                return;
        }
 
@@ -1334,13 +1334,13 @@ void TEEC_CloseSession(TEEC_Session *session)
        TEEC_SessionImp *session_imp = (TEEC_SessionImp *)session->imp;
 
        if (!session_imp) {
-               LOGE(TEEC_LIB, "NULL session_imp");
+               LOGE(MODULE_TEEC_LIB, "NULL session_imp");
                return;
        }
 
        // Check if the context is initialized
        if (!checkContext(session_imp->context)) {
-               LOGE(TEEC_LIB, "Invalid context");
+               LOGE(MODULE_TEEC_LIB, "Invalid context");
                return;
        }
 
@@ -1348,7 +1348,7 @@ void TEEC_CloseSession(TEEC_Session *session)
        TEEC_ContextImp *context_imp = (TEEC_ContextImp *)session_imp->context->imp;
 
        if (!context_imp || context_imp->sockfd < 0) {
-               LOGE(TEEC_LIB, "Bad parameters");
+               LOGE(MODULE_TEEC_LIB, "Bad parameters");
                return;
        }
 
@@ -1365,7 +1365,7 @@ void TEEC_CloseSession(TEEC_Session *session)
        pthread_mutex_unlock(&context_imp->lock);
 
        if (result != TEEC_SUCCESS) { // Communication Failure
-               LOGE(TEEC_LIB, "sendCommand to Simulator Daemon failed");
+               LOGE(MODULE_TEEC_LIB, "sendCommand to Simulator Daemon failed");
                return;
        }
 
@@ -1400,7 +1400,7 @@ TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint32_t commandID,
                                                           TEEC_Operation *operation, uint32_t *returnOrigin)
 {
 
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Result result = TEEC_SUCCESS;
 
        InvokeCommandData ic;
@@ -1417,7 +1417,7 @@ TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint32_t commandID,
 
        // Check if Session is valid
        if (!session) {
-               LOGE(TEEC_LIB, "NULL session");
+               LOGE(MODULE_TEEC_LIB, "NULL session");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -1425,13 +1425,13 @@ TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint32_t commandID,
        TEEC_SessionImp *session_imp = (TEEC_SessionImp *)session->imp;
 
        if (!session_imp) {
-               LOGE(TEEC_LIB, "NULL session_imp");
+               LOGE(MODULE_TEEC_LIB, "NULL session_imp");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
        // Check if the context is initialized
        if (!checkContext(session_imp->context)) {
-               LOGE(TEEC_LIB, "Invalid context");
+               LOGE(MODULE_TEEC_LIB, "Invalid context");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -1439,7 +1439,7 @@ TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint32_t commandID,
        TEEC_ContextImp *context_imp = (TEEC_ContextImp *)session_imp->context->imp;
 
        if (!context_imp) {
-               LOGE(TEEC_LIB, "NULL context_imp");
+               LOGE(MODULE_TEEC_LIB, "NULL context_imp");
                return TEEC_ERROR_BAD_PARAMETERS;
        }
 
@@ -1454,7 +1454,7 @@ TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint32_t commandID,
                result = preProcessOperation(session, operation, &op, tmpSharedMem);
 
                if (result != TEEC_SUCCESS) {
-                       LOGE(TEEC_LIB, "preProcessOperation failed");
+                       LOGE(MODULE_TEEC_LIB, "preProcessOperation failed");
 
                        /* temp memref cleanup & release */
                        for (i = 0; i < 4; i++) {
@@ -1483,7 +1483,7 @@ TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint32_t commandID,
        pthread_mutex_unlock(&context_imp->lock);
 
        if (result != TEEC_SUCCESS) { // Communication Failure
-               LOGE(TEEC_LIB, "sendCommand to Simulator Daemon failed");
+               LOGE(MODULE_TEEC_LIB, "sendCommand to Simulator Daemon failed");
 
                if (returnOrigin) *returnOrigin = TEEC_ORIGIN_COMMS;
 
@@ -1501,7 +1501,7 @@ TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint32_t commandID,
                return result;
        }
 
-       LOGE(TEEC_LIB, "sendCommand to Simulator Daemon succes, origin=%d", ic.returnOrigin);
+       LOGE(MODULE_TEEC_LIB, "sendCommand to Simulator Daemon succes, origin=%d", ic.returnOrigin);
 
        if (returnOrigin) *returnOrigin = ic.returnOrigin;
 
@@ -1547,14 +1547,14 @@ TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint32_t commandID,
 void TEEC_RequestCancellation(TEEC_Operation *operation)
 {
 
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Result result = TEEC_SUCCESS;
 
        ReqCancellationData rc;
 
        // Check if cancellation is allowed
        if (operation->started != 0) {
-               LOGE(TEEC_LIB, "Cancellation not allowed");
+               LOGE(MODULE_TEEC_LIB, "Cancellation not allowed");
                return;
        }
 
@@ -1562,13 +1562,13 @@ void TEEC_RequestCancellation(TEEC_Operation *operation)
        TEEC_OperationImp *operation_imp = (TEEC_OperationImp *)operation->imp;
 
        if (!operation_imp) {
-               LOGE(TEEC_LIB, "NULL operation_imp");
+               LOGE(MODULE_TEEC_LIB, "NULL operation_imp");
                return;
        }
 
        // Check if session is valid
        if (!operation_imp->session) {
-               LOGE(TEEC_LIB, "NULL session");
+               LOGE(MODULE_TEEC_LIB, "NULL session");
                return;
        }
 
@@ -1576,13 +1576,13 @@ void TEEC_RequestCancellation(TEEC_Operation *operation)
        TEEC_SessionImp *session_imp = (TEEC_SessionImp *)operation_imp->session->imp;
 
        if (!session_imp) {
-               LOGE(TEEC_LIB, "NULL session_imp");
+               LOGE(MODULE_TEEC_LIB, "NULL session_imp");
                return;
        }
 
        // Check if the context is initialized
        if (!checkContext(session_imp->context)) {
-               LOGE(TEEC_LIB, "Invalid context");
+               LOGE(MODULE_TEEC_LIB, "Invalid context");
                return;
        }
 
@@ -1590,7 +1590,7 @@ void TEEC_RequestCancellation(TEEC_Operation *operation)
        TEEC_ContextImp *context_imp = (TEEC_ContextImp *)session_imp->context->imp;
 
        if (!context_imp) {
-               LOGE(TEEC_LIB, "NULL context_imp");
+               LOGE(MODULE_TEEC_LIB, "NULL context_imp");
                return;
        }
 
@@ -1608,7 +1608,7 @@ void TEEC_RequestCancellation(TEEC_Operation *operation)
        pthread_mutex_unlock(&context_imp->lock);
 
        if (result != TEEC_SUCCESS)
-               LOGE(TEEC_LIB, "sendCommand to Simulator Daemon failed");
+               LOGE(MODULE_TEEC_LIB, "sendCommand to Simulator Daemon failed");
 
        return;
 }
index 77a40dd..da805d3 100644 (file)
@@ -47,7 +47,7 @@
  */
 TEEC_Result connectToServer(int32_t *fd)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        int32_t serverSocket, socklen;
        struct sockaddr *sockptr;
        struct sockaddr_un daemonsock;
@@ -58,13 +58,13 @@ TEEC_Result connectToServer(int32_t *fd)
 
        // Check simulator socket name length is valid
        if (daemonsock.sun_path[sizeof(daemonsock.sun_path)-1] != 0) {
-               LOGE(TEEC_LIB, "Socket name too long: ", daemonsock.sun_path);
+               LOGE(MODULE_TEEC_LIB, "Socket name too long: ", daemonsock.sun_path);
                return TEEC_ERROR_GENERIC;
        }
 
        // Get socket decriptor
        if ((serverSocket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
-               LOGE(TEEC_LIB, "No socket for simdaemon");
+               LOGE(MODULE_TEEC_LIB, "No socket for simdaemon");
                return TEEC_ERROR_GENERIC;
        }
 
@@ -73,7 +73,7 @@ TEEC_Result connectToServer(int32_t *fd)
 
        // Connect to Simulator Daemon
        if (connect(serverSocket, sockptr, socklen) == -1) {
-               LOGE(TEEC_LIB, "connection to simdaemon(%s) failed errno=%d", SIMDAEMON_SOCK_PATH, errno);
+               LOGE(MODULE_TEEC_LIB, "connection to simdaemon(%s) failed errno=%d", SIMDAEMON_SOCK_PATH, errno);
                close(serverSocket);
                if (errno == EACCES)
                        return TEEC_ERROR_ACCESS_DENIED;
@@ -95,19 +95,19 @@ TEEC_Result connectToServer(int32_t *fd)
 void disconnectfromServer(int32_t serverSocket)
 {
        int32_t result;
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
 
        if (serverSocket >= 0) {
                // shutdown the socket
                result = shutdown(serverSocket, SHUT_WR);
 
                if (result != 0)
-                       LOGE(TEEC_LIB, "disconnectfromServer failed");
+                       LOGE(MODULE_TEEC_LIB, "disconnectfromServer failed");
 
                // close the socket
                close(serverSocket);
        } else
-               LOGE(TEEC_LIB, "Invalid socket, disconnectfromServer failed");
+               LOGE(MODULE_TEEC_LIB, "Invalid socket, disconnectfromServer failed");
 }
 
 /*
@@ -124,7 +124,7 @@ void disconnectfromServer(int32_t serverSocket)
  */
 static uint32_t sendCommandtoDaemon(int32_t sockfd, char *fdata, size_t size)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        ssize_t nwrite = 0;
        size_t nbytes = 0;
 
@@ -139,7 +139,7 @@ static uint32_t sendCommandtoDaemon(int32_t sockfd, char *fdata, size_t size)
                return (size != nbytes) ? errno : 0;
        }
 
-       LOGE(TEEC_LIB, "failed");
+       LOGE(MODULE_TEEC_LIB, "failed");
        return TEEC_ERROR_COMMUNICATION;
 }
 
@@ -157,7 +157,7 @@ static uint32_t sendCommandtoDaemon(int32_t sockfd, char *fdata, size_t size)
  */
 static uint32_t receiveResponse(int32_t sockfd, char *fdata, size_t size)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        ssize_t nread = 0;
        size_t nbytes = 0;
 
@@ -172,7 +172,7 @@ static uint32_t receiveResponse(int32_t sockfd, char *fdata, size_t size)
                return (size != nbytes) ? errno : 0;
        }
 
-       LOGE(TEEC_LIB, "failed");
+       LOGE(MODULE_TEEC_LIB, "failed");
        return TEEC_ERROR_COMMUNICATION;
 }
 
@@ -193,7 +193,7 @@ static uint32_t receiveResponse(int32_t sockfd, char *fdata, size_t size)
 static uint32_t Test(char cmd, char *fdata, size_t size, uint32_t in)
 {
 
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        FILE *f1 = NULL;
        char *fname;
        uint32_t type, i, j, shmid, key;
@@ -299,19 +299,19 @@ static uint32_t Test(char cmd, char *fdata, size_t size, uint32_t in)
                                                           IPC_CREAT | 0666);
 
                                if (shmid == -1) {
-                                       LOGE(TEEC_LIB, "shmget failed");
+                                       LOGE(MODULE_TEEC_LIB, "shmget failed");
                                        ret = TEEC_ERROR_GENERIC;
                                        break;
                                }
 
                                if ((buffer = (char *) shmat(shmid, NULL, 0)) == (char *) - 1) {
-                                       LOGE(TEEC_LIB, "shmat failed");
+                                       LOGE(MODULE_TEEC_LIB, "shmat failed");
                                        ret = TEEC_ERROR_GENERIC;
                                        break;
                                }
 
                                if (!buffer) {
-                                       LOGE(TEEC_LIB, "shmat failed");
+                                       LOGE(MODULE_TEEC_LIB, "shmat failed");
                                        ret = TEEC_ERROR_GENERIC;
                                        break;
                                }
@@ -383,19 +383,19 @@ static uint32_t Test(char cmd, char *fdata, size_t size, uint32_t in)
                                                           IPC_CREAT | 0666);
 
                                if (shmid == -1) {
-                                       LOGE(TEEC_LIB, "shmget failed");
+                                       LOGE(MODULE_TEEC_LIB, "shmget failed");
                                        ret = TEEC_ERROR_GENERIC;
                                        break;
                                }
 
                                if ((buffer = (char *) shmat(shmid, NULL, 0)) == (char *) - 1) {
-                                       LOGE(TEEC_LIB, "shmat failed");
+                                       LOGE(MODULE_TEEC_LIB, "shmat failed");
                                        ret = TEEC_ERROR_GENERIC;
                                        break;
                                }
 
                                if (!buffer) {
-                                       LOGE(TEEC_LIB, "shmat failed");
+                                       LOGE(MODULE_TEEC_LIB, "shmat failed");
                                        ret = TEEC_ERROR_GENERIC;
                                        break;
                                }
@@ -432,7 +432,7 @@ static uint32_t Test(char cmd, char *fdata, size_t size, uint32_t in)
                break;
 
        default:
-               LOGE(TEEC_LIB, "Invalid command");
+               LOGE(MODULE_TEEC_LIB, "Invalid command");
        }
 
        if (f1 != NULL)
@@ -457,7 +457,7 @@ static uint32_t Test(char cmd, char *fdata, size_t size, uint32_t in)
  */
 uint32_t sendCommand(int32_t sockfd, TEE_CMD cmd, void *data, size_t size)
 {
-       LOGD(TEEC_LIB, "Entry");
+       LOGD(MODULE_TEEC_LIB, "Entry");
        TEEC_Result result = TEEC_SUCCESS;
        char command = (char)cmd;
 
index df4aea8..7366185 100644 (file)
@@ -69,7 +69,7 @@ bool TAProperty::readPropertyFile() {
                    "properties")->first_node("general");\r
                for (xml_attribute<> *attr = propertiesName->first_attribute(); attr; attr =\r
                    attr->next_attribute()) {\r
-                       //LOGD(TEE_STUB, "Permission vector: %s", string(childnode->first_attribute("name")->value()));\r
+                       //LOGD(MODULE_TEE_STUB, "Permission vector: %s", string(childnode->first_attribute("name")->value()));\r
                        //1. Populate the map\r
                        PropertyValue newValue;\r
                        string type;\r
@@ -139,7 +139,7 @@ bool TAProperty::readPropertyFile() {
        }\r
        // Catch rapid xml errors\r
        catch (rapidxml::parse_error &e) {\r
-               LOGE(TEE_STUB, "xml exception, at TA Properties %d", e.what());\r
+               LOGE(MODULE_TEE_STUB, "xml exception, at TA Properties %d", e.what());\r
                return false;\r
        }\r
        return true;\r
index d82af16..918779b 100644 (file)
@@ -65,7 +65,7 @@ bool TEEProperty::readPropertyFile(string filePath) {
                xml_node<> *propertiesName = doc.first_node("teeproperties");\r
                for (xml_node<> *childnode = propertiesName->first_node("property");\r
                    childnode; childnode = childnode->next_sibling()) {\r
-                       //LOGD(TEE_STUB, "Permission vector: %s", string(childnode->first_attribute("name")->value()));\r
+                       //LOGD(MODULE_TEE_STUB, "Permission vector: %s", string(childnode->first_attribute("name")->value()));\r
                        // Populate the map\r
                        PropertyValue newValue;\r
                        newValue.type = childnode->first_attribute("type")->value();\r
@@ -75,7 +75,7 @@ bool TEEProperty::readPropertyFile(string filePath) {
        }\r
        // Catch rapid xml errors\r
        catch (rapidxml::parse_error &e) {\r
-               LOGE(TEE_STUB, "xml exception, at TEE Properties %s", e.what());\r
+               LOGE(MODULE_TEE_STUB, "xml exception, at TEE Properties %s", e.what());\r
                return false;\r
        }\r
        return true;\r
index 17db1d3..54d0191 100644 (file)
@@ -48,7 +48,7 @@ CommandCloseSession::CommandCloseSession(CloseTASessionData data) :
 TEE_Result CommandCloseSession::execute() {
        TOGGLE_PROPERTY_ACCESS;
        TA_CloseSessionEntryPoint(sessionContext);
-       LOGD(TEE_STUB, "TA_CloseSessionEntryPoint done");
+       LOGD(MODULE_TEE_STUB, "TA_CloseSessionEntryPoint done");
        TOGGLE_PROPERTY_ACCESS;
        return TEE_SUCCESS;
 }
index bb32028..0ffcb84 100644 (file)
@@ -43,7 +43,7 @@ CommandCreateEntryPoint::CommandCreateEntryPoint(CreateTAEntryPointData _data) :
  */
 TEE_Result CommandCreateEntryPoint::execute() {
        data.returnValue = TA_CreateEntryPoint();
-       LOGD(TEE_STUB, "TA_CreateEntryPoint done");
+       LOGD(MODULE_TEE_STUB, "TA_CreateEntryPoint done");
        return data.returnValue;
 }
 
index 616b12f..818011b 100644 (file)
@@ -44,7 +44,7 @@ CommandDestroyEntryPoint::CommandDestroyEntryPoint(DestroyTAEntryPointData _data
  */
 TEE_Result CommandDestroyEntryPoint::execute() {
        TA_DestroyEntryPoint();
-       LOGD(TEE_STUB, "TA_DestroyEntryPoint done");
+       LOGD(MODULE_TEE_STUB, "TA_DestroyEntryPoint done");
        exit(0);
        return TEE_SUCCESS;
 }
index 0bd908a..0c2ae74 100644 (file)
@@ -63,13 +63,13 @@ TEE_Result CommandInvoke::execute() {
                data.returnOrigin = TEE_ORIGIN_TRUSTED_APP;
                data.returnValue = TA_InvokeCommandEntryPoint(sessionContext,
                    data.commandID, data.op.paramTypes, data.op.params);
-               LOGD(TEE_STUB, "TA_InvokeCommandEntryPoint done, data.origin = %d", data.returnOrigin);
+               LOGD(MODULE_TEE_STUB, "TA_InvokeCommandEntryPoint done, data.origin = %d", data.returnOrigin);
        } else {
                data.returnValue = TEE_ERROR_OUT_OF_MEMORY;
        }
        sharedResult = SharedMemoryMap::deleteSharedMemory(data.op);
        if (!sharedResult) {
-               LOGE(TEE_STUB, "deleteSharedMemory failed");
+               LOGE(MODULE_TEE_STUB, "deleteSharedMemory failed");
        }
 
        TOGGLE_PROPERTY_ACCESS;
index 7a8eddb..1133de4 100644 (file)
@@ -58,13 +58,13 @@ TEE_Result CommandOpenSession::execute() {
                data.returnOrigin = TEE_ORIGIN_TRUSTED_APP;
                data.returnValue = TA_OpenSessionEntryPoint(data.op.paramTypes,
                    data.op.params, &sessionContext);
-               LOGD(TEE_STUB, "TA_OpenSessionEntryPoint done");
+               LOGD(MODULE_TEE_STUB, "TA_OpenSessionEntryPoint done");
        } else {
                data.returnValue = TEE_ERROR_OUT_OF_MEMORY;
        }
        sharedResult = SharedMemoryMap::deleteSharedMemory(data.op);
        if (!sharedResult) {
-               LOGE(TEE_STUB, "deleteSharedMemory failed");
+               LOGE(MODULE_TEE_STUB, "deleteSharedMemory failed");
        }
        TOGGLE_PROPERTY_ACCESS;
        return data.returnValue;
index 1ee9c87..a37e289 100644 (file)
@@ -95,7 +95,7 @@ bool SharedMemoryMap::deleteFromMap(uint32_t key) {
                }
 
                if (munmap(item.pBuffer, item.size) == -1) {
-                       LOGE(TEE_STUB, "cannot munmap buffer %p, error: %s", item.pBuffer, strerror(errno));
+                       LOGE(MODULE_TEE_STUB, "cannot munmap buffer %p, error: %s", item.pBuffer, strerror(errno));
                        return false;
                }
 
@@ -134,7 +134,7 @@ void* SharedMemoryMap::newOnceSharedMemory(uint32_t size) {
                }
 
                if (errno != EEXIST) {
-                       LOGE(TEE_STUB, "Cannot create shared memory object %s, error: %s",
+                       LOGE(MODULE_TEE_STUB, "Cannot create shared memory object %s, error: %s",
                                        shm_name.c_str(), strerror(errno));
                        return NULL;
                }
@@ -143,7 +143,7 @@ void* SharedMemoryMap::newOnceSharedMemory(uint32_t size) {
        } while (memKey < SHM_MAX_ID);
 
        if (memKey == SHM_MAX_ID) {
-               LOGE(TEE_STUB, "Cannot find free shared memory slot");
+               LOGE(MODULE_TEE_STUB, "Cannot find free shared memory slot");
                return NULL;
        }
 
@@ -151,14 +151,14 @@ void* SharedMemoryMap::newOnceSharedMemory(uint32_t size) {
 
        if (ftruncate(fd_shm, size) == -1) {
                close(fd_shm);
-               LOGE(TEE_STUB, "ftruncate failed, error: %s", strerror(errno));
+               LOGE(MODULE_TEE_STUB, "ftruncate failed, error: %s", strerror(errno));
                return NULL;
        }
 
        void *buffer = (void *) mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd_shm, 0);
        if (buffer == NULL) {
                close(fd_shm);
-               LOGE(TEE_STUB, "newOnceSharedMemory mmap failed, size: %u error: %s",
+               LOGE(MODULE_TEE_STUB, "newOnceSharedMemory mmap failed, size: %u error: %s",
                         size, strerror(errno));
                return NULL;
        }
@@ -172,7 +172,7 @@ void* SharedMemoryMap::newOnceSharedMemory(uint32_t size) {
        // Add shared memory allocated to shared memory map so that
        // it can be detached on closing the sessions or exiting the TA
        SharedMemoryMap::addToMap(memKey, &item);
-       LOGD(TEE_STUB, "newOnceSharedMemory return %p(size:%u)", buffer, size);
+       LOGD(MODULE_TEE_STUB, "newOnceSharedMemory return %p(size:%u)", buffer, size);
        return buffer;
 }
 
@@ -188,13 +188,13 @@ bool SharedMemoryMap::deleteOnceSharedMemory(void* buffer) {
                        std::string shm_name(SHM_NAME_PREFIX + std::to_string(it->first));
 
                        if (munmap(item.pBuffer, item.size) == -1) {
-                               LOGE(TEE_STUB, "can not find munmap buffer %p, error: %s",
+                               LOGE(MODULE_TEE_STUB, "can not find munmap buffer %p, error: %s",
                                                buffer, strerror(errno));
                                return false;
                        }
 
                        if (shm_unlink(shm_name.c_str()) == -1) {
-                               LOGE(TEE_STUB, "cannot shm_unlink %s, error: %s",
+                               LOGE(MODULE_TEE_STUB, "cannot shm_unlink %s, error: %s",
                                                shm_name.c_str(), strerror(errno));
                                return false;
                        }
@@ -205,7 +205,7 @@ bool SharedMemoryMap::deleteOnceSharedMemory(void* buffer) {
                }
        }
 
-       LOGE(TEE_STUB, "deleteOnceSharedMemory failed (cannot find %p)", buffer);
+       LOGE(MODULE_TEE_STUB, "deleteOnceSharedMemory failed (cannot find %p)", buffer);
        return false;
 }
 
@@ -234,7 +234,7 @@ bool SharedMemoryMap::allocateSharedMemory(Operation &op) {
 
                                int fd_shm = shm_open(shm_name.c_str(), O_RDWR, 0);
                                if (fd_shm == -1) {
-                                       LOGE(TEE_STUB, "shm_open %s failed, error: %s", shm_name.c_str(), strerror(errno));
+                                       LOGE(MODULE_TEE_STUB, "shm_open %s failed, error: %s", shm_name.c_str(), strerror(errno));
                                        return false;
                                }
 
@@ -245,13 +245,13 @@ bool SharedMemoryMap::allocateSharedMemory(Operation &op) {
                                close(fd_shm);
 
                                if (op.params[i].memref.buffer == MAP_FAILED) {
-                                       LOGE(TEE_STUB, "allocateSharedMemory mmap failed, size: %u error: %s",
+                                       LOGE(MODULE_TEE_STUB, "allocateSharedMemory mmap failed, size: %u error: %s",
                                                 size, strerror(errno));
                                        return false;
                                }
 
                                if (!op.params[i].memref.buffer) {
-                                       LOGE(TEE_STUB, "allocate failed, the buffer is NULL");
+                                       LOGE(MODULE_TEE_STUB, "allocate failed, the buffer is NULL");
                                        return false;
                                }
 
@@ -285,7 +285,7 @@ bool SharedMemoryMap::deleteSharedMemory(Operation &op) {
                    && (type != TEE_PARAM_TYPE_VALUE_INOUT)
                    && (type != TEE_PARAM_TYPE_NONE)) {
                        if (!op.params[i].memref.buffer) {
-                               LOGE(TEE_STUB, "de-allocate failed");
+                               LOGE(MODULE_TEE_STUB, "de-allocate failed");
                                sharedResult = false;
                        }
                        if(sharedResult != false) {
@@ -307,18 +307,18 @@ bool SharedMemoryMap::deleteAllSharedMemory() {
        for (map<uint32_t, registerItem>::iterator it = shmMap.begin(); it != shmMap.end();) {
                registerItem item = it->second;
 
-               LOGE(TEE_STUB, "item will be freed (%p (%u))", item.pBuffer, item.size);
+               LOGE(MODULE_TEE_STUB, "item will be freed (%p (%u))", item.pBuffer, item.size);
 
                std::string shm_name(SHM_NAME_PREFIX + std::to_string(it->first));
 
                if (munmap(item.pBuffer, item.size) == -1) {
-                       LOGE(TEE_STUB, "cannot munmap buffer %p, error: %s",
+                       LOGE(MODULE_TEE_STUB, "cannot munmap buffer %p, error: %s",
                             item.pBuffer, strerror(errno));
                        return false;
                }
 
                if (shm_unlink(shm_name.c_str()) == -1) {
-                       LOGE(TEE_STUB, "cannot shm_unlink %s, error: %s",
+                       LOGE(MODULE_TEE_STUB, "cannot shm_unlink %s, error: %s",
                             shm_name.c_str(), strerror(errno));
                        return false;
                }
index 821898f..213f8c9 100644 (file)
@@ -63,7 +63,7 @@ void ConnectionSession::handleRead(const boost::system::error_code& error,
                READ_PAYLOAD, PAYLOAD_COMPLETE,
        } states;
        static states currentState = READ_PAYLOAD;
-       LOGD(TEE_STUB, "Entry");
+       LOGD(MODULE_TEE_STUB, "Entry");
        if (!error) {
                /**
                 * A simple small state machine to parse command and handle its
@@ -78,7 +78,7 @@ void ConnectionSession::handleRead(const boost::system::error_code& error,
                        case READ_PAYLOAD: {
                                // Identify command
                                command = (SIM_COMMAND)clientData.at(0);
-                               LOGD(TEE_STUB, "Command received: %d", (int)command);
+                               LOGD(MODULE_TEE_STUB, "Command received: %d", (int)command);
 
                                // Calculate pending numbers of bytes pending to be read only for commands
                                // OPENSESSION, INVOKECOMMAND, CLOSESESSION
@@ -95,7 +95,7 @@ void ConnectionSession::handleRead(const boost::system::error_code& error,
                                } else if (-1 == payload_size) {
                                        // else case is invalid command
                                        // TODO: Identify the correct behaviour; what to do when invalid command is received?
-                                       LOGE(TEE_STUB, "Invalid command received!");
+                                       LOGE(MODULE_TEE_STUB, "Invalid command received!");
                                } else if (0 == payload_size) {
                                        // Call the TaskStrategy object to handle commands
                                        taskThread->handleCommand(MakeCommand::getCommand(command, (void*)0));
@@ -139,9 +139,9 @@ void ConnectionSession::handleRead(const boost::system::error_code& error,
                } //switch
        } else {
        // On error
-               LOGE(TEE_STUB, "error code %s", error.category().name());
+               LOGE(MODULE_TEE_STUB, "error code %s", error.category().name());
                if (boost::asio::error::eof == error.value()) {
-                       LOGE(TEE_STUB, "Simulator daemon is down! Exiting this TA instance.");
+                       LOGE(MODULE_TEE_STUB, "Simulator daemon is down! Exiting this TA instance.");
                        taskThread->stopThread();
                }
        }
index 3af9ffe..8de6369 100644 (file)
@@ -39,7 +39,7 @@ TEEStubServer::TEEStubServer(boost::asio::io_service& io_service,
     const std::string& file) :
                mem_io_service(io_service),
                    acceptor(io_service, stream_protocol::endpoint(file)) {
-       LOGD(TEE_STUB, "Waiting for connection from Simulator daemon");
+       LOGD(MODULE_TEE_STUB, "Waiting for connection from Simulator daemon");
        session_ptr new_session(new ConnectionSession(mem_io_service));
        acceptor.async_accept(new_session->socket(),
            boost::bind(&TEEStubServer::handleAccept, this, new_session,
@@ -58,9 +58,9 @@ void TEEStubServer::handleAccept(session_ptr new_session,
        }
        // Below is test code to handle multiple concurrent connections
        // Disabled as it is a test feature here
-       //LOGD(TEE_STUB, "Shared ptr ref count (before reset): %d", new_session.use_count());
+       //LOGD(MODULE_TEE_STUB, "Shared ptr ref count (before reset): %d", new_session.use_count());
        new_session.reset(new ConnectionSession(mem_io_service));
-       //LOGD(TEE_STUB, "Shared ptr ref count (after reset): %d", new_session.use_count());
+       //LOGD(MODULE_TEE_STUB, "Shared ptr ref count (after reset): %d", new_session.use_count());
        acceptor.async_accept(new_session->socket(),
            boost::bind(&TEEStubServer::handleAccept, this, new_session,
                boost::asio::placeholders::error));
index 9f358de..6adfb9c 100644 (file)
@@ -51,9 +51,9 @@ TaskQueuedStrategy::TaskQueuedStrategy(stream_protocol::socket &msocket) :
  * @param command[in] task/command to be queued for execution
  */
 void TaskQueuedStrategy::handleCommand(CommandBasePtr command) {
-       LOGD(TEE_STUB, "Entry");
+       LOGD(MODULE_TEE_STUB, "Entry");
        if (command->isCancelCommand()) {
-               LOGD(TEE_STUB, "A Cancel command has been received!");
+               LOGD(MODULE_TEE_STUB, "A Cancel command has been received!");
                executeCancellation(command);
        } else {
                boost::unique_lock<boost::mutex> lck(ready_mutex);
@@ -62,13 +62,13 @@ void TaskQueuedStrategy::handleCommand(CommandBasePtr command) {
                        SessionState ss(command->sessionID);
                        ss.addTask(command);
                        sessionTaskMap[command->sessionID] = ss;
-                       LOGD(TEE_STUB, "New Session ID");
+                       LOGD(MODULE_TEE_STUB, "New Session ID");
                } else {
                // Else, the session ID exists in map, so append to list in session
-                       LOGD(TEE_STUB, "Session ID Exists, adding tasks");
+                       LOGD(MODULE_TEE_STUB, "Session ID Exists, adding tasks");
                        sessionTaskMap[command->sessionID].addTask(command);
                }
-               LOGD(TEE_STUB, "MapSize: %d", sessionTaskMap.size());
+               LOGD(MODULE_TEE_STUB, "MapSize: %d", sessionTaskMap.size());
                cmdReady = true;
                ready_cond.notify_all();
        }
@@ -88,17 +88,17 @@ void TaskQueuedStrategy::executeCancellation(CommandBasePtr cancelCommand) {
        // check if the currently executing task needs to be cancelled.
        // If so set the shared data flag to communicate that the
        // current task should be cancelled.
-       //LOGD(TEE_STUB, "Current Command UID: %s", currentCommand->getCommandUID());
-       //LOGD(TEE_STUB, "Cancel Command UID: %s", cancelCommand->getCommandUID());
+       //LOGD(MODULE_TEE_STUB, "Current Command UID: %s", currentCommand->getCommandUID());
+       //LOGD(MODULE_TEE_STUB, "Cancel Command UID: %s", cancelCommand->getCommandUID());
        if (currentCommand->getCommandUID() == cancelCommand->getCommandUID()) {
-               LOGD(TEE_STUB, "Cancel command matched with current task");
+               LOGD(MODULE_TEE_STUB, "Cancel command matched with current task");
                sharedData.thisTaskCancel = true;
        } else {
        // If the task to be cancelled is not the current task
        // then the task must be in execution queue, yet to be executed.
        // Just push the request to cancellation vector using
        // cancel commands execute
-               LOGD(TEE_STUB, "Cancel command queued");
+               LOGD(MODULE_TEE_STUB, "Cancel command queued");
                cancelCommand->execute();
        }
 }
@@ -107,7 +107,7 @@ void TaskQueuedStrategy::executeCancellation(CommandBasePtr cancelCommand) {
  * Execute all tasks inside a session
  */
 void TaskQueuedStrategy::executeCommands() {
-       LOGD(TEE_STUB, "Entry");
+       LOGD(MODULE_TEE_STUB, "Entry");
        /**
         * Iterate the map for all SessionStates and dequeue all
         * the Tasks from the queue. Execute the dequeued tasks.
@@ -152,9 +152,9 @@ void TaskQueuedStrategy::executeCommands() {
                                                        boost::asio::write(clientSocket,
                                                            boost::asio::buffer(writeData, size + 1), ec);
                                                        if (!ec)
-                                                               LOGD(TEE_STUB, "Reply written back");
+                                                               LOGD(MODULE_TEE_STUB, "Reply written back");
                                                        else
-                                                       LOGE(TEE_STUB, "Reply write failed!");
+                                                       LOGE(MODULE_TEE_STUB, "Reply write failed!");
                                                        task = itr->second.getNextTask();
                                                }                            //if-else
                                        } //while
@@ -172,7 +172,7 @@ void TaskQueuedStrategy::executeCommands() {
  * Start the executor thread which executes task queue in all sessions.
  */
 void TaskQueuedStrategy::startThread() {
-       LOGD(TEE_STUB, "Entry");
+       LOGD(MODULE_TEE_STUB, "Entry");
        runThread = true;
        executorThread = boost::thread(&TaskQueuedStrategy::executeCommands, this);
 }
index b66cd4e..d09cd28 100644 (file)
@@ -50,13 +50,13 @@ boost::asio::io_service io_service; ///< io_service provides OS abstraction for
 void StartServer(string socketName) {
        try {
                ::unlink(socketName.c_str());
-               LOGD(TEE_STUB, "Waiting on socket %s", socketName.c_str());
+               LOGD(MODULE_TEE_STUB, "Waiting on socket %s", socketName.c_str());
                TEEStubServer s(io_service, socketName.c_str());
                io_service.run();
        } catch (std::exception& e) {
-               LOGE(TEE_STUB, "Exception: %s", e.what());
+               LOGE(MODULE_TEE_STUB, "Exception: %s", e.what());
        } catch (...) {
-               LOGE(TEE_STUB, "Unknown exception");
+               LOGE(MODULE_TEE_STUB, "Unknown exception");
        }
 }
 
@@ -76,7 +76,7 @@ void StopServer() {
  */
 int main(int argc, char* argv[]) {
        if (argc < 2) {
-               LOGE(TEE_STUB, "Invalid arguments to TEE Stub");
+               LOGE(MODULE_TEE_STUB, "Invalid arguments to TEE Stub");
        }
        //for export function
        getSharedMemoryAddress(0);
@@ -90,7 +90,7 @@ int main(int argc, char* argv[]) {
 
        // grab full TA directory to be able to open the manifest
        std::string taDir = fullPath.substr(0, lastSlashPos + 1);
-       LOGI(TEE_STUB, "UUID: %s, TA directory: %s", uuid.c_str(), taDir.c_str());
+       LOGI(MODULE_TEE_STUB, "UUID: %s, TA directory: %s", uuid.c_str(), taDir.c_str());
 
        // Initialize Properties module
        // TODO: fetch login method from Context, not to be hardcoded
@@ -109,9 +109,9 @@ int main(int argc, char* argv[]) {
        // Once the server is started, it exits only after the
        // connection is lost or gracefully disconnected.
        std::string sock = string(TEE_TASOCK_ROOT) + argv[1];
-       LOGD(TEE_STUB, "StartServer on %s\n", sock.c_str());
+       LOGD(MODULE_TEE_STUB, "StartServer on %s\n", sock.c_str());
        StartServer(sock);
-       LOGD(TEE_STUB, "Exiting TEEStub\n");
+       LOGD(MODULE_TEE_STUB, "Exiting TEEStub\n");
        // Deallocate property objects
        if (TEE_SUCCESS == initStatus) DeInitPropertyModule();
 
index bdbc890..014df39 100644 (file)
--- a/log/log.c
+++ b/log/log.c
@@ -54,7 +54,7 @@ __attribute__((visibility("default")))
 void setDebugAndModuleLevel(IN const int32_t module_level,
                            IN const LogLevel log_level)
 {
-       if (module_level < UTILS || module_level > ALL_MODULES
+       if (module_level < MODULE_UTILS || module_level > MODULE_ALL
            || log_level < SIMU_LOG_EMERG || log_level > SIMU_LOG_SILENT)
                return;
 
@@ -108,22 +108,22 @@ const char *getDebugLevelString(IN LogLevel dbg_level)
 const char *getModuleLevelString(IN int32_t module_level)
 {
        switch (module_level) {
-       case UTILS:
+       case MODULE_UTILS:
                return "UTILS";
 
-       case SIM_DAEMON:
+       case MODULE_SIM_DAEMON:
                return "SIM_DAEMON";
 
-       case TEEC_LIB:
+       case MODULE_TEEC_LIB:
                return "TEEC_LIB";
 
-       case TEE_STUB:
+       case MODULE_TEE_STUB:
                return "TEE_STUB";
 
-       case SSF_LIB:
+       case MODULE_SSF_LIB:
                return "SSF_LIB";
 
-       case OSA_LIB:
+       case MODULE_OSA_LIB:
                return "OSA_LIB";
 
        default:
index ab4d85d..e56c588 100644 (file)
--- a/log/log.h
+++ b/log/log.h
@@ -58,14 +58,14 @@ typedef int timer_t;
  * Enum to identify Module name
  */
 typedef enum {
-       UTILS = 0x01,
-       SIM_DAEMON = 0x02,
-       TEEC_LIB = 0x04,
-       TEE_STUB = 0x08,
-       TEST = 0x10,
-       SSF_LIB = 0x20,
-       OSA_LIB = 0x40,
-       ALL_MODULES = 0xFFFFFFF,
+       MODULE_UTILS = 0x01,
+       MODULE_SIM_DAEMON = 0x02,
+       MODULE_TEEC_LIB = 0x04,
+       MODULE_TEE_STUB = 0x08,
+       MODULE_TEST = 0x10,
+       MODULE_SSF_LIB = 0x20,
+       MODULE_OSA_LIB = 0x40,
+       MODULE_ALL = 0xFFFFFFF,
 } ModuleLevel;
 
 typedef enum {
index a2c652b..87701a0 100644 (file)
@@ -149,7 +149,7 @@ int OsaTimerCreate(int *pTimerId, int periodic, int s32Time,
                 * Add SIGALRM in the list
                 */
                if (sigaddset(&(Action_t.sa_mask), SIGALRM) < 0) {
-                       LOGE(OSA_LIB, "In OsaTimerCreate() : Could Not Stop \n");
+                       LOGE(MODULE_OSA_LIB, "In OsaTimerCreate() : Could Not Stop \n");
                        return OSAL_ERROR;
                }
 
@@ -157,7 +157,7 @@ int OsaTimerCreate(int *pTimerId, int periodic, int s32Time,
                 * Unblock the SIGALRM,if it is blocked
                 */
                if (sigprocmask(SIG_UNBLOCK, &(Action_t.sa_mask), NULL) < 0) {
-                       LOGE(OSA_LIB, "In OsaTimerCreate() : Could not mask the Signal \n");
+                       LOGE(MODULE_OSA_LIB, "In OsaTimerCreate() : Could not mask the Signal \n");
                        return OSAL_ERROR;
                }
 
@@ -198,7 +198,7 @@ int OsaTimerStart(int iTimerId)
        /* The timer is started  */
        if (Timer_data_t.start_timer != TRUE) {
                if (setitimer(ITIMER_REAL, &Timer_data_t.iTval_t, NULL) < 0) {
-                       LOGE(OSA_LIB, "In OsaTimerStart() : OsaTimerStart  failed \n ");
+                       LOGE(MODULE_OSA_LIB, "In OsaTimerStart() : OsaTimerStart  failed \n ");
                        return OSAL_ERROR;
                }
 
@@ -234,7 +234,7 @@ int OsaTimerStop(int iTimerId)
        trivial_it.it_value.tv_usec = 0;
 
        if (setitimer(ITIMER_REAL, &trivial_it, NULL) == -1) {
-               LOGE(OSA_LIB, "OsaTimerStop failed\n ");
+               LOGE(MODULE_OSA_LIB, "OsaTimerStop failed\n ");
                return OSAL_ERROR;
        }
 
@@ -261,7 +261,7 @@ int OsaTimerDelete(int iTimerId)
        //Action_t.sa_flags = 0;
 
        if (Timer_data_t.start_timer == FALSE) {
-               LOGE(OSA_LIB, "In OsaTimerDelete() : No timer present to be deleted  \n");
+               LOGE(MODULE_OSA_LIB, "In OsaTimerDelete() : No timer present to be deleted  \n");
                return OSAL_ERROR;
        }
 
@@ -273,7 +273,7 @@ int OsaTimerDelete(int iTimerId)
        /* The Timer is deleted  */
 
        if (setitimer(ITIMER_REAL, &iTmpval_t, NULL) < 0) {
-               LOGE(OSA_LIB, "In OsaTimerDelete() : pOsaTimerDelete failed \n");
+               LOGE(MODULE_OSA_LIB, "In OsaTimerDelete() : pOsaTimerDelete failed \n");
                return -1;
        }
 
@@ -299,14 +299,14 @@ int OsaTimerRestart(int iTimerId)
        struct sigaction Action_t;
 
        if (Timer_data_t.stop_timer == TRUE) {
-               LOGE(OSA_LIB, "In OsaTimerRestart() : Has been stopped   forever \n");
+               LOGE(MODULE_OSA_LIB, "In OsaTimerRestart() : Has been stopped   forever \n");
                return OSAL_ERROR;
        }
 
        /* OSAL_080918_1 :
         reset it_value to keep the first expiration after restart */
        if (setitimer(ITIMER_REAL, &Timer_data_t.iTval_t, NULL) == -1) {
-               LOGE(OSA_LIB, "OsaTimerRestart failed\n ");
+               LOGE(MODULE_OSA_LIB, "OsaTimerRestart failed\n ");
                return OSAL_ERROR;
        }
 
@@ -317,7 +317,7 @@ int OsaTimerRestart(int iTimerId)
        Action_t.sa_flags = 0;
 
        if (sigprocmask(SIG_UNBLOCK, &(Action_t.sa_mask), NULL) < 0) {
-               LOGE(OSA_LIB, "In OsaTimerRestart() : Could Not Start Again \n");
+               LOGE(MODULE_OSA_LIB, "In OsaTimerRestart() : Could Not Start Again \n");
                return OSAL_ERROR;
        }
 
index 89b5190..de50644 100644 (file)
@@ -104,7 +104,7 @@ int OsaShmDetach(const void *pShmAddr)
                return OSAL_ERROR;
 
        if (shmdt(pShmAddr) == -1) {
-               LOGE(OSA_LIB, "Error in Detaching");
+               LOGE(MODULE_OSA_LIB, "Error in Detaching");
                return OSAL_ERROR;
        }
 
@@ -148,7 +148,7 @@ static int UlOsaNamedSemCreate(const char pcName[10], int iCount,
        sem = (UlOsaSem_t *)malloc(sizeof(*sem));
 
        if (!sem) {
-               LOGE(OSA_LIB, "UlOsaSemCreate, Out of memory!\n");
+               LOGE(MODULE_OSA_LIB, "UlOsaSemCreate, Out of memory!\n");
                return OSAL_ERROR;
        }
 
@@ -164,7 +164,7 @@ static int UlOsaNamedSemCreate(const char pcName[10], int iCount,
                if (semctl(sem->iSemId, 0, SETVAL, semUnion) == -1) {
                        semctl(sem->iSemId, 0, IPC_RMID, NULL);
                        free(sem);
-                       LOGE(OSA_LIB, "UlOsaSemCreate, semctl Failed!\n");
+                       LOGE(MODULE_OSA_LIB, "UlOsaSemCreate, semctl Failed!\n");
                        return OSAL_ERROR;
                }
        } else {
@@ -173,7 +173,7 @@ static int UlOsaNamedSemCreate(const char pcName[10], int iCount,
                        iRetVal = OSAL_EXIST;
                } else {
                        free(sem);
-                       LOGE(OSA_LIB, "UlOsaSemCreate, semget Failed!\n");
+                       LOGE(MODULE_OSA_LIB, "UlOsaSemCreate, semget Failed!\n");
                        return OSAL_ERROR;
                }
        }
@@ -227,7 +227,7 @@ static int UlOsaNamedSemGet(void *uiSmid, int iFlags, int iTimeout)
                ret = semop(sem->iSemId, &semBuf, 1);
        } else if (iTimeout == 0) {
                /* wait _inifinite_ */
-               LOGD(OSA_LIB, "UlOsaSemGet-infinite(%s).\n", sem->bName);
+               LOGD(MODULE_OSA_LIB, "UlOsaSemGet-infinite(%s).\n", sem->bName);
                semBuf.sem_num = 0;
                semBuf.sem_op = -1;
                semBuf.sem_flg = SEM_UNDO;
@@ -235,9 +235,9 @@ static int UlOsaNamedSemGet(void *uiSmid, int iFlags, int iTimeout)
                ret = OSAL_FAILURE_RETRY(semop(sem->iSemId, &semBuf, 1));
        } else {
                /* with _timeout_ */
-               LOGD(OSA_LIB, "UlOsaSemGet-timeout(%s).\n", sem->bName);
+               LOGD(MODULE_OSA_LIB, "UlOsaSemGet-timeout(%s).\n", sem->bName);
                if (iTimeout < 0) {
-                       LOGE(OSA_LIB, "UlOsaSemGet-timeout: invalid arg!\n");
+                       LOGE(MODULE_OSA_LIB, "UlOsaSemGet-timeout: invalid arg!\n");
                        return OSAL_ERROR;
                }
 
@@ -258,17 +258,17 @@ static int UlOsaNamedSemGet(void *uiSmid, int iFlags, int iTimeout)
 
        /* result */
        if (ret == 0) {
-               LOGD(OSA_LIB, "UlOsaSemGet(%s) success.\n", sem->bName);
+               LOGD(MODULE_OSA_LIB, "UlOsaSemGet(%s) success.\n", sem->bName);
                return OSAL_OK;
        } else {
                if (iFlags == OSAL_SEM_NOWAIT && errno == EAGAIN) {
-                       LOGE(OSA_LIB, "UlOsaSemGet-nowait: now locked, failed to get.\n");
+                       LOGE(MODULE_OSA_LIB, "UlOsaSemGet-nowait: now locked, failed to get.\n");
                        return OSAL_ERROR;
                } else if (iTimeout > 0 && errno == EAGAIN) {
-                       LOGE(OSA_LIB, "UlOsaSemGet-timeout(%s): time-out\n",    sem->bName);
+                       LOGE(MODULE_OSA_LIB, "UlOsaSemGet-timeout(%s): time-out\n",    sem->bName);
                        return OSAL_ERR_TIMEOUT;
                } else {
-                       LOGE(OSA_LIB, "UlOsaSemGet error, errno=%d\n", errno);
+                       LOGE(MODULE_OSA_LIB, "UlOsaSemGet error, errno=%d\n", errno);
                        return OSAL_ERROR;
                }
        }
@@ -282,13 +282,13 @@ static int UlOsaNamedSemRelease(void *uiSmid)
        if (!sem)
                return OSAL_ERROR;
 
-       LOGD(OSA_LIB, "UlOsaSemRelease(%s)\n", sem->bName);
+       LOGD(MODULE_OSA_LIB, "UlOsaSemRelease(%s)\n", sem->bName);
        semBuf.sem_num = 0;
        semBuf.sem_op = 1;
        semBuf.sem_flg = SEM_UNDO;
 
        if (semop(sem->iSemId, &semBuf, 1) == -1) {
-               LOGE(OSA_LIB, "UlOsaSemRelease(%s) error! errno=%d.\n", sem->bName, errno);
+               LOGE(MODULE_OSA_LIB, "UlOsaSemRelease(%s) error! errno=%d.\n", sem->bName, errno);
                return OSAL_ERROR;
        } else
                return OSAL_OK;
@@ -302,11 +302,11 @@ static int UlOsaNamedSemReset(void *uiSmid)
        if (!sem)
                return OSAL_ERROR;
 
-       LOGD(OSA_LIB, "UlOsaSemReset(%s).\n", sem->bName);
+       LOGD(MODULE_OSA_LIB, "UlOsaSemReset(%s).\n", sem->bName);
        semUnion.val = sem->iCount;
 
        if (semctl(sem->iSemId, 0, SETVAL, semUnion) == -1) {
-               LOGE(OSA_LIB, "UlOsaSemReset, semctl Failed!\n");
+               LOGE(MODULE_OSA_LIB, "UlOsaSemReset, semctl Failed!\n");
                return OSAL_ERROR;
        }
 
@@ -324,10 +324,10 @@ static int UlOsaNamedSemGetval(void *uiSmid)
        n = semctl(sem->iSemId, 0, GETVAL, NULL);
 
        if (n == -1) {
-               LOGE(OSA_LIB, "UlOsaSemGetval, semctl Failed!\n");
+               LOGE(MODULE_OSA_LIB, "UlOsaSemGetval, semctl Failed!\n");
                return OSAL_ERROR;
        } else {
-               LOGD(OSA_LIB, "UlOsaSemGetval(%s): now %d\n", sem->bName, n);
+               LOGD(MODULE_OSA_LIB, "UlOsaSemGetval(%s): now %d\n", sem->bName, n);
                return (int)n;
        }
 }
index 75d39c0..fb59766 100644 (file)
@@ -60,7 +60,7 @@ int OsaQueueCreate(const char bName[10], unsigned int uiFlags,
        mqd_t QuId;
 
        if (puiQid == NULL) {
-               LOGD(OSA_LIB, "Null Argument(s) \n");
+               LOGD(MODULE_OSA_LIB, "Null Argument(s) \n");
                return OSAL_ERROR;
        }
 
@@ -89,14 +89,14 @@ int OsaQueueCreate(const char bName[10], unsigned int uiFlags,
 
        if (((int)*puiQid) == -1) { //IPC_CREATE
                perror("In OsaQueueCreate() : msgget: msgget failed");
-               LOGE(OSA_LIB, "In OsaQueueCreate() : Error no. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "In OsaQueueCreate() : Error no. : %d\n", errno);
                return ((int)errno);
        }
 
        /* Get the current value from the structure for the message queue and copy it in buf_t*/
        if (msgctl((int)(*puiQid), IPC_STAT, &tSetMqAttr) == -1) {
                perror("In OsaQueueCreate() : msgctl: msgctl failed");
-               LOGE(OSA_LIB, "In OsaQueueCreate() : Error no. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "In OsaQueueCreate() : Error no. : %d\n", errno);
                return ((int)errno);
        }
 
@@ -105,7 +105,7 @@ int OsaQueueCreate(const char bName[10], unsigned int uiFlags,
 
        if (msgctl((int)(*puiQid), IPC_SET, &tSetMqAttr) == -1) {
                perror("In OsaQueueCreate() : msgctl: msgctl failed");
-               LOGE(OSA_LIB, "In OsaQueueCreate() : Error no. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "In OsaQueueCreate() : Error no. : %d\n", errno);
                return ((int)errno);
        }
 
@@ -169,7 +169,7 @@ int OsaQueueDelete(const char *bName, unsigned int uiQid)
 
        if (msgctl((int)uiQid, IPC_RMID, NULL) == -1) {
                perror("In OsaQueueDelete(): msgctl: msgctl failed");
-               LOGE(OSA_LIB, "In OsaQueueDelete(): Error no. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "In OsaQueueDelete(): Error no. : %d\n", errno);
                return ((int)errno);
        }
 
@@ -205,13 +205,13 @@ int OsaQueueSend(unsigned int uiQid, unsigned int uiFlags, void *pvMsg_buf,
                tMqAttr.mq_flags = O_NONBLOCK;
 
                if ((err_no = mq_setattr((mqd_t)uiQid, &tMqAttr, (struct mq_attr *)NULL)) < 0) {
-                       LOGE(OSA_LIB, "mq_setattr(): mq_setattr() Failed errno=%d\n", err_no, 0, 0, 0, 0, 0);
+                       LOGE(MODULE_OSA_LIB, "mq_setattr(): mq_setattr() Failed errno=%d\n", err_no, 0, 0, 0, 0, 0);
                        return (OSAL_ERROR);
                }
        }
 
        if ((err_no = mq_send((mqd_t)uiQid, (const char *)pvMsg_buf, uiMsgLen, uiPriority)) < 0) {
-               LOGE(OSA_LIB, "mq_send():Failed errno=%d qid=%x flag=%d\n", err_no, uiQid, uiFlags, 0, 0, 0);
+               LOGE(MODULE_OSA_LIB, "mq_send():Failed errno=%d qid=%x flag=%d\n", err_no, uiQid, uiFlags, 0, 0, 0);
                return (OSAL_ERROR);
        }
 
@@ -220,7 +220,7 @@ int OsaQueueSend(unsigned int uiQid, unsigned int uiFlags, void *pvMsg_buf,
        int ret;
 
        if (uiMsgLen > MAXML) {
-               LOGE(OSA_LIB, "Message length exceeds max limit of %d\n", MAXML);
+               LOGE(MODULE_OSA_LIB, "Message length exceeds max limit of %d\n", MAXML);
                return OSAL_ERROR;
        }
 
@@ -234,7 +234,7 @@ int OsaQueueSend(unsigned int uiQid, unsigned int uiFlags, void *pvMsg_buf,
 
        if (ret != 0) {
                //perror("In OsaQueueSend () : msgsnd failed"); //COMMON_071024_1
-               LOGE(OSA_LIB, "In OsaQueueSend() : Error no. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "In OsaQueueSend() : Error no. : %d\n", errno);
                return ((int)errno);
        }
 
@@ -303,7 +303,7 @@ int OsaQueueReceive(unsigned int uiQid, unsigned int uiFlags, void *pvMsgBuf,
 
                if (errno != ENOMSG) {
                        perror("In OsaQueueReceive() : msgrcv failed");
-                       LOGE(OSA_LIB, "In OsaQueueReceive() : Msg id %d, Error no. : %d\n", uiQid, errno);
+                       LOGE(MODULE_OSA_LIB, "In OsaQueueReceive() : Msg id %d, Error no. : %d\n", uiQid, errno);
                }
 
                return ((int)errno);
@@ -337,7 +337,7 @@ int OsaQueueGetinfo(unsigned int uiQid, void *pvBuf)
        struct mq_attr tMqAttr;
 
        if (pvBuf == NULL) {
-               LOGE(OSA_LIB, "Null Argument(s) \n");
+               LOGE(MODULE_OSA_LIB, "Null Argument(s) \n");
                return OSAL_ERROR;
        }
 
@@ -361,7 +361,7 @@ int OsaQueueGetinfo(unsigned int uiQid, void *pvBuf)
 
        if (msgctl((int)uiQid, IPC_STAT, &buf) < 0) {
                perror("In OsaQueueGetinfo() : msgctl: msgctl failed");
-               LOGE(OSA_LIB, "In OsaQueueGetinfo() : Error no. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "In OsaQueueGetinfo() : Error no. : %d\n", errno);
                return ((int)errno);
 
        }
@@ -400,7 +400,7 @@ int OsaQueueSetinfo(unsigned int uiQid, void *pvBuf)
        struct mq_attr tMqAttr;
 
        if (pvBuf == NULL) {
-               LOGE(OSA_LIB, "Null Argument(s) \n");
+               LOGE(MODULE_OSA_LIB, "Null Argument(s) \n");
                return OSAL_ERROR;
        }
 
@@ -429,7 +429,7 @@ int OsaQueueSetinfo(unsigned int uiQid, void *pvBuf)
 
        if (msgctl((int)uiQid, IPC_SET, &buf) < 0) {
                perror("In OsaQueueGetinfo() : msgctl: msgctl failed");
-               LOGE(OSA_LIB, "In OsaQueueGetinfo() : Error no. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "In OsaQueueGetinfo() : Error no. : %d\n", errno);
                return ((int)errno);
        }
 
index 82af922..a4baef1 100644 (file)
@@ -50,12 +50,12 @@ static int UlOsaSemCreate(const char bName[10], int iCount, int iAttribute,
        sem = (UlOsaSem_t *)malloc(sizeof(*sem));
 
        if (!sem) {
-               LOGE(OSA_LIB, "UlOsaSemCreate, Out of memory!\n");
+               LOGE(MODULE_OSA_LIB, "UlOsaSemCreate, Out of memory!\n");
                return OSAL_ERROR;
        }
 
        if (sem_init(&sem->sem, 1, (unsigned int)iCount) < 0) {
-               LOGE(OSA_LIB, "UlOsaSemCreate, sem_init Failed!\n");
+               LOGE(MODULE_OSA_LIB, "UlOsaSemCreate, sem_init Failed!\n");
                free(sem);
                return OSAL_ERROR;
        }
@@ -94,17 +94,17 @@ static int UlOsaSemGet(void *uiSmid, int iFlags, int iTimeout)
 
        if (iFlags == OSAL_SEM_NOWAIT) {
                /* no wait */
-               LOGD(OSA_LIB, "UlOsaSemGet-nowait(%s).\n", sem->bName);
+               LOGD(MODULE_OSA_LIB, "UlOsaSemGet-nowait(%s).\n", sem->bName);
                ret = sem_trywait(&sem->sem);
        } else if (iTimeout == 0) {
                /* wait _inifinite_ */
-               LOGD(OSA_LIB, "UlOsaSemGet-infinite(%s).\n", sem->bName);
+               LOGD(MODULE_OSA_LIB, "UlOsaSemGet-infinite(%s).\n", sem->bName);
                ret = OSAL_FAILURE_RETRY(sem_wait(&sem->sem));
        } else {
                /* with _timeout_ */
-               LOGD(OSA_LIB, "UlOsaSemGet-timeout(%s).\n", sem->bName);
+               LOGD(MODULE_OSA_LIB, "UlOsaSemGet-timeout(%s).\n", sem->bName);
                if (iTimeout < 0) {
-                       LOGE(OSA_LIB, "UlOsaSemGet-timeout: invalid arg!\n");
+                       LOGE(MODULE_OSA_LIB, "UlOsaSemGet-timeout: invalid arg!\n");
                        return OSAL_ERROR;
                }
                do { // SoC_D00003324
@@ -120,17 +120,17 @@ static int UlOsaSemGet(void *uiSmid, int iFlags, int iTimeout)
 
        /* result */
        if (ret == 0) {
-               LOGD(OSA_LIB, "UlOsaSemGet(%s) success.\n", sem->bName);
+               LOGD(MODULE_OSA_LIB, "UlOsaSemGet(%s) success.\n", sem->bName);
                return OSAL_OK;
        } else {
                if (iFlags == OSAL_SEM_NOWAIT && errno == EAGAIN) {
-                       //          LOGE(OSA_LIB, "UlOsaSemGet-nowait: now locked, failed to get.\n");
+                       //          LOGE(MODULE_OSA_LIB, "UlOsaSemGet-nowait: now locked, failed to get.\n");
                        return OSAL_ERROR;
                } else if (iFlags == OSAL_SEM_WAIT && iTimeout <= 0) {
-                       LOGE(OSA_LIB, "UlOsaSemGet-timeout(%s): time-out\n", sem->bName);
+                       LOGE(MODULE_OSA_LIB, "UlOsaSemGet-timeout(%s): time-out\n", sem->bName);
                        return OSAL_ERR_TIMEOUT;
                } else {
-                       LOGE(OSA_LIB, "UlOsaSemGet error, errno=%d\n", errno);
+                       LOGE(MODULE_OSA_LIB, "UlOsaSemGet error, errno=%d\n", errno);
                        return OSAL_ERROR;
                }
        }
@@ -143,9 +143,9 @@ static int UlOsaSemRelease(void *uiSmid)
        if (!sem)
                return OSAL_ERROR;
 
-       LOGD(OSA_LIB, "UlOsaSemRelease(%s)\n", sem->bName);
+       LOGD(MODULE_OSA_LIB, "UlOsaSemRelease(%s)\n", sem->bName);
        if (sem_post(&sem->sem) != 0) {
-               LOGE(OSA_LIB, "UlOsaSemRelease(%s) error! errno=%d.\n", sem->bName, errno);
+               LOGE(MODULE_OSA_LIB, "UlOsaSemRelease(%s) error! errno=%d.\n", sem->bName, errno);
                return OSAL_ERROR;
        } else
                return OSAL_OK;
@@ -158,12 +158,12 @@ static int UlOsaSemReset(void *uiSmid)
        if (!sem)
                return OSAL_ERROR;
 
-       LOGD(OSA_LIB, "UlOsaSemReset(%s).\n", sem->bName);
+       LOGD(MODULE_OSA_LIB, "UlOsaSemReset(%s).\n", sem->bName);
 
        /* For threads currently blocked, the effect of destroying is not defined in POSIX.
         Currently, this will not release any blocked threads. */
        if (sem_destroy(&sem->sem) < 0) {
-               LOGE(OSA_LIB, "UlOsaSemReset, sem_destroy errno=%d\n", errno);
+               LOGE(MODULE_OSA_LIB, "UlOsaSemReset, sem_destroy errno=%d\n", errno);
                return OSAL_ERROR;
        }
 
@@ -182,10 +182,10 @@ static int UlOsaSemGetval(void *uiSmid)
                return OSAL_ERROR;
 
        if (sem_getvalue(&sem->sem, &n) != 0) {
-               LOGE(OSA_LIB, "UlOsaSemGetval(%s), sem_getvalue errno=%d\n", sem->bName, errno);
+               LOGE(MODULE_OSA_LIB, "UlOsaSemGetval(%s), sem_getvalue errno=%d\n", sem->bName, errno);
                return OSAL_ERROR;
        } else {
-               LOGD(OSA_LIB, "UlOsaSemGetval(%s): now %d\n", sem->bName, n);
+               LOGD(MODULE_OSA_LIB, "UlOsaSemGetval(%s): now %d\n", sem->bName, n);
                return (int)n;
        }
 }
@@ -305,7 +305,7 @@ int OsaMutCreate(const char bName[10], int iAttributes, void **puiMutid)
        pthread_mutex_t *pmutex_t;
 
        if (puiMutid == NULL) {
-               LOGE(OSA_LIB, "In OsaMutCreate() : NULL PTR ERROR");
+               LOGE(MODULE_OSA_LIB, "In OsaMutCreate() : NULL PTR ERROR");
                return OSAL_ERROR;
        }
 
@@ -334,7 +334,7 @@ int OsaMutCreate(const char bName[10], int iAttributes, void **puiMutid)
 
                pthread_mutexattr_destroy(&attr_t);
        } else {
-               LOGE(OSA_LIB, "In OsaMutCreate() : No memory");
+               LOGE(MODULE_OSA_LIB, "In OsaMutCreate() : No memory");
                return OSAL_ERROR;
        }
 
@@ -370,7 +370,7 @@ int OsaMutDelete(void *uiMutid)
 
        if (iRet < 0) {
                perror("In OsaMutDelete() :  failed ");
-               LOGE(OSA_LIB, "Error no. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "Error no. : %d\n", errno);
                return ((int)errno);
        }
 
@@ -400,7 +400,7 @@ int OsaMutRelease(void *uiMutid)
 
        if (iRet < 0) {
                perror("In OsaMutRelease() :  failed ");
-               LOGE(OSA_LIB, "Error no. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "Error no. : %d\n", errno);
                return ((int)errno);
        }
 
@@ -427,7 +427,7 @@ int OsaMutGet(void *uiMutid, int iFlags, int iTimeout)
 
        if (iRet < 0) {
                perror("In OsaMutGet() :  failed ");
-               LOGE(OSA_LIB, "Error no. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "Error no. : %d\n", errno);
                return ((int)errno);
        }
 
index bf09d3b..f7582d2 100644 (file)
@@ -51,7 +51,7 @@ int OsaSigProcmask(int iMode, const unsigned int *puiNewmask,
 
        if (iRet) {
                perror("SigProcMask:  SigProcMask Failed  ");
-               LOGE(OSA_LIB, "Error No. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "Error No. : %d\n", errno);
                return ((int)errno);
        }
 
@@ -78,7 +78,7 @@ int OsaSigSuspend(unsigned int *puiPending)
 
        if (iRet) {
                perror("SigSuspend: SigSuspend INTR  ");
-               LOGE(OSA_LIB, "Error No. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "Error No. : %d\n", errno);
                return ((int)errno);
 
        }
@@ -106,7 +106,7 @@ int OsaSigTimedwait(void)
 
        if (iRet) {
                perror("TimeWait: TimeWait INTR  ");
-               LOGE(OSA_LIB, "Error No. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "Error No. : %d\n", errno);
                return ((int)errno);
 
        }
@@ -134,7 +134,7 @@ int OsaSigSetmask(int iSigno)
 
        if (sigaddset(&(Action_t.sa_mask), iSigno) < 0) {
                perror("sigaddset:  sigaddset Failed  ");
-               LOGE(OSA_LIB, "Error No. : %d\n", errno);
+               LOGE(MODULE_OSA_LIB, "Error No. : %d\n", errno);
                return ((int)errno);
        }
 
index 3c719bf..fa9f37d 100644 (file)
@@ -60,7 +60,7 @@ static void *_thread_start_handler(void *pArg)
 
        if (iRet) {
                perror("In OsaTaskSpawn() :  prctl() Failed\n ");
-               LOGE(OSA_LIB, "In OsaTaskSpawn() : prctl() error no. : %d\n", iRet);
+               LOGE(MODULE_OSA_LIB, "In OsaTaskSpawn() : prctl() error no. : %d\n", iRet);
        }
 
        (*sThreadParam.pEntryFunc)(sThreadParam.pArg);
@@ -133,7 +133,7 @@ int OsaTaskSpawn(const char *pName, void **puiTid, int iPriority,
                        *puiTid = NULL;
                        free(pThreadParam);
                        perror("In OsaTaskSpawn() :  pthread create Failed\n ");
-                       LOGE(OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
+                       LOGE(MODULE_OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
                        return ((int)iRet);
                }
        }
@@ -145,7 +145,7 @@ int OsaTaskSpawn(const char *pName, void **puiTid, int iPriority,
                        *puiTid = NULL;
                        free(pThreadParam);
                        perror("In OsaTaskSpawn() : pthread attr init  Failed\n ");
-                       LOGE(OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
+                       LOGE(MODULE_OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
                        return ((int)iRet);
                }
 
@@ -155,7 +155,7 @@ int OsaTaskSpawn(const char *pName, void **puiTid, int iPriority,
                        *puiTid = NULL;
                        free(pThreadParam);
                        perror("In OsaTaskSpawn() : pthread attr setstacksize Failed\n ");
-                       LOGE(OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
+                       LOGE(MODULE_OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
                        pthread_attr_destroy(&tattr_t);
                        return ((int)iRet);
                }
@@ -167,7 +167,7 @@ int OsaTaskSpawn(const char *pName, void **puiTid, int iPriority,
                        *puiTid = NULL;
                        free(pThreadParam);
                        perror("In OsaTaskSpawn() :  pthread create Failed\n ");
-                       LOGE(OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
+                       LOGE(MODULE_OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
                        pthread_attr_destroy(&tattr_t);
                        return ((int)iRet);
                }
@@ -183,7 +183,7 @@ int OsaTaskSpawn(const char *pName, void **puiTid, int iPriority,
                if (iRet) {
                        *puiTid = NULL;
                        perror("In OsaTaskSpawn() :  pthread setschedparam Failed\n ");
-                       LOGE(OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
+                       LOGE(MODULE_OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
                        pthread_kill(createThread, 0);
                        return ((int)iRet);
                }
@@ -194,14 +194,14 @@ int OsaTaskSpawn(const char *pName, void **puiTid, int iPriority,
        if (iRet) {
                *puiTid = NULL;
                perror("In OsaTaskSpawn() :  pthread_detach Failed\n ");
-               LOGE(OSA_LIB, "In OsaTaskSpawn() : detach error no. : %d\n", iRet);
+               LOGE(MODULE_OSA_LIB, "In OsaTaskSpawn() : detach error no. : %d\n", iRet);
                pthread_kill(createThread, 0);
                return ((int)iRet);
        }
 
        *puiTid = (void *)createThread;
 
-       LOGD(OSA_LIB, "%s thread created policy: %d, priority %d\n", pName, createThreadPolicy, iPriority);
+       LOGD(MODULE_OSA_LIB, "%s thread created policy: %d, priority %d\n", pName, createThreadPolicy, iPriority);
        return OSAL_OK;
 }
 
@@ -242,7 +242,7 @@ int OsaTaskDelete(void *uiTid)
 
        if (iRet) {
                perror("In OsaTaskDelete() : TaskDelete  Failed ");
-               LOGE(OSA_LIB, "In OsaTaskDelete() : error no. : %d\n",errno);
+               LOGE(MODULE_OSA_LIB, "In OsaTaskDelete() : error no. : %d\n",errno);
                return ((int)errno);
        }
 
@@ -274,7 +274,7 @@ int OsaTaskSetPriority(unsigned int uiTid, int iNewpriority)
 
        if (iRet) {
                perror("In OsaTaskSetPriority() : TaskSetPriority  set Failed ");
-               LOGE(OSA_LIB, "In  OsaTaskSetPriority() : error no. : %d\n",errno);
+               LOGE(MODULE_OSA_LIB, "In  OsaTaskSetPriority() : error no. : %d\n",errno);
                return ((int)errno);
        }
 
@@ -304,7 +304,7 @@ int OsaTaskGetPriority(unsigned int uiTid, int *piPriority)
        if (iRet) {
                piPriority = NULL;
                perror("In OsaTaskGetPriority() : TaskGetPriority Failed ");
-               LOGE(OSA_LIB, "In OsaTaskGetPriority() : error no. : %d\n",errno);
+               LOGE(MODULE_OSA_LIB, "In OsaTaskGetPriority() : error no. : %d\n",errno);
                return ((int)errno);
        }
 
@@ -342,7 +342,7 @@ int OsaTaskNanosleep(int iNanosec)
 
        if (iRetval) {
                perror("TaskNanoSleep: TaskNanoSleep Failed ");
-               LOGE(OSA_LIB, "Error No. : %d\n",errno);
+               LOGE(MODULE_OSA_LIB, "Error No. : %d\n",errno);
                return ((int)errno);
 
        }
@@ -396,7 +396,7 @@ int OsaTaskDelaymsecs(unsigned int uiMsec)
 
        if (iRetval) {
                perror("In OsaTaskDelaymsecs() : TaskNanoSleep Failed ");
-               LOGE(OSA_LIB, "In OsaTaskDelaymsecs() : error no. : %d\n",errno);
+               LOGE(MODULE_OSA_LIB, "In OsaTaskDelaymsecs() : error no. : %d\n",errno);
                return ((int)errno);
        }
 
index 1b49201..93307d3 100644 (file)
@@ -49,7 +49,7 @@ void CommandRegSharedMem::execute() {
        TEEC_Result result = TEEC_ERROR_GENERIC;
        result = pTEECtx->registerSharedMemory(data);
        if (result != TEEC_SUCCESS) {
-               LOGE(SIM_DAEMON, "Register Shared Memory response write to CA FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Register Shared Memory response write to CA FAILED");
                FinalizeContextData fdata;
                fdata.contextID = data.contextID;
                pTEECtx->finContext(fdata);
index 6aaf37d..465146f 100644 (file)
@@ -49,7 +49,7 @@ void CommandRelSharedMem::execute() {
        TEEC_Result result = TEEC_ERROR_GENERIC;
        result = pTEECtx->releaseSharedMemory(data);
        if (result != TEEC_SUCCESS) {
-               LOGE(SIM_DAEMON, "Release Shared Memory response write to CA FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Release Shared Memory response write to CA FAILED");
                FinalizeContextData fdata;
                fdata.contextID = data.contextID;
                pTEECtx->finContext(fdata);
index a41f178..8753027 100644 (file)
@@ -38,7 +38,7 @@
 CommandBasePtr MakeCommand::getCommand(TEE_CMD teecmd, void* teedata,
     TEEContext *TEECtx) {
 
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        CommandBasePtr command;
        switch (teecmd) {
                case INITIALIZE_CONTEXT: {
@@ -137,51 +137,51 @@ uint32_t MakeCommand::getDataSize(TEE_CMD command) {
        switch (command) {
                case INITIALIZE_CONTEXT:
                        size = sizeof(InitContextData);
-                       LOGD(SIM_DAEMON, "[TEEC] InitContextData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] InitContextData Size: %d", size);
                        break;
                case OPEN_SESSION:
                        size = sizeof(OpenSessionData);
-                       LOGD(SIM_DAEMON, "[TEEC] OpenSessionData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] OpenSessionData Size: %d", size);
                        break;
                case REGISTER_SHARED_MEMORY:
                        size = sizeof(RegSharedMemData);
-                       LOGD(SIM_DAEMON, "[TEEC] RegSharedMemData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] RegSharedMemData Size: %d", size);
                        break;
                case INVOKE_COMMAND:
                        size = sizeof(InvokeCommandData);
-                       LOGD(SIM_DAEMON, "[TEEC] InvokeCommandData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] InvokeCommandData Size: %d", size);
                        break;
                case RELEASE_SHARED_MEMORY:
                        size = sizeof(RelSharedMemData);
-                       LOGD(SIM_DAEMON, "[TEEC] RelSharedMemData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] RelSharedMemData Size: %d", size);
                        break;
                case CLOSE_SESSION:
                        size = sizeof(CloseSessionData);
-                       LOGD(SIM_DAEMON, "[TEEC] CloseSessionData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] CloseSessionData Size: %d", size);
                        break;
                case FINALIZE_CONTEXT:
                        size = sizeof(FinalizeContextData);
-                       LOGD(SIM_DAEMON, "[TEEC] FinalizeContextData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] FinalizeContextData Size: %d", size);
                        break;
                case REQUEST_CANCELLATION:
                        size = sizeof(ReqCancellationData);
-                       LOGD(SIM_DAEMON, "[TEEC] ReqCancellationData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] ReqCancellationData Size: %d", size);
                        break;
                case OPEN_TA_SESSION:
                        size = sizeof(IntTAOpenSessionData);
-                       LOGD(SIM_DAEMON, "[TEEC] IntTAOpenSessionData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] IntTAOpenSessionData Size: %d", size);
                        break;
                case INVOKE_TA_COMMAND:
                        size = sizeof(IntTAInvokeCommandData);
-                       LOGD(SIM_DAEMON, "[TEEC] IntTAInvokeCommandData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] IntTAInvokeCommandData Size: %d", size);
                        break;
                case CLOSE_TA_SESSION:
                        size = sizeof(IntTACloseSessionData);
-                       LOGD(SIM_DAEMON, "[TEEC] IntTACloseSessionData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] IntTACloseSessionData Size: %d", size);
                        break;
                case PANIC:
                        size = sizeof(IntTAPanicData);
-                       LOGD(SIM_DAEMON, "[TEEC] PanicData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TEEC] PanicData Size: %d", size);
                        break;
                default:
                        size = -1;
index a94572a..fbbf8ec 100644 (file)
@@ -71,7 +71,7 @@ void ConnectionSession<header_t>::start() {
 template<typename header_t>
 void ConnectionSession<header_t>::handleRead(const boost::system::error_code& error,
     size_t bytes_transferred) {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        if (!error) {
                /**
@@ -146,7 +146,7 @@ template<typename header_t>
 boost::system::error_code ConnectionSession<header_t>::write(header_t header,
                                                          char* data, size_t size)
 {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        boost::system::error_code error = boost::asio::error::host_not_found;
        pthread_mutex_lock(&connLock);
 
index fd698b6..7b347de 100644 (file)
@@ -42,14 +42,14 @@ void ControlConnectionHandler::handleConnect(int sock)
 
 int32_t ControlConnectionHandler::getDataSize(enum ControlCommand cmd)
 {
-       LOGD(SIM_DAEMON, "Control command received: %d", (uint32_t)cmd);
+       LOGD(MODULE_SIM_DAEMON, "Control command received: %d", (uint32_t)cmd);
        switch(cmd) {
        case CTL_SET_PORT:
                return sizeof(SetPortControlCommand);
        case CTL_QUERY_PORT:
                return sizeof(QueryPortControlCommand);
        default:
-               LOGE(SIM_DAEMON, "Invalid command received!");
+               LOGE(MODULE_SIM_DAEMON, "Invalid command received!");
                return -1;
        }
 }
@@ -71,7 +71,7 @@ void ControlConnectionHandler::handleRead(enum ControlCommand header,
 
 void ControlConnectionHandler::handleReadError(boost::system::error_code e)
 {
-       LOGE(SIM_DAEMON, "Error in reading from the control socket: Response returned with error code %d, message %s",
+       LOGE(MODULE_SIM_DAEMON, "Error in reading from the control socket: Response returned with error code %d, message %s",
             e.value(), e.category().name());
 }
 
@@ -90,7 +90,7 @@ void ControlConnectionHandler::handleSetPortCommand(std::vector<char> &data)
        auto UUIDConfig = getUUIDConfig();
        if (!UUIDConfig) {
                reply.status = CTL_REPLY_INTERNAL_ERROR;
-               LOGE(SIM_DAEMON, "Setting UUID debug port failed - config manager not found");
+               LOGE(MODULE_SIM_DAEMON, "Setting UUID debug port failed - config manager not found");
                m_writer->write(CTL_SET_PORT_REPLY, (char *) &reply, sizeof(reply));
                return;
        }
@@ -100,7 +100,7 @@ void ControlConnectionHandler::handleSetPortCommand(std::vector<char> &data)
                (*UUIDConfig)[cmd.uuid]->clearDebugPort();
        else
                (*UUIDConfig)[cmd.uuid]->setDebugPort(cmd.port);
-       LOGI(SIM_DAEMON, "%s debug port of UUID %s",
+       LOGI(MODULE_SIM_DAEMON, "%s debug port of UUID %s",
                         cmd.clear ? "Cleared" : "Set",
                         UUIDToString(cmd.uuid).c_str());
        reply.status = CTL_REPLY_SUCCESS;
@@ -115,7 +115,7 @@ void ControlConnectionHandler::handleQueryPortCommand(std::vector<char> &data)
        auto UUIDConfig = getUUIDConfig();
        if (!UUIDConfig) {
                reply.status = CTL_REPLY_INTERNAL_ERROR;
-               LOGE(SIM_DAEMON, "Setting UUID debug port failed - config manager not found");
+               LOGE(MODULE_SIM_DAEMON, "Setting UUID debug port failed - config manager not found");
                m_writer->write(CTL_QUERY_PORT_REPLY, (char *) &reply, sizeof(reply));
                return;
        }
index 9c8f3db..c0cbe43 100644 (file)
@@ -53,7 +53,7 @@ void ResCommandCloseSession::execute() {
        TAFactory *TAFact = TAFactory::getInstance();
        if (NULL == TAFact) {
                // This error should not come
-               LOGE(SIM_DAEMON, "TA Factory instance creation failed. Check logs for further info");
+               LOGE(MODULE_SIM_DAEMON, "TA Factory instance creation failed. Check logs for further info");
                return;
        }
        map<uint32_t, ISession*>::iterator it;
@@ -74,7 +74,7 @@ void ResCommandCloseSession::execute() {
                                                result = (session->getTAInstance())->sendRequestToTA(DESTROY,
                                                    (void*)&ddata, sizeof(DestroyTAEntryPointData));
                                                if (result != TEEC_SUCCESS) {
-                                                       LOGE(SIM_DAEMON, "Destroy sendRequestToTA FAILED");
+                                                       LOGE(MODULE_SIM_DAEMON, "Destroy sendRequestToTA FAILED");
                                                        (session->getTAInstance())->killTA();
                                                }
                                        } else {
@@ -95,7 +95,7 @@ void ResCommandCloseSession::execute() {
                                result = session->writeResponse(CLOSE_TA_SESSION,
                                    (char*)&cdata, sizeof(IntTACloseSessionData));
                                if (result != TEEC_SUCCESS) {
-                                       LOGE(SIM_DAEMON, "Close Session response write to TA FAILED");
+                                       LOGE(MODULE_SIM_DAEMON, "Close Session response write to TA FAILED");
                                }
                        } else {
                                CloseSessionData cdata;
@@ -105,7 +105,7 @@ void ResCommandCloseSession::execute() {
                                result = session->writeResponse(CLOSE_SESSION, (char*)&cdata,
                                    sizeof(CloseSessionData));
                                if (result != TEEC_SUCCESS) {
-                                       LOGE(SIM_DAEMON, "Close Session response write to CA FAILED");
+                                       LOGE(MODULE_SIM_DAEMON, "Close Session response write to CA FAILED");
                                }
                        }
                        session->detachFromContext();
@@ -114,7 +114,7 @@ void ResCommandCloseSession::execute() {
                delete session;
        } else {
                // This error should not come
-               LOGE(SIM_DAEMON, "SessionID: %d not found in map", data->sessionID);
+               LOGE(MODULE_SIM_DAEMON, "SessionID: %d not found in map", data->sessionID);
        }
 }
 
index 057d99e..a976b13 100644 (file)
@@ -78,7 +78,7 @@ void ResCommandInvokeCommand::execute() {
                        result = it->second->writeResponse(INVOKE_TA_COMMAND,
                            (char*)&idata, sizeof(IntTAInvokeCommandData));
                        if (result != TEEC_SUCCESS) {
-                               LOGE(SIM_DAEMON, "Invoke Command response write to TA FAILED");
+                               LOGE(MODULE_SIM_DAEMON, "Invoke Command response write to TA FAILED");
                        }
                } else {
                        InvokeCommandData idata;
@@ -107,13 +107,13 @@ void ResCommandInvokeCommand::execute() {
                        result = it->second->writeResponse(INVOKE_COMMAND,
                            (char*)&idata, sizeof(InvokeCommandData));
                        if (result != TEEC_SUCCESS) {
-                               LOGE(SIM_DAEMON, "Invoke Command response write to CA FAILED");
+                               LOGE(MODULE_SIM_DAEMON, "Invoke Command response write to CA FAILED");
                        }
                }
                it->second->getTAInstance()->eraseCommand(INVOKECOMMAND, data->sessionID);
        } else {
                // This error should not come
-               LOGE(SIM_DAEMON, "SessionID: %d not found in map", data->sessionID);
+               LOGE(MODULE_SIM_DAEMON, "SessionID: %d not found in map", data->sessionID);
        }
 }
 
index b44492b..0aa2838 100644 (file)
@@ -77,7 +77,7 @@ void ResCommandOpenSession::execute() {
                        result = it->second->writeResponse(OPEN_TA_SESSION,
                            (char*)&odata, sizeof(IntTAOpenSessionData));
                        if (result != TEEC_SUCCESS) {
-                               LOGE(SIM_DAEMON, "Open Session response write to TA FAILED");
+                               LOGE(MODULE_SIM_DAEMON, "Open Session response write to TA FAILED");
                        }
                } else {
                        OpenSessionData odata;
@@ -105,13 +105,13 @@ void ResCommandOpenSession::execute() {
                        result = it->second->writeResponse(OPEN_SESSION,
                            (char*)&odata, sizeof(OpenSessionData));
                        if (result != TEEC_SUCCESS) {
-                               LOGE(SIM_DAEMON, "Open Session response write to CA FAILED");
+                               LOGE(MODULE_SIM_DAEMON, "Open Session response write to CA FAILED");
                        }
                }
                it->second->getTAInstance()->eraseCommand(OPENSESSION, data->sessionID);
        } else {
                // This error should not come
-               LOGE(SIM_DAEMON, "SessionID: %d not found in map", data->sessionID);
+               LOGE(MODULE_SIM_DAEMON, "SessionID: %d not found in map", data->sessionID);
        }
 }
 
index f0a7f67..4651a55 100644 (file)
@@ -89,27 +89,27 @@ uint32_t ResMakeCommand::getDataSize(SIM_COMMAND command) {
        switch (command) {
                case CREATE:
                        size = sizeof(CreateTAEntryPointData);
-                       LOGD(SIM_DAEMON, "[TA] CreateTAEntryPoint Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TA] CreateTAEntryPoint Size: %d", size);
                        break;
                case DESTROY:
                        size = sizeof(DestroyTAEntryPointData);
-                       LOGD(SIM_DAEMON, "[TA] DestroyTAEntryPoint Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TA] DestroyTAEntryPoint Size: %d", size);
                        break;
                case OPENSESSION:
                        size = sizeof(OpenTASessionData);
-                       LOGD(SIM_DAEMON, "[TA] OpenTASessionData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TA] OpenTASessionData Size: %d", size);
                        break;
                case INVOKECOMMAND:
                        size = sizeof(InvokeTACommandData);
-                       LOGD(SIM_DAEMON, "[TA] InvokeTACommandData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TA] InvokeTACommandData Size: %d", size);
                        break;
                case CLOSESESSION:
                        size = sizeof(CloseTASessionData);
-                       LOGD(SIM_DAEMON, "[TA] CloseTASessionData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TA] CloseTASessionData Size: %d", size);
                        break;
                case REQCANCEL:
                        size = sizeof(RequestTACancelData);
-                       LOGD(SIM_DAEMON, "[TA] RequestTACancelData Size: %d", size);
+                       LOGD(MODULE_SIM_DAEMON, "[TA] RequestTACancelData Size: %d", size);
                        break;
                default:
                        size = -1;
index 19faa6a..c06a953 100644 (file)
@@ -38,7 +38,7 @@
  * @param TEECtx Context instance associated with the session
  */
 Session::Session(TEEContext* TEECtx) {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        mContext = TEECtx;
        mSessionID = -1;
 }
@@ -48,9 +48,9 @@ bool Session::checkInternal() {
 }
 
 uint32_t Session::getContextID() {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        if (mContext != NULL) {
-               LOGD(SIM_DAEMON, "Entry");
+               LOGD(MODULE_SIM_DAEMON, "Entry");
                return mContext->mContextID;
        } else {
                return 0;
@@ -71,7 +71,7 @@ void Session::detachFromContext() {
        pthread_rwlock_wrlock(&mContext->mSessionMapLock);
        it = mContext->mSessionMap.find(mSessionID);
        if (it == mContext->mSessionMap.end()) {
-               LOGE(SIM_DAEMON, "Session not found");
+               LOGE(MODULE_SIM_DAEMON, "Session not found");
                pthread_rwlock_unlock(&mContext->mSessionMapLock);
                return;
        }
@@ -92,12 +92,12 @@ TEEC_Result Session::writeResponse(TEE_CMD command, char* data, size_t size) {
 TEEC_Result Session::createSession(OpenSessionData data) {
        uint32_t i, type;
        TEEC_Result result = TEEC_ERROR_GENERIC;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        // Get TA factory instance
        TAFactory *TAFact = TAFactory::getInstance();
        if (NULL == TAFact) {
-               LOGE(SIM_DAEMON, "TA Factory instance creation failed. Check logs for further info");
+               LOGE(MODULE_SIM_DAEMON, "TA Factory instance creation failed. Check logs for further info");
                return TEEC_ERROR_OUT_OF_MEMORY;
        }
        // Update member variable mSessionID with the assigned session ID
@@ -105,7 +105,7 @@ TEEC_Result Session::createSession(OpenSessionData data) {
 
        auto UUIDConf = UUIDConfigManager::getInstance();
        if (!UUIDConf) {
-               LOGE(SIM_DAEMON, "Failed to get UUID config manager instance");
+               LOGE(MODULE_SIM_DAEMON, "Failed to get UUID config manager instance");
                return TEEC_ERROR_GENERIC;
        }
 
@@ -122,7 +122,7 @@ TEEC_Result Session::createSession(OpenSessionData data) {
                auto itr = TAFact->mTAInstanceMap.find(data.uuid);
                if (itr != TAFact->mTAInstanceMap.end()) {
                        mTAInstance = itr->second;
-                       LOGD(SIM_DAEMON, "KILL pid = %d", mTAInstance->getPID());
+                       LOGD(MODULE_SIM_DAEMON, "KILL pid = %d", mTAInstance->getPID());
                        mTAInstance->killTA();
                        TAFact->mTAInstanceMap.erase(itr);
                }
@@ -134,7 +134,7 @@ TEEC_Result Session::createSession(OpenSessionData data) {
        mTAInstance = TAFact->getTAInstance(data.uuid, this);
        pthread_rwlock_unlock(&TAFact->mTAInstanceMapLock);
        if (!mTAInstance == true) { // failure
-               LOGE(SIM_DAEMON, "Creating Trusted Application Instance FAILED - "
+               LOGE(MODULE_SIM_DAEMON, "Creating Trusted Application Instance FAILED - "
                                "TA not launched/Create FAILED");
                return TEEC_ERROR_ITEM_NOT_FOUND;
        }
@@ -148,7 +148,7 @@ TEEC_Result Session::createSession(OpenSessionData data) {
        if (mTAInstance->getCreated() == false) {
                result = mTAInstance->receiveCreateResponse();
                if (TEEC_SUCCESS != result) { // failure
-                       LOGE(SIM_DAEMON, "Create TA entry point FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Create TA entry point FAILED");
                        pthread_rwlock_wrlock(&TAFact->mTAInstanceMapLock);
                        for (auto it = TAFact->mTAInstanceMap.begin();
                            it != TAFact->mTAInstanceMap.end(); ++it) {
@@ -196,7 +196,7 @@ TEEC_Result Session::createSession(OpenSessionData data) {
        result = mTAInstance->sendRequestToTA(OPENSESSION, (void*)&tdata,
            sizeof(OpenTASessionData));
        if (result != TEEC_SUCCESS) { // failure
-               LOGE(SIM_DAEMON, "OpenSession sendRequestToTA FAILED\n");
+               LOGE(MODULE_SIM_DAEMON, "OpenSession sendRequestToTA FAILED\n");
        } else { // success
                cmdData sdata;
                sdata.osdata = tdata;
@@ -211,7 +211,7 @@ TEEC_Result Session::createSession(OpenSessionData data) {
  * @param data InvokeCommandData type of data for invoking a command
  */
 TEEC_Result Session::handleCommand(InvokeCommandData data) {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        uint32_t i, type;
        TEEC_Result result = TEEC_ERROR_GENERIC;
 
@@ -245,7 +245,7 @@ TEEC_Result Session::handleCommand(InvokeCommandData data) {
        result = mTAInstance->sendRequestToTA(INVOKECOMMAND, (void*)&idata,
            sizeof(InvokeTACommandData));
        if (result != TEEC_SUCCESS) { // failure
-               LOGE(SIM_DAEMON, "InvokeCommand sendRequestToTA FAILED");
+               LOGE(MODULE_SIM_DAEMON, "InvokeCommand sendRequestToTA FAILED");
        } else { // success
                cmdData sdata;
                sdata.icdata = idata;
@@ -261,7 +261,7 @@ TEEC_Result Session::handleCommand(InvokeCommandData data) {
  * @param data ReqCancellationData type of data for cancelling an operation
  */
 void Session::handleCancel(ReqCancellationData data) {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        TEEC_Result result = TEEC_ERROR_GENERIC;
 
        // Generate RequestTACancelData to be sent to TA
@@ -276,7 +276,7 @@ void Session::handleCancel(ReqCancellationData data) {
        result = mTAInstance->sendRequestToTA(REQCANCEL, (void*)&rdata,
            sizeof(RequestTACancelData));
        if (result != TEEC_SUCCESS) { // failure
-               LOGE(SIM_DAEMON, "Request Cancellation sendRequestToTA FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Request Cancellation sendRequestToTA FAILED");
        } else { // success
                cmdData sdata;
                sdata.rcdata = rdata;
@@ -290,12 +290,12 @@ void Session::handleCancel(ReqCancellationData data) {
  */
 TEEC_Result Session::finalize(uint32_t contextID) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        // Get TA Factory insatnce
        TAFactory *TAFact = TAFactory::getInstance();
        if (NULL == TAFact) {
-               LOGE(SIM_DAEMON, "TA Factory instance creation failed. Check logs for further info");
+               LOGE(MODULE_SIM_DAEMON, "TA Factory instance creation failed. Check logs for further info");
                return TEEC_ERROR_OUT_OF_MEMORY;
        }
        // Generate CloseTASessionData to be sent to TA
@@ -309,7 +309,7 @@ TEEC_Result Session::finalize(uint32_t contextID) {
        result = mTAInstance->sendRequestToTA(CLOSESESSION, (void*)&cdata,
            sizeof(CloseTASessionData));
        if (result != TEEC_SUCCESS) { //failure
-               LOGE(SIM_DAEMON, "CloseSession sendRequestToTA FAILED");
+               LOGE(MODULE_SIM_DAEMON, "CloseSession sendRequestToTA FAILED");
 
                // remove the session from the TA Instance's Session Map
                mTAInstance->takeSessionMapLock();
@@ -342,7 +342,7 @@ TEEC_Result Session::finalize(uint32_t contextID) {
                                                result = mTAInstance->sendRequestToTA(DESTROY, (void*)&ddata,
                                                    sizeof(DestroyTAEntryPointData));
                                                if (result != TEEC_SUCCESS) { // failure
-                                                       LOGE(SIM_DAEMON, "Destroy sendRequestToTA FAILED");
+                                                       LOGE(MODULE_SIM_DAEMON, "Destroy sendRequestToTA FAILED");
                                                        mTAInstance->killTA();
                                                }
                                        } else {
@@ -369,5 +369,5 @@ TEEC_Result Session::finalize(uint32_t contextID) {
  * Session destructor. Delete the Session instance
  */
 Session::~Session() {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 }
index d662262..8dcac8e 100644 (file)
  * @param io_service
  */
 void startServer(boost::asio::io_service& io_service) {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        try {
                io_service.run();
        } catch (std::exception& e) {
-               LOGE(SIM_DAEMON, "Exception: %s", e.what());
+               LOGE(MODULE_SIM_DAEMON, "Exception: %s", e.what());
        }
 }
 
@@ -51,7 +51,7 @@ void startServer(boost::asio::io_service& io_service) {
  * Stops the Simulator Daemon server
  */
 void stopServer(boost::asio::io_service& io_service) {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        io_service.stop();
 }
 
@@ -62,12 +62,12 @@ int getSystemdSocket(const std::string& path) {
        int n = sd_listen_fds(0);
 
        if (n < 0) {
-               LOGE(SIM_DAEMON, "Error while getting sockets from systemd: %d", n);
+               LOGE(MODULE_SIM_DAEMON, "Error while getting sockets from systemd: %d", n);
                return n;
        }
 
        if (n == 0) {
-               LOGE(SIM_DAEMON, "No usable systemd socket found");
+               LOGE(MODULE_SIM_DAEMON, "No usable systemd socket found");
                return 0;
        }
 
@@ -75,12 +75,12 @@ int getSystemdSocket(const std::string& path) {
                int fd = SD_LISTEN_FDS_START + i;
                int ret = sd_is_socket_unix(fd, SOCK_STREAM, 1, path.c_str(), 0);
                if (ret > 0) {
-                       LOGI(SIM_DAEMON, "Acquired systemd socket %d", fd);
+                       LOGI(MODULE_SIM_DAEMON, "Acquired systemd socket %d", fd);
                        return fd;
                }
        }
 
-       LOGE(SIM_DAEMON, "No found systemd socket is a matching UNIX socket.");
+       LOGE(MODULE_SIM_DAEMON, "No found systemd socket is a matching UNIX socket.");
        return 0;
 }
 
@@ -89,12 +89,12 @@ SimulatorDaemonServer::acceptor_ptr getSocketAcceptor(
        SimulatorDaemonServer::acceptor_ptr acceptor;
        int sockfd = getSystemdSocket(path);
        if (sockfd > 0) {
-               LOGI(SIM_DAEMON, "Using existing systemd socket %d", sockfd);
+               LOGI(MODULE_SIM_DAEMON, "Using existing systemd socket %d", sockfd);
                acceptor = SimulatorDaemonServer::acceptor_ptr(
                                new stream_protocol::acceptor(io));
                acceptor->assign(stream_protocol(), sockfd);
        } else {
-               LOGI(SIM_DAEMON, "No systemd socket available for %s - creating own one",
+               LOGI(MODULE_SIM_DAEMON, "No systemd socket available for %s - creating own one",
                     path.c_str());
 
                acceptor = SimulatorDaemonServer::acceptor_ptr(
@@ -109,7 +109,7 @@ SimulatorDaemonServer::acceptor_ptr getSocketAcceptor(
  * @return
  */
 int main() {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        uint32_t result = 0;
        try {
                SimulatorDaemonServer::acceptor_ptr tee_acceptor, ctl_acceptor;
@@ -122,9 +122,9 @@ int main() {
                syslog(LOG_INFO | LOG_USER, "Daemon stopped");
        } catch (std::exception& e) {
                syslog(LOG_ERR | LOG_USER, "Exception: %s", e.what());
-               LOGE(SIM_DAEMON, "Exception: %s", e.what());
+               LOGE(MODULE_SIM_DAEMON, "Exception: %s", e.what());
        } catch (...) {
-               LOGE(SIM_DAEMON, "Unknown exception in SimulatorDaemon");
+               LOGE(MODULE_SIM_DAEMON, "Unknown exception in SimulatorDaemon");
        }
        stopServer(ioService::getInstance());
        return result;
index 535e0de..3cb6a0b 100644 (file)
@@ -163,7 +163,7 @@ TABinaryManager* TABinaryManager::getInstance() {
  * @return On successful completion of above operations returns true else false.
  */
 bool TABinaryManager::initTA(const TEEC_UUID &uuid) {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        std::vector<string> paths;
        paths.push_back(TEE_TASTORE_ROOT);
@@ -183,7 +183,7 @@ bool TABinaryManager::initTA(const TEEC_UUID &uuid) {
        }
 
        if (tapath.empty()) {
-               LOGE(SIM_DAEMON, "Cannot find TA: %s", uuidStr.c_str());
+               LOGE(MODULE_SIM_DAEMON, "Cannot find TA: %s", uuidStr.c_str());
                return false;
        }
 
@@ -219,7 +219,7 @@ void TABinaryManager::decryptImage(StructBinaryInfo& info) {
        string keyHash = "echo -n " + secret + " | openssl dgst -sha256 | awk '{print $2}' > " + keyhashFilename;
        int result = system(keyHash.c_str());
        if (result != 0) {
-               LOGE(SIM_DAEMON, "Hashing key failed");
+               LOGE(MODULE_SIM_DAEMON, "Hashing key failed");
        }
 
        string line;
@@ -236,26 +236,26 @@ void TABinaryManager::decryptImage(StructBinaryInfo& info) {
                + " -iv 0000000000000000";
        result = system(dec_command.c_str());
        if (result != 0) {
-               LOGE(SIM_DAEMON, "Image decryption failed");
+               LOGE(MODULE_SIM_DAEMON, "Image decryption failed");
        }
 
        boost::system::error_code ec;
        fs::remove(fs::path(info.imagePath), ec);
        if (ec) {
-               LOGE(SIM_DAEMON, "Post decryption failed: unlink %s : %s", info.imagePath.c_str(),
+               LOGE(MODULE_SIM_DAEMON, "Post decryption failed: unlink %s : %s", info.imagePath.c_str(),
                        ec.message());
        }
 
        fs::rename(decName, fs::path(info.imagePath), ec);
        if (ec) {
-               LOGE(SIM_DAEMON, "Post decryption failed: rename %s -> %s : %s",
+               LOGE(MODULE_SIM_DAEMON, "Post decryption failed: rename %s -> %s : %s",
                        decName.string().c_str(), info.imagePath.c_str(),
                        ec.message());
        }
 
        fs::remove(fs::path(keyhashFilename), ec);
        if (ec) {
-               LOGE(SIM_DAEMON, "Post decryption failed: unlink %s : %s", keyhashFilename.c_str(),
+               LOGE(MODULE_SIM_DAEMON, "Post decryption failed: unlink %s : %s", keyhashFilename.c_str(),
                        ec.message());
        }
 }
@@ -275,7 +275,7 @@ bool TABinaryManager::unpackBinary(const TEEC_UUID &uuid, const string& tapath,
        string uuidStr = UUIDToString(uuid);
        bool ret = false;
        if (0 == unpacker->unpackTA(tapath, uuidStr)) {
-               LOGD(SIM_DAEMON, "Unpacked TA %s from %s", uuidStr.c_str(), tapath.c_str());
+               LOGD(MODULE_SIM_DAEMON, "Unpacked TA %s from %s", uuidStr.c_str(), tapath.c_str());
                // 1. Set binary info
                info.path = tapath + uuidStr;
                info.extractpath = string(TEE_EXTRACT_ROOT) + uuidStr + "-ext/";
@@ -284,7 +284,7 @@ bool TABinaryManager::unpackBinary(const TEEC_UUID &uuid, const string& tapath,
                // 2. Parse manifest and store results
                info.manifest.processXML(info.manifestPath);
 
-               LOGD(SIM_DAEMON, "Decrypting");
+               LOGD(MODULE_SIM_DAEMON, "Decrypting");
                // 3. Decrypt image using secret value in manifest
                if (info.manifest.properties.extension.launchMode == "debug")
                        decryptImage(info);
@@ -295,7 +295,7 @@ bool TABinaryManager::unpackBinary(const TEEC_UUID &uuid, const string& tapath,
                        result = chmod(info.imagePath.c_str(), st.st_mode|S_IXUSR|S_IXGRP|S_IXOTH);
                }
                if (result != 0) {
-                       LOGE(SIM_DAEMON, "Unpacking executable TA failed: %s", strerror(errno));
+                       LOGE(MODULE_SIM_DAEMON, "Unpacking executable TA failed: %s", strerror(errno));
                }
 
                ret = true;
index bda56dc..2dd96d4 100644 (file)
@@ -65,7 +65,7 @@ TAUnpack* TAUnpack::getInstance() {
  * @return -1 on error otherwise 0
  */
 int TAUnpack::unpackTA(const string& path, const string& uuid) {
-       LOGD(SIM_DAEMON, "");
+       LOGD(MODULE_SIM_DAEMON, "");
        TAPackageHeaderV2 packageHeader;
        memset(&packageHeader, 0, sizeof(TAPackageHeaderV2));
 
@@ -74,11 +74,11 @@ int TAUnpack::unpackTA(const string& path, const string& uuid) {
        boost::system::error_code ec;
        fs::remove_all(extract_dir_path, ec);
        if (ec != 0){
-               LOGE(SIM_DAEMON, "remove_all failed %s %s (trying to continue)", extract_dir_path.c_str(), ec.message().c_str());
+               LOGE(MODULE_SIM_DAEMON, "remove_all failed %s %s (trying to continue)", extract_dir_path.c_str(), ec.message().c_str());
        }
        fs::create_directory(extract_dir_path, ec);
        if (ec != 0){
-               LOGE(SIM_DAEMON, "create_directory failed %s %s", extract_dir_path.c_str(), ec.message().c_str());
+               LOGE(MODULE_SIM_DAEMON, "create_directory failed %s %s", extract_dir_path.c_str(), ec.message().c_str());
                return -1;
        }
 
@@ -86,13 +86,13 @@ int TAUnpack::unpackTA(const string& path, const string& uuid) {
        string path_to_file = path + uuid;
        ifstream tapackage(path_to_file.c_str(), ios::in | ios::binary);
        if (!tapackage.is_open()) {
-               LOGE(SIM_DAEMON, "Cannot open ta: %s", path_to_file.c_str());
+               LOGE(MODULE_SIM_DAEMON, "Cannot open ta: %s", path_to_file.c_str());
                return -1; //> unable to open file
        }
        // 1. Read header
        tapackage.read((char*)&packageHeader, sizeof(TAPackageHeaderV2));
        if (tapackage.fail()) {
-               LOGE(SIM_DAEMON, "Read failed");
+               LOGE(MODULE_SIM_DAEMON, "Read failed");
                return -1;
        }
        // 2. Verify header
@@ -108,13 +108,13 @@ int TAUnpack::unpackTA(const string& path, const string& uuid) {
                auto imagedump = std::make_unique<char[]>(packageHeader.image_size);
                tapackage.read(imagedump.get(), packageHeader.image_size);
                if (tapackage.fail()) {
-                       LOGE(SIM_DAEMON, "Read failed");
+                       LOGE(MODULE_SIM_DAEMON, "Read failed");
                        return -1;
                }
 
                ofstream image(imageFile.c_str(), ios::out | ios::binary);
                if (image.fail()) {
-                       LOGE(SIM_DAEMON, "Open failed %s %s", imageFile.c_str(), strerror(errno));
+                       LOGE(MODULE_SIM_DAEMON, "Open failed %s %s", imageFile.c_str(), strerror(errno));
                        return -1;
                }
                image.write(imagedump.get(), packageHeader.image_size);
@@ -125,19 +125,19 @@ int TAUnpack::unpackTA(const string& path, const string& uuid) {
                auto manifestdump = std::make_unique<char[]>(packageHeader.manifest_size);
                tapackage.read(manifestdump.get(), packageHeader.manifest_size);
                if (tapackage.fail()) {
-                       LOGE(SIM_DAEMON, "Read failed");
+                       LOGE(MODULE_SIM_DAEMON, "Read failed");
                        return -1;
                }
 
                ofstream manifest(manifestFile.c_str(), ios::out | ios::binary);
                if (manifest.fail()) {
-                       LOGE(SIM_DAEMON, "Open failed %s %s", manifestFile.c_str(), strerror(errno));
+                       LOGE(MODULE_SIM_DAEMON, "Open failed %s %s", manifestFile.c_str(), strerror(errno));
                        return -1;
                }
                manifest.write(manifestdump.get(), packageHeader.manifest_size);
                manifest.close();
        } else {
-               LOGE(SIM_DAEMON, "Header verification failed");
+               LOGE(MODULE_SIM_DAEMON, "Header verification failed");
                return -1;
        }
 
index d6e4f42..d79ad67 100644 (file)
@@ -108,7 +108,7 @@ int test_main() {
                        }
                }
        } catch (std::exception& e) {
-               LOGE(SIM_DAEMON, "Exception: %s", e.what());
+               LOGE(MODULE_SIM_DAEMON, "Exception: %s", e.what());
        }
        return 0;
 }
index 7d90c6a..30db8e3 100644 (file)
@@ -65,7 +65,7 @@ TAFactory::TAFactory() {
  * instance and return the instance else return the already created instance.
  */
 TAFactory* TAFactory::getInstance() {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        pthread_mutex_lock(&instLock);
 
        // Check if the instance is not yet craeted
@@ -86,7 +86,7 @@ TAFactory* TAFactory::getInstance() {
 TAInstancePtr TAFactory::getTAInstance(TEEC_UUID uuid, ISession* session) {
        TAInstancePtr TAInst;
        bool result;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        // Get TA Binary Manager instance
        TABinaryManager *TABin = TABinaryManager::getInstance();
@@ -98,14 +98,14 @@ TAInstancePtr TAFactory::getTAInstance(TEEC_UUID uuid, ISession* session) {
                 */
                TAInst = createUninitalizedTAInstance(uuid, session);
                if (!TAInst == true) {
-                       LOGE(SIM_DAEMON, "Creating Trusted Application Instance FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Creating Trusted Application Instance FAILED");
                        return TAInstancePtr();
                }
        } else if ((TABin->isSingleInstance(uuid, result) == 0)
            && (result == true)) {
                // TA is Single Instance and alive
                if (TABin->isMultipleSession(uuid, result) < 0) {
-                       LOGE(SIM_DAEMON, "TA not in list");
+                       LOGE(MODULE_SIM_DAEMON, "TA not in list");
                        return TAInstancePtr();
                } else {
                        // Find alive TA Instance in TA Factory's Instance Map
@@ -120,24 +120,24 @@ TAInstancePtr TAFactory::getTAInstance(TEEC_UUID uuid, ISession* session) {
                                         */
 
                                        if (!TAInst == true) {
-                                               LOGE(SIM_DAEMON, "Creating Trusted Application Instance FAILED");
+                                               LOGE(MODULE_SIM_DAEMON, "Creating Trusted Application Instance FAILED");
                                                TAInst->releaseSessionMapLock();
                                                return TAInstancePtr();
                                        }
                                        TAInst->releaseSessionMapLock();
                                } else {
-                                       LOGE(SIM_DAEMON, "TA Single Instance Single Session - "
+                                       LOGE(MODULE_SIM_DAEMON, "TA Single Instance Single Session - "
                                                        "multiple connections not supported");
                                        TAInst->releaseSessionMapLock();
                                        return TAInstancePtr();
                                }
                        } else {
-                               LOGE(SIM_DAEMON, "Trusted Application Instance not found.");
+                               LOGE(MODULE_SIM_DAEMON, "Trusted Application Instance not found.");
                                return TAInstancePtr();
                        }
                }
        } else {
-               LOGE(SIM_DAEMON, "TA not in list");
+               LOGE(MODULE_SIM_DAEMON, "TA not in list");
                return TAInstancePtr();
        }
        TAInst->takeSessionMapLock();
@@ -153,7 +153,7 @@ TAInstancePtr TAFactory::getTAInstance(TEEC_UUID uuid, ISession* session) {
  * @param TAUUID TA UUID
  */
 bool TAFactory::checkIfTARunning(TEEC_UUID TAUUID) {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        auto itr = mTAInstanceMap.find(TAUUID);
        return itr != mTAInstanceMap.end();
 }
@@ -166,7 +166,7 @@ bool TAFactory::checkIfTARunning(TEEC_UUID TAUUID) {
  */
 TAInstancePtr TAFactory::createUninitalizedTAInstance(TEEC_UUID TAUUID,
                ISession* session) {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        // Initialize PID to -1
        pid_t pid = -1;
@@ -198,7 +198,7 @@ TAInstancePtr TAFactory::createUninitalizedTAInstance(TEEC_UUID TAUUID,
                 * member variable isKeepAlive
                 */
                if (TABin->isSingleInstance(TAUUID, singleInst) < 0) {
-                       LOGE(SIM_DAEMON, "TA not in list");
+                       LOGE(MODULE_SIM_DAEMON, "TA not in list");
                        pthread_rwlock_unlock(&instIDLock);
                        return TAInstancePtr();
                } else if (singleInst == true) {
@@ -208,12 +208,12 @@ TAInstancePtr TAFactory::createUninitalizedTAInstance(TEEC_UUID TAUUID,
                         * variable isKeepAlive to false.
                         */
                        if (TABin->isKeepAlive(TAUUID, alive) < 0) {
-                               LOGE(SIM_DAEMON, "TA not in list");
+                               LOGE(MODULE_SIM_DAEMON, "TA not in list");
                                // Kill the launched TA
                                if (pid > 0) {
                                        kill(pid, SIGKILL);
                                        while (kill(pid, 0) != -1);
-                                       LOGD(SIM_DAEMON, "TA process exited");
+                                       LOGD(MODULE_SIM_DAEMON, "TA process exited");
                                }
                                pthread_rwlock_unlock(&instIDLock);
                                return TAInstancePtr();
@@ -232,7 +232,7 @@ TAInstancePtr TAFactory::createUninitalizedTAInstance(TEEC_UUID TAUUID,
                // Increment the Instance ID variable for assigning to next TA Instance
                InstID++;
                if (TEEC_SUCCESS != TAInst->connecttoTA(str)) {
-                       LOGE(SIM_DAEMON, "Connection to TA FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Connection to TA FAILED");
                        TAInst->killTA();
                        pthread_rwlock_unlock(&instIDLock);
                        return TAInstancePtr();
@@ -257,7 +257,7 @@ TAInstancePtr TAFactory::createUninitalizedTAInstance(TEEC_UUID TAUUID,
                        result = TAInst->sendRequestToTA(CREATE, (void*)&cdata,
                            sizeof(CreateTAEntryPointData));
                        if (result != TEEC_SUCCESS) {
-                               LOGE(SIM_DAEMON, "Create sendRequestToTA FAILED\n");
+                               LOGE(MODULE_SIM_DAEMON, "Create sendRequestToTA FAILED\n");
                                // Kill the launched TA
                                TAInst->killTA();
                                pthread_rwlock_unlock(&instIDLock);
@@ -284,7 +284,7 @@ void* TAFactory::waitForChild(void *pid) {
 
        // Wait for PID to exit
        waitpid(PID, &childStatus, 0);
-       LOGD(SIM_DAEMON, "PID %d exited", PID);
+       LOGD(MODULE_SIM_DAEMON, "PID %d exited", PID);
        if (instance != NULL) {
                // Clean (handle immature termination of) TA
                instance->cleanupTAInstance(PID);
@@ -298,7 +298,7 @@ void* TAFactory::waitForChild(void *pid) {
  * @param pid pointer to the PID of the exited TA
  */
 void TAFactory::cleanupTAInstance(pid_t PID) {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        TAInstancePtr Inst;
 
        // Find the TA instance associated with the argument PID
@@ -342,12 +342,12 @@ bool TAFactory::launchTA(TEEC_UUID TAUUID, std::stringstream& str, bool debug,
 
        int32_t result = -1;
        pthread_t thread;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        // Get TABinaryManager instance
        TABinaryManager *TABin = TABinaryManager::getInstance();
        if (TABin == nullptr) {
-               LOGE(SIM_DAEMON, "Failed to get the TA binary manager instance");
+               LOGE(MODULE_SIM_DAEMON, "Failed to get the TA binary manager instance");
                return false;
        }
 
@@ -359,7 +359,7 @@ bool TAFactory::launchTA(TEEC_UUID TAUUID, std::stringstream& str, bool debug,
        }
 
        if ("" == argvPath) {
-               LOGE(SIM_DAEMON, "Trusted Application does not exist");
+               LOGE(MODULE_SIM_DAEMON, "Trusted Application does not exist");
                return false;
        }
        char *envp[1];
@@ -368,7 +368,7 @@ bool TAFactory::launchTA(TEEC_UUID TAUUID, std::stringstream& str, bool debug,
 
        auto UUIDConf = UUIDConfigManager::getInstance();
        if (!UUIDConf) {
-               LOGE(SIM_DAEMON, "Failed to get the UUID config manager instance");
+               LOGE(MODULE_SIM_DAEMON, "Failed to get the UUID config manager instance");
                return false;
        }
        // Get the port to be assigned to TA if TA is to be launched in debug mode
@@ -396,13 +396,13 @@ bool TAFactory::launchTA(TEEC_UUID TAUUID, std::stringstream& str, bool debug,
                // fork TA with GDB
                pid = fork();
                if (0 == pid) {
-                       LOGD(SIM_DAEMON, "In Child Process");
+                       LOGD(MODULE_SIM_DAEMON, "In Child Process");
                        execv(argv[0], argv);
-                       LOGE(SIM_DAEMON, "Launching Trusted Application FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Launching Trusted Application FAILED");
                        pthread_mutex_unlock(&TABin->taLock);
                        return false;
                }
-               LOGD(SIM_DAEMON, "In Parent Process");
+               LOGD(MODULE_SIM_DAEMON, "In Parent Process");
        } else { //RELEASE MODE
                char *argv[3];
                argv[0] = &argvPath[0];
@@ -414,7 +414,7 @@ bool TAFactory::launchTA(TEEC_UUID TAUUID, std::stringstream& str, bool debug,
                posix_spawn_file_actions_t child_fd_actions;
                int ret = posix_spawn_file_actions_init(&child_fd_actions);
                if (ret != 0) {
-                       LOGE(SIM_DAEMON, "posix_spawn_file_actions_init failed");
+                       LOGE(MODULE_SIM_DAEMON, "posix_spawn_file_actions_init failed");
                        return false;
                }
 
@@ -422,25 +422,25 @@ bool TAFactory::launchTA(TEEC_UUID TAUUID, std::stringstream& str, bool debug,
                                                       (TEE_TALOG_ROOT + uuidStr + ".log").c_str(),
                                                       O_WRONLY | O_CREAT | O_APPEND | O_SYNC, 0644);
                if (ret != 0) {
-                       LOGE(SIM_DAEMON, "posix_spawn_file_actions_addopen failed");
+                       LOGE(MODULE_SIM_DAEMON, "posix_spawn_file_actions_addopen failed");
                        return false;
                }
 
                ret = posix_spawn_file_actions_adddup2(&child_fd_actions, 1, 2);
                if (ret != 0) {
-                       LOGE(SIM_DAEMON, "posix_spawn_file_actions_adddup2 failed");
+                       LOGE(MODULE_SIM_DAEMON, "posix_spawn_file_actions_adddup2 failed");
                        return false;
                }
 
-               LOGD(SIM_DAEMON, "spawn TA %s %s", argv[0], argv[1]);
+               LOGD(MODULE_SIM_DAEMON, "spawn TA %s %s", argv[0], argv[1]);
                // Spawn TA
                result = posix_spawn(&pid, argv[0], &child_fd_actions, NULL, argv, envp);
                if (result == 0) {
-                       LOGD(SIM_DAEMON, "TA pid: %i\n", pid);
-                       LOGD(SIM_DAEMON, "Launched Trusted Application");
+                       LOGD(MODULE_SIM_DAEMON, "TA pid: %i\n", pid);
+                       LOGD(MODULE_SIM_DAEMON, "Launched Trusted Application");
                } else {
                        ret = errno;
-                       LOGE(SIM_DAEMON, "Launching Trusted Application FAILED %s(%d)", strerror(ret), ret);
+                       LOGE(MODULE_SIM_DAEMON, "Launching Trusted Application FAILED %s(%d)", strerror(ret), ret);
                        pthread_mutex_unlock(&TABin->taLock);
                        return false;
                }
@@ -450,10 +450,10 @@ bool TAFactory::launchTA(TEEC_UUID TAUUID, std::stringstream& str, bool debug,
        pthread_attr_t attr;
        int s = pthread_attr_init(&attr);
        if (s != 0)
-               LOGE(SIM_DAEMON, "pthread_attr_init");
+               LOGE(MODULE_SIM_DAEMON, "pthread_attr_init");
        s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
        if (s != 0)
-               LOGE(SIM_DAEMON, "pthread_attr_setdetachstate");
+               LOGE(MODULE_SIM_DAEMON, "pthread_attr_setdetachstate");
        pthread_create(&thread, &attr, TAFactory::waitForChild, (void *)&pid);
        return true;
 }
index 8eca010..5d69a6e 100644 (file)
@@ -37,7 +37,7 @@
  */
 TAInstance::TAInstance(uint32_t pid, bool alive, bool debug, uint32_t InstID, boost::asio::io_service& client_io_service) :
 mTAConnectionSocket(client_io_service), readData() {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        // Initialize the lock for Session map (mSessionMap)
        pthread_rwlock_init(&mSessionMapLock, NULL);
@@ -118,12 +118,12 @@ void TAInstance::killTA() {
        if (mPID > 0) {
                kill(mPID, SIGKILL);
                while (kill(mPID, 0) != -1);
-               LOGD(SIM_DAEMON, "TA process exited");
+               LOGD(MODULE_SIM_DAEMON, "TA process exited");
        }
 }
 
 void TAInstance::cleanup() {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        multimap<SIM_COMMAND, cmdData>::iterator it;
        for (it = mCommandMap.begin(); mCommandMap.size() != 0;) {
                ResCommandBasePtr ptr;
@@ -157,14 +157,14 @@ void TAInstance::cleanup() {
                        case CREATE:
                        case DESTROY:
                        default:
-                               LOGE(SIM_DAEMON, "Invalid Command");
+                               LOGE(MODULE_SIM_DAEMON, "Invalid Command");
                                break;
                }
                if (!ptr == false) {
                        // Call the Session object to handle commands
                        ptr->execute();
                } else {
-                       LOGE(SIM_DAEMON, "Command not found");
+                       LOGE(MODULE_SIM_DAEMON, "Command not found");
                }
        }
 }
@@ -181,13 +181,13 @@ TEEC_Result TAInstance::connecttoTA(std::stringstream& str) {
                string tasock = string(TEE_TASOCK_ROOT) + str.str();
                stream_protocol::endpoint ep(tasock);
 
-               LOGD(SIM_DAEMON, "Connect to TEEStub %s", tasock.c_str());
+               LOGD(MODULE_SIM_DAEMON, "Connect to TEEStub %s", tasock.c_str());
                // Try to connect to TA RETRY_COUNT number of times
                while (error && (retry_count < RETRY_COUNT)) {
 #if 0
-                       LOGD(SIM_DAEMON, "Trying to connect to TEEStub");
-                       LOGE(SIM_DAEMON, "Response returned with error code %d", error.value());
-                       LOGE(SIM_DAEMON, "Response returned with error code %s",
+                       LOGD(MODULE_SIM_DAEMON, "Trying to connect to TEEStub");
+                       LOGE(MODULE_SIM_DAEMON, "Response returned with error code %d", error.value());
+                       LOGE(MODULE_SIM_DAEMON, "Response returned with error code %s",
                                        error.category().name());
 #endif
                        mTAConnectionSocket.close();
@@ -196,11 +196,11 @@ TEEC_Result TAInstance::connecttoTA(std::stringstream& str) {
                }
                if (retry_count < RETRY_COUNT) {
                        // Connection successful
-                       LOGD(SIM_DAEMON, "Connected to TEEStub");
+                       LOGD(MODULE_SIM_DAEMON, "Connected to TEEStub");
                        return TEEC_SUCCESS;
                } else {
                        // Retry count exceeded, connection failed
-                       LOGE(SIM_DAEMON, "Connection to TEEStub timed out");
+                       LOGE(MODULE_SIM_DAEMON, "Connection to TEEStub timed out");
                        return TEEC_ERROR_COMMUNICATION;
                }
        } catch (std::exception& e) {
@@ -218,7 +218,7 @@ TEEC_Result TAInstance::connecttoTA(std::stringstream& str) {
 TEEC_Result TAInstance::sendRequestToTA(SIM_COMMAND cmd, void* data,
     uint32_t size) {
 
-       LOGD(SIM_DAEMON, "Instance ID: %d", mTAInstanceID);
+       LOGD(MODULE_SIM_DAEMON, "Instance ID: %d", mTAInstanceID);
        TEEC_Result result = TEEC_ERROR_TARGET_DEAD;
        boost::system::error_code error = boost::asio::error::host_not_found;
 
@@ -234,15 +234,15 @@ TEEC_Result TAInstance::sendRequestToTA(SIM_COMMAND cmd, void* data,
                        result = TEEC_SUCCESS;
                else
                {
-                       LOGE(SIM_DAEMON, "Error in writing Data to TA");
-                       LOGE(SIM_DAEMON, "Response returned with error code %d", error.value());
-                       LOGE(SIM_DAEMON, "Response returned with error code %s",
+                       LOGE(MODULE_SIM_DAEMON, "Error in writing Data to TA");
+                       LOGE(MODULE_SIM_DAEMON, "Response returned with error code %d", error.value());
+                       LOGE(MODULE_SIM_DAEMON, "Response returned with error code %s",
                            error.category().name());
                }
        } else {
-               LOGE(SIM_DAEMON, "Error in writing Command to TA");
-               LOGE(SIM_DAEMON, "Response returned with error code %d", error.value());
-               LOGE(SIM_DAEMON, "Response returned with error code %s",
+               LOGE(MODULE_SIM_DAEMON, "Error in writing Command to TA");
+               LOGE(MODULE_SIM_DAEMON, "Response returned with error code %d", error.value());
+               LOGE(MODULE_SIM_DAEMON, "Response returned with error code %s",
                    error.category().name());
        }
        pthread_mutex_unlock(&sendLock);
@@ -286,7 +286,7 @@ void TAInstance::handleRead(const boost::system::error_code& error,
                        case CMD_READ: {
                                // Identify command
                                command = (SIM_COMMAND)readData.at(0);
-                               LOGD(SIM_DAEMON, "Command received: %d", (uint32_t)command);
+                               LOGD(MODULE_SIM_DAEMON, "Command received: %d", (uint32_t)command);
 
                                /* Calculate pending numbers of bytes pending to be read only for
                                 * commands
@@ -307,7 +307,7 @@ void TAInstance::handleRead(const boost::system::error_code& error,
                                        /* TODO: Identify the correct behavior;
                                         * what to do when invalid command is received?
                                         */
-                                       LOGE(SIM_DAEMON, "Invalid command received!");
+                                       LOGE(MODULE_SIM_DAEMON, "Invalid command received!");
                                } else if (0 == data_size) {
                                        // reset state to read new command
                                        currentState = CMD_READ;
@@ -338,7 +338,7 @@ void TAInstance::handleRead(const boost::system::error_code& error,
                                        // Call the Session object to handle commands
                                        ptr->execute();
                                } else {
-                                       LOGE(SIM_DAEMON, "Command not found");
+                                       LOGE(MODULE_SIM_DAEMON, "Command not found");
                                }
 
                                // reset state to read new command
@@ -363,12 +363,12 @@ void TAInstance::handleRead(const boost::system::error_code& error,
 int32_t TAInstance::setSocketOpt(struct timeval timeout) {
        int32_t result = 0;
        if (isDebug == false) {
-               LOGD(SIM_DAEMON, "Entry");
+               LOGD(MODULE_SIM_DAEMON, "Entry");
                //Set socket timeout for mTAConnectionSocket
                result = setsockopt(mTAConnectionSocket.native(), SOL_SOCKET, SO_RCVTIMEO,
                    (char*)&timeout, sizeof(timeout));
                if (result < 0) {
-                       LOGE(SIM_DAEMON, "setsockopt timeout = %d FAILED", timeout.tv_usec);
+                       LOGE(MODULE_SIM_DAEMON, "setsockopt timeout = %d FAILED", timeout.tv_usec);
                }
        }
        return result;
@@ -386,7 +386,7 @@ TEEC_Result TAInstance::receiveCreateResponse() {
        timeout.tv_sec = 0;
        timeout.tv_usec = 30000;
 
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        if (!setSocketOpt(timeout)) {
                // If no error is setting socket timeout, receive response command
                boost::asio::read(mTAConnectionSocket, boost::asio::buffer(readData),
@@ -399,19 +399,19 @@ TEEC_Result TAInstance::receiveCreateResponse() {
                        if (!ec)
                                result = TEEC_SUCCESS;
                        else
-                       LOGE(SIM_DAEMON, "read data FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "read data FAILED");
                } else {
-                       LOGE(SIM_DAEMON, "read command FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "read command FAILED");
                }
        } else {
-               LOGE(SIM_DAEMON, "Setting timeout failed");
+               LOGE(MODULE_SIM_DAEMON, "Setting timeout failed");
                return result;
        }
        //Set Socket timeout to default after receiving Create response
        timeout.tv_usec = 0;
        if (0 != setSocketOpt(timeout)) {
                result = TEEC_ERROR_COMMUNICATION;
-               LOGE(SIM_DAEMON, "Setting timeout failed");
+               LOGE(MODULE_SIM_DAEMON, "Setting timeout failed");
        }
        return result;
 }
@@ -420,13 +420,13 @@ TEEC_Result TAInstance::receiveCreateResponse() {
  * Function call to close socket connection with TA
  */
 void TAInstance::closeConnectionToTA() {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        boost::system::error_code ec;
 
        mTAConnectionSocket.close(ec);
        if(ec)
-               LOGE(SIM_DAEMON, "TA Connection close FAILED");
+               LOGE(MODULE_SIM_DAEMON, "TA Connection close FAILED");
 }
 
 /**
@@ -434,7 +434,7 @@ void TAInstance::closeConnectionToTA() {
  * called.
  */
 TAInstance::~TAInstance() {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        // Close connection with TA
        closeConnectionToTA();
index 1b23894..9c4a372 100644 (file)
@@ -50,7 +50,7 @@ void TEEConnectionHandler::setWriter(IConnectionWriter<int8_t> &writer)
 
 void TEEConnectionHandler::handleConnect(int sock)
 {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        // Create a new Context
        pthread_rwlock_wrlock(&ctxIDLock);
@@ -67,10 +67,10 @@ int32_t TEEConnectionHandler::getDataSize(int8_t cmdData)
        TEE_CMD cmd = dataToCmd(cmdData);
        int32_t data_size;
 
-       LOGD(SIM_DAEMON, "Command received: %d", (uint32_t)cmd);
+       LOGD(MODULE_SIM_DAEMON, "Command received: %d", (uint32_t)cmd);
        data_size = MakeCommand::getDataSize(cmd);
        if (data_size == -1)
-               LOGE(SIM_DAEMON, "Invalid command received!");
+               LOGE(MODULE_SIM_DAEMON, "Invalid command received!");
        return data_size;
 }
 
@@ -86,15 +86,15 @@ void TEEConnectionHandler::handleRead(int8_t headerData, std::vector<char> &data
        if (!ptr == false) {
                ptr->execute();
        } else {
-               LOGE(SIM_DAEMON, "Command not found");
+               LOGE(MODULE_SIM_DAEMON, "Command not found");
        }
 }
 
 void TEEConnectionHandler::handleReadError(boost::system::error_code e)
 {
-       LOGE(SIM_DAEMON, "Error in reading from CA");
-       LOGE(SIM_DAEMON, "Response returned with error code %d", e.value());
-       LOGE(SIM_DAEMON, "Response returned with error code %s",
+       LOGE(MODULE_SIM_DAEMON, "Error in reading from CA");
+       LOGE(MODULE_SIM_DAEMON, "Response returned with error code %d", e.value());
+       LOGE(MODULE_SIM_DAEMON, "Response returned with error code %s",
            e.category().name());
 }
 
@@ -108,7 +108,7 @@ void TEEConnectionHandler::handleConnectionClosed()
        if (!ptr == false) {
                ptr->execute();
        } else {
-               LOGE(SIM_DAEMON, "Command not found");
+               LOGE(MODULE_SIM_DAEMON, "Command not found");
        }
 }
 
@@ -119,7 +119,7 @@ TEEC_Result TEEConnectionHandler::write(TEE_CMD cmd, char* data, size_t size)
 
        writeRet = m_writer->write(cmdToData(cmd), data, size);
        if (writeRet) {
-               LOGE(SIM_DAEMON, "Error in writing Data to CA: response returned with error code %d, message '%s'",
+               LOGE(MODULE_SIM_DAEMON, "Error in writing Data to CA: response returned with error code %d, message '%s'",
                                 writeRet.value(),
                                 writeRet.category().name());
                result = TEEC_ERROR_COMMUNICATION;
@@ -128,7 +128,7 @@ TEEC_Result TEEConnectionHandler::write(TEE_CMD cmd, char* data, size_t size)
 }
 
 TEEConnectionHandler::~TEEConnectionHandler() {
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        delete TEECtx;
        TEECtx = NULL;
 }
index 622f529..37e7c4b 100644 (file)
@@ -45,7 +45,7 @@ uint32_t sessID = 51;
  * @param connSession ConnectionSession instance associated with the context
  */
 TEEContext::TEEContext(uint32_t contextID, TEEConnectionHandler* connSession) {
-       LOGD(SIM_DAEMON, "ContextID: %d", contextID);
+       LOGD(MODULE_SIM_DAEMON, "ContextID: %d", contextID);
 
        /* Initialize the locks for shared memory list (mShmList) and Session map
         * (mSessionMap) */
@@ -69,13 +69,13 @@ TEEContext::TEEContext(uint32_t contextID, TEEConnectionHandler* connSession) {
 TEEC_Result TEEContext::initContext(InitContextData* data) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
 
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        if (data->nameLength != 0) {
                data->returnValue = TEEC_ERROR_ITEM_NOT_FOUND;
                result = mConnSess->write(INITIALIZE_CONTEXT, (char*)data, sizeof(InitContextData));
                if (result != TEEC_SUCCESS) {
-                       LOGE(SIM_DAEMON, "Initialize Context response write to CA FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Initialize Context response write to CA FAILED");
                }
                return result;
        }
@@ -92,7 +92,7 @@ TEEC_Result TEEContext::initContext(InitContextData* data) {
        result = mConnSess->write(INITIALIZE_CONTEXT, (char*)data,
            sizeof(InitContextData));
        if (result != TEEC_SUCCESS) {
-               LOGE(SIM_DAEMON, "Initialize Context response write to CA FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Initialize Context response write to CA FAILED");
        }
        return result;
 }
@@ -105,7 +105,7 @@ TEEC_Result TEEContext::initContext(InitContextData* data) {
  */
 void TEEContext::finContext(FinalizeContextData data) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        /* Check if the Session map is empty i.e. if all the Sessions have
         * been closed. If not closed, print an error, close the sessions in the
@@ -113,7 +113,7 @@ void TEEContext::finContext(FinalizeContextData data) {
         */
        pthread_rwlock_wrlock(&mSessionMapLock);
        if (!mSessionMap.empty()) {
-               LOGE(SIM_DAEMON, "Session running in the context\n");
+               LOGE(MODULE_SIM_DAEMON, "Session running in the context\n");
                pthread_rwlock_unlock(&mSessionMapLock);
                map<uint32_t, ISession*>::iterator it;
                for (it = mSessionMap.begin(); it != mSessionMap.end(); ++it) {
@@ -123,7 +123,7 @@ void TEEContext::finContext(FinalizeContextData data) {
                        it->second->finalize(0);
                        result = closeSession(cdata);
                        if (TEE_SUCCESS != result) {
-                               LOGE(SIM_DAEMON, "Finalize Context - close session FAILED Session ID = %d\n", it->first);
+                               LOGE(MODULE_SIM_DAEMON, "Finalize Context - close session FAILED Session ID = %d\n", it->first);
                        }
                }
                pthread_rwlock_wrlock(&mSessionMapLock);
@@ -136,7 +136,7 @@ void TEEContext::finContext(FinalizeContextData data) {
         */
        pthread_rwlock_wrlock(&mShmListLock);
        if (!mShmList.empty()) {
-               LOGE(SIM_DAEMON, "WSM not released");
+               LOGE(MODULE_SIM_DAEMON, "WSM not released");
                mShmList.clear();
        }
        pthread_rwlock_unlock(&mShmListLock);
@@ -146,7 +146,7 @@ void TEEContext::finContext(FinalizeContextData data) {
                result = mConnSess->write(FINALIZE_CONTEXT, (char*)&data,
                    sizeof(FinalizeContextData));
                if (result != TEEC_SUCCESS) {
-                       LOGE(SIM_DAEMON, "Finalize Context response write to CA FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Finalize Context response write to CA FAILED");
                }
        }
 }
@@ -160,7 +160,7 @@ void TEEContext::finContext(FinalizeContextData data) {
 TEEC_Result TEEContext::openSession(OpenSessionData data) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
 
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        data.returnOrigin = TEEC_ORIGIN_TEE;
        data.returnValue = TEEC_ERROR_GENERIC;
 
@@ -175,7 +175,7 @@ TEEC_Result TEEContext::openSession(OpenSessionData data) {
        /* Call session createSession function to handle open session request */
        result = mSession->createSession(data);
        if (TEEC_SUCCESS != result) {
-               LOGE(SIM_DAEMON, "Open Command FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Open Command FAILED");
                delete mSession;
                data.returnValue = result;
 
@@ -183,12 +183,12 @@ TEEC_Result TEEContext::openSession(OpenSessionData data) {
                result = mConnSess->write(OPEN_SESSION, (char*)&data,
                    sizeof(OpenSessionData));
                if (result != TEEC_SUCCESS) {
-                       LOGE(SIM_DAEMON, "Open Session response write to CA FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Open Session response write to CA FAILED");
                }
                return result;
        }
        if (mSession->getTAInstance() == NULL) {
-               LOGE(SIM_DAEMON, "Creating Trusted Application Instance FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Creating Trusted Application Instance FAILED");
                delete mSession;
                data.returnValue = TEEC_ERROR_ITEM_NOT_FOUND;
 
@@ -196,7 +196,7 @@ TEEC_Result TEEContext::openSession(OpenSessionData data) {
                result = mConnSess->write(OPEN_SESSION, (char*)&data,
                    sizeof(OpenSessionData));
                if (result != TEEC_SUCCESS) {
-                       LOGE(SIM_DAEMON, "Open Session response write to CA FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Open Session response write to CA FAILED");
                }
                return result;
        }
@@ -215,7 +215,7 @@ TEEC_Result TEEContext::openSession(OpenSessionData data) {
  */
 TEEC_Result TEEContext::invokeCommand(InvokeCommandData data) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
        data.returnOrigin = TEEC_ORIGIN_TEE;
        data.returnValue = TEEC_ERROR_GENERIC;
 
@@ -224,7 +224,7 @@ TEEC_Result TEEContext::invokeCommand(InvokeCommandData data) {
        pthread_rwlock_wrlock(&mSessionMapLock);
        it = mSessionMap.find(data.sessionID);
        if (it == mSessionMap.end()) {
-               LOGE(SIM_DAEMON, "Session not found");
+               LOGE(MODULE_SIM_DAEMON, "Session not found");
                pthread_rwlock_unlock(&mSessionMapLock);
                return result;
        }
@@ -232,7 +232,7 @@ TEEC_Result TEEContext::invokeCommand(InvokeCommandData data) {
 
        /* Call session handleCommand function to handle invoke command request */
        if (NULL != it->second) {
-               LOGD(SIM_DAEMON, "Entry");
+               LOGD(MODULE_SIM_DAEMON, "Entry");
                result = it->second->handleCommand(data);
                if (TEEC_SUCCESS == result) {
                        return result;
@@ -240,13 +240,13 @@ TEEC_Result TEEContext::invokeCommand(InvokeCommandData data) {
        } else {
                result = TEEC_ERROR_TARGET_DEAD;
        }
-       LOGE(SIM_DAEMON, "Invoke Command FAILED");
+       LOGE(MODULE_SIM_DAEMON, "Invoke Command FAILED");
        data.returnValue = result;
        /* Write the response back to TEECLIB in case of failure */
        result = mConnSess->write(INVOKE_COMMAND, (char*)&data,
            sizeof(InvokeCommandData));
        if (result != TEEC_SUCCESS) {
-               LOGE(SIM_DAEMON, "Invoke Command response write to CA FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Invoke Command response write to CA FAILED");
        }
        return result;
 }
@@ -259,14 +259,14 @@ TEEC_Result TEEContext::invokeCommand(InvokeCommandData data) {
  */
 void TEEContext::reqCancel(ReqCancellationData data) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        /* Find the Session instance in the session map */
        map<uint32_t, ISession*>::iterator it;
        pthread_rwlock_wrlock(&mSessionMapLock);
        it = mSessionMap.find(data.sessionID);
        if (it == mSessionMap.end()) {
-               LOGE(SIM_DAEMON, "Session not found");
+               LOGE(MODULE_SIM_DAEMON, "Session not found");
                pthread_rwlock_unlock(&mSessionMapLock);
                return;
        }
@@ -274,7 +274,7 @@ void TEEContext::reqCancel(ReqCancellationData data) {
        /* Call session handleCancel function to handle cancellation request */
        pthread_rwlock_unlock(&mSessionMapLock);
        if (NULL != it->second) {
-               LOGD(SIM_DAEMON, "Entry");
+               LOGD(MODULE_SIM_DAEMON, "Entry");
                it->second->handleCancel(data);
        }
 
@@ -282,7 +282,7 @@ void TEEContext::reqCancel(ReqCancellationData data) {
        result = mConnSess->write(REQUEST_CANCELLATION, (char*)&data,
            sizeof(ReqCancellationData));
        if (result != TEEC_SUCCESS) {
-               LOGE(SIM_DAEMON, "Request Cancellation response write to CA FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Request Cancellation response write to CA FAILED");
        }
 }
 
@@ -294,22 +294,22 @@ void TEEContext::reqCancel(ReqCancellationData data) {
  */
 TEEC_Result TEEContext::closeSession(CloseSessionData data) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        /* Find the Session instance in the session map */
        map<uint32_t, ISession*>::iterator it;
        pthread_rwlock_wrlock(&mSessionMapLock);
        it = mSessionMap.find(data.sessionID);
        if (it == mSessionMap.end()) {
-               LOGE(SIM_DAEMON, "Session not found");
+               LOGE(MODULE_SIM_DAEMON, "Session not found");
                pthread_rwlock_unlock(&mSessionMapLock);
                return result;
        }
-       LOGE(SIM_DAEMON, "Session pointer 0x%x", it->second);
+       LOGE(MODULE_SIM_DAEMON, "Session pointer 0x%x", it->second);
 
        /* Call session finalize function to handle close session request */
        if (NULL != it->second) {
-               LOGD(SIM_DAEMON, "Entry");
+               LOGD(MODULE_SIM_DAEMON, "Entry");
                result = it->second->finalize(data.contextID);
                if (result == TEEC_SUCCESS) {
                        return result;
@@ -320,14 +320,14 @@ TEEC_Result TEEContext::closeSession(CloseSessionData data) {
                result = TEEC_ERROR_TARGET_DEAD;
        }
 
-       LOGE(SIM_DAEMON, "Close Command FAILED");
+       LOGE(MODULE_SIM_DAEMON, "Close Command FAILED");
        delete it->second;
        if (data.contextID != 0) {
                /* Write the response back to TEECLIB in case of failure */
                result = mConnSess->write(CLOSE_SESSION, (char*)&data,
                    sizeof(CloseSessionData));
                if (result != TEEC_SUCCESS) {
-                       LOGE(SIM_DAEMON, "Close Session response write to CA FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Close Session response write to CA FAILED");
                }
        }
        pthread_rwlock_unlock(&mSessionMapLock);
@@ -342,7 +342,7 @@ TEEC_Result TEEContext::closeSession(CloseSessionData data) {
  */
 TEEC_Result TEEContext::openTASession(IntTAOpenSessionData data) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        /* OpenTASession is a request from TA, so the member variable isInternal of
         * TEEContext is set to true
@@ -372,7 +372,7 @@ TEEC_Result TEEContext::openTASession(IntTAOpenSessionData data) {
                    sizeof(IntTAOpenSessionData));
 
                if (result != TEEC_SUCCESS) {
-                       LOGE(SIM_DAEMON, "Open TA Session response write to CA FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Open TA Session response write to CA FAILED");
                }
 
                return result;
@@ -384,7 +384,7 @@ TEEC_Result TEEContext::openTASession(IntTAOpenSessionData data) {
        /* Call session createSession function to handle open session request */
        result = mSession->createSession(sdata);
        if (TEEC_SUCCESS != result) {
-               LOGE(SIM_DAEMON, "Open TA command FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Open TA command FAILED");
                delete mSession;
                data.returnValue = result;
 
@@ -392,19 +392,19 @@ TEEC_Result TEEContext::openTASession(IntTAOpenSessionData data) {
                result = mConnSess->write(OPEN_TA_SESSION, (char*)&data,
                    sizeof(IntTAOpenSessionData));
                if (result != TEEC_SUCCESS) {
-                       LOGE(SIM_DAEMON, "Open TA Session response write to CA FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Open TA Session response write to CA FAILED");
                }
                return result;
        }
        if (mSession->getTAInstance() == NULL) {
-               LOGE(SIM_DAEMON, "Creating Trusted Application Instance FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Creating Trusted Application Instance FAILED");
                delete mSession;
                data.returnValue = TEEC_ERROR_ITEM_NOT_FOUND;
                /* Write the response back to SSFLIB in case of failure */
                result = mConnSess->write(OPEN_TA_SESSION, (char*)&data,
                    sizeof(IntTAOpenSessionData));
                if (result != TEEC_SUCCESS) {
-                       LOGE(SIM_DAEMON, "Open TA Session response write to CA FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Open TA Session response write to CA FAILED");
                }
                return result;
        }
@@ -424,13 +424,13 @@ TEEC_Result TEEContext::openTASession(IntTAOpenSessionData data) {
 void TEEContext::closeTASession(IntTACloseSessionData data) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
        map<uint32_t, ISession*>::iterator it;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        /* Find the Session instance in the session map */
        pthread_rwlock_wrlock(&mSessionMapLock);
        it = mSessionMap.find(data.session);
        if (it == mSessionMap.end()) {
-               LOGE(SIM_DAEMON, "Session not found");
+               LOGE(MODULE_SIM_DAEMON, "Session not found");
                pthread_rwlock_unlock(&mSessionMapLock);
                return;
        }
@@ -438,13 +438,13 @@ void TEEContext::closeTASession(IntTACloseSessionData data) {
        /* Call session finalize function to handle close session request */
        result = it->second->finalize(mContextID);
        if (result != TEEC_SUCCESS) {
-               LOGE(SIM_DAEMON, "Close TA Command FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Close TA Command FAILED");
                delete it->second;
                /* Write the response back to SSFLIB */
                result = mConnSess->write(CLOSE_TA_SESSION, (char*)&data,
                    sizeof(IntTACloseSessionData));
                if (result != TEEC_SUCCESS) {
-                       LOGE(SIM_DAEMON, "Close TA Session response write to CA FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Close TA Session response write to CA FAILED");
                }
        }
        /* Remove the Session instance from the session map */
@@ -460,7 +460,7 @@ void TEEContext::closeTASession(IntTACloseSessionData data) {
  */
 TEEC_Result TEEContext::invokeTACommand(IntTAInvokeCommandData data) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        data.returnOrigin = TEEC_ORIGIN_TEE;
        data.returnValue = TEEC_ERROR_GENERIC;
@@ -477,7 +477,7 @@ TEEC_Result TEEContext::invokeTACommand(IntTAInvokeCommandData data) {
        pthread_rwlock_wrlock(&mSessionMapLock);
        it = mSessionMap.find(data.session);
        if (it == mSessionMap.end()) {
-               LOGE(SIM_DAEMON, "Session not found");
+               LOGE(MODULE_SIM_DAEMON, "Session not found");
                pthread_rwlock_unlock(&mSessionMapLock);
                return result;
        }
@@ -486,13 +486,13 @@ TEEC_Result TEEContext::invokeTACommand(IntTAInvokeCommandData data) {
        /* Call session handle command function to handle invoke command request */
        result = it->second->handleCommand(idata);
        if (TEEC_SUCCESS != result) {
-               LOGE(SIM_DAEMON, "Invoke TA Command FAILED");
+               LOGE(MODULE_SIM_DAEMON, "Invoke TA Command FAILED");
                data.returnValue = result;
                /* Write the response back to SSFLIB */
                result = mConnSess->write(INVOKE_TA_COMMAND, (char*)&data,
                    sizeof(IntTAInvokeCommandData));
                if (result != TEEC_SUCCESS) {
-                       LOGE(SIM_DAEMON, "Invoke TA Session response write to CA FAILED");
+                       LOGE(MODULE_SIM_DAEMON, "Invoke TA Session response write to CA FAILED");
                }
        }
        return result;
@@ -506,7 +506,7 @@ TEEC_Result TEEContext::invokeTACommand(IntTAInvokeCommandData data) {
  */
 TEEC_Result TEEContext::registerSharedMemory(RegSharedMemData data) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        /* Add the shared memory in the list */
        pthread_rwlock_wrlock(&mShmListLock);
@@ -528,7 +528,7 @@ TEEC_Result TEEContext::registerSharedMemory(RegSharedMemData data) {
  */
 TEEC_Result TEEContext::releaseSharedMemory(RelSharedMemData data) {
        TEEC_Result result = TEEC_ERROR_GENERIC;
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        /* Remove the shared memory for the list */
        pthread_rwlock_wrlock(&mShmListLock);
@@ -544,7 +544,7 @@ TEEC_Result TEEContext::releaseSharedMemory(RelSharedMemData data) {
 TEEC_Result TEEContext::checkTADomain(IntTAOpenSessionData data) {
        TEEC_Result result = TEEC_ERROR_ACCESS_DENIED;
 
-       LOGD(SIM_DAEMON, "Entry");
+       LOGD(MODULE_SIM_DAEMON, "Entry");
 
        const TAManifest* srcTAManifest;
        const TAManifest* dstTAManifest;
@@ -555,7 +555,7 @@ TEEC_Result TEEContext::checkTADomain(IntTAOpenSessionData data) {
        TEEC_UUID src, dst;
        TABinaryManager *TABin = TABinaryManager::getInstance();
        if(TABin == NULL) {
-               LOGE(SIM_DAEMON, "Creating TABinaryManager Instance FAILED - ");
+               LOGE(MODULE_SIM_DAEMON, "Creating TABinaryManager Instance FAILED - ");
                return TEEC_ERROR_GENERIC;
        }
 
@@ -569,7 +569,7 @@ TEEC_Result TEEContext::checkTADomain(IntTAOpenSessionData data) {
        srcTAManifest = TABin->getManifest(src);
 
        if(srcTAManifest == NULL || dstTAManifest == NULL) {
-               LOGE(SIM_DAEMON, "Can`t find TA Manifest - source_uuid(%s), destination_uuid(%s)", srcStr.c_str(), dstStr.c_str());
+               LOGE(MODULE_SIM_DAEMON, "Can`t find TA Manifest - source_uuid(%s), destination_uuid(%s)", srcStr.c_str(), dstStr.c_str());
                return TEEC_ERROR_ACCESS_DENIED;
        }
 
@@ -604,7 +604,7 @@ TEEC_Result TEEContext::checkTADomain(IntTAOpenSessionData data) {
  * TEEContext destructer.
  */
 TEEContext::~TEEContext() {
-       LOGD(SIM_DAEMON, "ContextID: %d", mContextID);
+       LOGD(MODULE_SIM_DAEMON, "ContextID: %d", mContextID);
        /* Destroy the locks created for shared memory list (mShmList) and
         * Session map (mSessionMap). */
        pthread_rwlock_destroy(&mShmListLock);
index 119c511..fa1a460 100644 (file)
@@ -55,7 +55,7 @@ void TEE_GetSystemTime(TEE_Time* time) {
        TEE_Result result = TEE_GetPropertyAsU32(
            (TEE_PropSetHandle)TEE_PROPSET_TEE_IMPLEMENTATION,
            "gpd.tee.systemTime.protectionLevel", &value);
-       LOGD(SSF_LIB, "TEE_GetPropertyAsU32(systemTime.protectionLevel) : %d(ret:%d)",
+       LOGD(MODULE_SSF_LIB, "TEE_GetPropertyAsU32(systemTime.protectionLevel) : %d(ret:%d)",
            value, result);
        if (result == TEE_SUCCESS) if (value == 1000) /* req ree time*/
        reqSrcTee = false;
@@ -163,7 +163,7 @@ TEE_Result TEE_GetTAPersistentTime(TEE_Time* time) {
        TEE_Result result = TEE_GetPropertyAsU32(
            (TEE_PropSetHandle)TEE_PROPSET_TEE_IMPLEMENTATION,
            "gpd.tee.systemTime.protectionLevel", &value);
-       LOGD(SSF_LIB, "TEE_GetPropertyAsU32(systemTime.protectionLevel) : %d(ret:%d)",
+       LOGD(MODULE_SSF_LIB, "TEE_GetPropertyAsU32(systemTime.protectionLevel) : %d(ret:%d)",
            value, result);
        if (result == TEE_SUCCESS) if (value == 1000) /* req ree time*/
        reqSrcTee = false;
index 46c5524..bcc0ff2 100644 (file)
 
 #define PERMISSION_CHECK(variable)      \
         if (CheckPermission(variable)) { \
-               LOGE(SSF_LIB, "Permission Denied - Function %s() is not permitted." , __FUNCTION__);  \
+               LOGE(MODULE_SSF_LIB, "Permission Denied - Function %s() is not permitted." , __FUNCTION__);  \
                 return TEE_ERROR_ACCESS_DENIED; }
 
 #define PERMISSION_CHECK_RETURN_VOID(variable)  \
         if (CheckPermission(variable)) { \
-                LOGE(SSF_LIB, "Permission Denied - Function %s() is not permitted." , __FUNCTION__);  \
+                LOGE(MODULE_SSF_LIB, "Permission Denied - Function %s() is not permitted." , __FUNCTION__);  \
                 return; }
 
 typedef enum {
index fd4899d..82483da 100644 (file)
@@ -33,7 +33,7 @@
 /*-----------------------------------------------------------------------------
  *  MACROS
  *-----------------------------------------------------------------------------*/
-#define TAG SSF_LIB
+#define TAG MODULE_SSF_LIB
 #define SDRM_API_METADATA_LENGTH_IN_U32 4
 #define CNT_OF_BIT_IN_BYTE 8
 #define PASS_NOT_IMP_CODE
index 8094a29..e0cec5d 100644 (file)
  * @return socket file descriptor to connected server
  */
 int32_t connecttoServer(void) {
-       LOGD(SSF_LIB, "Entry");
+       LOGD(MODULE_SSF_LIB, "Entry");
        int serverSocket, socklen;
        size_t sock_path_len = 0;
        struct sockaddr* sockptr;
        struct sockaddr_un daemonsock;
 
        if ((serverSocket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
-               LOGE(SSF_LIB, "No socket for simdaemon");
+               LOGE(MODULE_SSF_LIB, "No socket for simdaemon");
                return -1;
        }
        daemonsock.sun_family = AF_UNIX;
@@ -63,7 +63,7 @@ int32_t connecttoServer(void) {
        socklen = sizeof(daemonsock);
        sockptr = (struct sockaddr*)&daemonsock;
        if (connect(serverSocket, sockptr, socklen) == -1) {
-               LOGE(SSF_LIB, "connection to simdaemon failed (s=%s)", SIMDAEMON_SOCK_PATH);
+               LOGE(MODULE_SSF_LIB, "connection to simdaemon failed (s=%s)", SIMDAEMON_SOCK_PATH);
                close(serverSocket);
                return -1;
        }
@@ -77,13 +77,13 @@ int32_t connecttoServer(void) {
  */
 void disconnectfromServer(int32_t serverSocket) {
        int32_t result;
-       LOGD(SSF_LIB, "Entry");
+       LOGD(MODULE_SSF_LIB, "Entry");
        if (serverSocket > 0) {
                result = shutdown(serverSocket, SHUT_WR);
-               if (result != 0) LOGE(SSF_LIB, "disconnectfromServer failed");
+               if (result != 0) LOGE(MODULE_SSF_LIB, "disconnectfromServer failed");
                close(serverSocket);
        } else {
-               LOGE(SSF_LIB, "Invalid socket, disconnectfromServer failed");
+               LOGE(MODULE_SSF_LIB, "Invalid socket, disconnectfromServer failed");
        }
 }
 
@@ -96,7 +96,7 @@ void disconnectfromServer(int32_t serverSocket) {
  * @return
  */
 static uint32_t sendCommandtoDaemon(int32_t sockfd, char* fdata, size_t size) {
-       LOGD(SSF_LIB, "Entry");
+       LOGD(MODULE_SSF_LIB, "Entry");
        ssize_t nwrite = 0;
        size_t nbytes = 0;
        if (sockfd >= 0) {
@@ -106,7 +106,7 @@ static uint32_t sendCommandtoDaemon(int32_t sockfd, char* fdata, size_t size) {
                    nwrite) < size)));
                return (size != nbytes) ? errno : 0;
        }
-       LOGE(SSF_LIB, "failed");
+       LOGE(MODULE_SSF_LIB, "failed");
        return TEEC_ERROR_COMMUNICATION;
 }
 
@@ -119,7 +119,7 @@ static uint32_t sendCommandtoDaemon(int32_t sockfd, char* fdata, size_t size) {
  * @return
  */
 static uint32_t receiveResponse(int32_t sockfd, char* fdata, size_t size) {
-       LOGD(SSF_LIB, "Entry");
+       LOGD(MODULE_SSF_LIB, "Entry");
        ssize_t nread = 0;
        size_t nbytes = 0;
        if (sockfd >= 0) {
@@ -129,7 +129,7 @@ static uint32_t receiveResponse(int32_t sockfd, char* fdata, size_t size) {
                    || (nread > 0 && ((nbytes += nread) < size)));
                return (size != nbytes) ? errno : 0;
        }
-       LOGE(SSF_LIB, "failed");
+       LOGE(MODULE_SSF_LIB, "failed");
        return TEEC_ERROR_COMMUNICATION;
 }
 
@@ -158,7 +158,7 @@ static uint32_t Test(char cmd, char* fdata, size_t size, uint32_t in) {
  * @return
  */
 uint32_t sendCommand(int32_t sockfd, TEE_CMD cmd, void* data, size_t size) {
-       LOGD(SSF_LIB, "Entry");
+       LOGD(MODULE_SSF_LIB, "Entry");
        TEE_Result result = TEE_SUCCESS;
        char command = (char)cmd;
 #ifdef TEST
index d0b3153..a0a6852 100644 (file)
@@ -39,7 +39,7 @@
 
 #define TAG "TEE:Crypto"
 
-#define CRYPTO_PANIC   do{LOGE(SSF_LIB, "This Line!");TEE_Panic(0);}while(0)
+#define CRYPTO_PANIC   do{LOGE(MODULE_SSF_LIB, "This Line!");TEE_Panic(0);}while(0)
 
 #define MAX_ATTRIBUTE_NUMBER 35 // Maximum number of attributes for each object
 
@@ -479,7 +479,7 @@ static int sw_crypto_ioctl_init(crypto_internal_operation *operation, crypto_int
                break;
 
                default:
-                       LOGE(SSF_LIB, "Not Support Algorithm : %X ", operation->info.algorithm);
+                       LOGE(MODULE_SSF_LIB, "Not Support Algorithm : %X ", operation->info.algorithm);
                        break;
        }
 
@@ -540,7 +540,7 @@ static int sw_crypto_ioctl_update(crypto_internal_operation *operation, unsigned
                        break;
 
                default:
-                       LOGE(SSF_LIB, "Not Support Algorithm : %X", operation->info.algorithm);
+                       LOGE(MODULE_SSF_LIB, "Not Support Algorithm : %X", operation->info.algorithm);
                        rc = -1;
                        break;
        }
@@ -673,7 +673,7 @@ static int sw_crypto_ioctl_final(crypto_internal_operation *operation, unsigned
                        break;
 
                default:
-                       LOGE(SSF_LIB, "Not Support Algorithm : %X", operation->info.algorithm);
+                       LOGE(MODULE_SSF_LIB, "Not Support Algorithm : %X", operation->info.algorithm);
                        break;
        }
 
@@ -879,7 +879,7 @@ static int sw_crypto_open(crypto_internal_operation *operation)
                        break;
 
                default:
-                       LOGE(SSF_LIB, "Not Support Algorithm : %X ", operation->info.algorithm);
+                       LOGE(MODULE_SSF_LIB, "Not Support Algorithm : %X ", operation->info.algorithm);
                        goto error;
                        break;
        }
@@ -1375,7 +1375,7 @@ exit:
        }
        return 0;
 error:
-       LOGE(SSF_LIB, "THIS HERE!!!");
+       LOGE(MODULE_SSF_LIB, "THIS HERE!!!");
        CRYPTO_INTERNAL_LOG("--------------------------------------------------------------");
        return -1;
 }
@@ -1737,7 +1737,7 @@ TEE_Result TEE_AllocateOperation(TEE_OperationHandle *operation, uint32_t algori
                        break;
 
                default:
-                       LOGE(SSF_LIB, "Not Support Algorithm : %X", algorithm);
+                       LOGE(MODULE_SSF_LIB, "Not Support Algorithm : %X", algorithm);
                        rc =  TEE_ERROR_NOT_SUPPORTED;
                        goto exit;
                        break;
@@ -1839,7 +1839,7 @@ error:
        }
 exit:
        *operation = TEE_HANDLE_NULL;
-       LOGE(SSF_LIB, "Error : %X", rc);
+       LOGE(MODULE_SSF_LIB, "Error : %X", rc);
        return rc;
 }
 
@@ -1896,7 +1896,7 @@ TEE_Result TEE_SetOperationKey(TEE_OperationHandle operation, TEE_ObjectHandle k
        crypto_internal_operation * op = (crypto_internal_operation*) operation;
        if (!op || op->info.operationClass == TEE_OPERATION_DIGEST || op->info.algorithm == TEE_ALG_AES_XTS)
     {
-        LOGE(SSF_LIB, "op->info.operationClass == TEE_OPERATION_DIGEST\n");
+        LOGE(MODULE_SSF_LIB, "op->info.operationClass == TEE_OPERATION_DIGEST\n");
         return TEE_ERROR_BAD_PARAMETERS;
     };
 
@@ -1909,7 +1909,7 @@ TEE_Result TEE_SetOperationKey(TEE_OperationHandle operation, TEE_ObjectHandle k
 
        if ((key->tr.info.objectUsage | ~(op->info.requiredKeyUsage)) != 0xffffffff)
     {
-        LOGE(SSF_LIB, "(key->tr.info.objectUsage | ~(op->info.requiredKeyUsage)) != 0xffffffff\n");
+        LOGE(MODULE_SSF_LIB, "(key->tr.info.objectUsage | ~(op->info.requiredKeyUsage)) != 0xffffffff\n");
         return TEE_ERROR_BAD_PARAMETERS;
     };
 
@@ -2235,20 +2235,20 @@ TEE_Result TEE_AEInit(TEE_OperationHandle operation, void* nonce, size_t nonceLe
 
        // operation check
        if (op->info.operationClass != TEE_OPERATION_AE) {
-               LOGE(SSF_LIB, "Incorrect operation class %x", op->info.operationClass);
+               LOGE(MODULE_SSF_LIB, "Incorrect operation class %x", op->info.operationClass);
                CRYPTO_PANIC;
        }
        if (op->info.mode != TEE_MODE_ENCRYPT && op->info.mode != TEE_MODE_DECRYPT) {
-               LOGE(SSF_LIB, "Incorrect operation mode %x", op->info.mode);
+               LOGE(MODULE_SSF_LIB, "Incorrect operation mode %x", op->info.mode);
                CRYPTO_PANIC;
        }
        if (!(operation->info.handleState & TEE_HANDLE_FLAG_KEY_SET)) {
-               LOGE(SSF_LIB, "Key not set in operation");
+               LOGE(MODULE_SSF_LIB, "Key not set in operation");
                CRYPTO_PANIC;
        }
        // nonce check
        if (nonce == NULL || nonceLen < 12) {
-               LOGE(SSF_LIB, "Incorrect nonce provided");
+               LOGE(MODULE_SSF_LIB, "Incorrect nonce provided");
                CRYPTO_PANIC;
        }
        // tagLen check
@@ -2257,43 +2257,43 @@ TEE_Result TEE_AEInit(TEE_OperationHandle operation, void* nonce, size_t nonceLe
        switch (op->info.algorithm) {
                case TEE_ALG_AES_GCM: {
                        if (std::find(values_GCM.begin(), values_GCM.end(), tagLen) == values_GCM.end()) {
-                               LOGE(SSF_LIB, "Incorrect tag length %u", tagLen);
+                               LOGE(MODULE_SSF_LIB, "Incorrect tag length %u", tagLen);
                                return TEE_ERROR_NOT_SUPPORTED;
                        }
                         break;
                }
                case TEE_ALG_AES_CCM: {
                        if (std::find(values_CCM.begin(), values_CCM.end(), tagLen) == values_CCM.end()) {
-                               LOGE(SSF_LIB, "Incorrect tag length %u", tagLen);
+                               LOGE(MODULE_SSF_LIB, "Incorrect tag length %u", tagLen);
                                return TEE_ERROR_NOT_SUPPORTED;
                        }
                         break;
                }
                default: {
-                       LOGE(SSF_LIB, "Incorrect algorithm %x", op->info.algorithm);
+                       LOGE(MODULE_SSF_LIB, "Incorrect algorithm %x", op->info.algorithm);
                        CRYPTO_PANIC;
                }
        };
        // CCM exclusive checks
        if (op->info.algorithm == TEE_ALG_AES_CCM) {
                // TODO support CCM and check AAD/payload here
-               LOGE(SSF_LIB, "CCM mode not supported");
+               LOGE(MODULE_SSF_LIB, "CCM mode not supported");
                return TEE_ERROR_NOT_SUPPORTED;
        }
        // key check
        if (TEE_GetObjectBufferAttribute(op->key1, TEE_ATTR_SECRET_VALUE,
                (void*)key.secret.buffer, (size_t*)&key.secret.size) != TEE_SUCCESS) {
-               LOGE(SSF_LIB, "Cannot acquire key from operation");
+               LOGE(MODULE_SSF_LIB, "Cannot acquire key from operation");
                CRYPTO_PANIC;
        }
        if (!key.secret.buffer) {
-               LOGE(SSF_LIB, "Uninitialized operation key");
+               LOGE(MODULE_SSF_LIB, "Uninitialized operation key");
                CRYPTO_PANIC;
        }
 
        if (ossl_crypto_ae_init(op, &key,
                                                        (unsigned char*)nonce, nonceLen, tagLen)) {
-               LOGE(SSF_LIB, "Failed to initialize AE algorithm");
+               LOGE(MODULE_SSF_LIB, "Failed to initialize AE algorithm");
                CRYPTO_PANIC;
        }
 
@@ -2307,20 +2307,20 @@ void TEE_AEUpdateAAD(TEE_OperationHandle operation, void* AADdata, size_t AADdat
 
        // operation check
        if (op->info.operationClass != TEE_OPERATION_AE) {
-               LOGE(SSF_LIB, "Incorrect operation class %x", op->info.operationClass);
+               LOGE(MODULE_SSF_LIB, "Incorrect operation class %x", op->info.operationClass);
                CRYPTO_PANIC;
        }
        if (op->info.mode != TEE_MODE_ENCRYPT && op->info.mode != TEE_MODE_DECRYPT) {
-               LOGE(SSF_LIB, "Incorrect operation mode %x", op->info.mode);
+               LOGE(MODULE_SSF_LIB, "Incorrect operation mode %x", op->info.mode);
                CRYPTO_PANIC;
        }
        if (op->crypto == 0) {
-               LOGE(SSF_LIB, "Uninitialized operation handle provided");
+               LOGE(MODULE_SSF_LIB, "Uninitialized operation handle provided");
                CRYPTO_PANIC;
        }
 
        if (ossl_crypto_ae_update_aad(op, AADdata, AADdataLen)) {
-               LOGE(SSF_LIB, "Failed to update AAD data");
+               LOGE(MODULE_SSF_LIB, "Failed to update AAD data");
                CRYPTO_PANIC;
        }
 
@@ -2333,20 +2333,20 @@ TEE_Result TEE_AEUpdate(TEE_OperationHandle operation, void* srcData, size_t src
        crypto_internal_operation *op = (crypto_internal_operation*)operation;
 
        if (op->info.operationClass != TEE_OPERATION_AE) {
-               LOGE(SSF_LIB, "Incorrect operation class %x", op->info.operationClass);
+               LOGE(MODULE_SSF_LIB, "Incorrect operation class %x", op->info.operationClass);
                CRYPTO_PANIC;
        }
        if (op->info.mode != TEE_MODE_ENCRYPT && op->info.mode != TEE_MODE_DECRYPT) {
-               LOGE(SSF_LIB, "Incorrect operation mode %x", op->info.mode);
+               LOGE(MODULE_SSF_LIB, "Incorrect operation mode %x", op->info.mode);
                CRYPTO_PANIC;
        }
        if (op->crypto == 0) {
-               LOGE(SSF_LIB, "Uninitialized operation handle provided");
+               LOGE(MODULE_SSF_LIB, "Uninitialized operation handle provided");
                CRYPTO_PANIC;
        }
 
        if (ossl_crypto_ae_update(op, srcData, srcLen, destData, destLen)) {
-               LOGE(SSF_LIB, "Failed to update cipher data");
+               LOGE(MODULE_SSF_LIB, "Failed to update cipher data");
                CRYPTO_PANIC;
        }
 
@@ -2359,20 +2359,20 @@ TEE_Result TEE_AEEncryptFinal(TEE_OperationHandle operation, void* srcData, size
        crypto_internal_operation * op = (crypto_internal_operation*) operation;
 
        if (op->info.operationClass != TEE_OPERATION_AE) {
-               LOGE(SSF_LIB, "Incorrect operation class %x", op->info.operationClass);
+               LOGE(MODULE_SSF_LIB, "Incorrect operation class %x", op->info.operationClass);
                CRYPTO_PANIC;
        }
        if (op->info.mode != TEE_MODE_ENCRYPT) {
-               LOGE(SSF_LIB, "Incorrect operation mode %x", op->info.mode);
+               LOGE(MODULE_SSF_LIB, "Incorrect operation mode %x", op->info.mode);
                CRYPTO_PANIC;
        }
        if (op->crypto == 0) {
-               LOGE(SSF_LIB, "Uninitialized operation handle provided");
+               LOGE(MODULE_SSF_LIB, "Uninitialized operation handle provided");
                CRYPTO_PANIC;
        }
 
        if (ossl_crypto_ae_enc_final(op, srcData, srcLen, destData, destLen, tag, tagLen)) {
-               LOGE(SSF_LIB, "Failed to finalize AE encryption");
+               LOGE(MODULE_SSF_LIB, "Failed to finalize AE encryption");
                CRYPTO_PANIC;
        }
 
@@ -2386,21 +2386,21 @@ TEE_Result TEE_AEDecryptFinal(TEE_OperationHandle operation, void* srcData, size
        TEE_Result ret = TEE_SUCCESS;
 
        if (op->info.operationClass != TEE_OPERATION_AE) {
-               LOGE(SSF_LIB, "Incorrect operation class %x", op->info.operationClass);
+               LOGE(MODULE_SSF_LIB, "Incorrect operation class %x", op->info.operationClass);
                CRYPTO_PANIC;
        }
        if (op->info.mode != TEE_MODE_DECRYPT) {
-               LOGE(SSF_LIB, "Incorrect operation mode %x", op->info.mode);
+               LOGE(MODULE_SSF_LIB, "Incorrect operation mode %x", op->info.mode);
                CRYPTO_PANIC;
        }
        if (op->crypto == 0) {
-               LOGE(SSF_LIB, "Uninitialized operation handle provided");
+               LOGE(MODULE_SSF_LIB, "Uninitialized operation handle provided");
                CRYPTO_PANIC;
        }
 
        ret = ossl_crypto_ae_dec_final(op, srcData, srcLen, destData, destLen, tag, tagLen);
        if (ret != TEE_SUCCESS && ret != TEE_ERROR_MAC_INVALID) {
-               LOGE(SSF_LIB, "Failed to finalize AE decryption");
+               LOGE(MODULE_SSF_LIB, "Failed to finalize AE decryption");
                CRYPTO_PANIC;
        }
 
@@ -2675,7 +2675,7 @@ void TEE_GenerateRandom(void* randomBuffer, size_t randomBufferLen)
        memset((void *)&op,0,sizeof(op));
        if(randomBufferLen > 512)
        {
-               LOGE(SSF_LIB, "currently only support less than 512 byte random data");
+               LOGE(MODULE_SSF_LIB, "currently only support less than 512 byte random data");
                return;
        }
        op.info.algorithm = TEE_ALG_GENERATE_SECRET_KEY;
index 59988f0..7968e5c 100644 (file)
@@ -38,7 +38,7 @@ int ossl_crypto_open(crypto_internal_operation *op)
 {
        EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
        if (ctx == NULL) {
-               LOGE(SSF_LIB, "OSSL Crypto CTX failed to open");
+               LOGE(MODULE_SSF_LIB, "OSSL Crypto CTX failed to open");
                return -1;
        }
 
@@ -64,26 +64,26 @@ int ossl_crypto_ae_init(crypto_internal_operation *op, crypto_internal_keystruct
        EVP_CIPHER_CTX *ctx;
        int ret = -1;
 
-       LOGI(SSF_LIB, "AE Init");
+       LOGI(MODULE_SSF_LIB, "AE Init");
 
        ctx = (EVP_CIPHER_CTX *)op->crypto;
        if (ctx == NULL) {
-               LOGE(SSF_LIB, "Invalid OSSL Crypto CTX provided");
+               LOGE(MODULE_SSF_LIB, "Invalid OSSL Crypto CTX provided");
                return -1;
        }
 
        if (op->info.mode != TEE_MODE_ENCRYPT && op->info.mode != TEE_MODE_DECRYPT) {
-               LOGE(SSF_LIB, "Invalid operation mode");
+               LOGE(MODULE_SSF_LIB, "Invalid operation mode");
                return -1;
        }
 
        if (key == NULL || key->secret.buffer == NULL || key->secret.size == 0) {
-               LOGE(SSF_LIB, "Invalid key provided");
+               LOGE(MODULE_SSF_LIB, "Invalid key provided");
                return -1;
        }
 
        if ((key->secret.size * 8) != op->info.keySize) {
-               LOGE(SSF_LIB, "Provided key with incorrect length: %d", key->secret.size * 8);
+               LOGE(MODULE_SSF_LIB, "Provided key with incorrect length: %d", key->secret.size * 8);
                return -1;
        }
 
@@ -96,7 +96,7 @@ int ossl_crypto_ae_init(crypto_internal_operation *op, crypto_internal_keystruct
                                case 192: EVP_alg = EVP_aes_192_gcm; break;
                                case 256: EVP_alg = EVP_aes_256_gcm; break;
                                default: {
-                                       LOGE(SSF_LIB, "Unsupported key size %d", op->info.keySize);
+                                       LOGE(MODULE_SSF_LIB, "Unsupported key size %d", op->info.keySize);
                                        return -1;
                                }
                        }
@@ -104,7 +104,7 @@ int ossl_crypto_ae_init(crypto_internal_operation *op, crypto_internal_keystruct
                }
 
                default: {
-                       LOGE(SSF_LIB, "Unsupported AE crypto algorithm %x", op->info.algorithm);
+                       LOGE(MODULE_SSF_LIB, "Unsupported AE crypto algorithm %x", op->info.algorithm);
                        return -1;
                }
        }
@@ -112,13 +112,13 @@ int ossl_crypto_ae_init(crypto_internal_operation *op, crypto_internal_keystruct
        ret = EVP_CipherInit(ctx, EVP_alg(), key->secret.buffer, (unsigned char*)iv,
                                                (op->info.mode == TEE_MODE_ENCRYPT) ? 1 : 0);
        if (ret != EVP_SUCCESS) {
-               LOGE(SSF_LIB, "Failed to initialize cipher");
+               LOGE(MODULE_SSF_LIB, "Failed to initialize cipher");
                return ret;
        }
 
        ret = EVP_CIPHER_CTX_set_padding(ctx, 0);
        if (ret != EVP_SUCCESS) {
-               LOGE(SSF_LIB, "Failed to disable padding in OpenSSL");
+               LOGE(MODULE_SSF_LIB, "Failed to disable padding in OpenSSL");
                return ret;
        }
 
@@ -131,17 +131,17 @@ int ossl_crypto_ae_update_aad(crypto_internal_operation *op, void *aad, size_t a
        int dstLen = 0;
        int ret = 0;
 
-       LOGI(SSF_LIB, "AE Update AAD");
+       LOGI(MODULE_SSF_LIB, "AE Update AAD");
 
        ctx = (EVP_CIPHER_CTX *)op->crypto;
        if (ctx == NULL) {
-               LOGE(SSF_LIB, "Invalid OSSL Crypto CTX provided");
+               LOGE(MODULE_SSF_LIB, "Invalid OSSL Crypto CTX provided");
                return -1;
        }
 
        ret = EVP_CipherUpdate(ctx, NULL, &dstLen, (unsigned char*)aad, aad_len);
        if (ret != EVP_SUCCESS) {
-               LOGE(SSF_LIB, "AAD Update failed");
+               LOGE(MODULE_SSF_LIB, "AAD Update failed");
                return -1;
        }
 
@@ -154,17 +154,17 @@ int ossl_crypto_ae_update(crypto_internal_operation *op, void *src, size_t src_l
        EVP_CIPHER_CTX *ctx;
        int ret = 0;
 
-       LOGI(SSF_LIB, "AE Update");
+       LOGI(MODULE_SSF_LIB, "AE Update");
 
        ctx = (EVP_CIPHER_CTX *)op->crypto;
        if (ctx == NULL) {
-               LOGE(SSF_LIB, "Invalid OSSL Crypto CTX provided");
+               LOGE(MODULE_SSF_LIB, "Invalid OSSL Crypto CTX provided");
                return -1;
        }
 
        ret = EVP_CipherUpdate(ctx, (unsigned char*)dst, (int*)dst_len, (unsigned char*)src, src_len);
        if (ret != EVP_SUCCESS) {
-               LOGE(SSF_LIB, "Cipher Update failed");
+               LOGE(MODULE_SSF_LIB, "Cipher Update failed");
                return -1;
        }
 
@@ -180,14 +180,14 @@ int ossl_crypto_ae_enc_final(crypto_internal_operation *op, void *src, size_t sr
 
        ctx = (EVP_CIPHER_CTX *)op->crypto;
        if (ctx == NULL) {
-               LOGE(SSF_LIB, "Invalid OSSL Crypto CTX provided");
+               LOGE(MODULE_SSF_LIB, "Invalid OSSL Crypto CTX provided");
                return -1;
        }
 
        // deliver final portion of data
        ret = EVP_CipherUpdate(ctx, (unsigned char*)dst, &written, (unsigned char*)src, src_len);
        if (ret != EVP_SUCCESS) {
-               LOGE(SSF_LIB, "Failed to perform final crypto operation");
+               LOGE(MODULE_SSF_LIB, "Failed to perform final crypto operation");
                return ret;
        }
 
@@ -196,7 +196,7 @@ int ossl_crypto_ae_enc_final(crypto_internal_operation *op, void *src, size_t sr
        // finalize operation
        ret = EVP_CipherFinal(ctx, (unsigned char*)dst, &written);
        if (ret != EVP_SUCCESS) {
-               LOGE(SSF_LIB, "Failed to finalize crypto operation");
+               LOGE(MODULE_SSF_LIB, "Failed to finalize crypto operation");
                return ret;
        }
 
@@ -205,7 +205,7 @@ int ossl_crypto_ae_enc_final(crypto_internal_operation *op, void *src, size_t sr
        // get tag
        ret = EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, *tag_len, tag);
        if (ret != EVP_SUCCESS) {
-               LOGE(SSF_LIB, "Failed to acquire operation tag");
+               LOGE(MODULE_SSF_LIB, "Failed to acquire operation tag");
                return ret;
        }
 
@@ -221,14 +221,14 @@ int ossl_crypto_ae_dec_final(crypto_internal_operation *op, void *src, size_t sr
 
        ctx = (EVP_CIPHER_CTX *)op->crypto;
        if (ctx == NULL) {
-               LOGE(SSF_LIB, "Invalid OSSL Crypto CTX provided");
+               LOGE(MODULE_SSF_LIB, "Invalid OSSL Crypto CTX provided");
                return -1;
        }
 
        // deliver final portion of data
        ret = EVP_CipherUpdate(ctx, (unsigned char*)dst, &written, (unsigned char*)src, src_len);
        if (ret != EVP_SUCCESS) {
-               LOGE(SSF_LIB, "Failed to perform final crypto operation");
+               LOGE(MODULE_SSF_LIB, "Failed to perform final crypto operation");
                return ret;
        }
 
@@ -237,14 +237,14 @@ int ossl_crypto_ae_dec_final(crypto_internal_operation *op, void *src, size_t sr
        // set tag
        ret = EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, tag_len, tag);
        if (ret != EVP_SUCCESS) {
-               LOGE(SSF_LIB, "Failed to set operation tag");
+               LOGE(MODULE_SSF_LIB, "Failed to set operation tag");
                return ret;
        }
 
        // finalize operation
        ret = EVP_CipherFinal(ctx, (unsigned char*)dst, &written);
        if (ret != EVP_SUCCESS) {
-               LOGE(SSF_LIB, "Failed to finalize crypto operation (auth error)");
+               LOGE(MODULE_SSF_LIB, "Failed to finalize crypto operation (auth error)");
                return TEE_ERROR_MAC_INVALID;
        }
 
index d9b17f7..fdc1f39 100644 (file)
@@ -49,7 +49,7 @@ extern "C"{
 __attribute__((constructor)) void initializeSSF() {
        socketSimulatorDaemonFD = connecttoServer();
        assert(socketSimulatorDaemonFD != -1);
-       LOGD(SIM_DAEMON, "Done");}
+       LOGD(MODULE_SIM_DAEMON, "Done");}
 
 /**
  * Deinits SSF. Should be called by TA once
@@ -57,7 +57,7 @@ __attribute__((constructor)) void initializeSSF() {
 
 __attribute__((destructor)) void deinitializeSSF() {
        disconnectfromServer(socketSimulatorDaemonFD);
-       LOGD(SIM_DAEMON, "Done"); }
+       LOGD(MODULE_SIM_DAEMON, "Done"); }
 
 }