From 0d2c266c06aea854a6b9d40790a9ab0879caff2d Mon Sep 17 00:00:00 2001 From: avolinski Date: Wed, 21 Nov 2018 17:31:07 +0200 Subject: [PATCH] change MBEDTLS_RANDOM_SEED_ITS define to be PSA_CRYPTO_ITS_RANDOM_SEED_UID --- include/psa/crypto_extra.h | 2 +- library/psa_crypto.c | 4 ++-- tests/suites/test_suite_psa_crypto_entropy.function | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/psa/crypto_extra.h b/include/psa/crypto_extra.h index 880e09c24..b6f5adc89 100644 --- a/include/psa/crypto_extra.h +++ b/include/psa/crypto_extra.h @@ -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. diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 9c85b7ce3..aefd3da14 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -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 ) diff --git a/tests/suites/test_suite_psa_crypto_entropy.function b/tests/suites/test_suite_psa_crypto_entropy.function index 2c069a9e3..46c77e97c 100644 --- a/tests/suites/test_suite_psa_crypto_entropy.function +++ b/tests/suites/test_suite_psa_crypto_entropy.function @@ -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 */