Skip to content

Commit 6ac0518

Browse files
committed
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
1 parent 7003aaf commit 6ac0518

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,6 @@ psa_status_t psa_generate_random( uint8_t *output,
919919
return( ( psa_status_t ) err_call );
920920
}
921921

922-
#if ( defined(MBEDTLS_ENTROPY_NV_SEED) && defined(MBEDTLS_PSA_HAS_ITS_IO) )
923922
/****************************************************************/
924923
/* PSA_ENTROPY_INJECT */
925924
/****************************************************************/
@@ -942,7 +941,6 @@ psa_status_t mbedtls_psa_inject_entropy( const unsigned char *seed,
942941

943942
return( ( psa_status_t ) err_call );
944943
}
945-
#endif
946944
/****************************************************************/
947945
/* PSA Generator */
948946
/****************************************************************/

components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,13 +1115,13 @@ static void psa_key_management_operation( void )
11151115
psa_reply( msg.handle, status );
11161116
}
11171117

1118-
#if defined(MBEDTLS_ENTROPY_NV_SEED)
11191118
static void psa_entropy_operation( void )
11201119
{
11211120
psa_msg_t msg = { 0 };
11221121
psa_status_t status = PSA_SUCCESS;
11231122
psa_get( PSA_ENTROPY_INJECT, &msg );
11241123

1124+
#if ( defined(MBEDTLS_ENTROPY_NV_SEED) && defined(MBEDTLS_PSA_HAS_ITS_IO) )
11251125
switch ( msg.type )
11261126
{
11271127
case PSA_IPC_CONNECT:
@@ -1162,9 +1162,12 @@ static void psa_entropy_operation( void )
11621162
break;
11631163
}
11641164
}
1165+
#else
1166+
status = PSA_ERROR_NOT_SUPPORTED;
1167+
#endif /* MBEDTLS_ENTROPY_NV_SEED && MBEDTLS_PSA_HAS_ITS_IO*/
11651168
psa_reply( msg.handle, status );
11661169
}
1167-
#endif
1170+
11681171

11691172
static void psa_rng_operation( void )
11701173
{
@@ -1424,11 +1427,9 @@ void part_main(void *ptr)
14241427
{
14251428
psa_crypto_generator_operations( );
14261429
}
1427-
#if defined(MBEDTLS_ENTROPY_NV_SEED)
14281430
if( signals & PSA_ENTROPY_INJECT )
14291431
{
14301432
psa_entropy_operation( );
14311433
}
1432-
#endif /* MBEDTLS_ENTROPY_NV_SEED */
14331434
}
14341435
}

0 commit comments

Comments
 (0)