Skip to content

Commit 05b7267

Browse files
daxtensnaynajain
authored andcommitted
mbedtls: x509: do not include time.h without MBEDTLS_HAVE_TIME
MBEDTLS_HAVE_TIME is documented as: "System has time.h and time()." If that is not defined, do not attempt to include time.h. Signed-off-by: Daniel Axtens <[email protected]>
1 parent 4420e3c commit 05b7267

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

include/mbedtls/platform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ extern "C" {
7070
#if !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
7171
#include <stdio.h>
7272
#include <stdlib.h>
73+
#if defined(MBEDTLS_HAVE_TIME)
7374
#include <time.h>
75+
#endif
7476
#if !defined(MBEDTLS_PLATFORM_STD_SNPRINTF)
7577
#if defined(MBEDTLS_PLATFORM_HAS_NON_CONFORMING_SNPRINTF)
7678
#define MBEDTLS_PLATFORM_STD_SNPRINTF mbedtls_platform_win32_snprintf /**< The default \c snprintf function to use. */

library/x509_crl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@
5858
#define mbedtls_snprintf snprintf
5959
#endif
6060

61+
#if defined(MBEDTLS_HAVE_TIME)
6162
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
6263
#include <windows.h>
6364
#else
6465
#include <time.h>
6566
#endif
67+
#endif
6668

6769
#if defined(MBEDTLS_FS_IO) || defined(EFIX64) || defined(EFI32)
6870
#include <stdio.h>

library/x509_crt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@
6969
#include "mbedtls/threading.h"
7070
#endif
7171

72+
#if defined(MBEDTLS_HAVE_TIME)
7273
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
7374
#include <windows.h>
7475
#else
7576
#include <time.h>
7677
#endif
78+
#endif
7779

7880
#if defined(MBEDTLS_FS_IO)
7981
#include <stdio.h>

0 commit comments

Comments
 (0)