[noup] zephyr: Update to support MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG #76
+44
−25
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.