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] Also advance the masking PRNG when not used during processing #22844

Merged
merged 6 commits into from
Apr 30, 2024

Conversation

vogelpi
Copy link
Contributor

@vogelpi vogelpi commented Apr 25, 2024

This PR contains a couple of changes, but only two of them have functional/SCA impact:

I suggest disabling showing whitespace changes during the review as this PR contains some alignment changes to port lists.

For the other commits:

Update: As outline here the PR has been reworked such that the PRNG is not advanced randomly but unconditionally during data processing to constantly increase the noise floor.

@vogelpi
Copy link
Contributor Author

vogelpi commented Apr 25, 2024

I still need to run the FPGA experiments which will happen tomorrow most likely.

This change doesn't alter the functionality or the masking employed
inside AES but rather moves some PRD buffers around to facilite a
subsequent change improving SCA hardening.

Signed-off-by: Pirmin Vogel <[email protected]>
Previously, we were using the unbuffered PRNG output for input data
masking which is non-ideal from an SCA perspective as the PRNG output
may be subject to glitches during updating.

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, looks good for me from a security point of view!

Are you planning to share the results from the FPGA measurement? Would be interesting for me to see the effect of advancing the PRNG.

end

// Advance the masking PRNG based on the FSM and the shift register.
assign prng_update_o = prng_update | prd_q[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

@vogelpi please let's discuss this and L497 shortly

@vogelpi
Copy link
Contributor Author

vogelpi commented Apr 29, 2024

Thanks for your reviews @johannheyszl, @nasahlpa and @andreaskurth . SCA results look all good but I've discussed with @johannheyszl and @nasahlpa that it's probably better to always let the PRNG advance when some processing is going on. I'll change the design accordingly.

@johannheyszl
Copy link
Contributor

Thanks @vogelpi !

Advancing the masking PRNG even when it's not used during processing is
beneficial from an SCA hardening perspective as it increases the noise.

Signed-off-by: Pirmin Vogel <[email protected]>
The counter is not needed in this state anyway but since the PRNG
reseeding may take quite a while, it's better to not update the counter
to save power.

Signed-off-by: Pirmin Vogel <[email protected]>
@vogelpi vogelpi merged commit e41236f into lowRISC:master Apr 30, 2024
32 checks passed
Copy link

@cdgori cdgori left a comment

Choose a reason for hiding this comment

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

More catch-up, LGTM (I especially like the extra noise from randomly advancing the masking PRNG)

@vogelpi vogelpi changed the title [aes] Randomly advance the masking PRNG when not used during processing [aes] Also advance the masking PRNG when not used during processing May 7, 2024
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.

[aes] Potential minor PRNG-related modifications for production
5 participants