Skip to content

[crypto] Prepare for alert management#29618

Open
siemen11 wants to merge 6 commits intolowRISC:earlgrey_1.0.0from
siemen11:cryptolib_config
Open

[crypto] Prepare for alert management#29618
siemen11 wants to merge 6 commits intolowRISC:earlgrey_1.0.0from
siemen11:cryptolib_config

Conversation

@siemen11
Copy link
Copy Markdown
Contributor

@siemen11 siemen11 commented Mar 29, 2026

The cryptolib has to ensure that no output is given when an alert is fired.
This PR prepares the cryptolib for this functionality by implementing the following:

  • Create a basic clear and read alert function based on reading alert manager registers (in the future other options will be presented)
  • Create an init function for the library which the user has to call before calling any other crypto function but leave it empty (this will setup the alert management)
  • Create an exit function for the library, the last function called before returning to the user but leave it empty (this function will react on read alerts)

@siemen11 siemen11 requested a review from a team as a code owner March 29, 2026 20:11
@siemen11 siemen11 requested review from andrea-caforio, engdoreis, johannheyszl and nasahlpa and removed request for a team and engdoreis March 29, 2026 20:11
@siemen11 siemen11 added the CherryPick:master This PR should be cherry-picked to master label Mar 29, 2026
@siemen11 siemen11 force-pushed the cryptolib_config branch 2 times, most recently from 144c22c to cc84ac4 Compare March 30, 2026 08:12
siemen11 added 6 commits April 1, 2026 00:20
Add alert drivers to read and init the sensors and alerts.

Signed-off-by: Siemen Dhooghe <sdhooghe@google.com>
The security_config files will be used for general configuration, rename
it.

Signed-off-by: Siemen Dhooghe <sdhooghe@google.com>
Make otcrypto_security_config_check return a otcrypto_status_t.

Signed-off-by: Siemen Dhooghe <sdhooghe@google.com>
The library requires an init function that does the following:
- Check the security configuration
- Set up alert management
- Perform (some) KATs for FIPS
- Set up the entropy source

Leave this function empty for now.

Signed-off-by: Siemen Dhooghe <sdhooghe@google.com>
Create a last function to be called when exiting from the crypto library
back to the user giving potentially an OTCRYPTO_OK (not to be used on
giving errors). This function is left empty for now, but will be
responsiible for reading out alerts at the end.

Signed-off-by: Siemen Dhooghe <sdhooghe@google.com>
Ensure otcrypto_eval_exit is the last function called before exiting an
API on an OTCRYPTO_OK.

Collateral: for the unittests, otcrypto_security_config_check was not
working since kDeviceType is unknown for such tests, hence hide it
behind #if defined(OPENTITAN_IS_EARLGREY).

Signed-off-by: Siemen Dhooghe <sdhooghe@google.com>
@siemen11 siemen11 added the CI:Rerun Rerun failed CI jobs label Apr 1, 2026
@github-actions github-actions bot removed the CI:Rerun Rerun failed CI jobs label Apr 1, 2026
@siemen11 siemen11 added the CI:Rerun Rerun failed CI jobs label Apr 1, 2026
@github-actions github-actions bot removed the CI:Rerun Rerun failed CI jobs label Apr 1, 2026
Copy link
Copy Markdown
Contributor

@johannheyszl johannheyszl left a comment

Choose a reason for hiding this comment

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

Great addition of missing pieces @siemen11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CherryPick:master This PR should be cherry-picked to master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants