- Fixed a whole bunch of dependencies on defines between files, examples and tests
diff --git a/programs/pkey/mpi_demo.c b/programs/pkey/mpi_demo.c
index b29f9a1..509a4c9 100644
--- a/programs/pkey/mpi_demo.c
+++ b/programs/pkey/mpi_demo.c
@@ -29,8 +29,16 @@
#include <stdio.h>
+#include "polarssl/config.h"
#include "polarssl/bignum.h"
+#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_FS_IO)
+int main( void )
+{
+ printf("POLARSSL_BIGNUM_C and/or POLARSSL_FS_IO not defined.\n");
+ return( 0 );
+}
+#else
int main( void )
{
mpi E, P, Q, N, H, D, X, Y, Z;
@@ -52,6 +60,7 @@
mpi_write_file( " P = ", &P, 10, NULL );
mpi_write_file( " Q = ", &Q, 10, NULL );
+#if defined(POLARSSL_GENPRIME)
mpi_sub_int( &P, &P, 1 );
mpi_sub_int( &Q, &Q, 1 );
mpi_mul_mpi( &H, &P, &Q );
@@ -59,7 +68,9 @@
mpi_write_file( " D = E^-1 mod (P-1)*(Q-1) = ",
&D, 10, NULL );
-
+#else
+ printf("\nTest skipped (POLARSSL_GENPRIME not defined).\n\n");
+#endif
mpi_read_string( &X, 10, "55555" );
mpi_exp_mod( &Y, &X, &E, &N, NULL );
mpi_exp_mod( &Z, &Y, &D, &N, NULL );
@@ -81,3 +92,4 @@
return( 0 );
}
+#endif /* POLARSSL_BIGNUM_C && POLARSSL_FS_IO */