programs/ssl: Fix compile errors when MBEDTLS_HAVE_TIME is not defined
Signed-off-by: Raoul Strackx <raoul.strackx@fortanix.com> [dja: add some more fixes, tweak title] Signed-off-by: Daniel Axtens <dja@axtens.net>
This commit is contained in:
parent
446af202f6
commit
9ed9bc9377
@ -42,7 +42,9 @@ int main( void )
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
#include <time.h>
|
||||
#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 );
|
||||
|
@ -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,
|
||||
|
@ -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 )
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user