From 3b0c4306384053bdc144d9bc390125465106027a Mon Sep 17 00:00:00 2001 From: Krzysztof Stachowiak Date: Wed, 24 Apr 2019 14:24:46 +0200 Subject: [PATCH] Unify the example programs' termination This is done to account for platforms, for which we want custom behavior upon the program termination, hence we call `mbedtls_exit()` instead of returning from `main()`. For the sake of consistency, introduces the modifications have been made to the test and utility examples as well. These, while less likely to be used in the low level environments, won't suffer from such a change. --- programs/aes/aescrypt2.c | 4 ++-- programs/aes/crypt_and_hash.c | 4 ++-- programs/hash/generic_sum.c | 10 +++++----- programs/hash/hello.c | 6 +++--- programs/pkey/dh_client.c | 4 ++-- programs/pkey/dh_genprime.c | 6 +++--- programs/pkey/dh_server.c | 4 ++-- programs/pkey/ecdh_curve25519.c | 4 ++-- programs/pkey/ecdsa.c | 4 ++-- programs/pkey/gen_key.c | 4 ++-- programs/pkey/key_app.c | 4 ++-- programs/pkey/key_app_writer.c | 4 ++-- programs/pkey/mpi_demo.c | 4 ++-- programs/pkey/pk_decrypt.c | 4 ++-- programs/pkey/pk_encrypt.c | 4 ++-- programs/pkey/pk_sign.c | 4 ++-- programs/pkey/pk_verify.c | 4 ++-- programs/pkey/rsa_decrypt.c | 4 ++-- programs/pkey/rsa_encrypt.c | 4 ++-- programs/pkey/rsa_genkey.c | 4 ++-- programs/pkey/rsa_sign.c | 4 ++-- programs/pkey/rsa_sign_pss.c | 4 ++-- programs/pkey/rsa_verify.c | 4 ++-- programs/pkey/rsa_verify_pss.c | 4 ++-- programs/random/gen_entropy.c | 8 ++++---- programs/random/gen_random_ctr_drbg.c | 8 ++++---- programs/random/gen_random_havege.c | 8 ++++---- programs/ssl/dtls_client.c | 5 +++-- programs/ssl/dtls_server.c | 5 +++-- programs/ssl/mini_client.c | 4 ++-- programs/ssl/ssl_client1.c | 4 ++-- programs/ssl/ssl_client2.c | 6 +++--- programs/ssl/ssl_fork_server.c | 6 +++--- programs/ssl/ssl_mail_client.c | 4 ++-- programs/ssl/ssl_pthread_server.c | 4 ++-- programs/ssl/ssl_server.c | 4 ++-- programs/ssl/ssl_server2.c | 6 +++--- programs/test/benchmark.c | 4 ++-- programs/test/udp_proxy.c | 5 +++-- programs/test/zeroize.c | 8 +++++--- programs/util/pem2der.c | 4 ++-- programs/util/strerror.c | 8 +++++--- programs/x509/cert_app.c | 4 ++-- programs/x509/cert_req.c | 4 ++-- programs/x509/cert_write.c | 4 ++-- programs/x509/crl_app.c | 4 ++-- programs/x509/req_app.c | 4 ++-- 47 files changed, 117 insertions(+), 110 deletions(-) diff --git a/programs/aes/aescrypt2.c b/programs/aes/aescrypt2.c index 8242ea7c9..bb300822a 100644 --- a/programs/aes/aescrypt2.c +++ b/programs/aes/aescrypt2.c @@ -76,7 +76,7 @@ int main( void ) mbedtls_printf("MBEDTLS_AES_C and/or MBEDTLS_SHA256_C " "and/or MBEDTLS_FS_IO and/or MBEDTLS_MD_C " "not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -465,6 +465,6 @@ exit: mbedtls_aes_free( &aes_ctx ); mbedtls_md_free( &sha_ctx ); - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_AES_C && MBEDTLS_SHA256_C && MBEDTLS_FS_IO */ diff --git a/programs/aes/crypt_and_hash.c b/programs/aes/crypt_and_hash.c index a5acf5b8b..83731d0e6 100644 --- a/programs/aes/crypt_and_hash.c +++ b/programs/aes/crypt_and_hash.c @@ -78,7 +78,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_CIPHER_C and/or MBEDTLS_MD_C and/or MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -562,6 +562,6 @@ exit: mbedtls_cipher_free( &cipher_ctx ); mbedtls_md_free( &md_ctx ); - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_CIPHER_C && MBEDTLS_MD_C && MBEDTLS_FS_IO */ diff --git a/programs/hash/generic_sum.c b/programs/hash/generic_sum.c index 709a149e0..97f7a46f9 100644 --- a/programs/hash/generic_sum.c +++ b/programs/hash/generic_sum.c @@ -48,7 +48,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_MD_C and/or MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -203,7 +203,7 @@ int main( int argc, char *argv[] ) fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } /* @@ -213,12 +213,12 @@ int main( int argc, char *argv[] ) if( md_info == NULL ) { mbedtls_fprintf( stderr, "Message Digest '%s' not found\n", argv[1] ); - return( exit_code ); + mbedtls_exit( exit_code ); } if( mbedtls_md_setup( &md_ctx, md_info, 0 ) ) { mbedtls_fprintf( stderr, "Failed to initialize context.\n" ); - return( exit_code ); + mbedtls_exit( exit_code ); } ret = 0; @@ -237,6 +237,6 @@ int main( int argc, char *argv[] ) exit: mbedtls_md_free( &md_ctx ); - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_MD_C && MBEDTLS_FS_IO */ diff --git a/programs/hash/hello.c b/programs/hash/hello.c index 55a0c7e74..66fd31554 100644 --- a/programs/hash/hello.c +++ b/programs/hash/hello.c @@ -44,7 +44,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_MD5_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -58,7 +58,7 @@ int main( void ) mbedtls_printf( "\n MD5('%s') = ", str ); if( ( ret = mbedtls_md5_ret( (unsigned char *) str, 13, digest ) ) != 0 ) - return( MBEDTLS_EXIT_FAILURE ); + mbedtls_exit( MBEDTLS_EXIT_FAILURE ); for( i = 0; i < 16; i++ ) mbedtls_printf( "%02x", digest[i] ); @@ -70,6 +70,6 @@ int main( void ) fflush( stdout ); getchar(); #endif - return( MBEDTLS_EXIT_SUCCESS ); + mbedtls_exit( MBEDTLS_EXIT_SUCCESS ); } #endif /* MBEDTLS_MD5_C */ diff --git a/programs/pkey/dh_client.c b/programs/pkey/dh_client.c index 86b260ca0..90fc4e546 100644 --- a/programs/pkey/dh_client.c +++ b/programs/pkey/dh_client.c @@ -68,7 +68,7 @@ int main( void ) "and/or MBEDTLS_NET_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_SHA256_C and/or MBEDTLS_FS_IO and/or " "MBEDTLS_CTR_DRBG_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -307,7 +307,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_AES_C && MBEDTLS_DHM_C && MBEDTLS_ENTROPY_C && MBEDTLS_NET_C && MBEDTLS_RSA_C && MBEDTLS_SHA256_C && diff --git a/programs/pkey/dh_genprime.c b/programs/pkey/dh_genprime.c index bf5482ed0..5293f899c 100644 --- a/programs/pkey/dh_genprime.c +++ b/programs/pkey/dh_genprime.c @@ -45,7 +45,7 @@ int main( void ) mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_ENTROPY_C and/or " "MBEDTLS_FS_IO and/or MBEDTLS_CTR_DRBG_C and/or " "MBEDTLS_GENPRIME not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -91,7 +91,7 @@ int main( int argc, char **argv ) { usage: mbedtls_printf( USAGE ); - return( exit_code ); + mbedtls_exit( exit_code ); } for( i = 1; i < argc; i++ ) @@ -197,7 +197,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_FS_IO && MBEDTLS_CTR_DRBG_C && MBEDTLS_GENPRIME */ diff --git a/programs/pkey/dh_server.c b/programs/pkey/dh_server.c index c01177485..06676c08d 100644 --- a/programs/pkey/dh_server.c +++ b/programs/pkey/dh_server.c @@ -68,7 +68,7 @@ int main( void ) "and/or MBEDTLS_NET_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_SHA256_C and/or MBEDTLS_FS_IO and/or " "MBEDTLS_CTR_DRBG_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -330,7 +330,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_AES_C && MBEDTLS_DHM_C && MBEDTLS_ENTROPY_C && MBEDTLS_NET_C && MBEDTLS_RSA_C && MBEDTLS_SHA256_C && diff --git a/programs/pkey/ecdh_curve25519.c b/programs/pkey/ecdh_curve25519.c index 9f849dd29..e79dce09a 100644 --- a/programs/pkey/ecdh_curve25519.c +++ b/programs/pkey/ecdh_curve25519.c @@ -45,7 +45,7 @@ int main( void ) "MBEDTLS_ECP_DP_CURVE25519_ENABLED and/or " "MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C " "not defined\n" ); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -238,7 +238,7 @@ exit: mbedtls_ctr_drbg_free( &ctr_drbg ); mbedtls_entropy_free( &entropy ); - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_ECDH_C && MBEDTLS_ECP_DP_CURVE25519_ENABLED && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */ diff --git a/programs/pkey/ecdsa.c b/programs/pkey/ecdsa.c index b851c3173..b898b6275 100644 --- a/programs/pkey/ecdsa.c +++ b/programs/pkey/ecdsa.c @@ -66,7 +66,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_ECDSA_C and/or MBEDTLS_SHA256_C and/or " "MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C not defined\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else #if defined(VERBOSE) @@ -248,7 +248,7 @@ exit: mbedtls_ctr_drbg_free( &ctr_drbg ); mbedtls_entropy_free( &entropy ); - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_ECDSA_C && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C && ECPARAMS */ diff --git a/programs/pkey/gen_key.c b/programs/pkey/gen_key.c index 23e4e145c..04e88bb78 100644 --- a/programs/pkey/gen_key.c +++ b/programs/pkey/gen_key.c @@ -133,7 +133,7 @@ int main( void ) "MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or " "MBEDTLS_PEM_WRITE_C" "not defined.\n" ); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -446,7 +446,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_PK_WRITE_C && MBEDTLS_PEM_WRITE_C && MBEDTLS_FS_IO && * MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */ diff --git a/programs/pkey/key_app.c b/programs/pkey/key_app.c index 793930991..442e1732d 100644 --- a/programs/pkey/key_app.c +++ b/programs/pkey/key_app.c @@ -70,7 +70,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_BIGNUM_C and/or " "MBEDTLS_PK_PARSE_C and/or MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -311,6 +311,6 @@ cleanup: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_PK_PARSE_C && MBEDTLS_FS_IO */ diff --git a/programs/pkey/key_app_writer.c b/programs/pkey/key_app_writer.c index 60964292b..b0b831a11 100644 --- a/programs/pkey/key_app_writer.c +++ b/programs/pkey/key_app_writer.c @@ -94,7 +94,7 @@ int main( void ) { mbedtls_printf( "MBEDTLS_PK_PARSE_C and/or MBEDTLS_PK_WRITE_C and/or MBEDTLS_FS_IO not defined.\n" ); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -436,6 +436,6 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_PK_PARSE_C && MBEDTLS_PK_WRITE_C && MBEDTLS_FS_IO */ diff --git a/programs/pkey/mpi_demo.c b/programs/pkey/mpi_demo.c index ecdcd329a..816378137 100644 --- a/programs/pkey/mpi_demo.c +++ b/programs/pkey/mpi_demo.c @@ -46,7 +46,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -112,6 +112,6 @@ cleanup: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_FS_IO */ diff --git a/programs/pkey/pk_decrypt.c b/programs/pkey/pk_decrypt.c index bf425079e..c80928d21 100644 --- a/programs/pkey/pk_decrypt.c +++ b/programs/pkey/pk_decrypt.c @@ -56,7 +56,7 @@ int main( void ) mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_PK_PARSE_C and/or " "MBEDTLS_FS_IO and/or MBEDTLS_ENTROPY_C and/or " "MBEDTLS_CTR_DRBG_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -171,7 +171,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_PK_PARSE_C && MBEDTLS_FS_IO && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */ diff --git a/programs/pkey/pk_encrypt.c b/programs/pkey/pk_encrypt.c index a32b14761..1850d93ef 100644 --- a/programs/pkey/pk_encrypt.c +++ b/programs/pkey/pk_encrypt.c @@ -57,7 +57,7 @@ int main( void ) mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_PK_PARSE_C and/or " "MBEDTLS_ENTROPY_C and/or MBEDTLS_FS_IO and/or " "MBEDTLS_CTR_DRBG_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -176,7 +176,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_PK_PARSE_C && MBEDTLS_ENTROPY_C && MBEDTLS_FS_IO && MBEDTLS_CTR_DRBG_C */ diff --git a/programs/pkey/pk_sign.c b/programs/pkey/pk_sign.c index 47a098a1a..f27d8ea26 100644 --- a/programs/pkey/pk_sign.c +++ b/programs/pkey/pk_sign.c @@ -47,7 +47,7 @@ int main( void ) "MBEDTLS_SHA256_C and/or MBEDTLS_MD_C and/or " "MBEDTLS_PK_PARSE_C and/or MBEDTLS_FS_IO and/or " "MBEDTLS_CTR_DRBG_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -174,7 +174,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SHA256_C && MBEDTLS_PK_PARSE_C && MBEDTLS_FS_IO && diff --git a/programs/pkey/pk_verify.c b/programs/pkey/pk_verify.c index a6bfe3f29..e6d7d4c41 100644 --- a/programs/pkey/pk_verify.c +++ b/programs/pkey/pk_verify.c @@ -45,7 +45,7 @@ int main( void ) mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_MD_C and/or " "MBEDTLS_SHA256_C and/or MBEDTLS_PK_PARSE_C and/or " "MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -147,7 +147,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_SHA256_C && MBEDTLS_PK_PARSE_C && MBEDTLS_FS_IO */ diff --git a/programs/pkey/rsa_decrypt.c b/programs/pkey/rsa_decrypt.c index ff71bd055..6e675c657 100644 --- a/programs/pkey/rsa_decrypt.c +++ b/programs/pkey/rsa_decrypt.c @@ -55,7 +55,7 @@ int main( void ) mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_FS_IO and/or MBEDTLS_ENTROPY_C and/or " "MBEDTLS_CTR_DRBG_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -207,6 +207,6 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_RSA_C && MBEDTLS_FS_IO */ diff --git a/programs/pkey/rsa_encrypt.c b/programs/pkey/rsa_encrypt.c index 4a71c15dd..48f01abbc 100644 --- a/programs/pkey/rsa_encrypt.c +++ b/programs/pkey/rsa_encrypt.c @@ -55,7 +55,7 @@ int main( void ) mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_ENTROPY_C and/or MBEDTLS_FS_IO and/or " "MBEDTLS_CTR_DRBG_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -184,7 +184,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_RSA_C && MBEDTLS_ENTROPY_C && MBEDTLS_FS_IO && MBEDTLS_CTR_DRBG_C */ diff --git a/programs/pkey/rsa_genkey.c b/programs/pkey/rsa_genkey.c index d556c1902..4d1da9bba 100644 --- a/programs/pkey/rsa_genkey.c +++ b/programs/pkey/rsa_genkey.c @@ -60,7 +60,7 @@ int main( void ) mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_ENTROPY_C and/or " "MBEDTLS_RSA_C and/or MBEDTLS_GENPRIME and/or " "MBEDTLS_FS_IO and/or MBEDTLS_CTR_DRBG_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -186,7 +186,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_RSA_C && MBEDTLS_GENPRIME && MBEDTLS_FS_IO && MBEDTLS_CTR_DRBG_C */ diff --git a/programs/pkey/rsa_sign.c b/programs/pkey/rsa_sign.c index 9bcd7a627..570a64490 100644 --- a/programs/pkey/rsa_sign.c +++ b/programs/pkey/rsa_sign.c @@ -46,7 +46,7 @@ int main( void ) mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_MD_C and/or " "MBEDTLS_SHA256_C and/or MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -188,7 +188,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_RSA_C && MBEDTLS_SHA256_C && MBEDTLS_FS_IO */ diff --git a/programs/pkey/rsa_sign_pss.c b/programs/pkey/rsa_sign_pss.c index 42209e27c..b65225e59 100644 --- a/programs/pkey/rsa_sign_pss.c +++ b/programs/pkey/rsa_sign_pss.c @@ -47,7 +47,7 @@ int main( void ) "MBEDTLS_RSA_C and/or MBEDTLS_SHA256_C and/or " "MBEDTLS_PK_PARSE_C and/or MBEDTLS_FS_IO and/or " "MBEDTLS_CTR_DRBG_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -175,7 +175,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_RSA_C && MBEDTLS_SHA256_C && MBEDTLS_PK_PARSE_C && MBEDTLS_FS_IO && diff --git a/programs/pkey/rsa_verify.c b/programs/pkey/rsa_verify.c index 94f0ef9ce..0cbce682e 100644 --- a/programs/pkey/rsa_verify.c +++ b/programs/pkey/rsa_verify.c @@ -45,7 +45,7 @@ int main( void ) mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_MD_C and/or " "MBEDTLS_SHA256_C and/or MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -161,7 +161,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_RSA_C && MBEDTLS_SHA256_C && MBEDTLS_FS_IO */ diff --git a/programs/pkey/rsa_verify_pss.c b/programs/pkey/rsa_verify_pss.c index 148cd5110..f788ff156 100644 --- a/programs/pkey/rsa_verify_pss.c +++ b/programs/pkey/rsa_verify_pss.c @@ -47,7 +47,7 @@ int main( void ) "MBEDTLS_RSA_C and/or MBEDTLS_SHA256_C and/or " "MBEDTLS_PK_PARSE_C and/or MBEDTLS_FS_IO and/or " "MBEDTLS_CTR_DRBG_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -152,7 +152,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_RSA_C && MBEDTLS_SHA256_C && MBEDTLS_PK_PARSE_C && MBEDTLS_FS_IO */ diff --git a/programs/random/gen_entropy.c b/programs/random/gen_entropy.c index 6ae63b725..e19ab61d0 100644 --- a/programs/random/gen_entropy.c +++ b/programs/random/gen_entropy.c @@ -47,7 +47,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_ENTROPY_C and/or MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -63,13 +63,13 @@ int main( int argc, char *argv[] ) if( argc < 2 ) { mbedtls_fprintf( stderr, "usage: %s \n", argv[0] ); - return( exit_code ); + mbedtls_exit( exit_code ); } if( ( f = fopen( argv[1], "wb+" ) ) == NULL ) { mbedtls_printf( "failed to open '%s' for writing.\n", argv[1] ); - return( exit_code ); + mbedtls_exit( exit_code ); } mbedtls_entropy_init( &entropy ); @@ -99,6 +99,6 @@ cleanup: fclose( f ); mbedtls_entropy_free( &entropy ); - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_ENTROPY_C */ diff --git a/programs/random/gen_random_ctr_drbg.c b/programs/random/gen_random_ctr_drbg.c index 59df34b66..b0882767a 100644 --- a/programs/random/gen_random_ctr_drbg.c +++ b/programs/random/gen_random_ctr_drbg.c @@ -50,7 +50,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_CTR_DRBG_C and/or MBEDTLS_ENTROPY_C and/or MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -69,13 +69,13 @@ int main( int argc, char *argv[] ) if( argc < 2 ) { mbedtls_fprintf( stderr, "usage: %s \n", argv[0] ); - return( exit_code ); + mbedtls_exit( exit_code ); } if( ( f = fopen( argv[1], "wb+" ) ) == NULL ) { mbedtls_printf( "failed to open '%s' for writing.\n", argv[1] ); - return( exit_code ); + mbedtls_exit( exit_code ); } mbedtls_entropy_init( &entropy ); @@ -132,6 +132,6 @@ cleanup: mbedtls_ctr_drbg_free( &ctr_drbg ); mbedtls_entropy_free( &entropy ); - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_CTR_DRBG_C && MBEDTLS_ENTROPY_C */ diff --git a/programs/random/gen_random_havege.c b/programs/random/gen_random_havege.c index 5ea52aec9..6a65de093 100644 --- a/programs/random/gen_random_havege.c +++ b/programs/random/gen_random_havege.c @@ -48,7 +48,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_HAVEGE_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -65,13 +65,13 @@ int main( int argc, char *argv[] ) if( argc < 2 ) { mbedtls_fprintf( stderr, "usage: %s \n", argv[0] ); - return( exit_code ); + mbedtls_exit( exit_code ); } if( ( f = fopen( argv[1], "wb+" ) ) == NULL ) { mbedtls_printf( "failed to open '%s' for writing.\n", argv[1] ); - return( exit_code ); + mbedtls_exit( exit_code ); } mbedtls_havege_init( &hs ); @@ -104,6 +104,6 @@ int main( int argc, char *argv[] ) exit: mbedtls_havege_free( &hs ); fclose( f ); - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_HAVEGE_C */ diff --git a/programs/ssl/dtls_client.c b/programs/ssl/dtls_client.c index 3ea2a680b..b74926e39 100644 --- a/programs/ssl/dtls_client.c +++ b/programs/ssl/dtls_client.c @@ -29,6 +29,7 @@ #include "mbedtls/platform.h" #else #include +#include #define mbedtls_printf printf #define mbedtls_fprintf fprintf #define mbedtls_exit exit @@ -48,7 +49,7 @@ int main( void ) "MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or " "MBEDTLS_X509_CRT_PARSE_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_CERTS_C and/or MBEDTLS_PEM_PARSE_C not defined.\n" ); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -355,7 +356,7 @@ exit: if( ret < 0 ) ret = 1; - return( ret ); + mbedtls_exit( ret ); } #endif /* MBEDTLS_SSL_CLI_C && MBEDTLS_SSL_PROTO_DTLS && MBEDTLS_NET_C && MBEDTLD_TIMING_C && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C && diff --git a/programs/ssl/dtls_server.c b/programs/ssl/dtls_server.c index bb3272478..9121c34df 100644 --- a/programs/ssl/dtls_server.c +++ b/programs/ssl/dtls_server.c @@ -29,6 +29,7 @@ #include "mbedtls/platform.h" #else #include +#include #define mbedtls_printf printf #define mbedtls_fprintf fprintf #define mbedtls_time_t time_t @@ -61,7 +62,7 @@ int main( void ) "MBEDTLS_X509_CRT_PARSE_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_CERTS_C and/or MBEDTLS_PEM_PARSE_C and/or " "MBEDTLS_TIMING_C not defined.\n" ); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -430,7 +431,7 @@ exit: if( ret < 0 ) ret = 1; - return( ret ); + mbedtls_exit( ret ); } #endif /* MBEDTLS_SSL_SRV_C && MBEDTLS_SSL_PROTO_DTLS && MBEDTLS_SSL_COOKIE_C && MBEDTLS_NET_C && MBEDTLS_ENTROPY_C && diff --git a/programs/ssl/mini_client.c b/programs/ssl/mini_client.c index 4b8140e68..c568242f7 100644 --- a/programs/ssl/mini_client.c +++ b/programs/ssl/mini_client.c @@ -60,7 +60,7 @@ int main( void ) mbedtls_printf( "MBEDTLS_CTR_DRBG_C and/or MBEDTLS_ENTROPY_C and/or " "MBEDTLS_NET_C and/or MBEDTLS_SSL_CLI_C and/or UNIX " "not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -296,6 +296,6 @@ exit: mbedtls_x509_crt_free( &ca ); #endif - return( ret ); + mbedtls_exit( ret ); } #endif diff --git a/programs/ssl/ssl_client1.c b/programs/ssl/ssl_client1.c index b723243c9..2976a5afc 100644 --- a/programs/ssl/ssl_client1.c +++ b/programs/ssl/ssl_client1.c @@ -51,7 +51,7 @@ int main( void ) "MBEDTLS_NET_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_CTR_DRBG_C and/or MBEDTLS_X509_CRT_PARSE_C " "not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -312,7 +312,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C && MBEDTLS_SSL_CLI_C && MBEDTLS_NET_C && MBEDTLS_RSA_C && diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index f95ca0c18..958bb3d40 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -48,7 +48,7 @@ int main( void ) mbedtls_printf("MBEDTLS_ENTROPY_C and/or " "MBEDTLS_SSL_TLS_C and/or MBEDTLS_SSL_CLI_C and/or " "MBEDTLS_NET_C and/or MBEDTLS_CTR_DRBG_C and/or not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -991,7 +991,7 @@ int main( int argc, char *argv[] ) } else if( strcmp( p, "query_config" ) == 0 ) { - return query_config( q ); + mbedtls_exit( query_config( q ) ); } else goto usage; @@ -2143,7 +2143,7 @@ exit: if( ret < 0 ) ret = 1; - return( ret ); + mbedtls_exit( ret ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C && MBEDTLS_SSL_CLI_C && MBEDTLS_NET_C && MBEDTLS_RSA_C && diff --git a/programs/ssl/ssl_fork_server.c b/programs/ssl/ssl_fork_server.c index 80407e49a..1ff5369c4 100644 --- a/programs/ssl/ssl_fork_server.c +++ b/programs/ssl/ssl_fork_server.c @@ -54,14 +54,14 @@ int main( int argc, char *argv[] ) "MBEDTLS_NET_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_CTR_DRBG_C and/or MBEDTLS_X509_CRT_PARSE_C and/or " "MBEDTLS_TIMING_C and/or MBEDTLS_PEM_PARSE_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #elif defined(_WIN32) int main( void ) { mbedtls_printf("_WIN32 defined. This application requires fork() and signals " "to work correctly.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -416,7 +416,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_CERTS_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C && MBEDTLS_SSL_SRV_C && MBEDTLS_NET_C && diff --git a/programs/ssl/ssl_mail_client.c b/programs/ssl/ssl_mail_client.c index 3163e2124..08ff02595 100644 --- a/programs/ssl/ssl_mail_client.c +++ b/programs/ssl/ssl_mail_client.c @@ -56,7 +56,7 @@ int main( void ) "MBEDTLS_NET_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_CTR_DRBG_C and/or MBEDTLS_X509_CRT_PARSE_C " "not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -853,7 +853,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C && MBEDTLS_SSL_CLI_C && MBEDTLS_NET_C && MBEDTLS_RSA_C ** diff --git a/programs/ssl/ssl_pthread_server.c b/programs/ssl/ssl_pthread_server.c index 0624d3363..3496ef6a5 100644 --- a/programs/ssl/ssl_pthread_server.c +++ b/programs/ssl/ssl_pthread_server.c @@ -54,7 +54,7 @@ int main( void ) "MBEDTLS_CTR_DRBG_C and/or MBEDTLS_X509_CRT_PARSE_C and/or " "MBEDTLS_THREADING_C and/or MBEDTLS_THREADING_PTHREAD " "and/or MBEDTLS_PEM_PARSE_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -524,7 +524,7 @@ exit: fflush( stdout ); getchar(); #endif - return( ret ); + mbedtls_exit( ret ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_CERTS_C && MBEDTLS_ENTROPY_C && diff --git a/programs/ssl/ssl_server.c b/programs/ssl/ssl_server.c index 3e1d9a4e6..21ba2c1c7 100644 --- a/programs/ssl/ssl_server.c +++ b/programs/ssl/ssl_server.c @@ -52,7 +52,7 @@ int main( void ) "MBEDTLS_NET_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_CTR_DRBG_C and/or MBEDTLS_X509_CRT_PARSE_C " "and/or MBEDTLS_PEM_PARSE_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -397,7 +397,7 @@ exit: fflush( stdout ); getchar(); #endif - return( ret ); + mbedtls_exit( ret ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_CERTS_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C && MBEDTLS_SSL_SRV_C && MBEDTLS_NET_C && diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index b429b2491..e3f13d1d4 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -49,7 +49,7 @@ int main( void ) mbedtls_printf("MBEDTLS_ENTROPY_C and/or " "MBEDTLS_SSL_TLS_C and/or MBEDTLS_SSL_SRV_C and/or " "MBEDTLS_NET_C and/or MBEDTLS_CTR_DRBG_C and/or not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -1773,7 +1773,7 @@ int main( int argc, char *argv[] ) } else if( strcmp( p, "query_config" ) == 0 ) { - return query_config( q ); + mbedtls_exit( query_config( q ) ); } else goto usage; @@ -3217,7 +3217,7 @@ exit: if( ret < 0 ) ret = 1; - return( ret ); + mbedtls_exit( ret ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C && MBEDTLS_SSL_SRV_C && MBEDTLS_NET_C && MBEDTLS_RSA_C && diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c index 2b8656692..a8f7f6e1b 100644 --- a/programs/test/benchmark.c +++ b/programs/test/benchmark.c @@ -43,7 +43,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_TIMING_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -999,7 +999,7 @@ int main( int argc, char *argv[] ) fflush( stdout ); getchar(); #endif - return( 0 ); + mbedtls_exit( 0 ); } #endif /* MBEDTLS_TIMING_C */ diff --git a/programs/test/udp_proxy.c b/programs/test/udp_proxy.c index e96e91bf5..62508a097 100644 --- a/programs/test/udp_proxy.c +++ b/programs/test/udp_proxy.c @@ -42,6 +42,7 @@ #define mbedtls_printf printf #define mbedtls_calloc calloc #define mbedtls_free free +#define mbedtls_exit exit #define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS #define MBEDTLS_EXIT_FAILURE EXIT_FAILURE #endif /* MBEDTLS_PLATFORM_C */ @@ -50,7 +51,7 @@ int main( void ) { mbedtls_printf( "MBEDTLS_NET_C not defined.\n" ); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -923,7 +924,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_NET_C */ diff --git a/programs/test/zeroize.c b/programs/test/zeroize.c index 29cc0ac3c..6f5726066 100644 --- a/programs/test/zeroize.c +++ b/programs/test/zeroize.c @@ -40,8 +40,10 @@ #if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" #else +#include #include #define mbedtls_printf printf +#define mbedtls_exit exit #define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS #define MBEDTLS_EXIT_FAILURE EXIT_FAILURE #endif @@ -72,14 +74,14 @@ int main( int argc, char** argv ) { mbedtls_printf( "This program takes exactly 1 agument\n" ); usage(); - return( exit_code ); + mbedtls_exit( exit_code ); } fp = fopen( argv[1], "r" ); if( fp == NULL ) { mbedtls_printf( "Could not open file '%s'\n", argv[1] ); - return( exit_code ); + mbedtls_exit( exit_code ); } while( ( c = fgetc( fp ) ) != EOF && p < end - 1 ) @@ -97,5 +99,5 @@ int main( int argc, char** argv ) fclose( fp ); mbedtls_platform_zeroize( buf, sizeof( buf ) ); - return( exit_code ); + mbedtls_exit( exit_code ); } diff --git a/programs/util/pem2der.c b/programs/util/pem2der.c index f18493926..f1961a145 100644 --- a/programs/util/pem2der.c +++ b/programs/util/pem2der.c @@ -61,7 +61,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_BASE64_C and/or MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -290,6 +290,6 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BASE64_C && MBEDTLS_FS_IO */ diff --git a/programs/util/strerror.c b/programs/util/strerror.c index 458280c98..5d1bbc9e6 100644 --- a/programs/util/strerror.c +++ b/programs/util/strerror.c @@ -29,7 +29,9 @@ #include "mbedtls/platform.h" #else #include +#include #define mbedtls_printf printf +#define mbedtls_exit exit #endif #if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY) @@ -48,7 +50,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_ERROR_C and/or MBEDTLS_ERROR_STRERROR_DUMMY not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else int main( int argc, char *argv[] ) @@ -59,7 +61,7 @@ int main( int argc, char *argv[] ) if( argc != 2 ) { mbedtls_printf( USAGE ); - return( 0 ); + mbedtls_exit( 0 ); } val = strtol( argv[1], &end, 10 ); @@ -87,6 +89,6 @@ int main( int argc, char *argv[] ) fflush( stdout ); getchar(); #endif - return( val ); + mbedtls_exit( val ); } #endif /* MBEDTLS_ERROR_C */ diff --git a/programs/x509/cert_app.c b/programs/x509/cert_app.c index 84d62fe60..b8367f611 100644 --- a/programs/x509/cert_app.c +++ b/programs/x509/cert_app.c @@ -51,7 +51,7 @@ int main( void ) "MBEDTLS_NET_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_X509_CRT_PARSE_C and/or MBEDTLS_FS_IO and/or " "MBEDTLS_CTR_DRBG_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -493,7 +493,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C && MBEDTLS_SSL_CLI_C && MBEDTLS_NET_C && MBEDTLS_RSA_C && diff --git a/programs/x509/cert_req.c b/programs/x509/cert_req.c index f3d915750..81e0d8c94 100644 --- a/programs/x509/cert_req.c +++ b/programs/x509/cert_req.c @@ -46,7 +46,7 @@ int main( void ) "MBEDTLS_PK_PARSE_C and/or MBEDTLS_SHA256_C and/or " "MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C " "not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -444,7 +444,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_X509_CSR_WRITE_C && MBEDTLS_PK_PARSE_C && MBEDTLS_FS_IO && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C && MBEDTLS_PEM_WRITE_C */ diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c index c3e89bef5..0c433184c 100644 --- a/programs/x509/cert_write.c +++ b/programs/x509/cert_write.c @@ -47,7 +47,7 @@ int main( void ) "MBEDTLS_FS_IO and/or MBEDTLS_SHA256_C and/or " "MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or " "MBEDTLS_ERROR_C not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -811,7 +811,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_X509_CRT_WRITE_C && MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_FS_IO && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C && diff --git a/programs/x509/crl_app.c b/programs/x509/crl_app.c index 127320a13..cebc724e7 100644 --- a/programs/x509/crl_app.c +++ b/programs/x509/crl_app.c @@ -42,7 +42,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_X509_CRL_PARSE_C and/or MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -147,7 +147,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_RSA_C && MBEDTLS_X509_CRL_PARSE_C && MBEDTLS_FS_IO */ diff --git a/programs/x509/req_app.c b/programs/x509/req_app.c index 3bb4277fd..3182d30bc 100644 --- a/programs/x509/req_app.c +++ b/programs/x509/req_app.c @@ -42,7 +42,7 @@ int main( void ) { mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_RSA_C and/or " "MBEDTLS_X509_CSR_PARSE_C and/or MBEDTLS_FS_IO not defined.\n"); - return( 0 ); + mbedtls_exit( 0 ); } #else @@ -147,7 +147,7 @@ exit: fflush( stdout ); getchar(); #endif - return( exit_code ); + mbedtls_exit( exit_code ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_RSA_C && MBEDTLS_X509_CSR_PARSE_C && MBEDTLS_FS_IO */