Misc selftest adjustements
diff --git a/include/polarssl/ecp.h b/include/polarssl/ecp.h
index 1cafc46..3942891 100644
--- a/include/polarssl/ecp.h
+++ b/include/polarssl/ecp.h
@@ -621,12 +621,14 @@
int ecp_gen_key( ecp_group_id grp_id, ecp_keypair *key,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
+#if defined(POLARSSL_SELF_TEST)
/**
* \brief Checkup routine
*
- * \return 0 if successful, or 1 if the test failed
+ * \return 0 if successful, or 1 if a test failed
*/
int ecp_self_test( int verbose );
+#endif
#ifdef __cplusplus
}
diff --git a/library/pkcs5.c b/library/pkcs5.c
index c4cdf03..2845f68 100644
--- a/library/pkcs5.c
+++ b/library/pkcs5.c
@@ -361,9 +361,13 @@
if( ( ret = md_init_ctx( &sha1_ctx, info_sha1 ) ) != 0 )
return( 1 );
+ if( verbose != 0 )
+ polarssl_printf( " PBKDF2 warning: test #3 may be slow!\n" );
+
for( i = 0; i < MAX_TESTS; i++ )
{
- polarssl_printf( " PBKDF2 (SHA1) #%d: ", i );
+ if( verbose != 0 )
+ polarssl_printf( " PBKDF2 (SHA1) #%d: ", i );
ret = pkcs5_pbkdf2_hmac( &sha1_ctx, password[i], plen[i], salt[i],
slen[i], it_cnt[i], key_len[i], key );
diff --git a/programs/test/selftest.c b/programs/test/selftest.c
index 6f73608..82477e5 100644
--- a/programs/test/selftest.c
+++ b/programs/test/selftest.c
@@ -173,16 +173,6 @@
return( ret );
#endif
-#if defined(POLARSSL_PBKDF2_C)
- if( ( ret = pbkdf2_self_test( v ) ) != 0 )
- return( ret );
-#else
-#if defined(POLARSSL_PKCS5_C)
- if( ( ret = pkcs5_self_test( v ) ) != 0 )
- return( ret );
-#endif
-#endif
-
#if defined(POLARSSL_ECP_C)
if( ( ret = ecp_self_test( v ) ) != 0 )
return( ret );
@@ -193,6 +183,18 @@
return( ret );
#endif
+/* Slow tests last */
+
+#if defined(POLARSSL_PBKDF2_C)
+ if( ( ret = pbkdf2_self_test( v ) ) != 0 )
+ return( ret );
+#else
+#if defined(POLARSSL_PKCS5_C)
+ if( ( ret = pkcs5_self_test( v ) ) != 0 )
+ return( ret );
+#endif
+#endif
+
#if defined(POLARSSL_TIMING_C)
if( ( ret = timing_self_test( v ) ) != 0 )
return( ret );