- Fixed a whole bunch of dependencies on defines between files, examples and tests
diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c
index 95cdc1b..db4511e 100644
--- a/programs/test/benchmark.c
+++ b/programs/test/benchmark.c
@@ -57,6 +57,13 @@
unsigned char buf[BUFSIZE];
+#if !defined(POLARSSL_TIMING_C)
+int main( void )
+{
+ printf("POLARSSL_TIMING_C not defined.\n");
+ return( 0 );
+}
+#else
int main( void )
{
int keysize;
@@ -75,7 +82,8 @@
#if defined(POLARSSL_CAMELLIA_C)
camellia_context camellia;
#endif
-#if defined(POLARSSL_RSA_C)
+#if defined(POLARSSL_RSA_C) && defined(POLARSSL_BIGNUM_C) && \
+ defined(POLARSSL_GENPRIME)
rsa_context rsa;
#endif
@@ -263,7 +271,8 @@
}
#endif
-#if defined(POLARSSL_RSA_C)
+#if defined(POLARSSL_RSA_C) && defined(POLARSSL_BIGNUM_C) && \
+ defined(POLARSSL_GENPRIME)
rsa_init( &rsa, RSA_PKCS_V15, 0 );
rsa_gen_key( &rsa, myrand, NULL, 1024, 65537 );
@@ -361,3 +370,4 @@
return( 0 );
}
+#endif /* POLARSSL_TIMING_C */
diff --git a/programs/test/selftest.c b/programs/test/selftest.c
index 4c43620..508d39d 100644
--- a/programs/test/selftest.c
+++ b/programs/test/selftest.c
@@ -117,12 +117,12 @@
return( ret );
#endif
-#if defined(POLARSSL_RSA_C)
+#if defined(POLARSSL_RSA_C) && defined(POLARSSL_BIGNUM_C)
if( ( ret = rsa_self_test( v ) ) != 0 )
return( ret );
#endif
-#if defined(POLARSSL_X509_PARSE_C)
+#if defined(POLARSSL_X509_PARSE_C) && defined(POLARSSL_BIGNUM_C)
if( ( ret = x509_self_test( v ) ) != 0 )
return( ret );
#endif
diff --git a/programs/test/ssl_cert_test.c b/programs/test/ssl_cert_test.c
index 6166150..1e5126b 100644
--- a/programs/test/ssl_cert_test.c
+++ b/programs/test/ssl_cert_test.c
@@ -30,6 +30,8 @@
#include <string.h>
#include <stdio.h>
+#include "polarssl/config.h"
+
#include "polarssl/certs.h"
#include "polarssl/x509.h"
@@ -63,6 +65,15 @@
"cert_digest.key"
};
+#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
+ !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO)
+int main( void )
+{
+ 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( void )
{
int ret, i;
@@ -232,3 +243,5 @@
return( ret );
}
+#endif /* POLARSSL_BIGNUM_C && POLARSSL_RSA_C && POLARSSL_X509_PARSE_C &&
+ POLARSSL_FS_IO */
diff --git a/programs/test/ssl_test.c b/programs/test/ssl_test.c
index f294e2c..643b1e1 100644
--- a/programs/test/ssl_test.c
+++ b/programs/test/ssl_test.c
@@ -31,6 +31,8 @@
#include <stdlib.h>
#include <stdio.h>
+#include "polarssl/config.h"
+
#include "polarssl/net.h"
#include "polarssl/ssl.h"
#include "polarssl/havege.h"
@@ -121,6 +123,19 @@
fprintf( stderr, "%s", str );
}
+#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
+ !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_SRV_C) || \
+ !defined(POLARSSL_SSL_CLI_C) || !defined(POLARSSL_NET_C) || \
+ !defined(POLARSSL_RSA_C)
+int main( void )
+{
+ printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_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_RSA_C not defined.\n");
+ return( 0 );
+}
+#else
/*
* perform a single SSL connection
*/
@@ -180,6 +195,10 @@
if( opt->opmode == OPMODE_SERVER )
{
+#if !defined(POLARSSL_CERTS_C)
+ printf("POLARSSL_CERTS_C not defined.\n");
+ goto exit;
+#else
ret = x509parse_crt( &srvcert, (unsigned char *) test_srv_crt,
strlen( test_srv_crt ) );
if( ret != 0 )
@@ -203,6 +222,7 @@
printf( " ! x509parse_key returned %d\n\n", ret );
goto exit;
}
+#endif
if( server_fd < 0 )
{
@@ -571,3 +591,6 @@
return( ret );
}
+#endif /* POLARSSL_BIGNUM_C && POLARSSL_HAVEGE_C && POLARSSL_SSL_TLS_C &&
+ POLARSSL_SSL_SRV_C && POLARSSL_SSL_CLI_C && POLARSSL_NET_C &&
+ POLARSSL_RSA_C */