xtest 6017: Test info.dataSize in Persistent objects
Create a persistent object and write some data into it,
get the info.dataSize and then close it, and reopen it
to get the new info.dataSize of this reopen's object,
these two dataSizes should be equal.
Signed-off-by: Guanchao Liang <liang.guanchao@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/ta/storage/include/storage.h b/ta/storage/include/storage.h
index d037c17..d4a4ddc 100644
--- a/ta/storage/include/storage.h
+++ b/ta/storage/include/storage.h
@@ -54,5 +54,7 @@
TEE_Result ta_storage_cmd_alloc_obj(uint32_t param_types, TEE_Param params[4]);
TEE_Result ta_storage_cmd_free_obj(uint32_t param_types, TEE_Param params[4]);
TEE_Result ta_storage_cmd_reset_obj(uint32_t param_types, TEE_Param params[4]);
+TEE_Result ta_storage_cmd_get_obj_info(uint32_t param_types,
+ TEE_Param params[4]);
#endif /*STORAGE_H */
diff --git a/ta/storage/include/ta_storage.h b/ta/storage/include/ta_storage.h
index d2aede1..45b3d25 100644
--- a/ta/storage/include/ta_storage.h
+++ b/ta/storage/include/ta_storage.h
@@ -54,5 +54,6 @@
#define TA_STORAGE_CMD_ALLOC_OBJ 18
#define TA_STORAGE_CMD_FREE_OBJ 19
#define TA_STORAGE_CMD_RESET_OBJ 20
+#define TA_STORAGE_CMD_GET_OBJ_INFO 21
#endif /*TA_SKELETON_H */
diff --git a/ta/storage/storage.c b/ta/storage/storage.c
index 1140170..e9a507b 100644
--- a/ta/storage/storage.c
+++ b/ta/storage/storage.c
@@ -485,3 +485,21 @@
TEE_ResetTransientObject(o);
return TEE_SUCCESS;
}
+
+TEE_Result ta_storage_cmd_get_obj_info(uint32_t param_types,
+ TEE_Param params[4])
+{
+ TEE_Result res;
+ TEE_ObjectInfo *info;
+ TEE_ObjectHandle o = VAL2HANDLE(params[0].value.a);
+
+ ASSERT_PARAM_TYPE(TEE_PARAM_TYPES
+ (TEE_PARAM_TYPE_VALUE_INPUT,
+ TEE_PARAM_TYPE_MEMREF_OUTPUT, TEE_PARAM_TYPE_NONE,
+ TEE_PARAM_TYPE_NONE));
+
+ info = (TEE_ObjectInfo *)params[1].memref.buffer;
+ res = TEE_GetObjectInfo1(o, info);
+
+ return res;
+}
diff --git a/ta/storage/ta_entry.c b/ta/storage/ta_entry.c
index 8b82f88..7157550 100644
--- a/ta/storage/ta_entry.c
+++ b/ta/storage/ta_entry.c
@@ -133,6 +133,9 @@
case TA_STORAGE_CMD_RESET_OBJ:
return ta_storage_cmd_reset_obj(nParamTypes, pParams);
+ case TA_STORAGE_CMD_GET_OBJ_INFO:
+ return ta_storage_cmd_get_obj_info(nParamTypes, pParams);
+
default:
return TEE_ERROR_BAD_PARAMETERS;
}