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

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

rprakas-gsc
Copy link
Contributor

@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
Contributor 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

Copy link
Contributor

Choose a reason for hiding this comment

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

The final result would be the same, TRY would return immediately and then the callee would abort by using CHECK_STATUS_OK.

@rprakas-gsc
Copy link
Contributor 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
Contributor 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
Contributor 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
Contributor Author

rprakas-gsc commented Oct 9, 2024 via email

@rprakas-gsc
Copy link
Contributor 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
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/BUILD Outdated Show resolved Hide resolved
sw/device/tests/aes_interrupt_encryption_test.c Outdated Show resolved Hide resolved
@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.

Copy link
Contributor

@engdoreis engdoreis Oct 14, 2024

Choose a reason for hiding this comment

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

I suggest the following message for the commit 2:
[test, aes] Clean-up log message.

Copy link
Contributor

@engdoreis engdoreis Oct 14, 2024

Choose a reason for hiding this comment

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

I would also squash the commit number 3 with the previous.

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.

Tue Oct 22  Incorporated the changes suggested by reviewers and added AES modes (CFB-128, OFB, CTR) called out in the test plan
Tue Oct 23 Fixed lint errors
Signed-off-by: Ramesh Prakash <[email protected]>
memcpy(iv.iv, &iv_encrypt1, sizeof(iv.iv));
transaction.manual_operation = kDifAesManualOperationAuto;

// "Convert" key share byte arrays to `dif_aes_key_share_t`.
Copy link
Member

Choose a reason for hiding this comment

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

I think this is not necessary as key should still contain the key used for the first two blocks?

Copy link
Member

@nasahlpa nasahlpa left a comment

Choose a reason for hiding this comment

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

Thanks @rprakas-gsc for changing the code based on the feedback. Apart from a small nit this PR looks good to me.

Maybe @engdoreis could have another look.

Copy link
Contributor

@engdoreis engdoreis left a comment

Choose a reason for hiding this comment

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

Thanks for the changes.

@engdoreis engdoreis merged commit 73ffe0d into lowRISC:master Oct 25, 2024
42 checks passed
@rprakas-gsc rprakas-gsc added the CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0 label Oct 31, 2024
Copy link

Successfully created backport PR for earlgrey_1.0.0:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants