diff --git a/programs/ssl/ssl_context_info.c b/programs/ssl/ssl_context_info.c index 62c3cc52b..cc889d46c 100644 --- a/programs/ssl/ssl_context_info.c +++ b/programs/ssl/ssl_context_info.c @@ -42,7 +42,9 @@ int main( void ) #include #include #include +#if defined(MBEDTLS_HAVE_TIME) #include +#endif #include "mbedtls/ssl.h" #include "mbedtls/error.h" #include "mbedtls/base64.h" @@ -307,6 +309,7 @@ void print_hex( const uint8_t *b, size_t len, /* * Print the value of time_t in format e.g. 2020-01-23 13:05:59 */ +#if defined(MBEDTLS_HAVE_TIME) void print_time( const time_t *time ) { char buf[20]; @@ -322,6 +325,7 @@ void print_time( const time_t *time ) printf( "unknown\n" ); } } +#endif /* * Print the input string if the bit is set in the value @@ -608,7 +612,12 @@ void print_deserialized_ssl_session( const uint8_t *ssl, uint32_t len, ( (uint64_t) ssl[7] ); ssl += 8; printf( "\tstart time : " ); +#if defined(MBEDTLS_HAVE_TIME) print_time( (time_t*) &start ); +#else + (void) start; + printf( "not supported\n" ); +#endif } CHECK_SSL_END( 2 ); diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index 595300e85..60958e6c6 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -2723,8 +2723,10 @@ int main( int argc, char *argv[] ) if( opt.cache_max != -1 ) mbedtls_ssl_cache_set_max_entries( &cache, opt.cache_max ); +#if defined(MBEDTLS_HAVE_TIME) if( opt.cache_timeout != -1 ) mbedtls_ssl_cache_set_timeout( &cache, opt.cache_timeout ); +#endif mbedtls_ssl_conf_session_cache( &conf, &cache, mbedtls_ssl_cache_get, diff --git a/programs/ssl/ssl_test_lib.c b/programs/ssl/ssl_test_lib.c index 04e127a85..a28a47769 100644 --- a/programs/ssl/ssl_test_lib.c +++ b/programs/ssl/ssl_test_lib.c @@ -46,11 +46,13 @@ void my_debug( void *ctx, int level, fflush( (FILE *) ctx ); } +#if defined(MBEDTLS_HAVE_TIME) mbedtls_time_t dummy_constant_time( mbedtls_time_t* time ) { (void) time; return 0x5af2a056; } +#endif #if !defined(MBEDTLS_TEST_USE_PSA_CRYPTO_RNG) static int dummy_entropy( void *data, unsigned char *output, size_t len ) diff --git a/programs/ssl/ssl_test_lib.h b/programs/ssl/ssl_test_lib.h index ff024924f..b3c4cfa0f 100644 --- a/programs/ssl/ssl_test_lib.h +++ b/programs/ssl/ssl_test_lib.h @@ -129,7 +129,9 @@ void my_debug( void *ctx, int level, const char *file, int line, const char *str ); +#if defined(MBEDTLS_HAVE_TIME) mbedtls_time_t dummy_constant_time( mbedtls_time_t* time ); +#endif #if defined(MBEDTLS_USE_PSA_CRYPTO) /* If MBEDTLS_TEST_USE_PSA_CRYPTO_RNG is defined, the SSL test programs will use