Skip to content
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

xtest regression case 4017 #741

Merged
merged 3 commits into from
Jun 17, 2024
Merged

Conversation

jenswi-linaro
Copy link
Contributor

Copy link
Contributor

@jforissier jforissier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For "ta: crypt: fix authenc entries" and "xtest: return out-buffer sizes unconditionally":
Reviewed-by: Jerome Forissier <[email protected]>

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-by: Etienne Carriere <[email protected]> for commits
"ta: crypt: fix authenc entries" and
"xtest: return out-buffer sizes unconditionally".

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For commit "xtest: regression: add case 4017":
1 comment otherwise test 4017 implementation LGTM, pretty well factorized. I'll have another look.

host/xtest/regression_4000.c Show resolved Hide resolved
Copy link

This pull request has been marked as a stale pull request because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment, otherwise this pull request will automatically be closed in 5 days. Note that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label May 25, 2024
Copy link
Contributor

@jforissier jforissier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For "xtest: regression: add case 4017", with my comments addressed:

Acked-by: Jerome Forissier <[email protected]>

goto out;
}

for (n = 0; n < bs.text_size; n++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • A comment explaining the influence of level would be helpful here. What is tested when level is < 14, 14, 15, > 15 ?
  • Could you shift the values down by 2? Reason being, we have RFC6070_TEST(15, 4) at level 15 which is quite slow (several minutes on QEMUv8 on my machine) so it would be nice to be able to run the "moderately slow" AES tests without running RFC6070_TEST(15, 4).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, done.

@jenswi-linaro
Copy link
Contributor Author

@jforissier's comment addressed and tags applied.

@github-actions github-actions bot removed the Stale label May 29, 2024
@jforissier
Copy link
Contributor

@etienne-lms any comment on "xtest: regression: add case 4017"?

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late feedback.
I maybe found minor issues. The overall looks consistent to me.

for (n = 0; n < middle_count && n + initial_count < bs->text_size;
n += middle_increment)
if (!ADBG_EXPECT_TRUE(c, process_bytes_4017(c, bs, 1)))
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks strange to me. I think it works because middle_increment is always 1, as stated in the inline comment at line 6561:

		 * If level < 12 test with middle_count of 32 else 0.
		 * (middle_count - n) bytes are processed one by one.

Unless you plan some day to change this middle_increment in the future, I think it would more better to remove middle_increment and use 1 straight. Otherwise, I suggest to change line 6396:

-		if (!ADBG_EXPECT_TRUE(c, process_bytes_4017(c, bs, 1)))
+		if (!ADBG_EXPECT_TRUE(c, process_bytes_4017(c, bs, middle_increment)))

and line 6562:

 		 * If level < 12 test with middle_count of 32 else 0.
-		 * (middle_count - n) bytes are processed one by one.
+		 * (middle_count - n) bytes are processed by middle_increment
+		 * bytes bursts.

If I understood that correctly of course :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll drop the middle_increment.

goto out;
Do_ADBG_EndSubCase(c, "TEE_ALG_AES_CCM 1 extra byte");

out:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

misses an call to Do_ADBG_EndSubCase() when we reach this point before line 6682 is reached.

Actually, I wonder if the goto out are really useful. If removed, we'll get a status of all the cases, maybe flowed of error trace messages if many test cases fail but i think its worth it, unless the session crashed soemwhere during the test cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove the gotos.

@jenswi-linaro
Copy link
Contributor Author

Updated

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acked-by: Etienne Carriere <[email protected]>
for commit "xtest: regression: add case 4017"

@jenswi-linaro
Copy link
Contributor Author

Tag applied

Fix the AE cipher entry functions:
ta_entry_ae_update() - return TEE_AEUpdate() instead of TEE_SUCCESS
ta_entry_ae_{en,de}crypt_final() - handle NULL buffers

Signed-off-by: Jens Wiklander <[email protected]>
Reviewed-by: Jerome Forissier <[email protected]>
Reviewed-by: Etienne Carriere <[email protected]>
In ta_crypt_cmd_cipher_update(), ta_crypt_cmd_cipher_do_final(),
ta_crypt_cmd_ae_update(), ta_crypt_cmd_ae_encrypt_final(), and
ta_crypt_cmd_ae_decrypt_final(), always return out-buffer sizes even if
the function doesn't return TEEC_SUCCESS.

Signed-off-by: Jens Wiklander <[email protected]>
Reviewed-by: Etienne Carriere <[email protected]>
Add case 4017 "Test TEE Internal API Cipher block buffering". This test
tries to test the corner cases for Cipher and AE buffering.

Signed-off-by: Jens Wiklander <[email protected]>
Acked-by: Jerome Forissier <[email protected]>
Acked-by: Etienne Carriere <[email protected]>
@jenswi-linaro
Copy link
Contributor Author

Rebased to fix CI issue.

@jforissier jforissier merged commit c7e0b13 into OP-TEE:master Jun 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants