1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +03:00

Merge pull request #5563 from AndrzejKurek/timeless-2.28

Backport 2.28: Fix builds with MBEDTLS_HAVE_TIME disabled and test
This commit is contained in:
Dave Rodgman
2022-03-15 16:43:18 +00:00
committed by GitHub
19 changed files with 153 additions and 11 deletions

View File

@ -107,7 +107,9 @@ static int wsa_init_done = 0;
#include <stdio.h>
#if defined(MBEDTLS_HAVE_TIME)
#include <time.h>
#endif
#include <stdint.h>

View File

@ -56,17 +56,18 @@ struct _hr_time
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
#include <signal.h>
#if defined(MBEDTLS_HAVE_TIME)
#include <time.h>
#include <sys/time.h>
struct _hr_time
{
struct timeval start;
};
#endif
#endif /* _WIN32 && !EFIX64 && !EFI32 */
#if defined(MBEDTLS_HAVE_TIME)
#if !defined(HAVE_HARDCLOCK) && defined(MBEDTLS_HAVE_ASM) && \
( defined(_MSC_VER) && defined(_M_IX86) ) || defined(__WATCOMC__)
@ -364,7 +365,6 @@ int mbedtls_timing_get_delay( void *data )
return( 0 );
}
#endif /* !MBEDTLS_TIMING_ALT */
#if defined(MBEDTLS_SELF_TEST)
@ -527,4 +527,44 @@ hard_test_done:
#endif /* MBEDTLS_SELF_TEST */
#else
volatile int mbedtls_timing_alarmed = 0;
int mbedtls_timing_get_delay( void *data )
{
(void) data;
return( 0 );
}
void mbedtls_timing_set_delay( void *data, uint32_t int_ms, uint32_t fin_ms )
{
(void) data;
(void) int_ms;
(void) fin_ms;
}
unsigned long mbedtls_timing_get_timer( struct mbedtls_timing_hr_time *val, int reset )
{
(void) val;
(void) reset;
return( 0 );
}
unsigned long mbedtls_timing_hardclock( void )
{
return( 0 );
}
void mbedtls_set_alarm( int seconds )
{
(void) seconds;
}
#if defined(MBEDTLS_SELF_TEST)
int mbedtls_timing_self_test( int verbose )
{
(void) verbose;
return( 0 );
}
#endif /* MBEDTLS_SELF_TEST */
#endif /* MBEDTLS_HAVE_TIME */
#endif /* !MBEDTLS_TIMING_ALT */
#endif /* MBEDTLS_TIMING_C */

View File

@ -52,11 +52,13 @@
#define mbedtls_snprintf snprintf
#endif
#if defined(MBEDTLS_HAVE_TIME)
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
#include <windows.h>
#else
#include <time.h>
#endif
#endif
#if defined(MBEDTLS_FS_IO) || defined(EFIX64) || defined(EFI32)
#include <stdio.h>

View File

@ -63,11 +63,13 @@
#include "mbedtls/threading.h"
#endif
#if defined(MBEDTLS_HAVE_TIME)
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
#include <windows.h>
#else
#include <time.h>
#endif
#endif
#if defined(MBEDTLS_FS_IO)
#include <stdio.h>