mirror of
https://github.com/cuberite/polarssl.git
synced 2025-10-03 02:23:32 -04:00
crypto_extra: revert changes to mbedtls_psa_random_free()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
0ca1868fcd
commit
83e0de8481
@ -193,15 +193,6 @@ psa_status_t mbedtls_psa_register_se_key(
|
|||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief PSA random deinitialization.
|
|
||||||
*
|
|
||||||
* This function frees the RNG implementation used by PSA.
|
|
||||||
*
|
|
||||||
* This is an Mbed TLS extension.
|
|
||||||
*/
|
|
||||||
void mbedtls_psa_random_free(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Library deinitialization.
|
* \brief Library deinitialization.
|
||||||
*
|
*
|
||||||
|
@ -7327,16 +7327,14 @@ static void mbedtls_psa_random_init(mbedtls_psa_random_context_t *rng)
|
|||||||
|
|
||||||
/** Deinitialize the PSA random generator.
|
/** Deinitialize the PSA random generator.
|
||||||
*/
|
*/
|
||||||
void mbedtls_psa_random_free(void)
|
static void mbedtls_psa_random_free(mbedtls_psa_random_context_t *rng)
|
||||||
{
|
{
|
||||||
if (global_data.rng_state != RNG_NOT_INITIALIZED) {
|
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
|
#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
|
||||||
memset(&global_data.rng, 0, sizeof(global_data.rng));
|
memset(rng, 0, sizeof(*rng));
|
||||||
#else /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
|
#else /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
|
||||||
mbedtls_psa_drbg_free(MBEDTLS_PSA_RANDOM_STATE);
|
mbedtls_psa_drbg_free(MBEDTLS_PSA_RANDOM_STATE);
|
||||||
global_data.rng.entropy_free(&global_data.rng.entropy);
|
rng->entropy_free(&rng->entropy);
|
||||||
#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
|
#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Seed the PSA random generator.
|
/** Seed the PSA random generator.
|
||||||
@ -7663,7 +7661,9 @@ psa_status_t mbedtls_psa_crypto_configure_entropy_sources(
|
|||||||
void mbedtls_psa_crypto_free(void)
|
void mbedtls_psa_crypto_free(void)
|
||||||
{
|
{
|
||||||
psa_wipe_all_key_slots();
|
psa_wipe_all_key_slots();
|
||||||
mbedtls_psa_random_free();
|
if (global_data.rng_state != RNG_NOT_INITIALIZED) {
|
||||||
|
mbedtls_psa_random_free(&global_data.rng);
|
||||||
|
}
|
||||||
/* Wipe all remaining data, including configuration.
|
/* Wipe all remaining data, including configuration.
|
||||||
* In particular, this sets all state indicator to the value
|
* In particular, this sets all state indicator to the value
|
||||||
* indicating "uninitialized". */
|
* indicating "uninitialized". */
|
||||||
|
@ -91,9 +91,7 @@ static int invalidate_psa(invalidate_method_t invalidate_method)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PSA_ASSERT(psa_crypto_init());
|
PSA_ASSERT(psa_crypto_init());
|
||||||
|
|
||||||
ASSERT_PSA_PRISTINE();
|
ASSERT_PSA_PRISTINE();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user