Fix compilation with MinGW32

Signed-off-by: Cameron Cawley <ccawley2011@gmail.com>
This commit is contained in:
Cameron Cawley 2021-03-08 23:29:26 +00:00 committed by Dave Rodgman
parent a745c7d439
commit ea5496ceb3
2 changed files with 9 additions and 4 deletions

View file

@ -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 ) );

View file

@ -44,9 +44,12 @@ typedef UINT32 uint32_t;
#include <string.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__MINGW32__)
#include <strings.h>
#endif
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#include <strings.h>
#endif
/* Type for Hex parameters */