Commit 85b05ec3 authored by Rich Evans's avatar Rich Evans
Browse files

Cleanup programs further

removed casting of main args to void
parent 18b78c74
......@@ -65,10 +65,8 @@
#if !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) ||\
!defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_AES_C and/or POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
......
......@@ -66,11 +66,8 @@
#if !defined(POLARSSL_CIPHER_C) || !defined(POLARSSL_MD_C) ||\
!defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_CIPHER_C and/or POLARSSL_MD_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
......
......@@ -42,11 +42,8 @@
#endif
#if !defined(POLARSSL_MD_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_MD_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
......
......@@ -38,24 +38,18 @@
#endif
#if !defined(POLARSSL_MD5_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_MD5_C not defined.\n");
return( 0 );
}
#else
int main( int argc, char *argv[] )
int main( void )
{
int i;
unsigned char digest[16];
char str[] = "Hello, world!";
((void) argc);
((void) argv);
polarssl_printf( "\n MD5('%s') = ", str );
md5( (unsigned char *) str, 13, digest );
......
......@@ -42,11 +42,8 @@
#endif
#if !defined(POLARSSL_MD5_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_MD5_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
......
......@@ -42,11 +42,8 @@
#endif
#if !defined(POLARSSL_SHA1_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
......
......@@ -42,11 +42,8 @@
#endif
#if !defined(POLARSSL_SHA256_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
......
......@@ -56,11 +56,8 @@
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA256_C) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_AES_C and/or POLARSSL_DHM_C and/or POLARSSL_ENTROPY_C "
"and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_FS_IO and/or "
......@@ -68,7 +65,7 @@ int main( int argc, char *argv[] )
return( 0 );
}
#else
int main( int argc, char *argv[] )
int main( void )
{
FILE *f;
......@@ -87,9 +84,6 @@ int main( int argc, char *argv[] )
dhm_context dhm;
aes_context aes;
((void) argc);
((void) argv);
memset( &rsa, 0, sizeof( rsa ) );
dhm_init( &dhm );
aes_init( &aes );
......
......@@ -54,18 +54,15 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_CTR_DRBG_C) || \
!defined(POLARSSL_GENPRIME)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_FS_IO and/or POLARSSL_CTR_DRBG_C and/or "
"POLARSSL_GENPRIME not defined.\n");
return( 0 );
}
#else
int main( int argc, char *argv[] )
int main( void )
{
int ret = 1;
mpi G, P, Q;
......@@ -74,9 +71,6 @@ int main( int argc, char *argv[] )
const char *pers = "dh_genprime";
FILE *fout;
((void) argc);
((void) argv);
mpi_init( &G ); mpi_init( &P ); mpi_init( &Q );
entropy_init( &entropy );
......
......@@ -56,11 +56,8 @@
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA256_C) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_AES_C and/or POLARSSL_DHM_C and/or POLARSSL_ENTROPY_C "
"and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_FS_IO and/or "
......@@ -68,7 +65,7 @@ int main( int argc, char *argv[] )
return( 0 );
}
#else
int main( int argc, char *argv[] )
int main( void )
{
FILE *f;
......@@ -88,9 +85,6 @@ int main( int argc, char *argv[] )
dhm_context dhm;
aes_context aes;
((void) argc);
((void) argv);
memset( &rsa, 0, sizeof( rsa ) );
dhm_init( &dhm );
aes_init( &aes );
......
......@@ -58,11 +58,8 @@
#if !defined(POLARSSL_ECDSA_C) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_ECDSA_C and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C not defined\n");
return( 0 );
......
......@@ -123,11 +123,8 @@ int dev_random_entropy_poll( void *data, unsigned char *output,
#if !defined(POLARSSL_PK_WRITE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf( "POLARSSL_PK_WRITE_C and/or POLARSSL_FS_IO and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C "
"not defined.\n" );
......
......@@ -64,11 +64,8 @@
#if !defined(POLARSSL_BIGNUM_C) || \
!defined(POLARSSL_PK_PARSE_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or "
"POLARSSL_PK_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
......
......@@ -86,11 +86,8 @@
"\n"
#if !defined(POLARSSL_PK_WRITE_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf( "POLARSSL_PK_WRITE_C and/or POLARSSL_FS_IO not defined.\n" );
return( 0 );
}
......
......@@ -40,22 +40,16 @@
#endif
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
#else
int main( int argc, char *argv[] )
int main( void )
{
mpi E, P, Q, N, H, D, X, Y, Z;
((void) argc);
((void) argv);
mpi_init( &E ); mpi_init( &P ); mpi_init( &Q ); mpi_init( &N );
mpi_init( &H ); mpi_init( &D ); mpi_init( &X ); mpi_init( &Y );
mpi_init( &Z );
......
......@@ -49,11 +49,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_PK_PARSE_C) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_ENTROPY_C) || \
!defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_PK_PARSE_C and/or "
"POLARSSL_FS_IO and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_CTR_DRBG_C not defined.\n");
......
......@@ -49,11 +49,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_PK_PARSE_C) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_PK_PARSE_C and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_FS_IO and/or "
"POLARSSL_CTR_DRBG_C not defined.\n");
......
......@@ -56,11 +56,8 @@
!defined(POLARSSL_SHA256_C) || \
!defined(POLARSSL_PK_PARSE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_SHA256_C and/or "
"POLARSSL_PK_PARSE_C and/or POLARSSL_FS_IO and/or "
......
......@@ -52,11 +52,8 @@
#if !defined(POLARSSL_BIGNUM_C) || \
!defined(POLARSSL_SHA256_C) || !defined(POLARSSL_PK_PARSE_C) || \
!defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_PK_PARSE_C and/or "
"POLARSSL_FS_IO not defined.\n");
......
......@@ -47,11 +47,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_ENTROPY_C) || \
!defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_FS_IO and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_CTR_DRBG_C not defined.\n");
......
......@@ -48,11 +48,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_FS_IO and/or "
"POLARSSL_CTR_DRBG_C not defined.\n");
......
......@@ -52,18 +52,15 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_GENPRIME) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_RSA_C and/or POLARSSL_GENPRIME and/or "
"POLARSSL_FS_IO and/or POLARSSL_CTR_DRBG_C not defined.\n");
return( 0 );
}
#else
int main( int argc, char *argv[] )
int main( void )
{
int ret;
rsa_context rsa;
......@@ -73,9 +70,6 @@ int main( int argc, char *argv[] )
FILE *fpriv = NULL;
const char *pers = "rsa_genkey";
((void) argc);
((void) argv);
polarssl_printf( "\n . Seeding the random number generator..." );
fflush( stdout );
......
......@@ -45,11 +45,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_SHA256_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
......
......@@ -56,11 +56,8 @@
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA256_C) || \
!defined(POLARSSL_PK_PARSE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_RSA_C and/or POLARSSL_SHA256_C and/or "
"POLARSSL_PK_PARSE_C and/or POLARSSL_FS_IO and/or "
......
......@@ -44,11 +44,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_SHA256_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
......
......@@ -53,11 +53,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_SHA256_C) || !defined(POLARSSL_PK_PARSE_C) || \
!defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_PK_PARSE_C and/or "
"POLARSSL_FS_IO not defined.\n");
......
......@@ -41,11 +41,8 @@
#endif
#if !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_ENTROPY_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
......
......@@ -44,11 +44,8 @@
#if !defined(POLARSSL_CTR_DRBG_C) || !defined(POLARSSL_ENTROPY_C) ||\
!defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_CTR_DRBG_C and/or POLARSSL_ENTROPY_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
......
......@@ -42,11 +42,8 @@
#endif
#if !defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_HAVEGE_C not defined.\n");
return( 0 );
}
......
......@@ -60,11 +60,8 @@
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_CTR_DRBG_C) || !defined(POLARSSL_X509_CRT_PARSE_C)
int main( int argc, char *argv[] )
int main( void )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
......@@ -81,7 +78,7 @@ static void my_debug( void *ctx, int level, const char *str )
fflush( (FILE *) ctx );
}
int main( int argc, char *argv[] )
int main( void )
{
int ret, len, server_fd = -1;
unsigned char buf[1024];
......@@ -92,9 +89,6 @@ int main( int argc, char *argv[] )
ssl_context ssl;
x509_crt cacert;
((void) argc);
((void) argv);
#if defined(POLARSSL_DEBUG_C)
debug_set_threshold( DEBUG_LEVEL );
#endif
......
......@@ -97,147 +97,6 @@
#define GET_REQUEST "GET %s HTTP/1.0\r\nExtra-header: "
#define GET_REQUEST_END "\r\n\r\n"
#if !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
!defined(POLARSSL_NET_C) || !defined(POLARSSL_CTR_DRBG_C)
int main( int argc, char *argv[] )
{
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_ENTROPY_C and/or "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_CTR_DRBG_C not defined.\n");
return( 0 );
}
#else
/*
* global options
*/
struct options
{
const char *server_name; /* hostname of the server (client only) */
const char *server_addr; /* address of the server (client only) */
int server_port; /* port on which the ssl service runs */
int debug_level; /* level of debugging */
int nbio; /* should I/O be blocking? */
const char *request_page; /* page on server to request */
int request_size; /* pad request with header to requested size */
const char *ca_file; /* the file with the CA certificate(s) */
const char *ca_path; /* the path with the CA certificate(s) reside */
const char *crt_file; /* the file with the client certificate */
const char *key_file; /* the file with the client key */
const char *psk; /* the pre-shared key */
const char *psk_identity; /* the pre-shared key identity */
int force_ciphersuite[2]; /* protocol/ciphersuite to use, or all */
int renegotiation; /* enable / disable renegotiation */
int allow_legacy; /* allow legacy renegotiation */
int renegotiate; /* attempt renegotiation? */
int renego_delay; /* delay before enforcing renegotiation */
int exchanges; /* number of data exchanges */
int min_version; /* minimum protocol version accepted */
int max_version; /* maximum protocol version accepted */
int arc4; /* flag for arc4 suites support */
int auth_mode; /* verify mode for connection */
unsigned char mfl_code; /* code for maximum fragment length */
int trunc_hmac; /* negotiate truncated hmac or not */
int recsplit; /* enable record splitting? */
int reconnect; /* attempt to resume session */
int reco_delay; /* delay in seconds before resuming session */
int tickets; /* enable / disable session tickets */
const char *alpn_string; /* ALPN supported protocols */
int fallback; /* is this a fallback connection? */
int extended_ms; /* negotiate extended master secret? */
int etm; /* negotiate encrypt then mac? */
} opt;
static void my_debug( void *ctx, int level, const char *str )
{
((void) level);
polarssl_fprintf( (FILE *) ctx, "%s", str );
fflush( (FILE *) ctx );
}
/*
* Test recv/send functions that make sure each try returns
* WANT_READ/WANT_WRITE at least once before sucesseding
*/
static int my_recv( void *ctx, unsigned char *buf, size_t len )