mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-02-18 16:33:01 +00:00
Add handlers for parameter validation in the sample programs
The sample programs require an additional handler function of mbedtls_param_failed() to handle any failed parameter validation checks enabled by the MBEDTLS_CHECK_PARAMS config.h option.
This commit is contained in:
committed by
Manuel Pégourié-Gonnard
parent
a646345e3f
commit
63cb97e562
@@ -78,6 +78,16 @@ int main( void )
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
|
||||
#if defined( MBEDTLS_CHECK_PARAMS ) && defined(MBEDTLS_PLATFORM_C)
|
||||
void mbedtls_param_failed( char* failure_condition, char* file, int line )
|
||||
{
|
||||
mbedtls_printf("%s:%i: Input param failed - %s\n", file, line,
|
||||
failure_condition );
|
||||
mbedtls_exit( MBEDTLS_EXIT_FAILURE );
|
||||
}
|
||||
#endif
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -109,6 +119,7 @@ int main( int argc, char *argv[] )
|
||||
off_t filesize, offset;
|
||||
#endif
|
||||
|
||||
mbedtls_aes_init( NULL );
|
||||
mbedtls_aes_init( &aes_ctx );
|
||||
mbedtls_md_init( &sha_ctx );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user