Change behavior realted to MBEDTLS_ENTROPY_NV_SEED and MBEDTLS_PSA_HAS_ITS_IO flags

* mbedtls_psa_inject_entropy() MUST be always available for client side.
* Partition will return PSA_ERROR_NOT_SUPPPORTED in case where MBEDTLS_ENTROPY_NV_SEED or MBEDTLS_PSA_HAS_ITS_IO flags are not defined
pull/8804/head
Mohammad AboMokh 2018-11-22 16:22:35 +02:00 committed by mohammad1603
parent fb88cb4cb5
commit 54cd8bf51f
2 changed files with 5 additions and 6 deletions

View File

@ -919,7 +919,6 @@ psa_status_t psa_generate_random( uint8_t *output,
return( ( psa_status_t ) err_call );
}
#if ( defined(MBEDTLS_ENTROPY_NV_SEED) && defined(MBEDTLS_PSA_HAS_ITS_IO) )
/****************************************************************/
/* PSA_ENTROPY_INJECT */
/****************************************************************/
@ -942,7 +941,6 @@ psa_status_t mbedtls_psa_inject_entropy( const unsigned char *seed,
return( ( psa_status_t ) err_call );
}
#endif
/****************************************************************/
/* PSA Generator */
/****************************************************************/

View File

@ -1115,13 +1115,13 @@ static void psa_key_management_operation( void )
psa_reply( msg.handle, status );
}
#if defined(MBEDTLS_ENTROPY_NV_SEED)
static void psa_entropy_operation( void )
{
psa_msg_t msg = { 0 };
psa_status_t status = PSA_SUCCESS;
psa_get( PSA_ENTROPY_INJECT, &msg );
#if ( defined(MBEDTLS_ENTROPY_NV_SEED) && defined(MBEDTLS_PSA_HAS_ITS_IO) )
switch ( msg.type )
{
case PSA_IPC_CONNECT:
@ -1162,9 +1162,12 @@ static void psa_entropy_operation( void )
break;
}
}
#else
status = PSA_ERROR_NOT_SUPPORTED;
#endif /* MBEDTLS_ENTROPY_NV_SEED && MBEDTLS_PSA_HAS_ITS_IO*/
psa_reply( msg.handle, status );
}
#endif
static void psa_rng_operation( void )
{
@ -1424,11 +1427,9 @@ void part_main(void *ptr)
{
psa_crypto_generator_operations( );
}
#if defined(MBEDTLS_ENTROPY_NV_SEED)
if( signals & PSA_ENTROPY_INJECT )
{
psa_entropy_operation( );
}
#endif /* MBEDTLS_ENTROPY_NV_SEED */
}
}