mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 14:44:15 +01:00
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
6f63cc7188
commit
2db000feb6
@ -44,7 +44,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"
|
||||
@ -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 );
|
||||
|
@ -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,
|
||||
|
@ -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 )
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user