tinyCrypt: Adapt RNG wrapper to return 0 on failure

This commit is contained in:
Hanno Becker 2019-07-24 09:05:05 +01:00
parent ef982d57bf
commit d089fad925

View file

@ -58,7 +58,12 @@
#if defined(MBEDTLS_USE_TINYCRYPT) #if defined(MBEDTLS_USE_TINYCRYPT)
static int uecc_rng_wrapper( uint8_t *dest, unsigned int size ) static int uecc_rng_wrapper( uint8_t *dest, unsigned int size )
{ {
return( mbedtls_ssl_conf_rng_func( NULL, dest, size ) ); int ret;
ret = mbedtls_ssl_conf_rng_func( NULL, dest, size );
if( ret == 0 )
return( (int) size );
return( 0 );
} }
#endif /* MBEDTLS_USE_TINYCRYPT */ #endif /* MBEDTLS_USE_TINYCRYPT */