TEEC_Result tempSharedMemAllocate(TEEC_SharedMemory** tmpSharedMem, uint32_t type,
TEEC_Context* context, TEEC_Parameter param)
{
+ LOGD(TEEC_LIB, "Entry");
TEEC_Result result;
*tmpSharedMem = (TEEC_SharedMemory *)OsaMalloc(sizeof(TEEC_SharedMemory));
if (!*tmpSharedMem)
return TEEC_ERROR_OUT_OF_MEMORY;
(*tmpSharedMem)->size = param.tmpref.size;
(*tmpSharedMem)->buffer = param.tmpref.buffer;
-
(*tmpSharedMem)->flags = type & (TEEC_MEM_INPUT | TEEC_MEM_OUTPUT);
result = TEEC_RegisterSharedMemory(context, *tmpSharedMem);
TEEC_Operation *operation, OperationData *op,
TEEC_SharedMemory *tmpSharedMem[4])
{
- TEEC_Context *context = NULL;
-
LOGD(TEEC_LIB, "Entry");
+ TEEC_Context *context = NULL;
TEEC_RegisteredMemoryReference *memref;
TEEC_SharedMemoryImp *memref_imp;
TEEC_Result result = TEEC_SUCCESS;
LOGE(TEEC_LIB, "Bad parameters");
return TEEC_ERROR_BAD_PARAMETERS;
}
- context = ((TEEC_SessionImp *)session->imp)->context;
// Check if output Operation structure is valid
if (!op)
return TEEC_ERROR_GENERIC;
+ context = ((TEEC_SessionImp *)session->imp)->context;
+
// Initialize output Operation structure paramtypes to NONE
op->paramTypes = (TEE_PARAM_TYPE_NONE << 24) | (TEE_PARAM_TYPE_NONE << 16)
| (TEE_PARAM_TYPE_NONE << 8) | TEE_PARAM_TYPE_NONE;
* specifications, so assign them without modifications.
*/
op->paramTypes |= type << (8 * i);
-
if (!tmpSharedMem[i]) {
result = tempSharedMemAllocate(&tmpSharedMem[i], type, context, operation->params[i]);
if (result != TEEC_SUCCESS)
// Check if the context is initialized
if (!checkContext(context)) {
- LOGE(TEEC_LIB, "Invalid context");
+ LOGE(TEEC_LIB, "Invalid context %p", context);
return TEEC_ERROR_BAD_PARAMETERS;
}
* 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(TEEC_LIB, "Shared Memory size is too large %u > %u", sharedMem->size, TEEC_CONFIG_SHAREDMEM_MAX_SIZE);
return TEEC_ERROR_BAD_PARAMETERS;
}
OpenSessionData os;
OperationData op;
TEEC_SharedMemory *tmpSharedMem[4];
- memset(tmpSharedMem, 0x0, sizeof(TEEC_SharedMemory *) * 4);
uint32_t i;
+ memset(tmpSharedMem, 0x0, sizeof(tmpSharedMem));
+
// Check if the context, session and UUID is valid
if (!session || !context || !destination) {
LOGE(TEEC_LIB, "Invalid input parameters");
OsaFree(session_imp);
session->imp = NULL;
- if (operation) postProcessOperation(operation, &op, tmpSharedMem);
-
/* temp memref cleanup & release */
for (i = 0; i < 4; i++) {
if (tmpSharedMem[i]) {
InvokeCommandData ic;
OperationData op;
TEEC_SharedMemory *tmpSharedMem[4];
- memset(tmpSharedMem, 0x0, sizeof(TEEC_SharedMemory *) * 4);
uint32_t i;
+ memset(tmpSharedMem, 0x0, sizeof(tmpSharedMem));
+
// Check if Session is valid
if (!session) {
LOGE(TEEC_LIB, "NULL session");
if (result != TEEC_SUCCESS) {
LOGE(TEEC_LIB, "preProcessOperation failed");
- if (operation) postProcessOperation(operation, &op, tmpSharedMem);
-
/* temp memref cleanup & release */
for (i = 0; i < 4; i++) {
if (tmpSharedMem[i]) {