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

[aes/sw] Load all-zero vector into PRNG buffer stage for masking off #22930

Merged
merged 1 commit into from
May 2, 2024

Conversation

vogelpi
Copy link
Contributor

@vogelpi vogelpi commented May 2, 2024

The input masks are now taken from the PRNG buffer stage. This means after loading the magic seed into the PRNG and having the PRNG output the all-zero vector, the buffer stage needs to be updated as well. This can be achieved by triggering via a clearing operation of the data output registers.

This resolves #22917.

@vogelpi vogelpi requested a review from a team as a code owner May 2, 2024 10:19
@vogelpi vogelpi requested review from alees24 and removed request for a team May 2, 2024 10:19
@vogelpi vogelpi requested review from rswarbrick, nasahlpa and antmarzam and removed request for alees24 May 2, 2024 10:51
The input masks are now taken from the PRNG buffer stage. This means
after loading the magic seed into the PRNG and having the PRNG output
the all-zero vector, the buffer stage needs to be updated as well.
This can be achieved by triggering via a clearing operation of the data
output registers.

This resolves lowRISC#22917.

Signed-off-by: Pirmin Vogel <[email protected]>
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, LGTM!

Copy link
Contributor

@rswarbrick rswarbrick left a comment

Choose a reason for hiding this comment

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

Looks sensible, with a question about aes_serial.c

}
#endif
CHECK_DIF_OK(dif_aes_trigger(&aes, kDifAesTriggerDataOutClear));
Copy link
Contributor

Choose a reason for hiding this comment

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

I notice that the equivalent line in aes_sca.c is skipped for EnglishBreakfast. Is putting this line outside of the if/endif intentional?

Copy link
Contributor Author

@vogelpi vogelpi May 2, 2024

Choose a reason for hiding this comment

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

Yes it is. Only aes_serial.c runs on English Breakfast (where we use a different way to 0 masks because there is no CSRNG). aes_sca.c only runs on the actual chip and the CW310/340 (because English Breakfast has just 1 UART whereas the uJSON communication needs 2 UARTs).

Copy link
Contributor

@antmarzam antmarzam left a comment

Choose a reason for hiding this comment

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

LGTM :) Thank you!

@vogelpi
Copy link
Contributor Author

vogelpi commented May 2, 2024

Thanks for your reviews. There are some CI FPGA failures but this is all spurious. The code in this PR is NOT run on the FPGA in any form in CI. I am thus merging this.

@vogelpi vogelpi merged commit 3fe4254 into lowRISC:master May 2, 2024
28 of 32 checks 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.

[test-triage] chip_sw_aes_masking_off fails after AES RTL changes
4 participants