From 80d44fee2ef59f3a7ecec4048afcb4fdb3ecd122 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Mon, 9 Sep 2013 15:59:20 +0200 Subject: [PATCH] Moved 'define handling code' to top --- programs/x509/cert_app.c | 37 +++++++++++++++++++------------------ programs/x509/cert_req.c | 25 +++++++++++++------------ programs/x509/crl_app.c | 25 +++++++++++++------------ programs/x509/req_app.c | 25 +++++++++++++------------ 4 files changed, 58 insertions(+), 54 deletions(-) diff --git a/programs/x509/cert_app.c b/programs/x509/cert_app.c index 40d76d8e8..0096735bd 100644 --- a/programs/x509/cert_app.c +++ b/programs/x509/cert_app.c @@ -39,6 +39,25 @@ #include "polarssl/ssl.h" #include "polarssl/x509.h" +#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \ + !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \ + !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \ + !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) || \ + !defined(POLARSSL_CTR_DRBG_C) +int main( int argc, char *argv[] ) +{ + ((void) argc); + ((void) argv); + + 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 " + "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO and/or " + "POLARSSL_CTR_DRBG_C not defined.\n"); + return( 0 ); +} +#else + #define MODE_NONE 0 #define MODE_FILE 1 #define MODE_SSL 2 @@ -130,24 +149,6 @@ static int my_verify( void *data, x509_cert *crt, int depth, int *flags ) " permissive=%%d default: 0 (disabled)\n" \ "\n" -#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \ - !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \ - !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \ - !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) || \ - !defined(POLARSSL_CTR_DRBG_C) -int main( int argc, char *argv[] ) -{ - ((void) argc); - ((void) argv); - - 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 " - "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO and/or " - "POLARSSL_CTR_DRBG_C not defined.\n"); - return( 0 ); -} -#else int main( int argc, char *argv[] ) { int ret = 0, server_fd; diff --git a/programs/x509/cert_req.c b/programs/x509/cert_req.c index 1e402fc96..29a0da144 100644 --- a/programs/x509/cert_req.c +++ b/programs/x509/cert_req.c @@ -40,6 +40,19 @@ #include "polarssl/x509write.h" #include "polarssl/oid.h" +#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ + !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) +int main( int argc, char *argv[] ) +{ + ((void) argc); + ((void) argv); + + printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " + "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); + return( 0 ); +} +#else + #define DFL_FILENAME "keyfile.key" #define DFL_DEBUG_LEVEL 0 #define DFL_OUTPUT_FILENAME "cert.req" @@ -111,18 +124,6 @@ int write_certificate_request( x509write_csr *req, char *output_file ) " object_signing_ca\n" \ "\n" -#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ - !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) -int main( int argc, char *argv[] ) -{ - ((void) argc); - ((void) argv); - - printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " - "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); - return( 0 ); -} -#else int main( int argc, char *argv[] ) { int ret = 0; diff --git a/programs/x509/crl_app.c b/programs/x509/crl_app.c index b98e743dd..c9c3ef0d8 100644 --- a/programs/x509/crl_app.c +++ b/programs/x509/crl_app.c @@ -35,6 +35,19 @@ #include "polarssl/x509.h" +#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ + !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) +int main( int argc, char *argv[] ) +{ + ((void) argc); + ((void) argv); + + printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " + "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); + return( 0 ); +} +#else + #define DFL_FILENAME "crl.pem" #define DFL_DEBUG_LEVEL 0 @@ -52,18 +65,6 @@ struct options " filename=%%s default: crl.pem\n" \ "\n" -#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ - !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) -int main( int argc, char *argv[] ) -{ - ((void) argc); - ((void) argv); - - printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " - "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); - return( 0 ); -} -#else int main( int argc, char *argv[] ) { int ret = 0; diff --git a/programs/x509/req_app.c b/programs/x509/req_app.c index 8c0e3fed5..e2faab43b 100644 --- a/programs/x509/req_app.c +++ b/programs/x509/req_app.c @@ -35,6 +35,19 @@ #include "polarssl/x509.h" +#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ + !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) +int main( int argc, char *argv[] ) +{ + ((void) argc); + ((void) argv); + + printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " + "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); + return( 0 ); +} +#else + #define DFL_FILENAME "cert.req" #define DFL_DEBUG_LEVEL 0 @@ -52,18 +65,6 @@ struct options " filename=%%s default: cert.req\n" \ "\n" -#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ - !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) -int main( int argc, char *argv[] ) -{ - ((void) argc); - ((void) argv); - - printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " - "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); - return( 0 ); -} -#else int main( int argc, char *argv[] ) { int ret = 0;