Simplify ifdef checks in programs/x509

This commit is contained in:
Manuel Pégourié-Gonnard 2015-03-31 15:10:03 +02:00
parent 88fca3ef0e
commit 8d649c66b3
5 changed files with 63 additions and 79 deletions

View File

@ -34,11 +34,22 @@
#define polarssl_printf printf #define polarssl_printf printf
#endif #endif
#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( void )
{
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 "
"POLARSSL_X509_CRT_PARSE_C and/or POLARSSL_FS_IO and/or "
"POLARSSL_CTR_DRBG_C not defined.\n");
return( 0 );
}
#else
#include "polarssl/entropy.h" #include "polarssl/entropy.h"
#include "polarssl/ctr_drbg.h" #include "polarssl/ctr_drbg.h"
#include "polarssl/net.h" #include "polarssl/net.h"
@ -48,7 +59,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#endif
#define MODE_NONE 0 #define MODE_NONE 0
#define MODE_FILE 1 #define MODE_FILE 1
@ -84,21 +94,6 @@
" permissive=%%d default: 0 (disabled)\n" \ " permissive=%%d default: 0 (disabled)\n" \
"\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_CRT_PARSE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_CTR_DRBG_C)
int main( void )
{
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 "
"POLARSSL_X509_CRT_PARSE_C and/or POLARSSL_FS_IO and/or "
"POLARSSL_CTR_DRBG_C not defined.\n");
return( 0 );
}
#else
/* /*
* global options * global options
*/ */

View File

@ -33,9 +33,19 @@
#define polarssl_printf printf #define polarssl_printf printf
#endif #endif
#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( void )
{
polarssl_printf( "POLARSSL_X509_CSR_WRITE_C and/or POLARSSL_FS_IO and/or "
"POLARSSL_PK_PARSE_C and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C "
"not defined.\n");
return( 0 );
}
#else
#include "polarssl/x509_csr.h" #include "polarssl/x509_csr.h"
#include "polarssl/entropy.h" #include "polarssl/entropy.h"
#include "polarssl/ctr_drbg.h" #include "polarssl/ctr_drbg.h"
@ -44,7 +54,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#endif
#define DFL_FILENAME "keyfile.key" #define DFL_FILENAME "keyfile.key"
#define DFL_DEBUG_LEVEL 0 #define DFL_DEBUG_LEVEL 0
@ -80,18 +89,6 @@
" object_signing_ca\n" \ " object_signing_ca\n" \
"\n" "\n"
#if !defined(POLARSSL_X509_CSR_WRITE_C) || !defined(POLARSSL_FS_IO) || \
!defined(POLARSSL_PK_PARSE_C) || \
!defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_CTR_DRBG_C)
int main( void )
{
polarssl_printf( "POLARSSL_X509_CSR_WRITE_C and/or POLARSSL_FS_IO and/or "
"POLARSSL_PK_PARSE_C and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C "
"not defined.\n");
return( 0 );
}
#else
/* /*
* global options * global options
*/ */

View File

@ -33,10 +33,20 @@
#define polarssl_printf printf #define polarssl_printf printf
#endif #endif
#if defined(POLARSSL_X509_CRT_WRITE_C) && \ #if !defined(POLARSSL_X509_CRT_WRITE_C) || \
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( void )
{
polarssl_printf( "POLARSSL_X509_CRT_WRITE_C and/or POLARSSL_X509_CRT_PARSE_C and/or "
"POLARSSL_FS_IO and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C and/or "
"POLARSSL_ERROR_C not defined.\n");
return( 0 );
}
#else
#include "polarssl/x509_crt.h" #include "polarssl/x509_crt.h"
#include "polarssl/x509_csr.h" #include "polarssl/x509_csr.h"
#include "polarssl/entropy.h" #include "polarssl/entropy.h"
@ -46,7 +56,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#endif
#if defined(POLARSSL_X509_CSR_PARSE_C) #if defined(POLARSSL_X509_CSR_PARSE_C)
#define USAGE_CSR \ #define USAGE_CSR \
@ -120,19 +129,6 @@
" object_signing_ca\n" \ " object_signing_ca\n" \
"\n" "\n"
#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) || \
!defined(POLARSSL_ERROR_C)
int main( void )
{
polarssl_printf( "POLARSSL_X509_CRT_WRITE_C and/or POLARSSL_X509_CRT_PARSE_C and/or "
"POLARSSL_FS_IO and/or "
"POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C and/or "
"POLARSSL_ERROR_C not defined.\n");
return( 0 );
}
#else
/* /*
* global options * global options
*/ */

View File

@ -33,14 +33,21 @@
#define polarssl_printf printf #define polarssl_printf printf
#endif #endif
#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( void )
{
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");
return( 0 );
}
#else
#include "polarssl/x509_crl.h" #include "polarssl/x509_crl.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#endif
#define DFL_FILENAME "crl.pem" #define DFL_FILENAME "crl.pem"
#define DFL_DEBUG_LEVEL 0 #define DFL_DEBUG_LEVEL 0
@ -51,15 +58,6 @@
" filename=%%s default: crl.pem\n" \ " filename=%%s default: crl.pem\n" \
"\n" "\n"
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_X509_CRL_PARSE_C) || !defined(POLARSSL_FS_IO)
int main( void )
{
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");
return( 0 );
}
#else
/* /*
* global options * global options
*/ */

View File

@ -33,14 +33,21 @@
#define polarssl_printf printf #define polarssl_printf printf
#endif #endif
#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( void )
{
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");
return( 0 );
}
#else
#include "polarssl/x509_csr.h" #include "polarssl/x509_csr.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#endif
#define DFL_FILENAME "cert.req" #define DFL_FILENAME "cert.req"
#define DFL_DEBUG_LEVEL 0 #define DFL_DEBUG_LEVEL 0
@ -51,15 +58,6 @@
" filename=%%s default: cert.req\n" \ " filename=%%s default: cert.req\n" \
"\n" "\n"
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_X509_CSR_PARSE_C) || !defined(POLARSSL_FS_IO)
int main( void )
{
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");
return( 0 );
}
#else
/* /*
* global options * global options
*/ */