mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 02:45:41 +01:00
change MBEDTLS_RANDOM_SEED_ITS define to be PSA_CRYPTO_ITS_RANDOM_SEED_UID
This commit is contained in:
parent
1c66205df6
commit
0d2c266c06
@ -35,7 +35,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* UID for secure storage seed */
|
||||
#define MBEDTLS_RANDOM_SEED_ITS_UID 0xFFFFFF52
|
||||
#define PSA_CRYPTO_ITS_RANDOM_SEED_UID 0xFFFFFF52
|
||||
|
||||
/**
|
||||
* \brief Library deinitialization.
|
||||
|
@ -4276,12 +4276,12 @@ psa_status_t mbedtls_psa_inject_entropy( const unsigned char *seed,
|
||||
( seed_size > MBEDTLS_ENTROPY_MAX_SEED_SIZE ) )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
|
||||
its_status = psa_its_get_info( MBEDTLS_RANDOM_SEED_ITS_UID, &p_info );
|
||||
its_status = psa_its_get_info( PSA_CRYPTO_ITS_RANDOM_SEED_UID, &p_info );
|
||||
status = its_to_psa_error( its_status );
|
||||
|
||||
if( PSA_ITS_ERROR_KEY_NOT_FOUND == its_status ) /* No seed exists */
|
||||
{
|
||||
its_status = psa_its_set( MBEDTLS_RANDOM_SEED_ITS_UID, seed_size, seed, 0 );
|
||||
its_status = psa_its_set( PSA_CRYPTO_ITS_RANDOM_SEED_UID, seed_size, seed, 0 );
|
||||
status = its_to_psa_error( its_status );
|
||||
}
|
||||
else if( PSA_ITS_SUCCESS == its_status )
|
||||
|
@ -48,7 +48,7 @@ void validate_entropy_seed_injection( int seed_length_a,
|
||||
{
|
||||
seed[i] = i;
|
||||
}
|
||||
its_status = psa_its_remove( MBEDTLS_RANDOM_SEED_ITS_UID );
|
||||
its_status = psa_its_remove( PSA_CRYPTO_ITS_RANDOM_SEED_UID );
|
||||
TEST_ASSERT( ( its_status == PSA_ITS_SUCCESS ) ||
|
||||
( its_status == PSA_ITS_ERROR_KEY_NOT_FOUND ) );
|
||||
status = mbedtls_psa_inject_entropy( seed, seed_length_a );
|
||||
@ -61,7 +61,7 @@ void validate_entropy_seed_injection( int seed_length_a,
|
||||
TEST_ASSERT( memcmp( output, zeros, sizeof( output ) ) != 0 );
|
||||
exit:
|
||||
mbedtls_free( seed );
|
||||
psa_its_remove( MBEDTLS_RANDOM_SEED_ITS_UID );
|
||||
psa_its_remove( PSA_CRYPTO_ITS_RANDOM_SEED_UID );
|
||||
mbedtls_psa_crypto_free( );
|
||||
}
|
||||
/* END_CASE */
|
||||
@ -78,12 +78,12 @@ void run_entropy_inject_with_crypto_init( )
|
||||
{
|
||||
seed[i] = i;
|
||||
}
|
||||
its_status = psa_its_remove( MBEDTLS_RANDOM_SEED_ITS_UID );
|
||||
its_status = psa_its_remove( PSA_CRYPTO_ITS_RANDOM_SEED_UID );
|
||||
TEST_ASSERT( ( its_status == PSA_ITS_SUCCESS ) ||
|
||||
( its_status == PSA_ITS_ERROR_KEY_NOT_FOUND ) );
|
||||
status = mbedtls_psa_inject_entropy( seed, sizeof( seed ) );
|
||||
TEST_ASSERT( status == PSA_SUCCESS );
|
||||
its_status = psa_its_remove( MBEDTLS_RANDOM_SEED_ITS_UID );
|
||||
its_status = psa_its_remove( PSA_CRYPTO_ITS_RANDOM_SEED_UID );
|
||||
TEST_ASSERT( its_status == PSA_ITS_SUCCESS );
|
||||
status = psa_crypto_init( );
|
||||
TEST_ASSERT( status == PSA_ERROR_INSUFFICIENT_ENTROPY );
|
||||
@ -96,7 +96,7 @@ void run_entropy_inject_with_crypto_init( )
|
||||
status = mbedtls_psa_inject_entropy( seed, sizeof( seed ) );
|
||||
TEST_ASSERT( status == PSA_ERROR_NOT_PERMITTED );
|
||||
exit:
|
||||
psa_its_remove( MBEDTLS_RANDOM_SEED_ITS_UID );
|
||||
psa_its_remove( PSA_CRYPTO_ITS_RANDOM_SEED_UID );
|
||||
mbedtls_psa_crypto_free( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
Loading…
Reference in New Issue
Block a user