diff --git a/programs/aes/aescrypt2.c b/programs/aes/aescrypt2.c index 5725eb0f32..522bfdacfc 100644 --- a/programs/aes/aescrypt2.c +++ b/programs/aes/aescrypt2.c @@ -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 ); diff --git a/programs/aes/crypt_and_hash.c b/programs/aes/crypt_and_hash.c index 88b852b4bd..542b37ef83 100644 --- a/programs/aes/crypt_and_hash.c +++ b/programs/aes/crypt_and_hash.c @@ -80,6 +80,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 = 1, i, n; diff --git a/programs/pkey/dh_client.c b/programs/pkey/dh_client.c index 3dadf48e6f..36ff8c0939 100644 --- a/programs/pkey/dh_client.c +++ b/programs/pkey/dh_client.c @@ -70,6 +70,15 @@ 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 - %sn", file, line, failure_condition ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); +} +#endif + int main( void ) { FILE *f; diff --git a/programs/pkey/dh_genprime.c b/programs/pkey/dh_genprime.c index 360e3554a9..9a37d5d099 100644 --- a/programs/pkey/dh_genprime.c +++ b/programs/pkey/dh_genprime.c @@ -68,6 +68,14 @@ int main( void ) */ #define GENERATOR "4" +#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( int argc, char **argv ) { int ret = 1; diff --git a/programs/pkey/dh_server.c b/programs/pkey/dh_server.c index c4e2c391e2..24f66ea69f 100644 --- a/programs/pkey/dh_server.c +++ b/programs/pkey/dh_server.c @@ -70,6 +70,15 @@ 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 - %sn", file, line, failure_condition ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); +} +#endif + int main( void ) { FILE *f; diff --git a/programs/pkey/ecdh_curve25519.c b/programs/pkey/ecdh_curve25519.c index 7fbf1678f9..0d8db09d01 100644 --- a/programs/pkey/ecdh_curve25519.c +++ b/programs/pkey/ecdh_curve25519.c @@ -52,6 +52,14 @@ int main( void ) #include "mbedtls/ctr_drbg.h" #include "mbedtls/ecdh.h" +#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( int argc, char *argv[] ) { int ret = 1; diff --git a/programs/pkey/ecdsa.c b/programs/pkey/ecdsa.c index c653df9e42..c38b16ec0c 100644 --- a/programs/pkey/ecdsa.c +++ b/programs/pkey/ecdsa.c @@ -99,6 +99,14 @@ static void dump_pubkey( const char *title, mbedtls_ecdsa_context *key ) #define dump_pubkey( a, b ) #endif +#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( int argc, char *argv[] ) { int ret = 1; diff --git a/programs/pkey/gen_key.c b/programs/pkey/gen_key.c index 31abb0cb8e..98936c950a 100644 --- a/programs/pkey/gen_key.c +++ b/programs/pkey/gen_key.c @@ -135,6 +135,15 @@ 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 - %sn", file, line, failure_condition ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); +} +#endif + /* * global options */ diff --git a/programs/pkey/key_app.c b/programs/pkey/key_app.c index 027b95f9d1..845d600b51 100644 --- a/programs/pkey/key_app.c +++ b/programs/pkey/key_app.c @@ -73,6 +73,15 @@ 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 - %sn", file, line, failure_condition ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); +} +#endif + /* * global options */ diff --git a/programs/pkey/key_app_writer.c b/programs/pkey/key_app_writer.c index cd0c230644..70c2440a95 100644 --- a/programs/pkey/key_app_writer.c +++ b/programs/pkey/key_app_writer.c @@ -96,6 +96,15 @@ 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 - %sn", file, line, failure_condition ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); +} +#endif + /* * global options */ diff --git a/programs/pkey/pk_decrypt.c b/programs/pkey/pk_decrypt.c index 1d8c959a09..3f08fe1d27 100644 --- a/programs/pkey/pk_decrypt.c +++ b/programs/pkey/pk_decrypt.c @@ -59,6 +59,15 @@ 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 - %sn", file, line, failure_condition ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); +} +#endif + int main( int argc, char *argv[] ) { FILE *f; diff --git a/programs/pkey/pk_encrypt.c b/programs/pkey/pk_encrypt.c index 22dedba103..2313818081 100644 --- a/programs/pkey/pk_encrypt.c +++ b/programs/pkey/pk_encrypt.c @@ -59,6 +59,15 @@ 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 - %sn", file, line, failure_condition ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); +} +#endif + int main( int argc, char *argv[] ) { FILE *f; diff --git a/programs/pkey/pk_sign.c b/programs/pkey/pk_sign.c index 7ec46752ad..dcfc0fc489 100644 --- a/programs/pkey/pk_sign.c +++ b/programs/pkey/pk_sign.c @@ -59,6 +59,14 @@ int main( void ) #include #include +#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( int argc, char *argv[] ) { FILE *f; diff --git a/programs/pkey/pk_verify.c b/programs/pkey/pk_verify.c index 3c7709f9d5..75ecf5296c 100644 --- a/programs/pkey/pk_verify.c +++ b/programs/pkey/pk_verify.c @@ -55,6 +55,14 @@ int main( void ) #include #include +#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( int argc, char *argv[] ) { FILE *f; diff --git a/programs/pkey/rsa_decrypt.c b/programs/pkey/rsa_decrypt.c index 0a252d2ada..a5fd482747 100644 --- a/programs/pkey/rsa_decrypt.c +++ b/programs/pkey/rsa_decrypt.c @@ -58,6 +58,15 @@ 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 - %sn", file, line, failure_condition ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); +} +#endif + int main( int argc, char *argv[] ) { FILE *f; diff --git a/programs/pkey/rsa_encrypt.c b/programs/pkey/rsa_encrypt.c index 411657a07c..86de8dfbbb 100644 --- a/programs/pkey/rsa_encrypt.c +++ b/programs/pkey/rsa_encrypt.c @@ -58,6 +58,15 @@ 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 - %sn", file, line, failure_condition ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); +} +#endif + int main( int argc, char *argv[] ) { FILE *f; diff --git a/programs/pkey/rsa_genkey.c b/programs/pkey/rsa_genkey.c index 3359e14074..77d9d8e746 100644 --- a/programs/pkey/rsa_genkey.c +++ b/programs/pkey/rsa_genkey.c @@ -62,6 +62,15 @@ 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 - %sn", file, line, failure_condition ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); +} +#endif + int main( void ) { int ret = 1; diff --git a/programs/pkey/rsa_sign_pss.c b/programs/pkey/rsa_sign_pss.c index b0b0f7ecf4..57c096d5c7 100644 --- a/programs/pkey/rsa_sign_pss.c +++ b/programs/pkey/rsa_sign_pss.c @@ -60,6 +60,14 @@ int main( void ) #include #include +#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( int argc, char *argv[] ) { FILE *f; diff --git a/programs/pkey/rsa_verify_pss.c b/programs/pkey/rsa_verify_pss.c index 7c9c68f229..3e1507e044 100644 --- a/programs/pkey/rsa_verify_pss.c +++ b/programs/pkey/rsa_verify_pss.c @@ -59,6 +59,14 @@ int main( void ) #include #include +#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( int argc, char *argv[] ) { FILE *f; diff --git a/programs/random/gen_random_ctr_drbg.c b/programs/random/gen_random_ctr_drbg.c index 5ade946a74..dfef8afa80 100644 --- a/programs/random/gen_random_ctr_drbg.c +++ b/programs/random/gen_random_ctr_drbg.c @@ -52,6 +52,15 @@ 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 - %sn", file, line, failure_condition ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); +} +#endif + int main( int argc, char *argv[] ) { FILE *f; diff --git a/programs/ssl/dtls_client.c b/programs/ssl/dtls_client.c index c29ab34a60..4d7177f910 100644 --- a/programs/ssl/dtls_client.c +++ b/programs/ssl/dtls_client.c @@ -79,6 +79,14 @@ int main( void ) #define DEBUG_LEVEL 0 +#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 + static void my_debug( void *ctx, int level, const char *file, int line, const char *str ) diff --git a/programs/ssl/dtls_server.c b/programs/ssl/dtls_server.c index b4ad6b53aa..0cee83414c 100644 --- a/programs/ssl/dtls_server.c +++ b/programs/ssl/dtls_server.c @@ -88,6 +88,14 @@ int main( void ) #define READ_TIMEOUT_MS 10000 /* 5 seconds */ #define DEBUG_LEVEL 0 +#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 + static void my_debug( void *ctx, int level, const char *file, int line, const char *str ) diff --git a/programs/ssl/mini_client.c b/programs/ssl/mini_client.c index 290455e9ae..c44794703a 100644 --- a/programs/ssl/mini_client.c +++ b/programs/ssl/mini_client.c @@ -168,6 +168,14 @@ enum exit_codes ssl_write_failed, }; +#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 = exit_ok; diff --git a/programs/ssl/ssl_client1.c b/programs/ssl/ssl_client1.c index bf7c0132af..a7e4513ac5 100644 --- a/programs/ssl/ssl_client1.c +++ b/programs/ssl/ssl_client1.c @@ -70,6 +70,14 @@ int main( void ) #define DEBUG_LEVEL 1 +#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 + static void my_debug( void *ctx, int level, const char *file, int line, const char *str ) diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 15c778d315..098c138fe1 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -314,6 +314,14 @@ int main( void ) #define ALPN_LIST_SIZE 10 #define CURVE_LIST_SIZE 20 +#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 + /* * global options */ diff --git a/programs/ssl/ssl_fork_server.c b/programs/ssl/ssl_fork_server.c index 1c3a80600c..3304b6bb14 100644 --- a/programs/ssl/ssl_fork_server.c +++ b/programs/ssl/ssl_fork_server.c @@ -86,6 +86,14 @@ int main( void ) #define DEBUG_LEVEL 0 +#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 + static void my_debug( void *ctx, int level, const char *file, int line, const char *str ) diff --git a/programs/ssl/ssl_mail_client.c b/programs/ssl/ssl_mail_client.c index 16cedfe946..6bf6cde68a 100644 --- a/programs/ssl/ssl_mail_client.c +++ b/programs/ssl/ssl_mail_client.c @@ -141,6 +141,14 @@ int main( void ) " force_ciphersuite= default: all enabled\n"\ " acceptable ciphersuite names:\n" +#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 + /* * global options */ diff --git a/programs/ssl/ssl_server.c b/programs/ssl/ssl_server.c index dcdafbb869..044193d86f 100644 --- a/programs/ssl/ssl_server.c +++ b/programs/ssl/ssl_server.c @@ -80,6 +80,14 @@ int main( void ) #define DEBUG_LEVEL 0 +#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 + static void my_debug( void *ctx, int level, const char *file, int line, const char *str ) diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index efda65d23d..fffd98c7d5 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -426,6 +426,14 @@ int main( void ) (out_be)[(i) + 7] = (unsigned char)( ( (in_le) >> 0 ) & 0xFF ); \ } +#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 + /* * global options */ diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c index dd4303b89d..ff1f4d1ba9 100644 --- a/programs/test/benchmark.c +++ b/programs/test/benchmark.c @@ -254,6 +254,14 @@ typedef struct { rsa, dhm, ecdsa, ecdh; } todo_list; +#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( int argc, char *argv[] ) { int i; diff --git a/programs/test/selftest.c b/programs/test/selftest.c index f923a43f52..6dc0f7fb84 100644 --- a/programs/test/selftest.c +++ b/programs/test/selftest.c @@ -77,6 +77,14 @@ #include "mbedtls/memory_buffer_alloc.h" #endif +#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 + static int test_snprintf( size_t n, const char ref_buf[10], int ref_ret ) { int ret; diff --git a/programs/test/ssl_cert_test.c b/programs/test/ssl_cert_test.c index fd3526f7fe..fd713f50f3 100644 --- a/programs/test/ssl_cert_test.c +++ b/programs/test/ssl_cert_test.c @@ -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; diff --git a/programs/x509/cert_app.c b/programs/x509/cert_app.c index c57ecca031..16c3d9f6f3 100644 --- a/programs/x509/cert_app.c +++ b/programs/x509/cert_app.c @@ -99,6 +99,14 @@ int main( void ) " permissive=%%d default: 0 (disabled)\n" \ "\n" +#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 + /* * global options */ diff --git a/programs/x509/cert_req.c b/programs/x509/cert_req.c index 8c56287b69..a5560702ea 100644 --- a/programs/x509/cert_req.c +++ b/programs/x509/cert_req.c @@ -100,6 +100,14 @@ int main( void ) " SHA384, SHA512\n" \ "\n" +#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 + /* * global options */ diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c index 3842ebce4e..fe60fbe892 100644 --- a/programs/x509/cert_write.c +++ b/programs/x509/cert_write.c @@ -153,6 +153,14 @@ int main( void ) " object_signing_ca\n" \ "\n" +#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 + /* * global options */ diff --git a/programs/x509/crl_app.c b/programs/x509/crl_app.c index f8316835fb..89adbdb7a7 100644 --- a/programs/x509/crl_app.c +++ b/programs/x509/crl_app.c @@ -60,6 +60,14 @@ int main( void ) " filename=%%s default: crl.pem\n" \ "\n" +#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 + /* * global options */ diff --git a/programs/x509/req_app.c b/programs/x509/req_app.c index 0f20c85f59..fc1da0d739 100644 --- a/programs/x509/req_app.c +++ b/programs/x509/req_app.c @@ -60,6 +60,14 @@ int main( void ) " filename=%%s default: cert.req\n" \ "\n" +#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 + /* * global options */