]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
We no longer need to have an exception n the tests for Windows gmtime_s
authorBob Beck <beck@openssl.org>
Wed, 22 Oct 2025 01:50:17 +0000 (19:50 -0600)
committerNeil Horman <nhorman@openssl.org>
Fri, 24 Oct 2025 14:59:09 +0000 (10:59 -0400)
being limited to dates only from the unix epoch to the year 3000.

We no longer use it on Windows.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28949)

test/asn1_time_test.c

index c40625c90a042b8e8fc8a6f2f913da1515f78c58..207981550527c81272f17ea9c2a70e3a9e92234a 100644 (file)
@@ -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
     }
 }