diff --git a/programs/ssl/ssl_context_info.c b/programs/ssl/ssl_context_info.c index 7018080d4..349e755ed 100644 --- a/programs/ssl/ssl_context_info.c +++ b/programs/ssl/ssl_context_info.c @@ -44,7 +44,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" @@ -310,6 +312,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]; @@ -325,6 +328,7 @@ void print_time( const time_t *time ) printf( "unknown\n" ); } } +#endif /* * Print the input string if the bit is set in the value @@ -609,7 +613,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 4db64a59f..4bf6ef0fd 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -2705,8 +2705,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 1bb9d6162..70cddfa75 100644 --- a/programs/ssl/ssl_test_lib.c +++ b/programs/ssl/ssl_test_lib.c @@ -44,11 +44,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 98751a0f0..b1a24087d 100644 --- a/programs/ssl/ssl_test_lib.h +++ b/programs/ssl/ssl_test_lib.h @@ -138,7 +138,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