From 7831b0cb3c2b0c8937e904a4b5a640b1cb9d76af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 20 Sep 2013 12:29:56 +0200 Subject: [PATCH] A few more issues with small configurations --- programs/test/ssl_cert_test.c | 31 +++++++++++++++---------------- programs/util/pem2der.c | 20 ++++++++++---------- programs/x509/cert_write.c | 12 ++++++------ 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/programs/test/ssl_cert_test.c b/programs/test/ssl_cert_test.c index 25397d0d7..a8362d316 100644 --- a/programs/test/ssl_cert_test.c +++ b/programs/test/ssl_cert_test.c @@ -32,6 +32,19 @@ #include "polarssl/config.h" +#if !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \ + !defined(POLARSSL_FS_IO) +int main( int argc, char *argv[] ) +{ + ((void) argc); + ((void) argv); + + printf("POLARSSL_RSA_C and/or POLARSSL_X509_CRT_PARSE_C " + "not defined.\n"); + return( 0 ); +} +#else + #include "polarssl/certs.h" #include "polarssl/x509_crt.h" @@ -39,6 +52,7 @@ #define snprintf _snprintf #endif + #define MAX_CLIENT_CERTS 8 const char *client_certificates[MAX_CLIENT_CERTS] = @@ -65,20 +79,6 @@ const char *client_private_keys[MAX_CLIENT_CERTS] = "cert_digest.key" }; -#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ - !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PK_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_CRT_PARSE_C and/or POLARSSL_FS_IO and/or " - "POLARSSL_PK_PARSE_C not defined.\n"); - return( 0 ); -} -#else int main( int argc, char *argv[] ) { int ret, i; @@ -261,5 +261,4 @@ exit: return( ret ); } -#endif /* POLARSSL_BIGNUM_C && POLARSSL_RSA_C && POLARSSL_X509_CRT_PARSE_C && - POLARSSL_FS_IO && POLARSSL_PK_PARSE_C */ +#endif /* POLARSSL_RSA_C && POLARSSL_X509_CRT_PARSE_C && POLARSSL_FS_IO */ diff --git a/programs/util/pem2der.c b/programs/util/pem2der.c index 0315f02ea..08df67169 100644 --- a/programs/util/pem2der.c +++ b/programs/util/pem2der.c @@ -39,6 +39,16 @@ #define DFL_FILENAME "file.pem" #define DFL_OUTPUT_FILENAME "file.der" +#if !defined(POLARSSL_BASE64_C) || !defined(POLARSSL_FS_IO) +int main( int argc, char *argv[] ) +{ + ((void) argc); + ((void) argv); + + printf("POLARSSL_BASE64_C and/or POLARSSL_FS_IO not defined.\n"); + return( 0 ); +} +#else /* * global options */ @@ -161,16 +171,6 @@ static int write_file( const char *path, unsigned char *buf, size_t n ) " output_file=%%s default: file.der\n" \ "\n" -#if !defined(POLARSSL_BASE64_C) || !defined(POLARSSL_FS_IO) -int main( int argc, char *argv[] ) -{ - ((void) argc); - ((void) argv); - - printf("POLARSSL_BASE64_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/cert_write.c b/programs/x509/cert_write.c index 2fd415a2c..1d9c14489 100644 --- a/programs/x509/cert_write.c +++ b/programs/x509/cert_write.c @@ -33,12 +33,6 @@ #include "polarssl/config.h" -#include "polarssl/x509_crt.h" -#include "polarssl/x509_csr.h" -#include "polarssl/entropy.h" -#include "polarssl/ctr_drbg.h" -#include "polarssl/error.h" - #if !defined(POLARSSL_X509_CRT_WRITE_C) || \ !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_FS_IO) || \ !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_CTR_DRBG_C) || \ @@ -56,6 +50,12 @@ int main( int argc, char *argv[] ) } #else +#include "polarssl/x509_crt.h" +#include "polarssl/x509_csr.h" +#include "polarssl/entropy.h" +#include "polarssl/ctr_drbg.h" +#include "polarssl/error.h" + #define DFL_ISSUER_CRT "" #define DFL_REQUEST_FILE "" #define DFL_SUBJECT_KEY "subject.key"