xtest 6012: Persistent File Creation

Test with specific persistent file creation:
optional object (can be NULL), and creation overwrite
using flag TEE_DATA_FLAG_OVERWRITE, on an existing file.

This reproduces https://github.com/OP-TEE/optee_os/issues/745

Change-Id: I6ed67a94e006325971e9ae494cd588d90586d964
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Pascal Brand <pascal.brand@st.com>
diff --git a/ta/storage/storage.c b/ta/storage/storage.c
index 6d4f892..5f3360e 100644
--- a/ta/storage/storage.c
+++ b/ta/storage/storage.c
@@ -76,6 +76,24 @@
 	return res;
 }
 
+TEE_Result ta_storage_cmd_create_overwrite(uint32_t param_types,
+					   TEE_Param params[4])
+{
+	TEE_Result res;
+
+	ASSERT_PARAM_TYPE(TEE_PARAM_TYPES
+			  (TEE_PARAM_TYPE_MEMREF_INPUT,
+			   TEE_PARAM_TYPE_NONE,
+			   TEE_PARAM_TYPE_NONE,
+			   TEE_PARAM_TYPE_NONE));
+
+	res = TEE_CreatePersistentObject(TEE_STORAGE_PRIVATE,
+		 params[0].memref.buffer, params[0].memref.size,
+		 TEE_DATA_FLAG_OVERWRITE,
+		 NULL, NULL, 0, NULL);
+	return res;
+}
+
 TEE_Result ta_storage_cmd_close(uint32_t param_types, TEE_Param params[4])
 {
 	ASSERT_PARAM_TYPE(TEE_PARAM_TYPES