2020#include "testlib/s2n_testlib.h"
2121#include "tls/s2n_certificate_keys.h"
2222
23- static int mock_time (void * data , uint64_t * timestamp )
24- {
25- * timestamp = * (uint64_t * ) data ;
26- return 0 ;
27- }
28-
2923static int fetch_expired_after_ocsp_timestamp (void * data , uint64_t * timestamp )
3024{
3125 /* 2250-01-01 */
@@ -41,6 +35,11 @@ static int fetch_early_expired_after_ocsp_timestamp(void *data, uint64_t *timest
4135}
4236
4337#if S2N_OCSP_STAPLING_SUPPORTED
38+ static int mock_time (void * data , uint64_t * timestamp )
39+ {
40+ * timestamp = * (uint64_t * ) data ;
41+ return 0 ;
42+ }
4443static int fetch_invalid_before_ocsp_timestamp (void * data , uint64_t * timestamp )
4544{
4645 /* 2015-02-27 */
@@ -128,7 +127,23 @@ static bool s2n_supports_large_time_t()
128127static bool s2n_libcrypto_supports_2050 ()
129128{
130129 ASN1_TIME * utc_time = ASN1_UTCTIME_set (NULL , 0 );
131- time_t time_2050 = 2524608000 ;
130+ if (!utc_time ) {
131+ return false;
132+ }
133+
134+ /* The `32BitBuildAndUnit` job in s2nGeneralBatch runs on a 32-bit system
135+ * where time_t cannot represent the year 2050 (2524608000) and triggers
136+ * -Wconstant-conversion (treated as an error).
137+ *
138+ * The libcrypto used by the job (i386-linux-gnu) does support year 2050.
139+ * Return true to skip the `X509_cmp_time` call.
140+ */
141+ if (sizeof (time_t ) < 8 ) {
142+ ASN1_STRING_free (utc_time );
143+ return true;
144+ }
145+
146+ time_t time_2050 = (time_t ) 2524608000LL ;
132147 int result = X509_cmp_time (utc_time , & time_2050 );
133148 ASN1_STRING_free (utc_time );
134149 return (result != 0 );
0 commit comments