-
Notifications
You must be signed in to change notification settings - Fork 96
psa: Check generator validity before read #57
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
Conversation
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.
The changes look good to me.
Besides the tests fixed here are there any other instances that could affected by the change in behavior? (e.g. example repo, IPC parameter checks in IPC)?
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.
A single typo, otherwise looks good to me
library/psa_crypto.c
Outdated
@@ -3911,7 +3922,13 @@ psa_status_t psa_generator_read( psa_crypto_generator_t *generator, | |||
exit: | |||
if( status != PSA_SUCCESS ) | |||
{ | |||
/* Preserve the algorithm upon errors, but clear all sensitive state. | |||
* This allows us to differentiate between exhaused generators and |
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.
Typo: exhaused -> exhausted
Rebasing to address review comments and to resolve merge conflicts. |
Check generator validity (i.e. that alg has been initialized) before allowing reads from the generator or allowing reads of the generator's capacity. This aligns our implementation with the documented error code behavior in our crypto.h and the PSA Crypto API.
ee116e5
to
cf2010c
Compare
Rebased. Unfortunately, the base change had to happen in order to get the merge conflicts resolved, and we've merged the latest Mbed TLS code in (so the base is quite different). Probably easiest to diff between diffs on this one instead of using GitHub's "force-pushed" diff. Old branch up at https://github.com/Patater/mbed-crypto/tree/check-generator-validity-1 |
CI failure is the FreeBSD timing test, a known flaky test. |
Check generator validity (i.e. that alg has been initialized) before
allowing reads from the generator or allowing reads of the generator's
capacity.
This aligns our implementation with the documented error code behavior
in our crypto.h and the PSA Crypto API.
Fixes https://github.com/ARMmbed/mbedtls-psa/issues/183