-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restric usage #715
Restric usage #715
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2254,3 +2254,65 @@ static void xtest_tee_test_6020_single(ADBG_Case_t *c, uint32_t storage_id) | |
DEFINE_TEST_MULTIPLE_STORAGE_IDS(xtest_tee_test_6020) | ||
ADBG_CASE_DEFINE(regression, 6020, xtest_tee_test_6020, | ||
"Object IDs in SHM (negative)"); | ||
|
||
static void xtest_tee_test_6021_single(ADBG_Case_t *c, uint32_t storage_id) | ||
{ | ||
const uint32_t flags = TEE_DATA_FLAG_ACCESS_READ | | ||
TEE_DATA_FLAG_ACCESS_WRITE | | ||
TEE_DATA_FLAG_ACCESS_WRITE_META; | ||
TEEC_Result res = TEEC_ERROR_GENERIC; | ||
TEE_ObjectInfo obj_info = { }; | ||
uint32_t ou = 0xffffffff; | ||
TEEC_Session sess = { }; | ||
uint32_t orig = 0; | ||
uint32_t obj = 0; | ||
|
||
res = xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig); | ||
if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) | ||
return; | ||
|
||
res = fs_create(&sess, file_01, sizeof(file_01), | ||
flags | TEE_DATA_FLAG_OVERWRITE, 0, | ||
data_00, sizeof(data_00), &obj, storage_id); | ||
if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) | ||
goto exit; | ||
|
||
res = fs_get_obj_info(&sess, obj, &obj_info); | ||
if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) | ||
goto exit; | ||
ADBG_EXPECT_COMPARE_UNSIGNED(c, obj_info.objectUsage, ==, ou); | ||
|
||
ou &= ~TEE_USAGE_EXTRACTABLE; | ||
res = fs_restrict_usage(&sess, obj, ou); | ||
if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) | ||
goto exit; | ||
|
||
res = fs_get_obj_info(&sess, obj, &obj_info); | ||
if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) | ||
goto exit; | ||
ADBG_EXPECT_COMPARE_UNSIGNED(c, obj_info.objectUsage, ==, ou); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test has failed at this point, but it's not completely useless to open a new session, reopen the object, and check once more. The test is stable even on errors. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok |
||
|
||
ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)); | ||
TEEC_CloseSession(&sess); | ||
|
||
res = xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig); | ||
if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) | ||
return; | ||
|
||
res = fs_open(&sess, file_01, sizeof(file_01), flags, &obj, storage_id); | ||
if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) | ||
goto exit; | ||
|
||
res = fs_get_obj_info(&sess, obj, &obj_info); | ||
if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) | ||
goto exit; | ||
ADBG_EXPECT_COMPARE_UNSIGNED(c, obj_info.objectUsage, ==, ou); | ||
|
||
exit: | ||
ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)); | ||
TEEC_CloseSession(&sess); | ||
return; | ||
} | ||
DEFINE_TEST_MULTIPLE_STORAGE_IDS(xtest_tee_test_6021) | ||
ADBG_CASE_DEFINE(regression, 6021, xtest_tee_test_6021, | ||
"Modify and check persistent object usage"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TEE_DATA_FLAG_OVERWRITE
to ensure object is destroyed and recreated?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll add it to the create call.