Replace MBED_RANDOM_SEED_ITS_UID with MBEDTLS_RANDOM_SEED_ITS_UID
Update mbedtls_psa_inject_entropy function documentation
This commit is contained in:
parent
4d27c94aee
commit
7cc8229d80
3 changed files with 13 additions and 13 deletions
|
@ -35,7 +35,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* UID for secure storage seed */
|
/* UID for secure storage seed */
|
||||||
#define MBED_RANDOM_SEED_ITS_UID 0xFFFFFF52
|
#define MBEDTLS_RANDOM_SEED_ITS_UID 0xFFFFFF52
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Library deinitialization.
|
* \brief Library deinitialization.
|
||||||
|
@ -91,11 +91,11 @@ void mbedtls_psa_crypto_free( void );
|
||||||
*
|
*
|
||||||
* \param seed[in] Buffer containing the seed value to inject.
|
* \param seed[in] Buffer containing the seed value to inject.
|
||||||
* \param seed_size Size of the \p seed buffer.
|
* \param seed_size Size of the \p seed buffer.
|
||||||
* The size of the seed must be equal or larger than any
|
* The size of the seed in bytes must be greater
|
||||||
* of the values defined both in
|
* or equal to both #MBEDTLS_ENTROPY_MIN_PLATFORM
|
||||||
* #MBEDTLS_ENTROPY_MIN_PLATFORM
|
* and #MBEDTLS_ENTROPY_BLOCK_SIZE.
|
||||||
* and in the #MBEDTLS_ENTROPY_BLOCK_SIZE defines
|
* It must be less or equal to
|
||||||
* and at most #MBEDTLS_ENTROPY_MAX_SEED_SIZE bytes.
|
* #MBEDTLS_ENTROPY_MAX_SEED_SIZE.
|
||||||
*
|
*
|
||||||
* \retval #PSA_SUCCESS
|
* \retval #PSA_SUCCESS
|
||||||
* The seed value was injected successfully. The random generator
|
* The seed value was injected successfully. The random generator
|
||||||
|
|
|
@ -4240,10 +4240,10 @@ psa_status_t mbedtls_psa_inject_entropy( const unsigned char *seed,
|
||||||
( seed_size > MBEDTLS_ENTROPY_MAX_SEED_SIZE ) )
|
( seed_size > MBEDTLS_ENTROPY_MAX_SEED_SIZE ) )
|
||||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||||
|
|
||||||
status = psa_its_get_info( MBED_RANDOM_SEED_ITS_UID, &p_info );
|
status = psa_its_get_info( MBEDTLS_RANDOM_SEED_ITS_UID, &p_info );
|
||||||
if( PSA_ITS_ERROR_KEY_NOT_FOUND == status ) /* No seed exists */
|
if( PSA_ITS_ERROR_KEY_NOT_FOUND == status ) /* No seed exists */
|
||||||
{
|
{
|
||||||
status = psa_its_set( MBED_RANDOM_SEED_ITS_UID, seed_size, seed, 0 );
|
status = psa_its_set( MBEDTLS_RANDOM_SEED_ITS_UID, seed_size, seed, 0 );
|
||||||
}
|
}
|
||||||
else if( PSA_ITS_SUCCESS == status )
|
else if( PSA_ITS_SUCCESS == status )
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ void validate_entropy_seed_injection( int seed_length_a,
|
||||||
{
|
{
|
||||||
seed[i] = i;
|
seed[i] = i;
|
||||||
}
|
}
|
||||||
its_status = psa_its_remove(MBED_RANDOM_SEED_ITS_UID);
|
its_status = psa_its_remove(MBEDTLS_RANDOM_SEED_ITS_UID);
|
||||||
TEST_ASSERT( (its_status == PSA_ITS_SUCCESS) || (its_status == PSA_ITS_ERROR_KEY_NOT_FOUND) );
|
TEST_ASSERT( (its_status == PSA_ITS_SUCCESS) || (its_status == PSA_ITS_ERROR_KEY_NOT_FOUND) );
|
||||||
status = mbedtls_psa_inject_entropy( seed, seed_length_a );
|
status = mbedtls_psa_inject_entropy( seed, seed_length_a );
|
||||||
TEST_ASSERT( status == expected_status_a );
|
TEST_ASSERT( status == expected_status_a );
|
||||||
|
@ -51,7 +51,7 @@ void validate_entropy_seed_injection( int seed_length_a,
|
||||||
TEST_ASSERT( memcmp( output , zeros, sizeof( output ) ) != 0 );
|
TEST_ASSERT( memcmp( output , zeros, sizeof( output ) ) != 0 );
|
||||||
exit:
|
exit:
|
||||||
mbedtls_free( seed );
|
mbedtls_free( seed );
|
||||||
psa_its_remove(MBED_RANDOM_SEED_ITS_UID);
|
psa_its_remove(MBEDTLS_RANDOM_SEED_ITS_UID);
|
||||||
mbedtls_psa_crypto_free( );
|
mbedtls_psa_crypto_free( );
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
@ -68,11 +68,11 @@ void run_entropy_inject_with_crypto_init( )
|
||||||
{
|
{
|
||||||
seed[i] = i;
|
seed[i] = i;
|
||||||
}
|
}
|
||||||
its_status = psa_its_remove(MBED_RANDOM_SEED_ITS_UID);
|
its_status = psa_its_remove(MBEDTLS_RANDOM_SEED_ITS_UID);
|
||||||
TEST_ASSERT( (its_status == PSA_ITS_SUCCESS) || (its_status == PSA_ITS_ERROR_KEY_NOT_FOUND) );
|
TEST_ASSERT( (its_status == PSA_ITS_SUCCESS) || (its_status == PSA_ITS_ERROR_KEY_NOT_FOUND) );
|
||||||
status = mbedtls_psa_inject_entropy( seed, MBEDTLS_ENTROPY_BLOCK_SIZE );
|
status = mbedtls_psa_inject_entropy( seed, MBEDTLS_ENTROPY_BLOCK_SIZE );
|
||||||
TEST_ASSERT( status == PSA_SUCCESS );
|
TEST_ASSERT( status == PSA_SUCCESS );
|
||||||
its_status = psa_its_remove(MBED_RANDOM_SEED_ITS_UID);
|
its_status = psa_its_remove(MBEDTLS_RANDOM_SEED_ITS_UID);
|
||||||
TEST_ASSERT( its_status == PSA_ITS_SUCCESS );
|
TEST_ASSERT( its_status == PSA_ITS_SUCCESS );
|
||||||
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
||||||
status = mbedtls_psa_inject_entropy( seed, MBEDTLS_ENTROPY_BLOCK_SIZE );
|
status = mbedtls_psa_inject_entropy( seed, MBEDTLS_ENTROPY_BLOCK_SIZE );
|
||||||
|
@ -82,7 +82,7 @@ void run_entropy_inject_with_crypto_init( )
|
||||||
status = mbedtls_psa_inject_entropy( seed, MBEDTLS_ENTROPY_BLOCK_SIZE );
|
status = mbedtls_psa_inject_entropy( seed, MBEDTLS_ENTROPY_BLOCK_SIZE );
|
||||||
TEST_ASSERT( status == PSA_ERROR_NOT_PERMITTED );
|
TEST_ASSERT( status == PSA_ERROR_NOT_PERMITTED );
|
||||||
exit:
|
exit:
|
||||||
psa_its_remove(MBED_RANDOM_SEED_ITS_UID);
|
psa_its_remove(MBEDTLS_RANDOM_SEED_ITS_UID);
|
||||||
mbedtls_psa_crypto_free( );
|
mbedtls_psa_crypto_free( );
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
Loading…
Reference in a new issue