-
Notifications
You must be signed in to change notification settings - Fork 96
psa: PSA entropy is compatible with other entropy #146
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
MBEDTLS_PSA_INJECT_ENTROPY is compatible with actual entropy sources. PSA entropy injection is implemented using the standard Mbed TLS NV Seed feature, and is as compatible with other entropy sources as the standard Mbed TLS NV Seed feature which does support entropy mixing.
What validation has been done with inject entropy and a TRNG in the same build? |
We've used a platform with a TRNG available to all Mbed TLS DRBGs in Mbed OS (via hardware_poll as a default source), K64F, with mbed-os-example-mbed-crypto, which demonstrates the factory entropy injection API. Tracing was added to show a relevant subset of the call graph, including calls to mbedtls_nv_seed_poll() and mbedtls_hardware_poll() from the PSA DRBG.
We can see both entropy gathering functions are called with the PSA entropy context during init. Reseeds also gather from both entropy sources. |
Suppose I take the default configuration and do the minimum needed to enable entropy injection:
Then entropy injection writes to ITS, but nothing reads that, and NV seed reads and writes That's a preexisting defect: enabling I'm very uncomfortable making entropy injection easier to enable without better integration and further validation. Validation should not just cover the nominal case but also runtime failures and misconfigurations. |
As integrated with Mbed OS, the NV seed hooks are set to use ITS. I agree it's a bit hard to configure right now and error prone, but we do have it pre-configured correctly in Mbed OS currently. https://github.com/ARMmbed/mbed-os/blob/b050a9df64cc53bfcc76aacc93958788aae0654c/features/mbedtls/platform/inc/platform_mbed.h#L29 |
These hooks should be moved to mbed-crypto and used if |
Agreed. However, we've run out of time to make that change in Mbed OS 5.13.0. We can update in a patch release to Mbed OS. This change targets Mbed OS 5.13.0. |
I've raised #147 to track your request to make the obvious thing Just Work™. |
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.
I've reviewed the code paths and done a bit of ad hoc testing, and I'm ok with enabling this on Mbed OS only. Not in the development branch of Mbed Crypto or Mbed TLS. Please either create a separate branch or add an Mbed OS-specific check in check_config.h
.
Added Mbed OS specific check in ARMmbed/mbed-os#10802 |
MBEDTLS_PSA_INJECT_ENTROPY is compatible with actual entropy sources.
PSA entropy injection is implemented using the standard Mbed TLS NV Seed
feature, and is as compatible with other entropy sources as the standard
Mbed TLS NV Seed feature which does support entropy mixing.