Fix Storage TA ABI TEE_ObjectInfo
With the updated types for GP 1.3 TEE_ObjectInfo contains elements with
the type size_t. If xtest is built for AArch64 while the storage TA is
built for AArch32 the ABI will become incompatible. Fix this by adding
struct ta_storage_obj_info with fixed width integers only and use that
in the TA ABI used by xtest.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
diff --git a/ta/storage/storage.c b/ta/storage/storage.c
index 3db9d41..93548a3 100644
--- a/ta/storage/storage.c
+++ b/ta/storage/storage.c
@@ -636,6 +636,7 @@
TEE_Param params[4])
{
TEE_Result res = TEE_ERROR_GENERIC;
+ struct ta_storage_obj_info oi = { };
TEE_ObjectInfo info = { };
TEE_ObjectHandle o = VAL2HANDLE(params[0].value.a);
@@ -644,12 +645,19 @@
TEE_PARAM_TYPE_MEMREF_OUTPUT, TEE_PARAM_TYPE_NONE,
TEE_PARAM_TYPE_NONE));
- if (params[1].memref.size < sizeof(info))
+ if (params[1].memref.size < sizeof(oi))
return TEE_ERROR_SHORT_BUFFER;
res = TEE_GetObjectInfo1(o, &info);
if (!res) {
- params[1].memref.size = sizeof(info);
- TEE_MemMove(params[1].memref.buffer, &info, sizeof(info));
+ params[1].memref.size = sizeof(oi);
+ oi.object_type = info.objectType;
+ oi.object_size = info.objectSize;
+ oi.max_object_size = info.maxObjectSize;
+ oi.object_usage = info.objectUsage;
+ oi.data_size = info.dataSize;
+ oi.data_position = info.dataPosition;
+ oi.handle_flags = info.handleFlags;
+ TEE_MemMove(params[1].memref.buffer, &oi, sizeof(oi));
}
return res;