[noup] zephyr: Update to support MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG#76
Merged
jukkar merged 1 commit intozephyrproject-rtos:mainfrom Feb 10, 2025
Merged
Conversation
-This commit add support for MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG which adds support for PRNG (seeded by TRNG) without using the legacy Mbed TLS APIs in ctr_drbg.c and entropy.c. When the configuration MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled there is a new function available in the system that is used to override this behavior. This function is called mbedtls_psa_external_get_random but for compatibility with the f_rng/p_rng signature the function mbedtls_psa_get_random (found in mbedtls/psa_util.h) is used directly in code. -Added a function pointer called hostap_rng_fn which is set to mbedtls_psa_get_random if MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled, otherwise it is set to the legacy API mbedtls_ctr_drbg_random. -Added a context pointer called hostap_rng_ctx that is set to MBEDTLS_PSA_RANDOM_STATE (NULL) if MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is set, otherwise it points to the existing ctr_drbg context. -Updated all calls using legacy APIs making use of the f_rng/p_rng pattern to use hostap_rng_fn and hostap_rng_ctx in crypto_mbedtls_alt -Added forward declaration of hostap_rng_fn and hostap_rng_ctx in tls_mbedtls_alt.c and changed every API-call making use of the f_rng/p_rng pattern. Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
95a6692 to
8a6e3cd
Compare
Collaborator
|
krish2718
approved these changes
Jan 27, 2025
This was referenced Jan 29, 2025
jukkar
approved these changes
Feb 3, 2025
Member
|
ping @MaochenWang1 |
MaochenWang1
approved these changes
Feb 5, 2025
fengming-ye
approved these changes
Feb 5, 2025
This was referenced Feb 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-This commit add support for MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
which adds support for PRNG (seeded by TRNG) without using
the legacy Mbed TLS APIs in ctr_drbg.c and entropy.c. When the
configuration MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled there
is a new function available in the system that is used to override
this behavior. This function is called mbedtls_psa_external_get_random
but for compatibility with the f_rng/p_rng signature the
function mbedtls_psa_get_random (found in mbedtls/psa_util.h) is
used directly in code.
-Added a function pointer called hostap_rng_fn which is set
to mbedtls_psa_get_random if MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is
enabled, otherwise it is set to the legacy API mbedtls_ctr_drbg_random.
-Added a context pointer called hostap_rng_ctx that is set to
MBEDTLS_PSA_RANDOM_STATE (NULL) if MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
is set, otherwise it points to the existing ctr_drbg context.
-Updated all calls using legacy APIs making use of the f_rng/p_rng
pattern to use hostap_rng_fn and hostap_rng_ctx in crypto_mbedtls_alt
-Added forward declaration of hostap_rng_fn and hostap_rng_ctx in
tls_mbedtls_alt.c and changed every API-call making use of the
f_rng/p_rng pattern.