Skip to content
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

The PSA RNG is not thread-safe #3391

Open
gilles-peskine-arm opened this issue Jun 3, 2020 · 2 comments
Open

The PSA RNG is not thread-safe #3391

gilles-peskine-arm opened this issue Jun 3, 2020 · 2 comments
Labels
bug component-crypto Crypto primitives and low-level interfaces

Comments

@gilles-peskine-arm
Copy link
Contributor

The global RNG used inside PSA crypto is not thread-safe if more than one thread can execute PSA crypto code at the same time. It should be protected by a mutex.

@gilles-peskine-arm gilles-peskine-arm added bug help-wanted This issue is not being actively worked on, but PRs welcome. component-crypto Crypto primitives and low-level interfaces labels Jun 3, 2020
@gilles-peskine-arm
Copy link
Contributor Author

Actually CTR_DRBG and HMAC_DRBG objects are protected by a mutex. So the PSA RNG is safe if either of these is used. This leaves the case of MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG. The call to mbedtls_psa_external_get_random should be protected by a mutex.

@yanesca
Copy link
Contributor

yanesca commented Dec 29, 2023

It makes sense to handle MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG consistently with drivers. In the MVP thread safety is the responsibility of the drivers and the core does not make any guarantees.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-crypto Crypto primitives and low-level interfaces
Projects
Status: PSA Crypto Threading
Development

No branches or pull requests

2 participants