-
Notifications
You must be signed in to change notification settings - Fork 771
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,kmac] Add kmac_error_conditions_test #24765
base: master
Are you sure you want to change the base?
Conversation
e8c149d
to
2f957c2
Compare
281e16c
to
0134925
Compare
/*processed=*/NULL, /*capacity=*/NULL); | ||
|
||
// It is OK to get kDifError at this point because of possible timeout. | ||
CHECK(res == kDifOk || res == kDifError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit.
CHECK(res == kDifOk || res == kDifError); | |
TRY_CHECK(res == kDifOk || res == kDifError); |
|
||
// Check if there is a new error. | ||
bool irq_err_pending; | ||
CHECK_DIF_OK( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHECK_DIF_OK( | |
TRY( |
if (irq_err_pending) { | ||
dif_kmac_error_t err_status; | ||
uint32_t err_info; | ||
CHECK_DIF_OK(dif_kmac_get_error(&kmac, &err_status, &err_info)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would apply to the others below.
CHECK_DIF_OK(dif_kmac_get_error(&kmac, &err_status, &err_info)); | |
TRY(dif_kmac_get_error(&kmac, &err_status, &err_info)); |
Thanks for your review, @engdoreis! As suggested, I've changed |
0134925
to
a2882d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @nasahlpa !
The test implementation looks mostly good.
Can you please elaborate on
ErrSwIssuedCmdInAppActive could not be implemented in SW as triggering a SW command while the app interface is active is not possible.
There are two error codes which we can't test related to this limitation. It would be good understand what the underlying issue is. I we agree to not test this, we should update the testplan accordingly.
Checking kmac_pkg.sv
I noted there are some other currently untested error codes that we should actually be able to test:
ErrSwHashingWithoutEntropyReady
- triggering a hash operation without setting the entropy mode first. This probably doesn't work in ROM_EXT though.ErrShadowRegUpdate
- triggering a shadow register update error. This should be super straight forward.
The remaining three are related to FI countermeasures and escalations. We probably can't test this using this test anyway.
* the KMAC block. Note that this test is not exhaustive, i.e., the test does | ||
* not trying to reach the ErrorSoftwareCommandSequence error state from each | ||
* other state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment, I think this is okay but maybe it would be good for someone from the SiVal team to confirm @luismarques , @engdoreis ?
a2882d9
to
3517dc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nasahlpa for the PR, You are using the mmio API on the test code to change the registers directly, isn't it worth creating DIFs to abstracts these registers access
|
||
// Check whether the KMAC ERR bit was set in the interrupt state register. | ||
TRY(dif_kmac_has_error_occurred(kmac, &error)); | ||
CHECK(error, "No error was triggered."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This applies throughout this file.
CHECK(error, "No error was triggered."); | |
TRY_CHECK(error, "No error was triggered."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I see, the difference between CHECK
and TRY_CHECK
is that the former aborts the test and the latter continues but returns a status_t
? Wouldn't it be better to abort the test (so using CHECK
)?
0b55457
to
ef9514c
Compare
This adds the new `kmac_error_conditions_test` test that is defined in the `chip_sw_kmac_error_conditions` chip level test. Signed-off-by: Pascal Nasahl <[email protected]>
Thanks for your review, @vogelpi and @engdoreis I've made quite some significant changes to this PR to address your review, @vogelpi:
@engdoreis I just have one question regarding the difference |
ef9514c
to
d18142a
Compare
This sounds all great, excellent work @nasahlpa ! About the |
This adds the new
kmac_error_conditions_test
test that is defined in thechip_sw_kmac_error_conditions
chip level test.