From 7e8e438fce7a9b5ece2b483b973d8e0d9e7d9817 Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Fri, 26 Sep 2025 15:25:43 +0100 Subject: [PATCH 1/4] Replace cases of time_t with mbedtls_time_t Signed-off-by: Ben Taylor --- library/ssl_tls.c | 2 +- programs/ssl/ssl_context_info.c | 2 +- programs/test/udp_proxy.c | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 37e4259e55..75c59a96ad 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -3178,7 +3178,7 @@ static int ssl_tls12_session_load(mbedtls_ssl_session *session, start = MBEDTLS_GET_UINT64_BE(p, 0); p += 8; - session->start = (time_t) start; + session->start = (mbedtls_time_t) start; #endif /* MBEDTLS_HAVE_TIME */ /* diff --git a/programs/ssl/ssl_context_info.c b/programs/ssl/ssl_context_info.c index 7bcd50fe65..46875ec414 100644 --- a/programs/ssl/ssl_context_info.c +++ b/programs/ssl/ssl_context_info.c @@ -277,7 +277,7 @@ static void print_time(const uint64_t *time) { #if defined(MBEDTLS_HAVE_TIME) char buf[20]; - struct tm *t = gmtime((time_t *) time); + struct tm *t = gmtime((mbedtls_time_t *) time); static const char format[] = "%Y-%m-%d %H:%M:%S"; if (NULL != t) { strftime(buf, sizeof(buf), format, t); diff --git a/programs/test/udp_proxy.c b/programs/test/udp_proxy.c index 1c52990a8e..efa003da0d 100644 --- a/programs/test/udp_proxy.c +++ b/programs/test/udp_proxy.c @@ -25,7 +25,6 @@ #if defined(MBEDTLS_HAVE_TIME) #include #define mbedtls_time time -#define mbedtls_time_t time_t #endif #define mbedtls_printf printf #define mbedtls_calloc calloc From 6efe52473ca719f273c9b2db97344bc2b0d6edd1 Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Mon, 29 Sep 2025 07:53:36 +0100 Subject: [PATCH 2/4] revert change to gmtime arguments int ssl_context_info.c Signed-off-by: Ben Taylor --- programs/ssl/ssl_context_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/ssl/ssl_context_info.c b/programs/ssl/ssl_context_info.c index 46875ec414..7bcd50fe65 100644 --- a/programs/ssl/ssl_context_info.c +++ b/programs/ssl/ssl_context_info.c @@ -277,7 +277,7 @@ static void print_time(const uint64_t *time) { #if defined(MBEDTLS_HAVE_TIME) char buf[20]; - struct tm *t = gmtime((mbedtls_time_t *) time); + struct tm *t = gmtime((time_t *) time); static const char format[] = "%Y-%m-%d %H:%M:%S"; if (NULL != t) { strftime(buf, sizeof(buf), format, t); From b11d5bc949671ebb79e1caf7a898c3009448eb44 Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Mon, 29 Sep 2025 13:59:26 +0100 Subject: [PATCH 3/4] Add ChangeLog Signed-off-by: Ben Taylor --- ChangeLog.d/replace_time_t.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ChangeLog.d/replace_time_t.txt diff --git a/ChangeLog.d/replace_time_t.txt b/ChangeLog.d/replace_time_t.txt new file mode 100644 index 0000000000..53b63cfd43 --- /dev/null +++ b/ChangeLog.d/replace_time_t.txt @@ -0,0 +1,3 @@ +Bugfix + * Replace occurances of time_t with + mbedtls_time_t. From c797a35acd88ed89eb6079903a08cf224c6f9cb9 Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Mon, 29 Sep 2025 14:18:20 +0100 Subject: [PATCH 4/4] Improve ChangeLog entry Signed-off-by: Ben Taylor --- ChangeLog.d/replace_time_t.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog.d/replace_time_t.txt b/ChangeLog.d/replace_time_t.txt index 53b63cfd43..ec0282a9f2 100644 --- a/ChangeLog.d/replace_time_t.txt +++ b/ChangeLog.d/replace_time_t.txt @@ -1,3 +1,4 @@ Bugfix - * Replace occurances of time_t with - mbedtls_time_t. + * Fix a build error or incorrect TLS session + lifetime on platforms where mbedtls_time_t + is not time_t. Fixes #10236.