change MBEDTLS_RANDOM_SEED_ITS define to be PSA_CRYPTO_ITS_RANDOM_SEED_UID

This commit is contained in:
avolinski 2018-11-21 17:31:07 +02:00
parent 1c66205df6
commit 0d2c266c06
3 changed files with 8 additions and 8 deletions

View File

@ -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.

View File

@ -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 )

View File

@ -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 */