/**
- * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015-2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*-----------------------------------------------------------------------------*/
extern TEE_UUID ssf_sharedthisTAUUID;
-#define __TEE_Preprocess_Operation \
- uint32_t i, type; \
- for (i = 0; i < 4; i++) { \
- type = ((data.operation.paramTypes) >> (8 * i)) & 0x7f; \
- if ((type == TEEC_VALUE_INPUT) || (type == TEEC_VALUE_OUTPUT) \
- || (type == TEEC_VALUE_INOUT)) { \
- data.operation.params[i].value.a = params[i].value.a; \
- data.operation.params[i].value.b = params[i].value.b; \
- } else if (type == TEEC_NONE) { \
- } else { \
- int getOffset = 0; \
- if (params[i].memref.memid == 0) { \
- params[i].memref.memid = getSharedMemoryShmID(params[i].memref.buffer); \
- } else { \
- char* getAdd = getSharedMemoryAddress(params[i].memref.memid); \
- if (getAdd != 0) \
- getOffset = (char*)params[i].memref.buffer - getAdd; \
- } \
- data.operation.params[i].mem.offset = getOffset; \
- data.operation.params[i].mem.size = params[i].memref.size; \
- data.operation.params[i].mem.shmKey = params[i].memref.memid; \
- } \
- }
+static void __TEE_Preprocess_Operation(IntTAOperationData *operation, TEE_Param params[4])
+{
+ uint32_t i, type;
+ for (i = 0; i < 4; i++) {
+ type = ((operation->paramTypes) >> (8 * i)) & 0x7f;
-#define __TEE_Postprocess_Operation \
- uint32_t i, type; \
- for (i = 0; i < 4; i++) { \
- type = ((data.operation.paramTypes) >> (8 * i)) & 0x7f; \
- if ((type == TEEC_VALUE_INPUT) || (type == TEEC_VALUE_OUTPUT) \
- || (type == TEEC_VALUE_INOUT)) { \
- params[i].value.a = data.operation.params[i].value.a; \
- params[i].value.b = data.operation.params[i].value.b; \
- } else if (type == TEEC_NONE) { \
- } else { \
- params[i].memref.size = data.operation.params[i].mem.size; \
- params[i].memref.memid = data.operation.params[i].mem.shmKey; \
- } \
- }
+ if ((type == TEEC_VALUE_INPUT) || (type == TEEC_VALUE_OUTPUT) || (type == TEEC_VALUE_INOUT)) {
+ operation->params[i].value.a = params[i].value.a;
+ operation->params[i].value.b = params[i].value.b;
+ } else if (type == TEEC_NONE) {
+ } else {
+ int getOffset = 0;
+ if(params[i].memref.memid == 0) {
+ params[i].memref.memid = getSharedMemoryShmID(params[i].memref.buffer);
+ } else {
+ char* getAdd = getSharedMemoryAddress(params[i].memref.memid);
+ if(getAdd != 0) {
+ getOffset = (char*)params[i].memref.buffer - getAdd;
+ }
+ }
+ operation->params[i].mem.offset = getOffset;
+ operation->params[i].mem.size = params[i].memref.size;
+ operation->params[i].mem.shmKey = params[i].memref.memid;
+ }
+ }
+}
+
+static void __TEE_Postprocess_Operation(IntTAOperationData *operation, TEE_Param params[4])
+{
+ uint32_t i, type;
+ for (i = 0; i < 4; i++) {
+ type = ((operation->paramTypes) >> (8 * i)) & 0x7f;
+ if ((type == TEEC_VALUE_INPUT) || (type == TEEC_VALUE_OUTPUT) || (type == TEEC_VALUE_INOUT)) {
+ params[i].value.a = operation->params[i].value.a;
+ params[i].value.b = operation->params[i].value.b;
+ } else if (type == TEEC_NONE) {
+ } else {
+ params[i].memref.size = operation->params[i].mem.size;
+ params[i].memref.memid = operation->params[i].mem.shmKey;
+ }
+ }
+}
TEE_Result TEE_OpenTASession(const TEE_UUID* destination,
uint32_t cancellationRequestTimeout, uint32_t paramTypes,
data.operation.paramTypes = paramTypes;
if(params != 0)
{
- __TEE_Preprocess_Operation;
+ __TEE_Preprocess_Operation(&data.operation, params);
}
pthread_mutex_lock(&socketLock);
// [out] uint32_t* returnOrigin);
if(params != NULL)
{
- __TEE_Postprocess_Operation;
+ __TEE_Postprocess_Operation(&data.operation, params);
}
+
*sessionData = data.session;
*session = (TEE_TASessionHandle)sessionData;
if (returnOrigin)
data.operation.paramTypes = paramTypes;
if(params != NULL)
{
- __TEE_Preprocess_Operation;
+ __TEE_Preprocess_Operation(&data.operation, params);
}
pthread_mutex_lock(&socketLock);
// [out] uint32_t* returnOrigin);
if(params != NULL)
{
- __TEE_Postprocess_Operation;
+ __TEE_Postprocess_Operation(&data.operation, params);
}
+
if(returnOrigin != NULL)
*returnOrigin = TEE_ORIGIN_TRUSTED_APP;
return data.returnValue;