Cleanup programs further

removed casting of main args to void
This commit is contained in:
Rich Evans 2015-02-12 11:37:29 +00:00
parent 18b78c7498
commit 85b05ec389
47 changed files with 414 additions and 586 deletions

View file

@ -65,10 +65,8 @@
#if !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) ||\ #if !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) ||\
!defined(POLARSSL_FS_IO) !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"); polarssl_printf("POLARSSL_AES_C and/or POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -66,11 +66,8 @@
#if !defined(POLARSSL_CIPHER_C) || !defined(POLARSSL_MD_C) ||\ #if !defined(POLARSSL_CIPHER_C) || !defined(POLARSSL_MD_C) ||\
!defined(POLARSSL_FS_IO) !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"); polarssl_printf("POLARSSL_CIPHER_C and/or POLARSSL_MD_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -42,11 +42,8 @@
#endif #endif
#if !defined(POLARSSL_MD_C) || !defined(POLARSSL_FS_IO) #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"); polarssl_printf("POLARSSL_MD_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -38,24 +38,18 @@
#endif #endif
#if !defined(POLARSSL_MD5_C) #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"); polarssl_printf("POLARSSL_MD5_C not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( int argc, char *argv[] ) int main( void )
{ {
int i; int i;
unsigned char digest[16]; unsigned char digest[16];
char str[] = "Hello, world!"; char str[] = "Hello, world!";
((void) argc);
((void) argv);
polarssl_printf( "\n MD5('%s') = ", str ); polarssl_printf( "\n MD5('%s') = ", str );
md5( (unsigned char *) str, 13, digest ); md5( (unsigned char *) str, 13, digest );

View file

@ -42,11 +42,8 @@
#endif #endif
#if !defined(POLARSSL_MD5_C) || !defined(POLARSSL_FS_IO) #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"); polarssl_printf("POLARSSL_MD5_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -42,11 +42,8 @@
#endif #endif
#if !defined(POLARSSL_SHA1_C) || !defined(POLARSSL_FS_IO) #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"); polarssl_printf("POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -42,11 +42,8 @@
#endif #endif
#if !defined(POLARSSL_SHA256_C) || !defined(POLARSSL_FS_IO) #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"); polarssl_printf("POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -56,11 +56,8 @@
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_NET_C) || \ !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA256_C) || \ !defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA256_C) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_CTR_DRBG_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 " 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 " "and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_FS_IO and/or " "POLARSSL_SHA256_C and/or POLARSSL_FS_IO and/or "
@ -68,7 +65,7 @@ int main( int argc, char *argv[] )
return( 0 ); return( 0 );
} }
#else #else
int main( int argc, char *argv[] ) int main( void )
{ {
FILE *f; FILE *f;
@ -87,9 +84,6 @@ int main( int argc, char *argv[] )
dhm_context dhm; dhm_context dhm;
aes_context aes; aes_context aes;
((void) argc);
((void) argv);
memset( &rsa, 0, sizeof( rsa ) ); memset( &rsa, 0, sizeof( rsa ) );
dhm_init( &dhm ); dhm_init( &dhm );
aes_init( &aes ); aes_init( &aes );

View file

@ -54,18 +54,15 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_CTR_DRBG_C) || \ !defined(POLARSSL_FS_IO) || !defined(POLARSSL_CTR_DRBG_C) || \
!defined(POLARSSL_GENPRIME) !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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_FS_IO and/or POLARSSL_CTR_DRBG_C and/or " "POLARSSL_FS_IO and/or POLARSSL_CTR_DRBG_C and/or "
"POLARSSL_GENPRIME not defined.\n"); "POLARSSL_GENPRIME not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( int argc, char *argv[] ) int main( void )
{ {
int ret = 1; int ret = 1;
mpi G, P, Q; mpi G, P, Q;
@ -74,9 +71,6 @@ int main( int argc, char *argv[] )
const char *pers = "dh_genprime"; const char *pers = "dh_genprime";
FILE *fout; FILE *fout;
((void) argc);
((void) argv);
mpi_init( &G ); mpi_init( &P ); mpi_init( &Q ); mpi_init( &G ); mpi_init( &P ); mpi_init( &Q );
entropy_init( &entropy ); entropy_init( &entropy );

View file

@ -56,11 +56,8 @@
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_NET_C) || \ !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA256_C) || \ !defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA256_C) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_CTR_DRBG_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 " 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 " "and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_FS_IO and/or " "POLARSSL_SHA256_C and/or POLARSSL_FS_IO and/or "
@ -68,7 +65,7 @@ int main( int argc, char *argv[] )
return( 0 ); return( 0 );
} }
#else #else
int main( int argc, char *argv[] ) int main( void )
{ {
FILE *f; FILE *f;
@ -88,9 +85,6 @@ int main( int argc, char *argv[] )
dhm_context dhm; dhm_context dhm;
aes_context aes; aes_context aes;
((void) argc);
((void) argv);
memset( &rsa, 0, sizeof( rsa ) ); memset( &rsa, 0, sizeof( rsa ) );
dhm_init( &dhm ); dhm_init( &dhm );
aes_init( &aes ); aes_init( &aes );

View file

@ -58,11 +58,8 @@
#if !defined(POLARSSL_ECDSA_C) || \ #if !defined(POLARSSL_ECDSA_C) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_CTR_DRBG_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_printf("POLARSSL_ECDSA_C and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C not defined\n"); "POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C not defined\n");
return( 0 ); return( 0 );

View file

@ -123,11 +123,8 @@ int dev_random_entropy_poll( void *data, unsigned char *output,
#if !defined(POLARSSL_PK_WRITE_C) || !defined(POLARSSL_FS_IO) || \ #if !defined(POLARSSL_PK_WRITE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_CTR_DRBG_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_PK_WRITE_C and/or POLARSSL_FS_IO and/or " polarssl_printf( "POLARSSL_PK_WRITE_C and/or POLARSSL_FS_IO and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C " "POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C "
"not defined.\n" ); "not defined.\n" );

View file

@ -64,11 +64,8 @@
#if !defined(POLARSSL_BIGNUM_C) || \ #if !defined(POLARSSL_BIGNUM_C) || \
!defined(POLARSSL_PK_PARSE_C) || !defined(POLARSSL_FS_IO) !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_printf("POLARSSL_BIGNUM_C and/or "
"POLARSSL_PK_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_PK_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );

View file

@ -86,11 +86,8 @@
"\n" "\n"
#if !defined(POLARSSL_PK_WRITE_C) || !defined(POLARSSL_FS_IO) #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" ); polarssl_printf( "POLARSSL_PK_WRITE_C and/or POLARSSL_FS_IO not defined.\n" );
return( 0 ); return( 0 );
} }

View file

@ -40,22 +40,16 @@
#endif #endif
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_FS_IO) #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"); polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( int argc, char *argv[] ) int main( void )
{ {
mpi E, P, Q, N, H, D, X, Y, Z; 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( &E ); mpi_init( &P ); mpi_init( &Q ); mpi_init( &N );
mpi_init( &H ); mpi_init( &D ); mpi_init( &X ); mpi_init( &Y ); mpi_init( &H ); mpi_init( &D ); mpi_init( &X ); mpi_init( &Y );
mpi_init( &Z ); mpi_init( &Z );

View file

@ -49,11 +49,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_PK_PARSE_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_PK_PARSE_C) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_ENTROPY_C) || \ !defined(POLARSSL_FS_IO) || !defined(POLARSSL_ENTROPY_C) || \
!defined(POLARSSL_CTR_DRBG_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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_PK_PARSE_C and/or "
"POLARSSL_FS_IO and/or POLARSSL_ENTROPY_C and/or " "POLARSSL_FS_IO and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_CTR_DRBG_C not defined.\n"); "POLARSSL_CTR_DRBG_C not defined.\n");

View file

@ -49,11 +49,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_PK_PARSE_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_PK_PARSE_C) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_FS_IO) || \ !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_CTR_DRBG_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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_PK_PARSE_C and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_FS_IO and/or " "POLARSSL_ENTROPY_C and/or POLARSSL_FS_IO and/or "
"POLARSSL_CTR_DRBG_C not defined.\n"); "POLARSSL_CTR_DRBG_C not defined.\n");

View file

@ -56,11 +56,8 @@
!defined(POLARSSL_SHA256_C) || \ !defined(POLARSSL_SHA256_C) || \
!defined(POLARSSL_PK_PARSE_C) || !defined(POLARSSL_FS_IO) || \ !defined(POLARSSL_PK_PARSE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_CTR_DRBG_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_ENTROPY_C and/or " polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_SHA256_C and/or " "POLARSSL_SHA256_C and/or "
"POLARSSL_PK_PARSE_C and/or POLARSSL_FS_IO and/or " "POLARSSL_PK_PARSE_C and/or POLARSSL_FS_IO and/or "

View file

@ -52,11 +52,8 @@
#if !defined(POLARSSL_BIGNUM_C) || \ #if !defined(POLARSSL_BIGNUM_C) || \
!defined(POLARSSL_SHA256_C) || !defined(POLARSSL_PK_PARSE_C) || \ !defined(POLARSSL_SHA256_C) || !defined(POLARSSL_PK_PARSE_C) || \
!defined(POLARSSL_FS_IO) !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_printf("POLARSSL_BIGNUM_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_PK_PARSE_C and/or " "POLARSSL_SHA256_C and/or POLARSSL_PK_PARSE_C and/or "
"POLARSSL_FS_IO not defined.\n"); "POLARSSL_FS_IO not defined.\n");

View file

@ -47,11 +47,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_ENTROPY_C) || \ !defined(POLARSSL_FS_IO) || !defined(POLARSSL_ENTROPY_C) || \
!defined(POLARSSL_CTR_DRBG_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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_FS_IO and/or POLARSSL_ENTROPY_C and/or " "POLARSSL_FS_IO and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_CTR_DRBG_C not defined.\n"); "POLARSSL_CTR_DRBG_C not defined.\n");

View file

@ -48,11 +48,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_FS_IO) || \ !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_CTR_DRBG_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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_FS_IO and/or " "POLARSSL_ENTROPY_C and/or POLARSSL_FS_IO and/or "
"POLARSSL_CTR_DRBG_C not defined.\n"); "POLARSSL_CTR_DRBG_C not defined.\n");

View file

@ -52,18 +52,15 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_GENPRIME) || \ !defined(POLARSSL_RSA_C) || !defined(POLARSSL_GENPRIME) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_CTR_DRBG_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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_RSA_C and/or POLARSSL_GENPRIME and/or " "POLARSSL_RSA_C and/or POLARSSL_GENPRIME and/or "
"POLARSSL_FS_IO and/or POLARSSL_CTR_DRBG_C not defined.\n"); "POLARSSL_FS_IO and/or POLARSSL_CTR_DRBG_C not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( int argc, char *argv[] ) int main( void )
{ {
int ret; int ret;
rsa_context rsa; rsa_context rsa;
@ -73,9 +70,6 @@ int main( int argc, char *argv[] )
FILE *fpriv = NULL; FILE *fpriv = NULL;
const char *pers = "rsa_genkey"; const char *pers = "rsa_genkey";
((void) argc);
((void) argv);
polarssl_printf( "\n . Seeding the random number generator..." ); polarssl_printf( "\n . Seeding the random number generator..." );
fflush( stdout ); fflush( stdout );

View file

@ -45,11 +45,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_SHA256_C) || !defined(POLARSSL_FS_IO) !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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );

View file

@ -56,11 +56,8 @@
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA256_C) || \ !defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA256_C) || \
!defined(POLARSSL_PK_PARSE_C) || !defined(POLARSSL_FS_IO) || \ !defined(POLARSSL_PK_PARSE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_CTR_DRBG_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_ENTROPY_C and/or " polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_RSA_C and/or POLARSSL_SHA256_C and/or " "POLARSSL_RSA_C and/or POLARSSL_SHA256_C and/or "
"POLARSSL_PK_PARSE_C and/or POLARSSL_FS_IO and/or " "POLARSSL_PK_PARSE_C and/or POLARSSL_FS_IO and/or "

View file

@ -44,11 +44,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_SHA256_C) || !defined(POLARSSL_FS_IO) !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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );

View file

@ -53,11 +53,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_SHA256_C) || !defined(POLARSSL_PK_PARSE_C) || \ !defined(POLARSSL_SHA256_C) || !defined(POLARSSL_PK_PARSE_C) || \
!defined(POLARSSL_FS_IO) !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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA256_C and/or POLARSSL_PK_PARSE_C and/or " "POLARSSL_SHA256_C and/or POLARSSL_PK_PARSE_C and/or "
"POLARSSL_FS_IO not defined.\n"); "POLARSSL_FS_IO not defined.\n");

View file

@ -41,11 +41,8 @@
#endif #endif
#if !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_FS_IO) #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"); polarssl_printf("POLARSSL_ENTROPY_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -44,11 +44,8 @@
#if !defined(POLARSSL_CTR_DRBG_C) || !defined(POLARSSL_ENTROPY_C) ||\ #if !defined(POLARSSL_CTR_DRBG_C) || !defined(POLARSSL_ENTROPY_C) ||\
!defined(POLARSSL_FS_IO) !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"); polarssl_printf("POLARSSL_CTR_DRBG_C and/or POLARSSL_ENTROPY_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -42,11 +42,8 @@
#endif #endif
#if !defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_FS_IO) #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"); polarssl_printf("POLARSSL_HAVEGE_C not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -60,11 +60,8 @@
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \ !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \ !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_CTR_DRBG_C) || !defined(POLARSSL_X509_CRT_PARSE_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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_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 " "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 ); fflush( (FILE *) ctx );
} }
int main( int argc, char *argv[] ) int main( void )
{ {
int ret, len, server_fd = -1; int ret, len, server_fd = -1;
unsigned char buf[1024]; unsigned char buf[1024];
@ -92,9 +89,6 @@ int main( int argc, char *argv[] )
ssl_context ssl; ssl_context ssl;
x509_crt cacert; x509_crt cacert;
((void) argc);
((void) argv);
#if defined(POLARSSL_DEBUG_C) #if defined(POLARSSL_DEBUG_C)
debug_set_threshold( DEBUG_LEVEL ); debug_set_threshold( DEBUG_LEVEL );
#endif #endif

View file

@ -97,147 +97,6 @@
#define GET_REQUEST "GET %s HTTP/1.0\r\nExtra-header: " #define GET_REQUEST "GET %s HTTP/1.0\r\nExtra-header: "
#define GET_REQUEST_END "\r\n\r\n" #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 )
{
static int first_try = 1;
int ret;
if( first_try )
{
first_try = 0;
return( POLARSSL_ERR_NET_WANT_READ );
}
ret = net_recv( ctx, buf, len );
if( ret != POLARSSL_ERR_NET_WANT_READ )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
static int my_send( void *ctx, const unsigned char *buf, size_t len )
{
static int first_try = 1;
int ret;
if( first_try )
{
first_try = 0;
return( POLARSSL_ERR_NET_WANT_WRITE );
}
ret = net_send( ctx, buf, len );
if( ret != POLARSSL_ERR_NET_WANT_WRITE )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
#if defined(POLARSSL_X509_CRT_PARSE_C)
/*
* Enabled if debug_level > 1 in code below
*/
static int my_verify( void *data, x509_crt *crt, int depth, int *flags )
{
char buf[1024];
((void) data);
polarssl_printf( "\nVerify requested for (Depth %d):\n", depth );
x509_crt_info( buf, sizeof( buf ) - 1, "", crt );
polarssl_printf( "%s", buf );
if( ( (*flags) & BADCERT_EXPIRED ) != 0 )
polarssl_printf( " ! server certificate has expired\n" );
if( ( (*flags) & BADCERT_REVOKED ) != 0 )
polarssl_printf( " ! server certificate has been revoked\n" );
if( ( (*flags) & BADCERT_CN_MISMATCH ) != 0 )
polarssl_printf( " ! CN mismatch\n" );
if( ( (*flags) & BADCERT_NOT_TRUSTED ) != 0 )
polarssl_printf( " ! self-signed or not signed by a trusted CA\n" );
if( ( (*flags) & BADCRL_NOT_TRUSTED ) != 0 )
polarssl_printf( " ! CRL not trusted\n" );
if( ( (*flags) & BADCRL_EXPIRED ) != 0 )
polarssl_printf( " ! CRL expired\n" );
if( ( (*flags) & BADCERT_OTHER ) != 0 )
polarssl_printf( " ! other (unknown) flag\n" );
if ( ( *flags ) == 0 )
polarssl_printf( " This certificate has no flags\n" );
return( 0 );
}
#endif /* POLARSSL_X509_CRT_PARSE_C */
#if defined(POLARSSL_X509_CRT_PARSE_C) #if defined(POLARSSL_X509_CRT_PARSE_C)
#if defined(POLARSSL_FS_IO) #if defined(POLARSSL_FS_IO)
#define USAGE_IO \ #define USAGE_IO \
@ -379,6 +238,144 @@ static int my_verify( void *data, x509_crt *crt, int depth, int *flags )
" force_ciphersuite=<name> default: all enabled\n"\ " force_ciphersuite=<name> default: all enabled\n"\
" acceptable ciphersuite names:\n" " acceptable ciphersuite names:\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( void )
{
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 )
{
static int first_try = 1;
int ret;
if( first_try )
{
first_try = 0;
return( POLARSSL_ERR_NET_WANT_READ );
}
ret = net_recv( ctx, buf, len );
if( ret != POLARSSL_ERR_NET_WANT_READ )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
static int my_send( void *ctx, const unsigned char *buf, size_t len )
{
static int first_try = 1;
int ret;
if( first_try )
{
first_try = 0;
return( POLARSSL_ERR_NET_WANT_WRITE );
}
ret = net_send( ctx, buf, len );
if( ret != POLARSSL_ERR_NET_WANT_WRITE )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
#if defined(POLARSSL_X509_CRT_PARSE_C)
/*
* Enabled if debug_level > 1 in code below
*/
static int my_verify( void *data, x509_crt *crt, int depth, int *flags )
{
char buf[1024];
((void) data);
polarssl_printf( "\nVerify requested for (Depth %d):\n", depth );
x509_crt_info( buf, sizeof( buf ) - 1, "", crt );
polarssl_printf( "%s", buf );
if( ( (*flags) & BADCERT_EXPIRED ) != 0 )
polarssl_printf( " ! server certificate has expired\n" );
if( ( (*flags) & BADCERT_REVOKED ) != 0 )
polarssl_printf( " ! server certificate has been revoked\n" );
if( ( (*flags) & BADCERT_CN_MISMATCH ) != 0 )
polarssl_printf( " ! CN mismatch\n" );
if( ( (*flags) & BADCERT_NOT_TRUSTED ) != 0 )
polarssl_printf( " ! self-signed or not signed by a trusted CA\n" );
if( ( (*flags) & BADCRL_NOT_TRUSTED ) != 0 )
polarssl_printf( " ! CRL not trusted\n" );
if( ( (*flags) & BADCRL_EXPIRED ) != 0 )
polarssl_printf( " ! CRL expired\n" );
if( ( (*flags) & BADCERT_OTHER ) != 0 )
polarssl_printf( " ! other (unknown) flag\n" );
if ( ( *flags ) == 0 )
polarssl_printf( " This certificate has no flags\n" );
return( 0 );
}
#endif /* POLARSSL_X509_CRT_PARSE_C */
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
int ret = 0, len, tail_len, server_fd, i, written, frags; int ret = 0, len, tail_len, server_fd, i, written, frags;

View file

@ -85,11 +85,8 @@ int main( int argc, char *argv[] )
return( 0 ); return( 0 );
} }
#elif defined(_WIN32) #elif defined(_WIN32)
int main( int argc, char *argv[] ) int main( void )
{ {
((void) argc);
((void) argv);
polarssl_printf("_WIN32 defined. This application requires fork() and signals " polarssl_printf("_WIN32 defined. This application requires fork() and signals "
"to work correctly.\n"); "to work correctly.\n");
return( 0 ); return( 0 );
@ -107,7 +104,7 @@ static void my_debug( void *ctx, int level, const char *str )
} }
} }
int main( int argc, char *argv[] ) int main( void )
{ {
int ret, len, cnt = 0, pid; int ret, len, cnt = 0, pid;
int listen_fd; int listen_fd;
@ -121,9 +118,6 @@ int main( int argc, char *argv[] )
x509_crt srvcert; x509_crt srvcert;
pk_context pkey; pk_context pkey;
((void) argc);
((void) argv);
memset( &ssl, 0, sizeof(ssl_context) ); memset( &ssl, 0, sizeof(ssl_context) );
entropy_init( &entropy ); entropy_init( &entropy );

View file

@ -91,16 +91,47 @@
#define MODE_SSL_TLS 0 #define MODE_SSL_TLS 0
#define MODE_STARTTLS 0 #define MODE_STARTTLS 0
#if defined(POLARSSL_BASE64_C)
#define USAGE_AUTH \
" authentication=%%d default: 0 (disabled)\n" \
" user_name=%%s default: \"user\"\n" \
" user_pwd=%%s default: \"password\"\n"
#else
#define USAGE_AUTH \
" authentication options disabled. (Require POLARSSL_BASE64_C)\n"
#endif /* POLARSSL_BASE64_C */
#if defined(POLARSSL_FS_IO)
#define USAGE_IO \
" ca_file=%%s default: \"\" (pre-loaded)\n" \
" crt_file=%%s default: \"\" (pre-loaded)\n" \
" key_file=%%s default: \"\" (pre-loaded)\n"
#else
#define USAGE_IO \
" No file operations available (POLARSSL_FS_IO not defined)\n"
#endif /* POLARSSL_FS_IO */
#define USAGE \
"\n usage: ssl_mail_client param=<>...\n" \
"\n acceptable parameters:\n" \
" server_name=%%s default: localhost\n" \
" server_port=%%d default: 4433\n" \
" debug_level=%%d default: 0 (disabled)\n" \
" mode=%%d default: 0 (SSL/TLS) (1 for STARTTLS)\n" \
USAGE_AUTH \
" mail_from=%%s default: \"\"\n" \
" mail_to=%%s default: \"\"\n" \
USAGE_IO \
" force_ciphersuite=<name> default: all enabled\n"\
" acceptable ciphersuite names:\n"
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \ !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \ !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_CTR_DRBG_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\ !defined(POLARSSL_CTR_DRBG_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
!defined(POLARSSL_FS_IO) !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_ENTROPY_C and/or " 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_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C and/or " "POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
@ -325,40 +356,6 @@ static int write_and_get_response( int sock_fd, unsigned char *buf, size_t len )
while( 1 ); while( 1 );
} }
#if defined(POLARSSL_BASE64_C)
#define USAGE_AUTH \
" authentication=%%d default: 0 (disabled)\n" \
" user_name=%%s default: \"user\"\n" \
" user_pwd=%%s default: \"password\"\n"
#else
#define USAGE_AUTH \
" authentication options disabled. (Require POLARSSL_BASE64_C)\n"
#endif /* POLARSSL_BASE64_C */
#if defined(POLARSSL_FS_IO)
#define USAGE_IO \
" ca_file=%%s default: \"\" (pre-loaded)\n" \
" crt_file=%%s default: \"\" (pre-loaded)\n" \
" key_file=%%s default: \"\" (pre-loaded)\n"
#else
#define USAGE_IO \
" No file operations available (POLARSSL_FS_IO not defined)\n"
#endif /* POLARSSL_FS_IO */
#define USAGE \
"\n usage: ssl_mail_client param=<>...\n" \
"\n acceptable parameters:\n" \
" server_name=%%s default: localhost\n" \
" server_port=%%d default: 4433\n" \
" debug_level=%%d default: 0 (disabled)\n" \
" mode=%%d default: 0 (SSL/TLS) (1 for STARTTLS)\n" \
USAGE_AUTH \
" mail_from=%%s default: \"\"\n" \
" mail_to=%%s default: \"\"\n" \
USAGE_IO \
" force_ciphersuite=<name> default: all enabled\n"\
" acceptable ciphersuite names:\n"
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
int ret = 0, len, server_fd; int ret = 0, len, server_fd;

View file

@ -73,17 +73,16 @@
#define DEBUG_LEVEL 0 #define DEBUG_LEVEL 0
#define MAX_NUM_THREADS 5
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_CERTS_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_CERTS_C) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_SSL_TLS_C) || \ !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_SSL_TLS_C) || \
!defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \ !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_CTR_DRBG_C) || \ !defined(POLARSSL_RSA_C) || !defined(POLARSSL_CTR_DRBG_C) || \
!defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_FS_IO) || \ !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_THREADING_C) || !defined(POLARSSL_THREADING_PTHREAD) !defined(POLARSSL_THREADING_C) || !defined(POLARSSL_THREADING_PTHREAD)
int main( int argc, char *argv[] ) int main( void )
{ {
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_ENTROPY_C " polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_ENTROPY_C "
"and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or " "and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C and/or " "POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
@ -124,8 +123,6 @@ typedef struct {
pthread_t thread; pthread_t thread;
} pthread_info_t; } pthread_info_t;
#define MAX_NUM_THREADS 5
static thread_info_t base_info; static thread_info_t base_info;
static pthread_info_t threads[MAX_NUM_THREADS]; static pthread_info_t threads[MAX_NUM_THREADS];
@ -373,7 +370,7 @@ static int thread_create( int client_fd )
return( 0 ); return( 0 );
} }
int main( int argc, char *argv[] ) int main( void )
{ {
int ret; int ret;
int listen_fd; int listen_fd;
@ -389,9 +386,6 @@ int main( int argc, char *argv[] )
ssl_cache_context cache; ssl_cache_context cache;
#endif #endif
((void) argc);
((void) argv);
#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C)
memory_buffer_alloc_init( alloc_buf, sizeof(alloc_buf) ); memory_buffer_alloc_init( alloc_buf, sizeof(alloc_buf) );
#endif #endif

View file

@ -73,11 +73,8 @@
!defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \ !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_CTR_DRBG_C) || \ !defined(POLARSSL_RSA_C) || !defined(POLARSSL_CTR_DRBG_C) || \
!defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_FS_IO) !defined(POLARSSL_X509_CRT_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_CERTS_C and/or POLARSSL_ENTROPY_C " polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_ENTROPY_C "
"and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or " "and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C and/or " "POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
@ -94,7 +91,7 @@ static void my_debug( void *ctx, int level, const char *str )
fflush( (FILE *) ctx ); fflush( (FILE *) ctx );
} }
int main( int argc, char *argv[] ) int main( void )
{ {
int ret, len; int ret, len;
int listen_fd; int listen_fd;
@ -111,9 +108,6 @@ int main( int argc, char *argv[] )
ssl_cache_context cache; ssl_cache_context cache;
#endif #endif
((void) argc);
((void) argv);
memset( &ssl, 0, sizeof(ssl_context) ); memset( &ssl, 0, sizeof(ssl_context) );
#if defined(POLARSSL_SSL_CACHE_C) #if defined(POLARSSL_SSL_CACHE_C)
ssl_cache_init( &cache ); ssl_cache_init( &cache );

View file

@ -133,110 +133,6 @@
*/ */
#define IO_BUF_LEN 200 #define IO_BUF_LEN 200
#if !defined(POLARSSL_ENTROPY_C) ||\
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_SRV_C) || \
!defined(POLARSSL_NET_C) || !defined(POLARSSL_CTR_DRBG_C)
#include <stdio.h>
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_SRV_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_addr; /* address on which the ssl service runs */
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 *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 server certificate */
const char *key_file; /* the file with the server key */
const char *crt_file2; /* the file with the 2nd server certificate */
const char *key_file2; /* the file with the 2nd server key */
const char *psk; /* the pre-shared key */
const char *psk_identity; /* the pre-shared key identity */
char *psk_list; /* list of PSK id/key pairs for callback */
int force_ciphersuite[2]; /* protocol/ciphersuite to use, or all */
const char *version_suites; /* per-version ciphersuites */
int renegotiation; /* enable / disable renegotiation */
int allow_legacy; /* allow legacy renegotiation */
int renegotiate; /* attempt renegotiation? */
int renego_delay; /* delay before enforcing renegotiation */
int renego_period; /* period for automatic 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; /* accept truncated hmac? */
int tickets; /* enable / disable session tickets */
int ticket_timeout; /* session ticket lifetime */
int cache_max; /* max number of session cache entries */
int cache_timeout; /* expiration delay of session cache entries */
char *sni; /* string describing sni information */
const char *alpn_string; /* ALPN supported protocols */
const char *dhm_file; /* the file with the DH parameters */
int extended_ms; /* allow negotiation of extended MS? */
int etm; /* allow negotiation of 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 )
{
static int first_try = 1;
int ret;
if( first_try )
{
first_try = 0;
return( POLARSSL_ERR_NET_WANT_READ );
}
ret = net_recv( ctx, buf, len );
if( ret != POLARSSL_ERR_NET_WANT_READ )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
static int my_send( void *ctx, const unsigned char *buf, size_t len )
{
static int first_try = 1;
int ret;
if( first_try )
{
first_try = 0;
return( POLARSSL_ERR_NET_WANT_WRITE );
}
ret = net_send( ctx, buf, len );
if( ret != POLARSSL_ERR_NET_WANT_WRITE )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
#if defined(POLARSSL_X509_CRT_PARSE_C) #if defined(POLARSSL_X509_CRT_PARSE_C)
#if defined(POLARSSL_FS_IO) #if defined(POLARSSL_FS_IO)
#define USAGE_IO \ #define USAGE_IO \
@ -382,6 +278,107 @@ static int my_send( void *ctx, const unsigned char *buf, size_t len )
" force_ciphersuite=<name> default: all enabled\n" \ " force_ciphersuite=<name> default: all enabled\n" \
" acceptable ciphersuite names:\n" " acceptable ciphersuite names:\n"
#if !defined(POLARSSL_ENTROPY_C) ||\
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_SRV_C) || \
!defined(POLARSSL_NET_C) || !defined(POLARSSL_CTR_DRBG_C)
#include <stdio.h>
int main( void )
{
polarssl_printf("POLARSSL_ENTROPY_C and/or "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_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_addr; /* address on which the ssl service runs */
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 *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 server certificate */
const char *key_file; /* the file with the server key */
const char *crt_file2; /* the file with the 2nd server certificate */
const char *key_file2; /* the file with the 2nd server key */
const char *psk; /* the pre-shared key */
const char *psk_identity; /* the pre-shared key identity */
char *psk_list; /* list of PSK id/key pairs for callback */
int force_ciphersuite[2]; /* protocol/ciphersuite to use, or all */
const char *version_suites; /* per-version ciphersuites */
int renegotiation; /* enable / disable renegotiation */
int allow_legacy; /* allow legacy renegotiation */
int renegotiate; /* attempt renegotiation? */
int renego_delay; /* delay before enforcing renegotiation */
int renego_period; /* period for automatic 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; /* accept truncated hmac? */
int tickets; /* enable / disable session tickets */
int ticket_timeout; /* session ticket lifetime */
int cache_max; /* max number of session cache entries */
int cache_timeout; /* expiration delay of session cache entries */
char *sni; /* string describing sni information */
const char *alpn_string; /* ALPN supported protocols */
const char *dhm_file; /* the file with the DH parameters */
int extended_ms; /* allow negotiation of extended MS? */
int etm; /* allow negotiation of 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 )
{
static int first_try = 1;
int ret;
if( first_try )
{
first_try = 0;
return( POLARSSL_ERR_NET_WANT_READ );
}
ret = net_recv( ctx, buf, len );
if( ret != POLARSSL_ERR_NET_WANT_READ )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
static int my_send( void *ctx, const unsigned char *buf, size_t len )
{
static int first_try = 1;
int ret;
if( first_try )
{
first_try = 0;
return( POLARSSL_ERR_NET_WANT_WRITE );
}
ret = net_send( ctx, buf, len );
if( ret != POLARSSL_ERR_NET_WANT_WRITE )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
/* /*
* Used by sni_parse and psk_parse to handle coma-separated lists * Used by sni_parse and psk_parse to handle coma-separated lists
*/ */

View file

@ -71,12 +71,72 @@
#define HEADER_FORMAT " %-24s : " #define HEADER_FORMAT " %-24s : "
#define TITLE_LEN 25 #define TITLE_LEN 25
#if !defined(POLARSSL_TIMING_C) #define DHM_SIZES 3
int main( int argc, char *argv[] )
{
((void) argc);
((void) argv);
#define OPTIONS \
"md4, md5, ripemd160, sha1, sha256, sha512,\n" \
"arc4, des3, des, aes_cbc, aes_gcm, aes_ccm, camellia, blowfish,\n" \
"havege, ctr_drbg, hmac_drbg\n" \
"rsa, dhm, ecdsa, ecdh.\n"
#if defined(POLARSSL_ERROR_C)
#define PRINT_ERROR \
polarssl_strerror( ret, ( char * )tmp, sizeof( tmp ) ); \
polarssl_printf( "FAILED: %s\n", tmp );
#else
#define PRINT_ERROR \
polarssl_printf( "FAILED: -0x%04x\n", -ret );
#endif
#define TIME_AND_TSC( TITLE, CODE ) \
do { \
unsigned long i, j, tsc; \
\
polarssl_printf( HEADER_FORMAT, TITLE ); \
fflush( stdout ); \
\
set_alarm( 1 ); \
for( i = 1; ! alarmed; i++ ) \
{ \
CODE; \
} \
\
tsc = hardclock(); \
for( j = 0; j < 1024; j++ ) \
{ \
CODE; \
} \
\
polarssl_printf( "%9lu Kb/s, %9lu cycles/byte\n", i * BUFSIZE / 1024, \
( hardclock() - tsc ) / ( j * BUFSIZE ) ); \
} while( 0 )
#define TIME_PUBLIC( TITLE, TYPE, CODE ) \
do { \
unsigned long i; \
int ret; \
\
polarssl_printf( HEADER_FORMAT, TITLE ); \
fflush( stdout ); \
set_alarm( 3 ); \
\
ret = 0; \
for( i = 1; ! alarmed && ! ret ; i++ ) \
{ \
CODE; \
} \
\
if( ret != 0 ) \
{ \
PRINT_ERROR; \
} \
else \
polarssl_printf( "%9lu " TYPE "/s\n", i / 3 ); \
} while( 0 )
#if !defined(POLARSSL_TIMING_C)
int main( void )
{
polarssl_printf("POLARSSL_TIMING_C not defined.\n"); polarssl_printf("POLARSSL_TIMING_C not defined.\n");
return( 0 ); return( 0 );
} }
@ -104,61 +164,6 @@ static int myrand( void *rng_state, unsigned char *output, size_t len )
return( 0 ); return( 0 );
} }
#define TIME_AND_TSC( TITLE, CODE ) \
do { \
unsigned long i, j, tsc; \
\
polarssl_printf( HEADER_FORMAT, TITLE ); \
fflush( stdout ); \
\
set_alarm( 1 ); \
for( i = 1; ! alarmed; i++ ) \
{ \
CODE; \
} \
\
tsc = hardclock(); \
for( j = 0; j < 1024; j++ ) \
{ \
CODE; \
} \
\
polarssl_printf( "%9lu Kb/s, %9lu cycles/byte\n", i * BUFSIZE / 1024, \
( hardclock() - tsc ) / ( j * BUFSIZE ) ); \
} while( 0 )
#if defined(POLARSSL_ERROR_C)
#define PRINT_ERROR \
polarssl_strerror( ret, ( char * )tmp, sizeof( tmp ) ); \
polarssl_printf( "FAILED: %s\n", tmp );
#else
#define PRINT_ERROR \
polarssl_printf( "FAILED: -0x%04x\n", -ret );
#endif
#define TIME_PUBLIC( TITLE, TYPE, CODE ) \
do { \
unsigned long i; \
int ret; \
\
polarssl_printf( HEADER_FORMAT, TITLE ); \
fflush( stdout ); \
set_alarm( 3 ); \
\
ret = 0; \
for( i = 1; ! alarmed && ! ret ; i++ ) \
{ \
CODE; \
} \
\
if( ret != 0 ) \
{ \
PRINT_ERROR; \
} \
else \
polarssl_printf( "%9lu " TYPE "/s\n", i / 3 ); \
} while( 0 )
unsigned char buf[BUFSIZE]; unsigned char buf[BUFSIZE];
typedef struct { typedef struct {
@ -168,12 +173,6 @@ typedef struct {
rsa, dhm, ecdsa, ecdh; rsa, dhm, ecdsa, ecdh;
} todo_list; } todo_list;
#define OPTIONS \
"md4, md5, ripemd160, sha1, sha256, sha512,\n" \
"arc4, des3, des, aes_cbc, aes_gcm, aes_ccm, camellia, blowfish,\n" \
"havege, ctr_drbg, hmac_drbg\n" \
"rsa, dhm, ecdsa, ecdh.\n"
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
int keysize, i; int keysize, i;
@ -521,7 +520,6 @@ int main( int argc, char *argv[] )
#if defined(POLARSSL_DHM_C) && defined(POLARSSL_BIGNUM_C) #if defined(POLARSSL_DHM_C) && defined(POLARSSL_BIGNUM_C)
if( todo.dhm ) if( todo.dhm )
{ {
#define DHM_SIZES 3
int dhm_sizes[DHM_SIZES] = { 1024, 2048, 3072 }; int dhm_sizes[DHM_SIZES] = { 1024, 2048, 3072 };
const char *dhm_P[DHM_SIZES] = { const char *dhm_P[DHM_SIZES] = {
POLARSSL_DHM_RFC5114_MODP_1024_P, POLARSSL_DHM_RFC5114_MODP_1024_P,

View file

@ -58,11 +58,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_PK_PARSE_C) || !defined(POLARSSL_FS_IO) !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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_PK_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_PK_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );

View file

@ -50,11 +50,8 @@
#if !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \ #if !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \
!defined(POLARSSL_FS_IO) || !defined(POLARSSL_X509_CRL_PARSE_C) !defined(POLARSSL_FS_IO) || !defined(POLARSSL_X509_CRL_PARSE_C)
int main( int argc, char *argv[] ) int main( void )
{ {
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_RSA_C and/or POLARSSL_X509_CRT_PARSE_C " polarssl_printf("POLARSSL_RSA_C and/or POLARSSL_X509_CRT_PARSE_C "
"POLARSSL_FS_IO and/or POLARSSL_X509_CRL_PARSE_C " "POLARSSL_FS_IO and/or POLARSSL_X509_CRL_PARSE_C "
"not defined.\n"); "not defined.\n");
@ -85,16 +82,13 @@ const char *client_private_keys[MAX_CLIENT_CERTS] =
"cert_digest.key" "cert_digest.key"
}; };
int main( int argc, char *argv[] ) int main( void )
{ {
int ret, i; int ret, i;
x509_crt cacert; x509_crt cacert;
x509_crl crl; x509_crl crl;
char buf[10240]; char buf[10240];
((void) argc);
((void) argv);
x509_crt_init( &cacert ); x509_crt_init( &cacert );
x509_crl_init( &crl ); x509_crl_init( &crl );

View file

@ -86,11 +86,8 @@
!defined(POLARSSL_SSL_CLI_C) || !defined(POLARSSL_NET_C) || \ !defined(POLARSSL_SSL_CLI_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_CTR_DRBG_C) || \ !defined(POLARSSL_RSA_C) || !defined(POLARSSL_CTR_DRBG_C) || \
!defined(POLARSSL_X509_CRT_PARSE_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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or " "POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
"POLARSSL_SSL_CLI_C and/or POLARSSL_NET_C and/or " "POLARSSL_SSL_CLI_C and/or POLARSSL_NET_C and/or "

View file

@ -55,11 +55,8 @@
"\n" "\n"
#if !defined(POLARSSL_BASE64_C) || !defined(POLARSSL_FS_IO) #if !defined(POLARSSL_BASE64_C) || !defined(POLARSSL_FS_IO)
int main( int argc, char *argv[] ) int main( void )
{ {
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_BASE64_C and/or POLARSSL_FS_IO not defined.\n"); polarssl_printf("POLARSSL_BASE64_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -46,11 +46,8 @@
"\n where <errorcode> can be a decimal or hexadecimal (starts with 0x or -0x)\n" "\n where <errorcode> can be a decimal or hexadecimal (starts with 0x or -0x)\n"
#if !defined(POLARSSL_ERROR_C) && !defined(POLARSSL_ERROR_STRERROR_DUMMY) #if !defined(POLARSSL_ERROR_C) && !defined(POLARSSL_ERROR_STRERROR_DUMMY)
int main( int argc, char *argv[] ) int main( void )
{ {
((void) argc);
((void) argv);
polarssl_printf("POLARSSL_ERROR_C and/or POLARSSL_ERROR_STRERROR_DUMMY not defined.\n"); polarssl_printf("POLARSSL_ERROR_C and/or POLARSSL_ERROR_STRERROR_DUMMY not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -64,16 +64,33 @@
#define DFL_DEBUG_LEVEL 0 #define DFL_DEBUG_LEVEL 0
#define DFL_PERMISSIVE 0 #define DFL_PERMISSIVE 0
#define USAGE_IO \
" ca_file=%%s The single file containing the top-level CA(s) you fully trust\n" \
" default: \"\" (none)\n" \
" crl_file=%%s The single CRL file you want to use\n" \
" default: \"\" (none)\n" \
" ca_path=%%s The path containing the top-level CA(s) you fully trust\n" \
" default: \"\" (none) (overrides ca_file)\n"
#define USAGE \
"\n usage: cert_app param=<>...\n" \
"\n acceptable parameters:\n" \
" mode=file|ssl default: none\n" \
" filename=%%s default: cert.crt\n" \
USAGE_IO \
" server_name=%%s default: localhost\n" \
" server_port=%%d default: 4433\n" \
" debug_level=%%d default: 0 (disabled)\n" \
" permissive=%%d default: 0 (disabled)\n" \
"\n"
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \ !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \ !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_FS_IO) || \ !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_CTR_DRBG_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_ENTROPY_C and/or " 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_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C and/or " "POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
@ -143,26 +160,6 @@ static int my_verify( void *data, x509_crt *crt, int depth, int *flags )
return( 0 ); return( 0 );
} }
#define USAGE_IO \
" ca_file=%%s The single file containing the top-level CA(s) you fully trust\n" \
" default: \"\" (none)\n" \
" crl_file=%%s The single CRL file you want to use\n" \
" default: \"\" (none)\n" \
" ca_path=%%s The path containing the top-level CA(s) you fully trust\n" \
" default: \"\" (none) (overrides ca_file)\n"
#define USAGE \
"\n usage: cert_app param=<>...\n" \
"\n acceptable parameters:\n" \
" mode=file|ssl default: none\n" \
" filename=%%s default: cert.crt\n" \
USAGE_IO \
" server_name=%%s default: localhost\n" \
" server_port=%%d default: 4433\n" \
" debug_level=%%d default: 0 (disabled)\n" \
" permissive=%%d default: 0 (disabled)\n" \
"\n"
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
int ret = 0, server_fd; int ret = 0, server_fd;

View file

@ -83,11 +83,8 @@
#if !defined(POLARSSL_X509_CSR_WRITE_C) || !defined(POLARSSL_FS_IO) || \ #if !defined(POLARSSL_X509_CSR_WRITE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_PK_PARSE_C) || \ !defined(POLARSSL_PK_PARSE_C) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_CTR_DRBG_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_X509_CSR_WRITE_C and/or POLARSSL_FS_IO and/or " polarssl_printf( "POLARSSL_X509_CSR_WRITE_C and/or POLARSSL_FS_IO and/or "
"POLARSSL_PK_PARSE_C and/or " "POLARSSL_PK_PARSE_C and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C " "POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C "

View file

@ -124,11 +124,8 @@
!defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_FS_IO) || \ !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_CTR_DRBG_C) || \ !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_CTR_DRBG_C) || \
!defined(POLARSSL_ERROR_C) !defined(POLARSSL_ERROR_C)
int main( int argc, char *argv[] ) int main( void )
{ {
((void) argc);
((void) argv);
polarssl_printf( "POLARSSL_X509_CRT_WRITE_C and/or POLARSSL_X509_CRT_PARSE_C and/or " polarssl_printf( "POLARSSL_X509_CRT_WRITE_C and/or POLARSSL_X509_CRT_PARSE_C and/or "
"POLARSSL_FS_IO and/or " "POLARSSL_FS_IO and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C and/or " "POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C and/or "

View file

@ -53,11 +53,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_X509_CRL_PARSE_C) || !defined(POLARSSL_FS_IO) !defined(POLARSSL_X509_CRL_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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_X509_CRL_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_X509_CRL_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );

View file

@ -53,11 +53,8 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_X509_CSR_PARSE_C) || !defined(POLARSSL_FS_IO) !defined(POLARSSL_X509_CSR_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_printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_X509_CSR_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_X509_CSR_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );