From 526d5bac1b65f907f67c05cd07beca72fbab88dd Mon Sep 17 00:00:00 2001 From: Jerome Forissier Date: Thu, 28 Mar 2024 16:51:13 +0100 Subject: [PATCH] gp: update API files to use the imp field in TEEC_Session The OP-TEE client library has been updated to include an 'imp' field as required by the GlobalPlatform specification. Therefore, update the parts of the code that access the TEE context which is now inside this 'imp' struct. This commit is the result of the following commands: sed -i 's/sess->ctx/sess->imp.ctx/' $(git grep -l 'sess->ctx') sed -i 's/s->ctx/s->imp.ctx/' $(git grep -l 's->ctx') Signed-off-by: Jerome Forissier Acked-by: Jens Wiklander --- host/xtest/gp/include/xml_common_api.h | 2 +- host/xtest/gp/include/xml_crypto_api.h | 88 ++++++++++----------- host/xtest/gp/include/xml_datastorage_api.h | 16 ++-- host/xtest/gp/include/xml_internal_api.h | 20 ++--- host/xtest/gp/include/xml_timearithm_api.h | 6 +- 5 files changed, 66 insertions(+), 66 deletions(-) diff --git a/host/xtest/gp/include/xml_common_api.h b/host/xtest/gp/include/xml_common_api.h index 245eddebe..a032419ae 100644 --- a/host/xtest/gp/include/xml_common_api.h +++ b/host/xtest/gp/include/xml_common_api.h @@ -233,7 +233,7 @@ static TEEC_Result GetObjectBufferAttribute_helper(ADBG_Case_t *c, if (!buffer_is_null) { shm.size = buffer_size; shm.flags = TEEC_MEM_OUTPUT; - res = TEEC_AllocateSharedMemory(sess->ctx, &shm); + res = TEEC_AllocateSharedMemory(sess->imp.ctx, &shm); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, &shm, shm.size); diff --git a/host/xtest/gp/include/xml_crypto_api.h b/host/xtest/gp/include/xml_crypto_api.h index 8b49dd1e1..b2c698490 100644 --- a/host/xtest/gp/include/xml_crypto_api.h +++ b/host/xtest/gp/include/xml_crypto_api.h @@ -1141,7 +1141,7 @@ static TEEC_Result Invoke_Crypto_GetOperationInfoMultiple(ADBG_Case_t *c, if (!ADBG_EXPECT_COMPARE_UNSIGNED(c, max_num_keys, <=, 2)) return TEEC_ERROR_BAD_PARAMETERS; - res = TEEC_AllocateSharedMemory(s->ctx, &shm); + res = TEEC_AllocateSharedMemory(s->imp.ctx, &shm); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; @@ -1312,11 +1312,11 @@ Invoke_Crypto_InitObjectWithKeys(ADBG_Case_t *c, TEEC_Session *s, uint32_t cmd, .flags = TEEC_MEM_INPUT, }; - res = TEEC_AllocateSharedMemory(s->ctx, &shm1); + res = TEEC_AllocateSharedMemory(s->imp.ctx, &shm1); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; - res = TEEC_AllocateSharedMemory(s->ctx, &shm2); + res = TEEC_AllocateSharedMemory(s->imp.ctx, &shm2); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) goto out_free_shm1; @@ -1451,7 +1451,7 @@ static TEEC_Result Invoke_Crypto_AEInit(ADBG_Case_t *c, TEEC_Session *s, }; - res = TEEC_AllocateSharedMemory(s->ctx, &shm); + res = TEEC_AllocateSharedMemory(s->imp.ctx, &shm); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; memcpy(shm.buffer, nonce_val, nonce_length); @@ -1484,10 +1484,10 @@ static TEEC_Result Invoke_Crypto_AEUpdate_for_encryption(ADBG_Case_t *c, uint32_t org = 0; size_t initial_size; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, partd_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, partd_length, TEEC_MEM_INPUT, partd_length, part_data, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, DS_BIG_SIZE, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, DS_BIG_SIZE, TEEC_MEM_OUTPUT, mem02_exit) op.params[0].value.a = op_handle; @@ -1547,13 +1547,13 @@ static TEEC_Result Invoke_Crypto_AEUpdate_for_decryption(ADBG_Case_t *c, TEEC_Operation op = TEEC_OPERATION_INITIALIZER; uint32_t ret_orig; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, buffer_encrypted_chunks[chunk_id].size, TEEC_MEM_INPUT, buffer_encrypted_chunks[chunk_id].size, buffer_encrypted_chunks[chunk_id]. buffer, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, partd_length, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, partd_length, TEEC_MEM_OUTPUT, mem02_exit) op.params[0].value.a = op_handle; @@ -1611,7 +1611,7 @@ static TEEC_Result Invoke_Crypto_AEUpdateAAD(ADBG_Case_t *c, TEEC_Session *s, TEEC_Operation op = TEEC_OPERATION_INITIALIZER; uint32_t ret_orig; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, aad_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, aad_length, TEEC_MEM_INPUT, aad_length, aad_data, mem01_exit) @@ -1653,12 +1653,12 @@ static TEEC_Result Invoke_Crypto_AEEncryptFinal(ADBG_Case_t *c, TEEC_Session *s, uint32_t ret_orig; size_t initial_partd_size, initial_fdata_size; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, partd_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, partd_length, TEEC_MEM_INPUT, partd_length, part_data, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, partd_length, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, partd_length, TEEC_MEM_OUTPUT, mem02_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM03, partd_length, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM03, partd_length, TEEC_MEM_OUTPUT, mem03_exit) op.params[0].value.a = op_handle; @@ -1749,15 +1749,15 @@ static TEEC_Result Invoke_Crypto_AEDecryptFinal(ADBG_Case_t *c, TEEC_Session *s, uint32_t ret_orig; size_t initial_size; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, buffer_encrypted_chunks[chunk_id].size, TEEC_MEM_INPUT, buffer_encrypted_chunks[chunk_id].size, buffer_encrypted_chunks[chunk_id]. buffer, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, partd_length, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, partd_length, TEEC_MEM_OUTPUT, mem02_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM03, ae_encrypt_tag.size, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM03, ae_encrypt_tag.size, TEEC_MEM_INPUT, mem03_exit) /* Fill "SharedMem3" with the tag previously * saved in Invoke_Crypto_AEEncryptFinal @@ -1836,7 +1836,7 @@ static TEEC_Result Invoke_Crypto_GenerateRandom(ADBG_Case_t *c, TEEC_Session *s, TEEC_Operation op = TEEC_OPERATION_INITIALIZER; uint32_t ret_orig; - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM01, BIG_SIZE, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, BIG_SIZE, TEEC_MEM_OUTPUT, mem01_exit) SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM01, @@ -1892,7 +1892,7 @@ static TEEC_Result Invoke_Crypto_DigestUpdate(ADBG_Case_t *c, TEEC_Session *s, TEEC_Operation op = TEEC_OPERATION_INITIALIZER; uint32_t ret_orig; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, partd_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, partd_length, TEEC_MEM_INPUT, partd_length, part_data, mem01_exit) @@ -1924,10 +1924,10 @@ static TEEC_Result Invoke_Crypto_DigestDoFinal(ADBG_Case_t *c, TEEC_Session *s, uint32_t ret_orig; size_t initial_size; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, partd_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, partd_length, TEEC_MEM_INPUT, partd_length, part_data, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, fdata_length, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, fdata_length, TEEC_MEM_OUTPUT, mem02_exit) op.params[0].value.a = op_handle; @@ -1995,11 +1995,11 @@ Invoke_Crypto_AsymmetricSignDigest(ADBG_Case_t *c, TEEC_Session *s, /* Fill SharedMem1 with the previously stored Digest value after TEE_DigestDoFinal */ - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, saved_digest.size, TEEC_MEM_INPUT, saved_digest.size, saved_digest.buffer, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, 512, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, 512, TEEC_MEM_OUTPUT, mem02_exit) op.params[0].value.a = oph; @@ -2057,10 +2057,10 @@ Invoke_Crypto_AsymmetricVerifyDigest(ADBG_Case_t *c, TEEC_Session *s, uint32_t ret_orig; uint32_t dec_input = 0; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, fdata_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, fdata_length, TEEC_MEM_INPUT, saved_digest.size, saved_digest.buffer, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, 512, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, 512, TEEC_MEM_INPUT, mem02_exit) struct crypto_buffer signed_dgst; @@ -2118,12 +2118,12 @@ static TEEC_Result Invoke_Crypto_AsymmetricEncrypt(ADBG_Case_t *c, size_t initial_size; /* Fill SharedMem1 with full_data */ - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, fdata_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, fdata_length, TEEC_MEM_INPUT, fdata_length, full_data, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, 512, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, 512, TEEC_MEM_OUTPUT, mem02_exit) op.params[0].value.a = oph; @@ -2188,12 +2188,12 @@ static TEEC_Result Invoke_Crypto_AsymmetricDecrypt(ADBG_Case_t *c, size_t sz; /* Fill SharedMem1 with buffer_asym_encrypted */ - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, buffer_asym_encrypted.size, TEEC_MEM_INPUT, buffer_asym_encrypted.size, buffer_asym_encrypted.buffer, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, 512, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, 512, TEEC_MEM_OUTPUT, mem02_exit) op.params[0].value.a = op_handle; @@ -2270,7 +2270,7 @@ static TEEC_Result Invoke_Crypto_MACInit( TEEC_Operation op = TEEC_OPERATION_INITIALIZER; uint32_t ret_orig; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM06, iv_len, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM06, iv_len, TEEC_MEM_INPUT, iv_len, iv, mem06_exit) op.params[0].value.a = oph; @@ -2307,7 +2307,7 @@ static TEEC_Result Invoke_Crypto_MACUpdate( TEEC_Operation op = TEEC_OPERATION_INITIALIZER; uint32_t ret_orig; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, partd_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, partd_length, TEEC_MEM_INPUT, partd_length, part_data, mem01_exit) @@ -2339,10 +2339,10 @@ static TEEC_Result Invoke_Crypto_MACCompareFinal( uint32_t ret_orig; /* Fill SharedMem1 with part_data */ - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, partd_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, partd_length, TEEC_MEM_INPUT, partd_length, part_data, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, fdata_length, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, fdata_length, TEEC_MEM_INPUT, mem02_exit) /* Fill SharedMem2 with valid computed MAC of full_data */ @@ -2393,10 +2393,10 @@ static TEEC_Result Invoke_Crypto_MACComputeFinal( size_t initial_size; /* Fill SharedMem1 with part_data */ - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, partd_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, partd_length, TEEC_MEM_INPUT, partd_length, part_data, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, fdata_length, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, fdata_length, TEEC_MEM_OUTPUT, mem02_exit) op.params[0].value.a = oph; @@ -2458,7 +2458,7 @@ static TEEC_Result Invoke_Crypto_CipherInit( TEEC_Operation op = TEEC_OPERATION_INITIALIZER; uint32_t ret_orig; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, iv_len, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, iv_len, TEEC_MEM_INPUT, iv_len, iv, mem01_exit) op.params[0].value.a = oph; @@ -2503,10 +2503,10 @@ static TEEC_Result Invoke_Crypto_CipherUpdate( uint32_t ret_orig; size_t initial_size; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, partd_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, partd_length, TEEC_MEM_INPUT, partd_length, part_data, mem01_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, partd_length, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, partd_length, TEEC_MEM_OUTPUT, mem02_exit) op.params[0].value.a = oph; @@ -2568,12 +2568,12 @@ static TEEC_Result Invoke_Crypto_CipherDoFinal( uint32_t ret_orig; size_t initial_size; - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM01, partd_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM01, partd_length, TEEC_MEM_INPUT, partd_length, part_data, mem01_exit) /* used fulld_length instead of partd_length as described in the Adaptation layer specification.*/ - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM02, fulld_length, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM02, fulld_length, TEEC_MEM_OUTPUT, mem02_exit) op.params[0].value.a = oph; @@ -3376,10 +3376,10 @@ static TEEC_Result mac_compute_final( /* CMD_MACComputeFinal */ /* Fill SharedMem1 with full_data */ - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM04, fdata_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM04, fdata_length, TEEC_MEM_INPUT, fdata_length, full_data, mem04_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM05, fdata_length, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM05, fdata_length, TEEC_MEM_OUTPUT, mem05_exit) op.params[0].value.a = (uint32_t)op1; @@ -3444,7 +3444,7 @@ static TEEC_Result cipher_do_final( } - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM04, fdata_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM04, fdata_length, TEEC_MEM_INPUT, saved_cipher_iv.size, saved_cipher_iv.buffer, @@ -3468,10 +3468,10 @@ static TEEC_Result cipher_do_final( /* CMD_CipherDoFinal */ /* Fill SharedMem1 with full_data */ - ALLOCATE_AND_FILL_SHARED_MEMORY(s->ctx, SHARE_MEM04, fdata_length, + ALLOCATE_AND_FILL_SHARED_MEMORY(s->imp.ctx, SHARE_MEM04, fdata_length, TEEC_MEM_INPUT, fdata_length, full_data, mem04_exit) - ALLOCATE_SHARED_MEMORY(s->ctx, SHARE_MEM05, fdata_length, + ALLOCATE_SHARED_MEMORY(s->imp.ctx, SHARE_MEM05, fdata_length, TEEC_MEM_OUTPUT, mem05_exit) op.params[0].value.a = (uint32_t)op1; @@ -3541,7 +3541,7 @@ static TEEC_Result Invoke_StoreAttributeBuffer(ADBG_Case_t *c, shm.size = value_size; shm.flags = TEEC_MEM_INPUT; - res = TEEC_AllocateSharedMemory(sess->ctx, &shm); + res = TEEC_AllocateSharedMemory(sess->imp.ctx, &shm); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; memcpy(shm.buffer, value_bufptr, shm.size); diff --git a/host/xtest/gp/include/xml_datastorage_api.h b/host/xtest/gp/include/xml_datastorage_api.h index 2d0169f95..7406d3392 100644 --- a/host/xtest/gp/include/xml_datastorage_api.h +++ b/host/xtest/gp/include/xml_datastorage_api.h @@ -1215,7 +1215,7 @@ static TEEC_Result Invoke_ReadObjectData( TEEC_Operation op = TEEC_OPERATION_INITIALIZER; uint32_t org; - ALLOCATE_SHARED_MEMORY(sess->ctx, SHARE_MEM01, buffer_size, + ALLOCATE_SHARED_MEMORY(sess->imp.ctx, SHARE_MEM01, buffer_size, TEEC_MEM_OUTPUT, mem01_exit) op.params[0].value.a = obj_handle; @@ -1268,7 +1268,7 @@ static TEEC_Result Invoke_RenamePersistentObject(ADBG_Case_t *c, if (new_obj_id) obj_id_len = strlen(new_obj_id); - ALLOCATE_AND_FILL_SHARED_MEMORY(sess->ctx, SHARE_MEM01, obj_id_len, + ALLOCATE_AND_FILL_SHARED_MEMORY(sess->imp.ctx, SHARE_MEM01, obj_id_len, TEEC_MEM_INPUT, obj_id_len, new_obj_id, mem01_exit); @@ -1439,14 +1439,14 @@ static TEEC_Result Invoke_CreatePersistentObject(ADBG_Case_t *c, shm_obj_id.size = strlen(obj_id); shm_obj_id.flags = TEEC_MEM_INPUT; - res = TEEC_AllocateSharedMemory(sess->ctx, &shm_obj_id); + res = TEEC_AllocateSharedMemory(sess->imp.ctx, &shm_obj_id); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; memcpy(shm_obj_id.buffer, obj_id, shm_obj_id.size); shm_data.size = initial_data_len; shm_data.flags = TEEC_MEM_INPUT; - res = TEEC_AllocateSharedMemory(sess->ctx, &shm_data); + res = TEEC_AllocateSharedMemory(sess->imp.ctx, &shm_data); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) goto out_free_obj_id; memcpy(shm_data.buffer, initial_data, shm_data.size); @@ -1487,7 +1487,7 @@ static TEEC_Result Invoke_OpenPersistentObject(ADBG_Case_t *c, shm.size = strlen(obj_id); shm.flags = TEEC_MEM_INPUT; - res = TEEC_AllocateSharedMemory(sess->ctx, &shm); + res = TEEC_AllocateSharedMemory(sess->imp.ctx, &shm); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; memcpy(shm.buffer, obj_id, shm.size); @@ -1616,7 +1616,7 @@ static TEEC_Result Invoke_GetNextPersistentObject_All(ADBG_Case_t *c, shm.size = TEE_OBJECT_ID_MAX_LEN; shm.flags = TEEC_MEM_OUTPUT; - res = TEEC_AllocateSharedMemory(sess->ctx, &shm); + res = TEEC_AllocateSharedMemory(sess->imp.ctx, &shm); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; @@ -1899,7 +1899,7 @@ static TEEC_Result Invoke_StoreBuffer(ADBG_Case_t *c, TEEC_Session *sess, if (data) { shm_data.size = size; shm_data.flags = TEEC_MEM_INPUT; - res = TEEC_AllocateSharedMemory(sess->ctx, &shm_data); + res = TEEC_AllocateSharedMemory(sess->imp.ctx, &shm_data); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; memcpy(shm_data.buffer, data, shm_data.size); @@ -1967,7 +1967,7 @@ static TEEC_Result Invoke_StoreAttributeBuffer(ADBG_Case_t *c, shm.size = value_size; shm.flags = TEEC_MEM_INPUT; - res = TEEC_AllocateSharedMemory(sess->ctx, &shm); + res = TEEC_AllocateSharedMemory(sess->imp.ctx, &shm); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; memcpy(shm.buffer, value_bufptr, shm.size); diff --git a/host/xtest/gp/include/xml_internal_api.h b/host/xtest/gp/include/xml_internal_api.h index 3ac51993c..dba833eb1 100644 --- a/host/xtest/gp/include/xml_internal_api.h +++ b/host/xtest/gp/include/xml_internal_api.h @@ -279,14 +279,14 @@ static TEEC_Result Invoke_GetPropertyAsXXX_withoutEnum( uint32_t expectedValueLen = 0; nameLen = strlen(name) + 1; - ALLOCATE_AND_FILL_SHARED_MEMORY(sess->ctx, SHARE_MEM01, BIG_SIZE, + ALLOCATE_AND_FILL_SHARED_MEMORY(sess->imp.ctx, SHARE_MEM01, BIG_SIZE, TEEC_MEM_INPUT, nameLen, name, mem01_exit) if (kindBuffer == TOO_SHORT_BUFFER) { - ALLOCATE_SHARED_MEMORY(sess->ctx, SHARE_MEM02, 1, + ALLOCATE_SHARED_MEMORY(sess->imp.ctx, SHARE_MEM02, 1, TEEC_MEM_OUTPUT, mem02_exit) } else { - ALLOCATE_SHARED_MEMORY(sess->ctx, SHARE_MEM02, BIG_SIZE, + ALLOCATE_SHARED_MEMORY(sess->imp.ctx, SHARE_MEM02, BIG_SIZE, TEEC_MEM_OUTPUT, mem02_exit) } @@ -373,7 +373,7 @@ static TEEC_Result Invoke_SetInstanceData(ADBG_Case_t *c, size_t data_size = strlen(data) + 1; uint32_t org; - ALLOCATE_AND_FILL_SHARED_MEMORY(sess->ctx, SHARE_MEM01, BIG_SIZE, + ALLOCATE_AND_FILL_SHARED_MEMORY(sess->imp.ctx, SHARE_MEM01, BIG_SIZE, TEEC_MEM_INPUT, data_size, data, mem01_exit) @@ -397,7 +397,7 @@ static TEEC_Result Invoke_GetInstanceData( TEEC_Operation op = TEEC_OPERATION_INITIALIZER; uint32_t org; - ALLOCATE_SHARED_MEMORY(sess->ctx, SHARE_MEM01, BIG_SIZE, + ALLOCATE_SHARED_MEMORY(sess->imp.ctx, SHARE_MEM01, BIG_SIZE, TEEC_MEM_OUTPUT, mem01_exit) SET_SHARED_MEMORY_OPERATION_PARAMETER(0, 0, SHARE_MEM01, @@ -437,7 +437,7 @@ static TEEC_Result Invoke_ProcessInvokeTAOpenSession( swapped_uuid.timeMid = htons(swapped_uuid.timeMid); swapped_uuid.timeHiAndVersion = htons(swapped_uuid.timeHiAndVersion); - ALLOCATE_AND_FILL_SHARED_MEMORY(sess->ctx, SHARE_MEM01, BIG_SIZE, + ALLOCATE_AND_FILL_SHARED_MEMORY(sess->imp.ctx, SHARE_MEM01, BIG_SIZE, TEEC_MEM_INPUT, 16, &swapped_uuid, mem01_exit) @@ -494,7 +494,7 @@ static TEEC_Result Invoke_CheckMemoryAccessRight(ADBG_Case_t *c, break; } - ALLOCATE_SHARED_MEMORY(sess->ctx, SHARE_MEM01, BIG_SIZE, + ALLOCATE_SHARED_MEMORY(sess->imp.ctx, SHARE_MEM01, BIG_SIZE, memory_flag, mem01_exit) op.params[0].value.a = memoryAccessFlags; @@ -570,10 +570,10 @@ static TEEC_Result Invoke_GetPropertyName(ADBG_Case_t *c, TEEC_Session *sess, uint32_t strLen = 0; if (kindBuffer == TOO_SHORT_BUFFER) { - ALLOCATE_SHARED_MEMORY(sess->ctx, SHARE_MEM01, 1, + ALLOCATE_SHARED_MEMORY(sess->imp.ctx, SHARE_MEM01, 1, TEEC_MEM_OUTPUT, mem01_exit) } else { - ALLOCATE_SHARED_MEMORY(sess->ctx, SHARE_MEM01, BIG_SIZE, + ALLOCATE_SHARED_MEMORY(sess->imp.ctx, SHARE_MEM01, BIG_SIZE, TEEC_MEM_OUTPUT, mem01_exit) } @@ -667,7 +667,7 @@ static TEEC_Result Invoke_OpenTASession(ADBG_Case_t *c, TEEC_Session *sess, swapped_uuid.timeMid = htons(swapped_uuid.timeMid); swapped_uuid.timeHiAndVersion = htons(swapped_uuid.timeHiAndVersion); - res = TEEC_RegisterSharedMemory(sess->ctx, &shm); + res = TEEC_RegisterSharedMemory(sess->imp.ctx, &shm); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; diff --git a/host/xtest/gp/include/xml_timearithm_api.h b/host/xtest/gp/include/xml_timearithm_api.h index 52c2d31a8..e2f2f3c32 100644 --- a/host/xtest/gp/include/xml_timearithm_api.h +++ b/host/xtest/gp/include/xml_timearithm_api.h @@ -906,7 +906,7 @@ static TEEC_Result Macro_StoreBigInt(ADBG_Case_t *c, TEEC_Session *sess, if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; - res = TEEC_AllocateSharedMemory(sess->ctx, &shm_value); + res = TEEC_AllocateSharedMemory(sess->imp.ctx, &shm_value); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; memcpy(shm_value.buffer, value, value_size); @@ -938,7 +938,7 @@ static TEEC_Result Invoke_BigIntConvertToOctetString(ADBG_Case_t *c, .flags = TEEC_MEM_OUTPUT, }; - res = TEEC_AllocateSharedMemory(sess->ctx, &shm); + res = TEEC_AllocateSharedMemory(sess->imp.ctx, &shm); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; @@ -983,7 +983,7 @@ static TEEC_Result Invoke_BigIntConvertFromOctetString(ADBG_Case_t *c, if (!ADBG_EXPECT_COMPARE_UNSIGNED(c, value_size, <=, shm.size)) return TEEC_ERROR_BAD_PARAMETERS; - res = TEEC_AllocateSharedMemory(sess->ctx, &shm); + res = TEEC_AllocateSharedMemory(sess->imp.ctx, &shm); if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) return res; memcpy(shm.buffer, value, value_size);