blob: 7646fae96e828462d874bcd1991498a8cda39f45 [file] [log] [blame]
Pascal Brandc639ac82015-07-02 08:53:34 +02001/*
2 * Copyright (c) 2014, STMicroelectronics International N.V.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include <string.h>
15#include <stdio.h>
16
17#include <adbg.h>
18#include <xtest_test.h>
19#include <xtest_helpers.h>
20
21#include <tee_client_api.h>
22#include <ta_storage.h>
23#include <tee_api_defines.h>
24#include <tee_api_types.h>
Pascal Brand8a74e362015-09-10 12:41:52 +020025#ifdef CFG_GP_TESTSUITE_ENABLE
26#include <TTA_DS_protocol.h>
27#endif
Pascal Brandc639ac82015-07-02 08:53:34 +020028
29static uint8_t file_00[] = {
30 0x00, 0x6E, 0x04, 0x57, 0x08, 0xFB, 0x71, 0x96,
31 0xF0, 0x2E, 0x55, 0x3D, 0x02, 0xC3, 0xA6, 0x92,
32 0xE9, 0xC3, 0xEF, 0x8A, 0xB2, 0x34, 0x53, 0xE6,
33 0xF0, 0x74, 0x9C, 0xD6, 0x36, 0xE7, 0xA8, 0x8E
34};
35
36static uint8_t file_01[] = {
37 0x01, 0x00
38};
39
40static uint8_t file_02[] = {
41 0x02, 0x11, 0x02
42};
43
44static uint8_t file_03[] = {
45 0x03, 0x13, 0x03
46};
47
48static uint8_t data_00[] = {
49 0x00, 0x6E, 0x04, 0x57, 0x08, 0xFB, 0x71, 0x96,
50 0x00, 0x2E, 0x55, 0x3D, 0x02, 0xC3, 0xA6, 0x92,
51 0x00, 0xC3, 0xEF, 0x8A, 0xB2, 0x34, 0x53, 0xE6,
52 0x00, 0x74, 0x9C, 0xD6, 0x36, 0xE7, 0xA8, 0x00
53};
54
55static uint8_t data_01[] = {
56 0x01, 0x6E, 0x04, 0x57, 0x08, 0xFB, 0x71, 0x96,
57 0x01, 0x2E, 0x55, 0x3D, 0x02, 0xC3, 0xA6, 0x92,
58 0x01, 0xC3, 0xEF, 0x8A, 0xB2, 0x34, 0x53, 0xE6,
59 0x01, 0x74, 0x9C, 0xD6, 0x36, 0xE7, 0xA8, 0x01
60};
61
62static TEEC_Result fs_open(TEEC_Session *sess, void *id, uint32_t id_size,
63 uint32_t flags, uint32_t *obj)
64{
Aijun Sun473d9072015-08-06 15:24:49 +080065 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +020066 TEEC_Result res;
67 uint32_t org;
68
69 op.params[0].tmpref.buffer = id;
70 op.params[0].tmpref.size = id_size;
71 op.params[1].value.a = flags;
72 op.params[1].value.b = 0;
73
74 op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
75 TEEC_VALUE_INOUT, TEEC_NONE,
76 TEEC_NONE);
77
78 res = TEEC_InvokeCommand(sess, TA_STORAGE_CMD_OPEN, &op, &org);
79
80 if (res == TEEC_SUCCESS)
81 *obj = op.params[1].value.b;
82
83 return res;
84}
85
86static TEEC_Result fs_create(TEEC_Session *sess, void *id, uint32_t id_size,
87 uint32_t flags, uint32_t attr, void *data,
88 uint32_t data_size, uint32_t *obj)
89{
Aijun Sun473d9072015-08-06 15:24:49 +080090 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +020091 TEEC_Result res;
92 uint32_t org;
93
94 op.params[0].tmpref.buffer = id;
95 op.params[0].tmpref.size = id_size;
96 op.params[1].value.a = flags;
97 op.params[1].value.b = 0;
98 op.params[2].value.a = attr;
99 op.params[2].value.b = 0;
100 op.params[3].tmpref.buffer = data;
101 op.params[3].tmpref.size = data_size;
102
103 op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
104 TEEC_VALUE_INOUT, TEEC_VALUE_INPUT,
105 TEEC_MEMREF_TEMP_INPUT);
106
107 res = TEEC_InvokeCommand(sess, TA_STORAGE_CMD_CREATE, &op, &org);
108
109 if (res == TEEC_SUCCESS)
110 *obj = op.params[1].value.b;
111
112 return res;
113}
114
115static TEEC_Result fs_close(TEEC_Session *sess, uint32_t obj)
116{
Aijun Sun473d9072015-08-06 15:24:49 +0800117 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +0200118 uint32_t org;
119
120 op.params[0].value.a = obj;
121
122 op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
123 TEEC_NONE, TEEC_NONE);
124
125 return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_CLOSE, &op, &org);
126}
127
128static TEEC_Result fs_read(TEEC_Session *sess, uint32_t obj, void *data,
129 uint32_t data_size, uint32_t *count)
130{
131 TEEC_Result res;
Aijun Sun473d9072015-08-06 15:24:49 +0800132 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +0200133 uint32_t org;
134
135 op.params[0].tmpref.buffer = data;
136 op.params[0].tmpref.size = data_size;
137 op.params[1].value.a = obj;
138 op.params[1].value.b = 0;
139
140 op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_OUTPUT,
141 TEEC_VALUE_INOUT, TEEC_NONE,
142 TEEC_NONE);
143
144 res = TEEC_InvokeCommand(sess, TA_STORAGE_CMD_READ, &op, &org);
145
146 if (res == TEEC_SUCCESS)
147 *count = op.params[1].value.b;
148
149 return res;
150}
151
152static TEEC_Result fs_write(TEEC_Session *sess, uint32_t obj, void *data,
153 uint32_t data_size)
154{
Aijun Sun473d9072015-08-06 15:24:49 +0800155 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +0200156 uint32_t org;
157
158 op.params[0].tmpref.buffer = data;
159 op.params[0].tmpref.size = data_size;
160 op.params[1].value.a = obj;
161 op.params[1].value.b = 0;
162
163 op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
164 TEEC_VALUE_INPUT, TEEC_NONE,
165 TEEC_NONE);
166
167 return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_WRITE, &op, &org);
168}
169
170static TEEC_Result fs_seek(TEEC_Session *sess, uint32_t obj, int32_t offset,
171 int32_t whence)
172{
Aijun Sun473d9072015-08-06 15:24:49 +0800173 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +0200174 uint32_t org;
175
176 op.params[0].value.a = obj;
177 op.params[0].value.b = offset;
178 op.params[1].value.a = whence;
179
180 op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_VALUE_INOUT,
181 TEEC_NONE, TEEC_NONE);
182
183 return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_SEEK, &op, &org);
184}
185
186static TEEC_Result fs_unlink(TEEC_Session *sess, uint32_t obj)
187{
Aijun Sun473d9072015-08-06 15:24:49 +0800188 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +0200189 uint32_t org;
190
191 op.params[0].value.a = obj;
192
193 op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
194 TEEC_NONE, TEEC_NONE);
195
196 return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_UNLINK, &op, &org);
197}
198
199static TEEC_Result fs_trunc(TEEC_Session *sess, uint32_t obj, uint32_t len)
200{
Aijun Sun473d9072015-08-06 15:24:49 +0800201 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +0200202 uint32_t org;
203
204 op.params[0].value.a = obj;
205 op.params[0].value.b = len;
206
207 op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
208 TEEC_NONE, TEEC_NONE);
209
210 return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_TRUNC, &op, &org);
211}
212
213static TEEC_Result fs_rename(TEEC_Session *sess, uint32_t obj, void *id,
214 uint32_t id_size)
215{
Aijun Sun473d9072015-08-06 15:24:49 +0800216 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +0200217 uint32_t org;
218
219 op.params[0].value.a = obj;
220 op.params[1].tmpref.buffer = id;
221 op.params[1].tmpref.size = id_size;
222
223 op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
224 TEEC_MEMREF_TEMP_INPUT, TEEC_NONE,
225 TEEC_NONE);
226
227 return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_RENAME, &op, &org);
228}
229
230static TEEC_Result fs_alloc_enum(TEEC_Session *sess, uint32_t *e)
231{
232 TEEC_Result res;
Aijun Sun473d9072015-08-06 15:24:49 +0800233 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +0200234 uint32_t org;
235
236 op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_OUTPUT, TEEC_NONE,
237 TEEC_NONE, TEEC_NONE);
238
239 res = TEEC_InvokeCommand(sess, TA_STORAGE_CMD_ALLOC_ENUM, &op, &org);
240
241 if (res == TEEC_SUCCESS)
242 *e = op.params[0].value.a;
243
244 return res;
245}
246
247static TEEC_Result fs_free_enum(TEEC_Session *sess, uint32_t e)
248{
Aijun Sun473d9072015-08-06 15:24:49 +0800249 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +0200250 uint32_t org;
251
252 op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE,
253 TEEC_NONE);
254
255 op.params[0].value.a = e;
256
257 return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_FREE_ENUM, &op, &org);
258}
259
260static TEEC_Result fs_start_enum(TEEC_Session *sess, uint32_t e)
261{
Aijun Sun473d9072015-08-06 15:24:49 +0800262 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +0200263 uint32_t org;
264
265 op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
266 TEEC_NONE, TEEC_NONE);
267
268 op.params[0].value.a = e;
269
270 return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_START_ENUM, &op, &org);
271}
272
273static TEEC_Result fs_next_enum(TEEC_Session *sess, uint32_t e, void *obj_info,
274 size_t info_size, void *id, uint32_t id_size)
275{
Aijun Sun473d9072015-08-06 15:24:49 +0800276 TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
Pascal Brandc639ac82015-07-02 08:53:34 +0200277 uint32_t org;
278
279 op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
280 TEEC_MEMREF_TEMP_OUTPUT,
281 TEEC_MEMREF_TEMP_OUTPUT, TEEC_NONE);
282
283 op.params[0].value.a = e;
284 op.params[1].tmpref.buffer = obj_info;
285 op.params[1].tmpref.size = info_size;
286 op.params[2].tmpref.buffer = id;
287 op.params[2].tmpref.size = id_size;
288
289 return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_NEXT_ENUM, &op, &org);
290}
291
James Kung98c0ba12015-09-09 15:51:59 +0800292/* trunc */
293static void test_truncate_file_length(ADBG_Case_t *c)
294{
295 TEEC_Session sess;
296 uint32_t obj;
297 uint8_t out[10] = { 0 };
298 uint32_t count;
299 uint32_t orig;
300
301 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
302 xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
303 return;
304
305 /* create */
306 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
307 fs_create(&sess, file_01, sizeof(file_01),
308 TEE_DATA_FLAG_ACCESS_WRITE |
309 TEE_DATA_FLAG_ACCESS_READ |
310 TEE_DATA_FLAG_ACCESS_WRITE_META, 0, data_00,
311 sizeof(data_00), &obj)))
312 goto exit;
313
314 /* trunc */
315 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_trunc(&sess, obj, 10)))
316 goto exit;
317
318 /* seek */
319 if (!ADBG_EXPECT_TEEC_SUCCESS(
320 c, fs_seek(&sess, obj, 5, TEE_DATA_SEEK_SET)))
321 goto exit;
322
323 /* verify */
324 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
325 goto exit;
326
327 /* check buffer */
328 (void)ADBG_EXPECT_BUFFER(c, &data_00[5], 5, out, count);
329
330 /* clean */
331 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
332 goto exit;
333
334exit:
335 TEEC_CloseSession(&sess);
336}
337
338/* extend */
339static void test_extend_file_length(ADBG_Case_t *c)
340{
341 TEEC_Session sess;
342 uint32_t obj;
343 uint8_t out[10] = { 0 };
344 uint8_t expect[10] = { 0 };
345 uint32_t count;
346 uint32_t orig;
347
348 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
349 xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
350 return;
351
352 /* create */
353 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
354 fs_create(&sess, file_01, sizeof(file_01),
355 TEE_DATA_FLAG_ACCESS_WRITE |
356 TEE_DATA_FLAG_ACCESS_READ |
357 TEE_DATA_FLAG_ACCESS_WRITE_META, 0, data_00,
358 sizeof(data_00), &obj)))
359 goto exit;
360
361 /* extend */
362 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_trunc(&sess, obj, 40)))
363 goto exit;
364
365 /* seek */
366 if (!ADBG_EXPECT_TEEC_SUCCESS(
367 c, fs_seek(&sess, obj, 30, TEE_DATA_SEEK_SET)))
368 goto exit;
369
370 /* verify */
371 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
372 goto exit;
373
374 /* check buffer */
375 expect[0] = data_00[30];
376 expect[1] = data_00[31];
377 (void)ADBG_EXPECT_BUFFER(c, &expect[0], 10, out, count);
378
379 /* clean */
380 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
381 goto exit;
382
383exit:
384 TEEC_CloseSession(&sess);
385}
386
387/* file hole */
388static void test_file_hole(ADBG_Case_t *c)
389{
390 TEEC_Session sess;
391 uint32_t obj;
392 uint8_t out[10] = { 0 };
393 uint8_t expect[10] = { 0 };
394 uint32_t count;
395 uint32_t orig;
396
397 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
398 xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
399 return;
400
401 /* create */
402 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
403 fs_create(&sess, file_01, sizeof(file_01),
404 TEE_DATA_FLAG_ACCESS_WRITE |
405 TEE_DATA_FLAG_ACCESS_READ |
406 TEE_DATA_FLAG_ACCESS_WRITE_META, 0, data_00,
407 sizeof(data_00), &obj)))
408 goto exit;
409
410 /* seek */
411 if (!ADBG_EXPECT_TEEC_SUCCESS(
412 c, fs_seek(&sess, obj, 80, TEE_DATA_SEEK_SET)))
413 goto exit;
414
415 /* write */
416 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_write(&sess, obj, data_00,
417 sizeof(data_00))))
418 goto exit;
419
420 /* seek */
421 if (!ADBG_EXPECT_TEEC_SUCCESS(
422 c, fs_seek(&sess, obj, 74, TEE_DATA_SEEK_SET)))
423 goto exit;
424
425 /* verify */
426 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
427 goto exit;
428
429 /* check buffer */
430 expect[6] = data_00[0];
431 expect[7] = data_00[1];
432 expect[8] = data_00[2];
433 expect[9] = data_00[3];
434 (void)ADBG_EXPECT_BUFFER(c, &expect[0], 10, out, count);
435
436 /* clean */
437 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
438 goto exit;
439
440exit:
441 TEEC_CloseSession(&sess);
442}
443
Pascal Brand8a74e362015-09-10 12:41:52 +0200444#ifdef CFG_GP_TESTSUITE_ENABLE
445static TEEC_Result ds_open_access_conf(TEEC_Session *sess)
446{
447 TEEC_Operation op;
448 uint32_t org;
449
450 op.paramTypes = TEEC_PARAM_TYPES(
451 TEEC_NONE, TEEC_NONE, TEEC_NONE, TEEC_NONE);
452
453 return TEEC_InvokeCommand(
454 sess, CMD_CreatePersistentObject_AccessConflict, &op, &org);
455}
456
457static TEEC_Result ds_res_obj_panic(TEEC_Session *sess)
458{
459 TEEC_Operation op;
460 uint32_t org;
461
462 op.paramTypes = TEEC_PARAM_TYPES(
463 TEEC_NONE, TEEC_NONE, TEEC_NONE, TEEC_NONE);
464
465 return TEEC_InvokeCommand(
466 sess, CMD_RestrictObjectUsagePanic, &op, &org);
467}
468
469static TEEC_Result ds_seek_obj_inv_handle(TEEC_Session *sess)
470{
471 TEEC_Operation op;
472 uint32_t org;
473
474 op.paramTypes = TEEC_PARAM_TYPES(
475 TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
476
477 op.params[0].value.a = CASE_DATA_OBJECT_NOT_PERSISTENT;
478
479 return TEEC_InvokeCommand(
480 sess, CMD_SeekObjectData_panic, &op, &org);
481}
482
483static TEEC_Result ds_seek_obj_bad_handle(TEEC_Session *sess)
484{
485 TEEC_Operation op;
486 uint32_t org;
487
488 op.paramTypes = TEEC_PARAM_TYPES(
489 TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
490
491 op.params[0].value.a = CASE_DATA_BAD_HANDLE;
492
493 return TEEC_InvokeCommand(
494 sess, CMD_SeekObjectData_panic, &op, &org);
495}
496
497static TEEC_Result ds_seek_gp(
498 TEEC_Session *sess, TEE_Whence wh, uint32_t wh_off, uint32_t set_off,
499 void *in, size_t in_size, void *out, size_t out_size)
500{
501 TEEC_Operation op;
502 uint32_t org;
503
504 op.paramTypes = TEEC_PARAM_TYPES(
505 TEEC_VALUE_INPUT, TEEC_VALUE_INPUT, TEEC_MEMREF_TEMP_INPUT,
506 TEEC_MEMREF_TEMP_OUTPUT);
507
508 op.params[0].value.a = wh;
509 op.params[0].value.b = wh_off;
510 op.params[1].value.a = set_off;
511 op.params[2].tmpref.buffer = in;
512 op.params[2].tmpref.size = in_size;
513 op.params[3].tmpref.buffer = out;
514 op.params[3].tmpref.size = out_size;
515
516 return TEEC_InvokeCommand(sess, CMD_SeekWriteReadObjectData, &op, &org);
517}
518
519static TEEC_Result ds_init_object_and_attributes(TEEC_Session *sess,
520 uint32_t obj_type, uint32_t obj_size, const void *attr_meta,
521 size_t attr_meta_len, const void *attr_data, size_t attr_data_len,
522 uint32_t option)
523{
524 TEEC_Operation op;
525 uint32_t org;
526
527 op.paramTypes = TEEC_PARAM_TYPES(
528 TEEC_VALUE_INPUT, TEEC_MEMREF_TEMP_INPUT,
529 TEEC_MEMREF_TEMP_INPUT, TEEC_VALUE_INPUT);
530
531 op.params[0].value.a = obj_type;
532 op.params[0].value.b = obj_size;
533 op.params[1].tmpref.buffer = (void *)attr_meta;
534 op.params[1].tmpref.size = attr_meta_len;
535 op.params[2].tmpref.buffer = (void *)attr_data;
536 op.params[2].tmpref.size = attr_data_len;
537 op.params[3].value.a = option;
538
539 return TEEC_InvokeCommand(sess, CMD_InitObjectAndAttributes, &op, &org);
540}
541
542static TEEC_Result ds_rename_access_conflict(TEEC_Session *sess)
543{
544 TEEC_Operation op;
545 uint32_t org;
546
547 op.paramTypes = TEEC_PARAM_TYPES(
548 TEEC_NONE, TEEC_NONE, TEEC_NONE, TEEC_NONE);
549
550 return TEEC_InvokeCommand(
551 sess, CMD_RenamePersistentObject_AccessConflict, &op, &org);
552}
553
554static TEEC_Result ds_start_enum_no_item(TEEC_Session *sess)
555{
556 TEEC_Operation op;
557 uint32_t org;
558 TEEC_Result res;
559
560 op.paramTypes = TEEC_PARAM_TYPES(
561 TEEC_VALUE_OUTPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
562
563 res = TEEC_InvokeCommand(
564 sess, CMD_StartNGetPersistentObjectEnumerator_itemNotFound, &op, &org);
565
566 if (res != TEEC_SUCCESS)
567 return res;
568
569 if (op.params[0].value.a != 0 || op.params[0].value.b != 0)
570 return TEEC_ERROR_GENERIC;
571
572 return res;
573}
574
575static TEEC_Result ds_rename_success(TEEC_Session *sess)
576{
577 TEEC_Operation op;
578 uint32_t org;
579
580 op.paramTypes = TEEC_PARAM_TYPES(
581 TEEC_NONE, TEEC_NONE, TEEC_NONE, TEEC_NONE);
582
583 return TEEC_InvokeCommand(
584 sess, CMD_RenamePersistentObject_Success, &op, &org);
585}
586
587static TEEC_Result ds_null_close_free_reset(TEEC_Session *sess)
588{
589 TEEC_Operation op;
590 uint32_t org;
591
592 op.paramTypes = TEEC_PARAM_TYPES(
593 TEEC_NONE, TEEC_NONE, TEEC_NONE, TEEC_NONE);
594
595 return TEEC_InvokeCommand(
596 sess, CMD_CloseFreeAndResetObjectSuccessHandleNull, &op, &org);
597}
598#endif
599
Pascal Brandc639ac82015-07-02 08:53:34 +0200600/* create */
601static void xtest_tee_test_6001(ADBG_Case_t *c)
602{
603 TEEC_Session sess;
604 uint32_t obj;
605 uint32_t orig;
606
607 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
608 xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
609 return;
610
611 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
612 fs_create(&sess, file_00, sizeof(file_00),
613 TEE_DATA_FLAG_ACCESS_WRITE |
614 TEE_DATA_FLAG_ACCESS_WRITE_META, 0, data_00,
615 sizeof(data_00), &obj)))
616 goto exit;
617
618 /* clean */
619 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
620 goto exit;
621
622exit:
623 TEEC_CloseSession(&sess);
624}
625
626/* open */
627static void xtest_tee_test_6002(ADBG_Case_t *c)
628{
629 TEEC_Session sess;
630 uint32_t obj;
631 uint32_t orig;
632
633 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
634 xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
635 return;
636
637 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
638 fs_create(&sess, file_01, sizeof(file_01),
639 TEE_DATA_FLAG_ACCESS_WRITE, 0, data_00,
640 sizeof(data_00), &obj)))
641 goto exit;
642
643 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
644 goto exit;
645
646 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
647 fs_open(&sess, file_01, sizeof(file_01),
648 TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
649 goto exit;
650
651 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
652 goto exit;
653
654 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
655 fs_open(&sess, file_01, sizeof(file_01),
656 TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
657 goto exit;
658
659 /* clean */
660 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
661 goto exit;
662
663exit:
664 TEEC_CloseSession(&sess);
665}
666
667/* read */
668static void xtest_tee_test_6003(ADBG_Case_t *c)
669{
670 TEEC_Session sess;
671 uint32_t obj;
672 uint8_t out[10] = { 0 };
673 uint32_t count;
674 uint32_t orig;
675
676 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
677 xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
678 return;
679
680 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
681 fs_create(&sess, file_02, sizeof(file_02),
682 TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
683 sizeof(data_01), &obj)))
684 goto exit;
685
686 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
687 goto exit;
688
689 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
690 fs_open(&sess, file_02, sizeof(file_02),
691 TEE_DATA_FLAG_ACCESS_READ |
692 TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
693 goto exit;
694
695 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
696 goto exit;
697
698 (void)ADBG_EXPECT_BUFFER(c, data_01, 10, out, count);
699
700 /* clean */
701 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
702 goto exit;
703
704exit:
705 TEEC_CloseSession(&sess);
706}
707
708/* write */
709static void xtest_tee_test_6004(ADBG_Case_t *c)
710{
711 TEEC_Session sess;
712 uint32_t obj;
713 uint8_t out[10] = { 0 };
714 uint32_t count;
715 uint32_t orig;
716
717 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
718 xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
719 return;
720
721 /* create */
722 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
723 fs_create(&sess, file_02, sizeof(file_02),
724 TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
725 sizeof(data_01), &obj)))
726 goto exit;
727
728 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
729 goto exit;
730
731 /* write new data */
732 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
733 fs_open(&sess, file_02, sizeof(file_02),
734 TEE_DATA_FLAG_ACCESS_WRITE, &obj)))
735 goto exit;
736
737 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
738 fs_write(&sess, obj, data_00, sizeof(data_00))))
739 goto exit;
740
741 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
742 goto exit;
743
744 /* verify */
745 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
746 fs_open(&sess, file_02, sizeof(file_02),
747 TEE_DATA_FLAG_ACCESS_READ |
748 TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
749 goto exit;
750
751 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
752 goto exit;
753
754 (void)ADBG_EXPECT_BUFFER(c, data_00, 10, out, count);
755
756 /* clean */
757 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
758 goto exit;
759
760exit:
761 TEEC_CloseSession(&sess);
762}
763
764/* seek */
765static void xtest_tee_test_6005(ADBG_Case_t *c)
766{
767 TEEC_Session sess;
768 uint32_t obj;
769 uint8_t out[10] = { 0 };
770 uint32_t count;
771 uint32_t orig;
772
773 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
774 xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
775 return;
776
777 /* create */
778 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
779 fs_create(&sess, file_01, sizeof(file_01),
780 TEE_DATA_FLAG_ACCESS_WRITE |
781 TEE_DATA_FLAG_ACCESS_READ |
782 TEE_DATA_FLAG_ACCESS_WRITE_META, 0, data_00,
783 sizeof(data_00), &obj)))
784 goto exit;
785
786 /* seek */
787 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
788 fs_seek(&sess, obj, 10, TEE_DATA_SEEK_SET)))
789 goto exit;
790
791 /* verify */
792 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
793 goto exit;
794
795 (void)ADBG_EXPECT_BUFFER(c, &data_00[10], 10, out, count);
796
797 /* clean */
798 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
799 goto exit;
800
801exit:
802 TEEC_CloseSession(&sess);
803}
804
805/* unlink */
806static void xtest_tee_test_6006(ADBG_Case_t *c)
807{
808 TEEC_Session sess;
809 uint32_t obj;
810 uint32_t orig;
811
812 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
813 xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
814 return;
815
816 /* create */
817 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
818 fs_create(&sess, file_01, sizeof(file_01),
819 TEE_DATA_FLAG_ACCESS_WRITE_META, 0, data_00,
820 sizeof(data_00), &obj)))
821 goto exit;
822
823 /* del & close */
824 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
825 goto exit;
826
827 /* check result */
828 if (!ADBG_EXPECT_TEEC_RESULT(c, TEEC_ERROR_ITEM_NOT_FOUND,
829 fs_open(&sess, file_01, sizeof(file_01),
830 TEE_DATA_FLAG_ACCESS_READ, &obj)))
831 goto exit;
832
833exit:
834 TEEC_CloseSession(&sess);
835}
836
Pascal Brandc639ac82015-07-02 08:53:34 +0200837static void xtest_tee_test_6007(ADBG_Case_t *c)
838{
James Kung98c0ba12015-09-09 15:51:59 +0800839 Do_ADBG_BeginSubCase(c, "Test truncate file length");
840 test_truncate_file_length(c);
841 Do_ADBG_EndSubCase(c, "Test truncate file length");
Pascal Brandc639ac82015-07-02 08:53:34 +0200842
James Kung98c0ba12015-09-09 15:51:59 +0800843 Do_ADBG_BeginSubCase(c, "Test extend file length");
844 test_extend_file_length(c);
845 Do_ADBG_EndSubCase(c, "Test extend file length");
Pascal Brandc639ac82015-07-02 08:53:34 +0200846
James Kung98c0ba12015-09-09 15:51:59 +0800847 Do_ADBG_BeginSubCase(c, "Test file hole");
848 test_file_hole(c);
849 Do_ADBG_EndSubCase(c, "Test file hole");
Pascal Brandc639ac82015-07-02 08:53:34 +0200850}
851
852static void xtest_tee_test_6008(ADBG_Case_t *c)
853{
854 TEEC_Session sess;
855 uint32_t obj;
856 uint8_t out[10] = { 0 };
857 uint32_t count;
858 uint32_t orig;
859
860 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
861 xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
862 return;
863
864 /* create */
865 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
866 fs_create(&sess, file_02, sizeof(file_02),
867 TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
868 sizeof(data_01), &obj)))
869 goto exit;
870
871 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
872 goto exit;
873
874 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
875 fs_open(&sess, file_02, sizeof(file_02),
876 TEE_DATA_FLAG_ACCESS_WRITE |
877 TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
878 goto exit;
879
880 /* write new data */
881 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
882 fs_write(&sess, obj, data_00, sizeof(data_00))))
883 goto exit;
884
885 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
886 fs_rename(&sess, obj, file_03, sizeof(file_03))))
887 goto exit;
888
889 /* close */
890 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
891 goto exit;
892
893 /* verify */
894 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
895 fs_open(&sess, file_03, sizeof(file_03),
896 TEE_DATA_FLAG_ACCESS_READ |
897 TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
898 goto exit;
899
900 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
901 goto exit;
902
903 /* check buffer */
904 (void)ADBG_EXPECT_BUFFER(c, data_00, 10, out, count);
905
906 /* clean */
907 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
908 goto exit;
909
910exit:
911 TEEC_CloseSession(&sess);
912}
913
914static void xtest_tee_test_6009(ADBG_Case_t *c)
915{
916 TEEC_Session sess;
917 uint32_t obj0;
918 uint32_t obj1;
919 uint32_t obj2;
920 uint32_t e = 0;
921 uint8_t info[200];
922 uint8_t id[200];
923 uint32_t orig;
924
925 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
926 xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
927 return;
928
929 /* create file 00 */
930 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
931 fs_create(&sess, file_00, sizeof(file_00),
932 TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
933 sizeof(data_01), &obj0)))
934 goto exit;
935
936 /* create file 01 */
937 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
938 fs_create(&sess, file_01, sizeof(file_01),
939 TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
940 sizeof(data_01), &obj1)))
941 goto exit;
942
943 /* create file 02 */
944 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
945 fs_create(&sess, file_02, sizeof(file_02),
946 TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
947 sizeof(data_01), &obj2)))
948 goto exit;
949
950 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj0)))
951 goto exit;
952
953 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj1)))
954 goto exit;
955
956 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj2)))
957 goto exit;
958
959 /* iterate */
960 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_alloc_enum(&sess, &e)))
961 goto exit;
962
963 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_start_enum(&sess, e)))
964 goto exit;
965
966 /* get 00 */
967 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
968 fs_next_enum(&sess, e, info, sizeof(info), id, sizeof(id))))
969 goto exit;
970
971 /* get 01 */
972 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
973 fs_next_enum(&sess, e, info, sizeof(info), id, sizeof(id))))
974 goto exit;
975
976 /* get 02 */
977 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
978 fs_next_enum(&sess, e, info, sizeof(info), id, sizeof(id))))
979 goto exit;
980
981 /* we should not have more files */
982 if (!ADBG_EXPECT_TEEC_RESULT(c, TEEC_ERROR_ITEM_NOT_FOUND,
983 fs_next_enum(&sess, e, info, sizeof(info), id, sizeof(id))))
984 goto exit;
985
986 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_free_enum(&sess, e)))
987 goto exit;
988
989 /* clean */
990 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
991 fs_open(&sess, file_00, sizeof(file_00),
992 TEE_DATA_FLAG_ACCESS_WRITE_META, &obj0)))
993 goto exit;
994
995 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj0)))
996 goto exit;
997
998 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
999 fs_open(&sess, file_01, sizeof(file_01),
1000 TEE_DATA_FLAG_ACCESS_WRITE_META, &obj1)))
1001 goto exit;
1002
1003 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj1)))
1004 goto exit;
1005
1006 if (!ADBG_EXPECT_TEEC_SUCCESS(c,
1007 fs_open(&sess, file_02, sizeof(file_02),
1008 TEE_DATA_FLAG_ACCESS_WRITE_META, &obj2)))
1009 goto exit;
1010
1011 if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj2)))
1012 goto exit;
1013
1014exit:
1015 TEEC_CloseSession(&sess);
1016}
1017
Pascal Brand8a74e362015-09-10 12:41:52 +02001018#ifdef CFG_GP_TESTSUITE_ENABLE
1019static void xtest_tee_test_6010(ADBG_Case_t *c)
1020{
1021 TEEC_Session sess;
1022 uint32_t orig;
1023 uint8_t out[4000] = {0};
1024 uint8_t in[0x12c] = {'b'};
1025
1026 if (!ADBG_EXPECT_TEEC_SUCCESS(
1027 c, xtest_teec_open_session(
1028 &sess, &gp_tta_ds_uuid, NULL, &orig)))
1029 return;
1030
1031 Do_ADBG_BeginSubCase(
1032 c, "GP DS CreatePersistentObject AccessConflict (9d-1d-62)");
1033
1034 if (!ADBG_EXPECT_TEEC_RESULT(
1035 c, TEEC_ERROR_ACCESS_CONFLICT, ds_open_access_conf(&sess)))
1036 goto exit;
1037
1038 Do_ADBG_EndSubCase(
1039 c, "GP DS CreatePersistentObject AccessConflict (9d-1d-62)");
1040 Do_ADBG_BeginSubCase(
1041 c, "GP DS RestrictObjectUsagePanic (9d-5d-46)");
1042
1043 if (!ADBG_EXPECT_TEEC_RESULT(
1044 c, TEE_ERROR_TARGET_DEAD, ds_res_obj_panic(&sess)))
1045 goto exit;
1046
1047 TEEC_CloseSession(&sess);
1048
1049 Do_ADBG_EndSubCase(
1050 c, "GP DS RestrictObjectUsagePanic (9d-5d-46)");
1051 Do_ADBG_BeginSubCase(
1052 c, "GP DS SeekObjectData BadHandle (9d-c3-c8)");
1053
1054 if (!ADBG_EXPECT_TEEC_SUCCESS(
1055 c, xtest_teec_open_session(
1056 &sess, &gp_tta_ds_uuid, NULL, &orig)))
1057 return;
1058
1059 if (!ADBG_EXPECT_TEEC_RESULT(
1060 c, TEE_ERROR_TARGET_DEAD, ds_seek_obj_bad_handle(&sess)))
1061 goto exit;
1062
1063 TEEC_CloseSession(&sess);
1064
1065 Do_ADBG_EndSubCase(
1066 c, "GP DS SeekObjectData BadHandle (9d-c3-c8)");
1067 Do_ADBG_BeginSubCase(
1068 c, "GP DS SeekObjectData NotPersist (9d-db-4a)");
1069
1070 if (!ADBG_EXPECT_TEEC_SUCCESS(
1071 c, xtest_teec_open_session(
1072 &sess, &gp_tta_ds_uuid, NULL, &orig)))
1073 return;
1074
1075 if (!ADBG_EXPECT_TEEC_RESULT(
1076 c, TEE_ERROR_TARGET_DEAD, ds_seek_obj_inv_handle(&sess)))
1077 goto exit;
1078
1079 TEEC_CloseSession(&sess);
1080
1081 Do_ADBG_EndSubCase(
1082 c, "GP DS SeekObjectData NotPersist (9d-db-4a)");
1083 Do_ADBG_BeginSubCase(c, "GP DS SeekWriteRead SEEK_END (9d-e4-58)");
1084
1085 if (!ADBG_EXPECT_TEEC_SUCCESS(
1086 c, xtest_teec_open_session(
1087 &sess, &gp_tta_ds_uuid, NULL, &orig)))
1088 return;
1089
1090 if (!ADBG_EXPECT_TEEC_SUCCESS(
1091 c, ds_seek_gp(
1092 &sess, TEE_DATA_SEEK_END, 0, 2, data_00, sizeof(data_00), out,
1093 sizeof(out))))
1094 goto exit;
1095
1096 /* check buffer */
1097 (void)ADBG_EXPECT_BUFFER(
1098 c, data_00, sizeof(data_00), out, sizeof(data_00));
1099
1100 if (!ADBG_EXPECT_TEEC_SUCCESS(
1101 c, ds_seek_gp(
1102 &sess, TEE_DATA_SEEK_END, sizeof(in), 0, in, sizeof(in), out,
1103 sizeof(out))))
1104 goto exit;
1105
1106 (void)ADBG_EXPECT_BUFFER(c, in + sizeof(in), sizeof(in), out, sizeof(in));
1107
1108 Do_ADBG_EndSubCase(c, "GP DS SeekWriteRead SEEK_END (9d-e4-58)");
1109 Do_ADBG_BeginSubCase(c, "GP DS Rename Access Conflict (9d-29-d1)");
1110
1111 if (!ADBG_EXPECT_TEEC_RESULT(
1112 c, TEE_ERROR_ACCESS_CONFLICT, ds_rename_access_conflict(&sess)))
1113 goto exit;
1114
1115 Do_ADBG_EndSubCase(c, "GP DS Rename Access Conflict (9d-29-d1)");
1116 Do_ADBG_BeginSubCase(
1117 c, "GP DS StartPersistentObjectEnumerator ItemNotFound (9d-52-ec)");
1118
1119 if (!ADBG_EXPECT_TEEC_SUCCESS(c, ds_start_enum_no_item(&sess)))
1120 goto exit;
1121
1122 Do_ADBG_EndSubCase(
1123 c, "GP DS StartPersistentObjectEnumerator ItemNotFound (9d-52-ec)");
1124 Do_ADBG_BeginSubCase(
1125 c, "GP DS RenamePersistent ReadWrite (9d-19-88)");
1126
1127 if (!ADBG_EXPECT_TEEC_SUCCESS(c, ds_rename_success(&sess)))
1128 goto exit;
1129
1130 Do_ADBG_EndSubCase(
1131 c, "GP DS RenamePersistent ReadWrite (9d-19-88)");
1132 Do_ADBG_BeginSubCase(
1133 c, "GP DS Close Free Reset Null (9d-6d-87)");
1134
1135 if (!ADBG_EXPECT_TEEC_SUCCESS(c, ds_null_close_free_reset(&sess)))
1136 goto exit;
1137
1138 Do_ADBG_EndSubCase(
1139 c, "GP DS Close Free Reset Null (9d-6d-87)");
1140
1141exit:
1142 TEEC_CloseSession(&sess);
1143}
1144
1145static void xtest_tee_test_6011(ADBG_Case_t *c)
1146{
1147 TEEC_Session sess;
1148 uint32_t orig;
1149 /*
1150 * Test data from
1151 * Invoke_InitObjectAndAttributes_TEE_TYPE_AES_success_attribute_
1152 * TEE_ATTR_SECRET_VALUE_correct_size (9d-9a-91)
1153 */
1154 static const uint8_t attr_meta[] = {
11550xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
11560x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
11570x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
11580x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1159 };
1160 static const uint8_t attr_data[] = {
11610x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe,0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,
11620x81,0x1f,0x35,0x2c,0x07,0x3b,0x61,0x08,0xd7,0x2d,0x98,0x10,0xa3,0x09,0x14,
11630xdf,0xf4,
1164 };
1165
1166 if (!ADBG_EXPECT_TEEC_SUCCESS(
1167 c, xtest_teec_open_session(
1168 &sess, &gp_tta_ds_uuid, NULL, &orig)))
1169 return;
1170
1171 if (!ADBG_EXPECT_TEEC_SUCCESS(c, ds_init_object_and_attributes(&sess,
1172 0xa0000010, 0x100, attr_meta, sizeof(attr_meta), attr_data,
1173 sizeof(attr_data), 0)))
1174 goto exit;
1175
1176exit:
1177 TEEC_CloseSession(&sess);
1178}
1179#endif
1180
Pascal Brandc639ac82015-07-02 08:53:34 +02001181ADBG_CASE_DEFINE(
1182 XTEST_TEE_6001, xtest_tee_test_6001,
1183 /* Title */
1184 "Test TEE_CreatePersistentObject",
1185 /* Short description */
1186 "Short description ...",
1187 /* Requirement IDs */
1188 "TEE-??",
1189 /* How to implement */
1190 "Description of how to implement ..."
1191 );
1192
1193ADBG_CASE_DEFINE(
1194 XTEST_TEE_6002, xtest_tee_test_6002,
1195 /* Title */
1196 "Test TEE_OpenPersistentObject",
1197 /* Short description */
1198 "Short description ...",
1199 /* Requirement IDs */
1200 "TEE-??",
1201 /* How to implement */
1202 "Description of how to implement ..."
1203 );
1204
1205ADBG_CASE_DEFINE(
1206 XTEST_TEE_6003, xtest_tee_test_6003,
1207 /* Title */
1208 "Test TEE_ReadObjectData",
1209 /* Short description */
1210 "Short description ...",
1211 /* Requirement IDs */
1212 "TEE-??",
1213 /* How to implement */
1214 "Description of how to implement ..."
1215 );
1216
1217ADBG_CASE_DEFINE(
1218 XTEST_TEE_6004, xtest_tee_test_6004,
1219 /* Title */
1220 "Test TEE_WriteObjectData",
1221 /* Short description */
1222 "Short description ...",
1223 /* Requirement IDs */
1224 "TEE-??",
1225 /* How to implement */
1226 "Description of how to implement ..."
1227 );
1228
1229ADBG_CASE_DEFINE(
1230 XTEST_TEE_6005, xtest_tee_test_6005,
1231 /* Title */
1232 "Test TEE_SeekObjectData",
1233 /* Short description */
1234 "Short description ...",
1235 /* Requirement IDs */
1236 "TEE-??",
1237 /* How to implement */
1238 "Description of how to implement ..."
1239 );
1240
1241ADBG_CASE_DEFINE(
1242 XTEST_TEE_6006, xtest_tee_test_6006,
1243 /* Title */
1244 "Test TEE_CloseAndDeletePersistentObject",
1245 /* Short description */
1246 "Short description ...",
1247 /* Requirement IDs */
1248 "TEE-??",
1249 /* How to implement */
1250 "Description of how to implement ..."
1251 );
1252
1253ADBG_CASE_DEFINE(
1254 XTEST_TEE_6007, xtest_tee_test_6007,
1255 /* Title */
1256 "Test TEE_TruncateObjectData",
1257 /* Short description */
1258 "Short description ...",
1259 /* Requirement IDs */
1260 "TEE-??",
1261 /* How to implement */
1262 "Description of how to implement ..."
1263 );
1264
1265ADBG_CASE_DEFINE(
1266 XTEST_TEE_6008, xtest_tee_test_6008,
1267 /* Title */
1268 "Test TEE_RenamePersistentObject",
1269 /* Short description */
1270 "Short description ...",
1271 /* Requirement IDs */
1272 "TEE-??",
1273 /* How to implement */
1274 "Description of how to implement ..."
1275 );
1276
1277ADBG_CASE_DEFINE(
1278 XTEST_TEE_6009, xtest_tee_test_6009,
1279 /* Title */
1280 "Test TEE Internal API Persistent Object Enumeration Functions",
1281 /* Short description */
1282 "Short description ...",
1283 /* Requirement IDs */
1284 "TEE-??",
1285 /* How to implement */
1286 "Description of how to implement ..."
1287 );
Pascal Brand8a74e362015-09-10 12:41:52 +02001288
1289#ifdef CFG_GP_TESTSUITE_ENABLE
1290ADBG_CASE_DEFINE(
1291 XTEST_TEE_6010, xtest_tee_test_6010,
1292 /* Title */
1293 "Test TEE GP TTA DS storage",
1294 /* Short description */
1295 "Short description ...",
1296 /* Requirement IDs */
1297 "TEE-??",
1298 /* How to implement */
1299 "Description of how to implement ..."
1300);
1301
1302ADBG_CASE_DEFINE(
1303 XTEST_TEE_6011, xtest_tee_test_6011,
1304 /* Title */
1305 "Test TEE GP TTA DS init objects",
1306 /* Short description */
1307 "Short description ...",
1308 /* Requirement IDs */
1309 "TEE-??",
1310 /* How to implement */
1311 "Description of how to implement ..."
1312);
1313#endif