From e70853d7bae4cc2e6620af182ef0d1f4e488bb20 Mon Sep 17 00:00:00 2001 From: Bob Beck Date: Tue, 21 Oct 2025 19:50:17 -0600 Subject: [PATCH] We no longer need to have an exception n the tests for Windows gmtime_s being limited to dates only from the unix epoch to the year 3000. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We no longer use it on Windows. Reviewed-by: Neil Horman Reviewed-by: Saša Nedvědický (Merged from https://github.com/openssl/openssl/pull/28949) --- test/asn1_time_test.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/test/asn1_time_test.c b/test/asn1_time_test.c index c40625c90a0..20798155052 100644 --- a/test/asn1_time_test.c +++ b/test/asn1_time_test.c @@ -703,17 +703,15 @@ static int test_gmtime_diff_limits(void) saved_value = min_tm.tm_year; min_tm.tm_year -= 1; /* These should now be outside the asn1 time range. */ - if (!TEST_false(OPENSSL_gmtime_diff(&pday, &psec, &min_tm, &max_tm))) { - goto err; - } + if (!TEST_false(OPENSSL_gmtime_diff(&pday, &psec, &min_tm, &max_tm))) + goto err; min_tm.tm_year = saved_value; expected_days -= 365; saved_value = max_tm.tm_year; max_tm.tm_year += 1; - if (!TEST_false(OPENSSL_gmtime_diff(&pday, &psec, &min_tm, &max_tm))) { - goto err; - } + if (!TEST_false(OPENSSL_gmtime_diff(&pday, &psec, &min_tm, &max_tm))) + goto err; max_tm.tm_year = saved_value; ret = 1; @@ -733,15 +731,10 @@ static int64_t time_t_min(void) OPENSSL_assert(sizeof(time_t) == sizeof(uint32_t)); return INT64_C(0); } else { -#if defined(OPENSSL_SYS_WINDOWS) - /* Windows can't handle before 1970, even with signed time_t */ - return INT64_C(0); -#else if (sizeof(time_t) == sizeof(int32_t)) return (int64_t)INT32_MIN; OPENSSL_assert(sizeof(time_t) == sizeof(uint64_t)); return INT64_MIN; -#endif } } @@ -757,12 +750,7 @@ static int64_t time_t_max(void) if (sizeof(time_t) == sizeof(int32_t)) return (int64_t)INT32_MAX; OPENSSL_assert(sizeof(time_t) == sizeof(uint64_t)); -#if defined(OPENSSL_SYS_WINDOWS) - /* Windows can't do past year 3000 even on signed 64 bit time_t */ - return INT64_C(32535215999); -#else return INT64_MAX; -#endif } } -- 2.47.3