From db0feca55c837600057636ed8e02fb8d0dd27ddf Mon Sep 17 00:00:00 2001 From: Simon Butcher Date: Tue, 17 May 2016 00:03:14 +0100 Subject: [PATCH] Fixes platform time_t abstraction Fixes platform abstraction in error.c and the file that it's generated from as well as DTLS samples. --- include/mbedtls/platform.h | 2 ++ library/error.c | 1 + programs/ssl/dtls_client.c | 1 + programs/ssl/dtls_server.c | 1 + scripts/data_files/error.fmt | 1 + 5 files changed, 6 insertions(+) diff --git a/include/mbedtls/platform.h b/include/mbedtls/platform.h index 039cb587a..fc3672cbe 100644 --- a/include/mbedtls/platform.h +++ b/include/mbedtls/platform.h @@ -237,6 +237,8 @@ int mbedtls_platform_set_exit( void (*exit_func)( int status ) ); #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) typedef MBEDTLS_PLATFORM_TIME_TYPE_MACRO mbedtls_time_t; #else +/* For time_t */ +#include typedef time_t mbedtls_time_t; #endif /* MBEDTLS_PLATFORM_TIME_TYPE_MACRO */ diff --git a/library/error.c b/library/error.c index debda1d78..4718b514d 100644 --- a/library/error.c +++ b/library/error.c @@ -34,6 +34,7 @@ #include "mbedtls/platform.h" #else #define mbedtls_snprintf snprintf +#define mbedtls_time_t time_t #endif #if defined(MBEDTLS_ERROR_C) diff --git a/programs/ssl/dtls_client.c b/programs/ssl/dtls_client.c index b37eb838c..14fb61202 100644 --- a/programs/ssl/dtls_client.c +++ b/programs/ssl/dtls_client.c @@ -31,6 +31,7 @@ #include #define mbedtls_printf printf #define mbedtls_fprintf fprintf +#define mbedtls_time_t time_t #endif #if !defined(MBEDTLS_SSL_CLI_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) || \ diff --git a/programs/ssl/dtls_server.c b/programs/ssl/dtls_server.c index df0fc780a..1d6eb3bea 100644 --- a/programs/ssl/dtls_server.c +++ b/programs/ssl/dtls_server.c @@ -31,6 +31,7 @@ #include #define mbedtls_printf printf #define mbedtls_fprintf fprintf +#define mbedtls_time_t time_t #endif #if !defined(MBEDTLS_SSL_SRV_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) || \ diff --git a/scripts/data_files/error.fmt b/scripts/data_files/error.fmt index bd6ef0138..a08742c83 100644 --- a/scripts/data_files/error.fmt +++ b/scripts/data_files/error.fmt @@ -34,6 +34,7 @@ #include "mbedtls/platform.h" #else #define mbedtls_snprintf snprintf +#define mbedtls_time_t time_t #endif #if defined(MBEDTLS_ERROR_C)