Skip to content

[crypto] Disable the iCache when entering CL #27678

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

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

Conversation

nasahlpa
Copy link
Member

This PR adds functionality to the CL that allows the library to disable and restore the instruction cache state.

To start discussions, this PR adds the iCache disable / restore to the AES-GCM CL implementation.

nasahlpa added 2 commits July 22, 2025 18:27
As code in CL should be executed in constant time, this commit
adds new functions that allow the CL to disable and restore the
state of the Ibex instruction cache.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
When entering the CL over the API, disable the iCache if it is
enabled. When leaving the CL, restore the previous state of the
iCache (enabled or disabled).

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
@nasahlpa nasahlpa requested a review from johannheyszl July 22, 2025 16:35
@johannheyszl
Copy link
Contributor

Thanks @nasahlpa . Addresses relevant parts of #15832 and #15788

@@ -27,6 +34,33 @@ static void wait_rnd_valid(void) {
}
}

hardened_bool_t ibex_disable_icache(void) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this makes sense. Requires the caller to create a var and handle the state in each function but avoids global var and state

@nasahlpa nasahlpa marked this pull request as ready for review July 23, 2025 07:30
@nasahlpa nasahlpa requested a review from a team as a code owner July 23, 2025 07:30
@nasahlpa nasahlpa requested review from timothytrippel, sameo, moidx, cfrantz and vogelpi and removed request for a team and timothytrippel July 23, 2025 07:30
@nasahlpa nasahlpa added the CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0 label Jul 23, 2025
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.

2 participants