mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-01 10:06:53 +03: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
@ -81,6 +81,14 @@ const char *client_private_keys[MAX_CLIENT_CERTS] =
|
||||
"cert_digest.key"
|
||||
};
|
||||
|
||||
#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 - %sn", file, line, failure_condition );
|
||||
mbedtls_exit( MBEDTLS_EXIT_FAILURE );
|
||||
}
|
||||
#endif
|
||||
|
||||
int main( void )
|
||||
{
|
||||
int ret = 1, i;
|
||||
|
Reference in New Issue
Block a user