diff --git a/library/platform_util.c b/library/platform_util.c index 3d5cb5baa..1d34e768c 100644 --- a/library/platform_util.c +++ b/library/platform_util.c @@ -92,9 +92,11 @@ void mbedtls_platform_zeroize( void *buf, size_t len ) * threading.h. However, this macro is not part of the Mbed TLS public API, so * we keep it private by only defining it in this file */ -#if ! ( defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) ) +#if ! ( defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) ) || \ + ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) ) #define PLATFORM_UTIL_USE_GMTIME -#endif /* ! ( defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) ) */ +#endif /* ! ( defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) ) || \ + (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) ) */ #endif /* !( ( defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L ) || \ ( defined(_POSIX_THREAD_SAFE_FUNCTIONS ) && \ @@ -103,7 +105,7 @@ void mbedtls_platform_zeroize( void *buf, size_t len ) struct tm *mbedtls_platform_gmtime_r( const mbedtls_time_t *tt, struct tm *tm_buf ) { -#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) +#if defined(_WIN32) && !defined(PLATFORM_UTIL_USE_GMTIME) return( ( gmtime_s( tm_buf, tt ) == 0 ) ? tm_buf : NULL ); #elif !defined(PLATFORM_UTIL_USE_GMTIME) return( gmtime_r( tt, tm_buf ) ); diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index 7481c5b4a..a620178f6 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -44,9 +44,12 @@ typedef UINT32 uint32_t; #include +#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__MINGW32__) +#include +#endif + #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #include -#include #endif /* Type for Hex parameters */