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

[sival/aes] Add AES Interrupt Encryption tests #24572

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rprakas-gsc
Copy link

@moidx Checking in aes_interrupt_encryption_test.c code and modified the BUILD to include this test.

@rprakas-gsc rprakas-gsc requested a review from a team as a code owner September 13, 2024 15:31
@rprakas-gsc rprakas-gsc requested review from engdoreis and removed request for a team September 13, 2024 15:31
@moidx moidx self-requested a review September 13, 2024 16:13
@rprakas-gsc rprakas-gsc force-pushed the a1-sival-aes-tests branch 2 times, most recently from a19f20c to ac6bdc1 Compare September 14, 2024 04:03
@rprakas-gsc rprakas-gsc force-pushed the a1-sival-aes-tests branch 4 times, most recently from 79f90e7 to 4b6f2e1 Compare September 21, 2024 01:35
Copy link
Contributor

@luismarques luismarques left a comment

Choose a reason for hiding this comment

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

Can you add review / commit comments explaining what overall scenario this test tests? I don't suppose there's a testplan testpoint to reference?

sw/device/tests/aes_interrupt_encryption_test.c Outdated Show resolved Hide resolved
sw/device/tests/BUILD Outdated Show resolved Hide resolved
sw/device/tests/aes_interrupt_encryption_test.c Outdated Show resolved Hide resolved
sw/device/tests/aes_interrupt_encryption_test.c Outdated Show resolved Hide resolved

OTTF_DEFINE_TEST_CONFIG();

status_t execute_test(void) {
Copy link
Contributor

Choose a reason for hiding this comment

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

As this function returns status_t, you can replace all instances of CHECK_DIF_OK by TRY, which would make the code cleaner in my opinion.

Copy link
Author

Choose a reason for hiding this comment

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

Ideally, I want the test code to report FAILURE & abort if the value doesn't get readout correctly , hence using CHECK_DIF_OK

@rprakas-gsc
Copy link
Author

Can you add review / commit comments explaining what overall scenario this test tests? I don't suppose there's a testplan testpoint to reference?
There is. I have added the below lines in the new Commit
Added AES Interrupt Encryption tests as per test plan identified here:[
and modified BUILD

@rprakas-gsc
Copy link
Author

@luismarques @engdoreis, Gentle ping on reviewing this PR. I already incorporated the changes from your feedback and waiting for functional checks on the test code (from AES folks)

@moidx moidx changed the title Added AES Interrupt Encryption tests and modified BUILD [sival] Add AES Interrupt Encryption tests Oct 2, 2024
@moidx moidx requested a review from nasahlpa October 2, 2024 16:13
@moidx
Copy link
Contributor

moidx commented Oct 2, 2024

Hi @nasahlpa, can you take a look at the test implementation to ensure it matches the intended test point description? Thanks!

@nasahlpa
Copy link
Member

nasahlpa commented Oct 4, 2024

Can you add review / commit comments explaining what overall scenario this test tests? I don't suppose there's a testplan testpoint to reference?
There is. I have added the below lines in the new Commit
Added AES Interrupt Encryption tests as per test plan identified here:[
and modified BUILD

Could you please add the description to the git commit itself? Currently, no description is available in the git commit message. Furthermore, the contributing guideline also mentions that a subject tag should be added to the git commit message.

@rprakas-gsc rprakas-gsc changed the title [sival] Add AES Interrupt Encryption tests [sival/aes] Add AES Interrupt Encryption tests Oct 8, 2024
@rprakas-gsc
Copy link
Author

Can you add review / commit comments explaining what overall scenario this test tests? I don't suppose there's a testplan testpoint to reference?
There is. I have added the below lines in the new Commit
Added AES Interrupt Encryption tests as per test plan identified here:[
and modified BUILD

Could you please add the description to the git commit itself? Currently, no description is available in the git commit message. Furthermore, the contributing guideline also mentions that a subject tag should be added to the git commit message.

The git commit has restrictions on word limit, if I include the entire link, i will run out of the world limit and won't be able to commit successfully.

@nasahlpa
Copy link
Member

nasahlpa commented Oct 9, 2024

Understood. But you could add something like this:

This commit implements the chip_sw_aes_interrupt_encryption test that is defined in the chip testplan. The purpose of this test is to check, whether an AES encryption can be interrupted and restored.

For the header of the git commit message you could use:

[sival/aes] Add AES interrupt encryption test

@rprakas-gsc
Copy link
Author

rprakas-gsc commented Oct 9, 2024 via email

Signed-off-by: Ramesh Prakash <rprakas@google.com>

This commit implements the chip_sw_aes_interrupt_encryption test that is
defined in the chip testplan. The purpose of this test is to check,
whether an AES encryption can be interrupted and restored.
@rprakas-gsc
Copy link
Author

Just updated the PR with the commit messages as suggested!

@nasahlpa
Copy link
Member

Thanks! Would you mind looking into the review comments I've added? Especially the question regarding the decryption should be addressed.

@moidx
Copy link
Contributor

moidx commented Oct 10, 2024

Hi @nasahlpa, I wasn't able to find your comments. Can you double check if they were sent? Thanks

sw/device/tests/aes_interrupt_encryption_test.c Outdated Show resolved Hide resolved
sw/device/tests/aes_interrupt_encryption_test.c Outdated Show resolved Hide resolved
Comment on lines +243 to +246
dif_aes_data_t out_data2;
CHECK_DIF_OK(dif_aes_read_output(&aes, &out_data2));
CHECK_DIF_OK(dif_aes_end(&aes));
// Finish the CBC decryption transaction.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
dif_aes_data_t out_data2;
CHECK_DIF_OK(dif_aes_read_output(&aes, &out_data2));
CHECK_DIF_OK(dif_aes_end(&aes));
// Finish the CBC decryption transaction.
// Finish the CBC decryption transaction.
dif_aes_data_t out_data2;
CHECK_DIF_OK(dif_aes_read_output(&aes, &out_data2));
CHECK_DIF_OK(dif_aes_end(&aes));

@@ -6279,3 +6279,22 @@ opentitan_test(
"//sw/device/lib/testing/test_framework:ottf_utils",
],
)

opentitan_test(
Copy link
Member

Choose a reason for hiding this comment

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

Could you please move this test up to the other AES tests? Alphabetically ordering the bazel entries helps to find the tests easier.

Comment on lines +6286 to +6288
exec_env = {
"//hw/top_earlgrey:fpga_cw340_sival": None,
},
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
exec_env = {
"//hw/top_earlgrey:fpga_cw340_sival": None,
},
exec_env = dicts.add(
EARLGREY_TEST_ENVS,
EARLGREY_SILICON_OWNER_ROM_EXT_ENVS,
{
"//hw/top_earlgrey:fpga_cw310_sival": None,
"//hw/top_earlgrey:fpga_cw340_sival": None,
"//hw/top_earlgrey:silicon_creator": None,
},
),

By adding this, you also could run the test in Verilator. @engdoreis do you know whether there is a rule which exec environments a test needs to have?


CHECK_DIF_OK(dif_aes_start(&aes, &transactiond, &key, &iv));

memcpy(cipher_text[0].data, kAesModesCipherTextCbc128,
Copy link
Member

Choose a reason for hiding this comment

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

Could you please explain what you are trying to achieve with the decryption? I assume you want to take the ciphertext generated from the interrupted AES encryption (dif_aes_t aes above) and check whether the same plaintext is generated after the decryption? If yes, why are you using kAesModesCipherTextCbc128 as an input for the decryption?

@nasahlpa
Copy link
Member

Hi @nasahlpa, I wasn't able to find your comments. Can you double check if they were sent? Thanks

Oh sorry, now the comments should be public.

rprakas-gsc and others added 2 commits October 10, 2024 16:43
Co-authored-by: Pascal Nasahl <pascal@nasahl.net>
Signed-off-by: Ramesh Prakash <rprakas@google.com>
Co-authored-by: Pascal Nasahl <pascal@nasahl.net>
Signed-off-by: Ramesh Prakash <rprakas@google.com>
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.

5 participants