ssl_client/server2 shouln't depend on timing.c

Would break test-ref-configs.pl.
This commit is contained in:
Manuel Pégourié-Gonnard 2015-05-13 13:58:56 +02:00
parent 0c89035d4d
commit d2377e7e78
2 changed files with 16 additions and 10 deletions

View File

@ -38,14 +38,12 @@
#if !defined(MBEDTLS_ENTROPY_C) || \ #if !defined(MBEDTLS_ENTROPY_C) || \
!defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_CLI_C) || \ !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_CLI_C) || \
!defined(MBEDTLS_NET_C) || !defined(MBEDTLS_CTR_DRBG_C) || \ !defined(MBEDTLS_NET_C) || !defined(MBEDTLS_CTR_DRBG_C)
!defined(MBEDTLS_TIMING_C)
int main( void ) int main( void )
{ {
mbedtls_printf("MBEDTLS_ENTROPY_C and/or " mbedtls_printf("MBEDTLS_ENTROPY_C and/or "
"MBEDTLS_SSL_TLS_C and/or MBEDTLS_SSL_CLI_C and/or " "MBEDTLS_SSL_TLS_C and/or MBEDTLS_SSL_CLI_C and/or "
"MBEDTLS_NET_C and/or MBEDTLS_CTR_DRBG_C and/or " "MBEDTLS_NET_C and/or MBEDTLS_CTR_DRBG_C and/or not defined.\n");
"MBEDTLS_TIMING_C not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
@ -392,7 +390,9 @@ int main( int argc, char *argv[] )
mbedtls_ssl_context ssl; mbedtls_ssl_context ssl;
mbedtls_ssl_config conf; mbedtls_ssl_config conf;
mbedtls_ssl_session saved_session; mbedtls_ssl_session saved_session;
#if defined(MBEDTLS_TIMING_C)
mbedtls_timing_delay_context timer; mbedtls_timing_delay_context timer;
#endif
#if defined(MBEDTLS_X509_CRT_PARSE_C) #if defined(MBEDTLS_X509_CRT_PARSE_C)
uint32_t flags; uint32_t flags;
mbedtls_x509_crt cacert; mbedtls_x509_crt cacert;
@ -1188,8 +1188,10 @@ int main( int argc, char *argv[] )
#endif #endif
); );
#if defined(MBEDTLS_TIMING_C)
mbedtls_ssl_set_timer_cb( &ssl, &timer, mbedtls_timing_set_delay, mbedtls_ssl_set_timer_cb( &ssl, &timer, mbedtls_timing_set_delay,
mbedtls_timing_get_delay ); mbedtls_timing_get_delay );
#endif
mbedtls_printf( " ok\n" ); mbedtls_printf( " ok\n" );
@ -1488,8 +1490,10 @@ reconnect:
mbedtls_net_close( server_fd ); mbedtls_net_close( server_fd );
#if defined(MBEDTLS_TIMING_C)
if( opt.reco_delay > 0 ) if( opt.reco_delay > 0 )
mbedtls_timing_m_sleep( 1000 * opt.reco_delay ); mbedtls_timing_m_sleep( 1000 * opt.reco_delay );
#endif
mbedtls_printf( " . Reconnecting with saved session..." ); mbedtls_printf( " . Reconnecting with saved session..." );
fflush( stdout ); fflush( stdout );
@ -1580,4 +1584,4 @@ exit:
} }
#endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C && #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C &&
MBEDTLS_SSL_CLI_C && MBEDTLS_NET_C && MBEDTLS_RSA_C && MBEDTLS_SSL_CLI_C && MBEDTLS_NET_C && MBEDTLS_RSA_C &&
MBEDTLS_CTR_DRBG_C && MBEDTLS_TIMING_C */ MBEDTLS_CTR_DRBG_C MBEDTLS_TIMING_C */

View File

@ -38,14 +38,12 @@
#if !defined(MBEDTLS_ENTROPY_C) || \ #if !defined(MBEDTLS_ENTROPY_C) || \
!defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_SRV_C) || \ !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_SRV_C) || \
!defined(MBEDTLS_NET_C) || !defined(MBEDTLS_CTR_DRBG_C) || \ !defined(MBEDTLS_NET_C) || !defined(MBEDTLS_CTR_DRBG_C)
!defined(MBEDTLS_TIMING_C)
int main( void ) int main( void )
{ {
mbedtls_printf("MBEDTLS_ENTROPY_C and/or " mbedtls_printf("MBEDTLS_ENTROPY_C and/or "
"MBEDTLS_SSL_TLS_C and/or MBEDTLS_SSL_SRV_C and/or " "MBEDTLS_SSL_TLS_C and/or MBEDTLS_SSL_SRV_C and/or "
"MBEDTLS_NET_C and/or MBEDTLS_CTR_DRBG_C and/or " "MBEDTLS_NET_C and/or MBEDTLS_CTR_DRBG_C and/or not defined.\n");
"MBEDTLS_TIMING_C not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
@ -720,7 +718,9 @@ int main( int argc, char *argv[] )
mbedtls_ctr_drbg_context ctr_drbg; mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ssl_context ssl; mbedtls_ssl_context ssl;
mbedtls_ssl_config conf; mbedtls_ssl_config conf;
#if defined(MBEDTLS_TIMING_C)
mbedtls_timing_delay_context timer; mbedtls_timing_delay_context timer;
#endif
#if defined(MBEDTLS_SSL_RENEGOTIATION) #if defined(MBEDTLS_SSL_RENEGOTIATION)
unsigned char renego_period[8] = { 0 }; unsigned char renego_period[8] = { 0 };
#endif #endif
@ -1751,8 +1751,10 @@ int main( int argc, char *argv[] )
#endif #endif
); );
#if defined(MBEDTLS_TIMING_C)
mbedtls_ssl_set_timer_cb( &ssl, &timer, mbedtls_timing_set_delay, mbedtls_ssl_set_timer_cb( &ssl, &timer, mbedtls_timing_set_delay,
mbedtls_timing_get_delay ); mbedtls_timing_get_delay );
#endif
mbedtls_printf( " ok\n" ); mbedtls_printf( " ok\n" );
@ -2228,4 +2230,4 @@ exit:
} }
#endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C && #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C &&
MBEDTLS_SSL_SRV_C && MBEDTLS_NET_C && MBEDTLS_RSA_C && MBEDTLS_SSL_SRV_C && MBEDTLS_NET_C && MBEDTLS_RSA_C &&
MBEDTLS_CTR_DRBG_C && MBEDTLS_TIMING_C */ MBEDTLS_CTR_DRBG_C */