aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Cook <bcook@openbsd.org>2015-10-17 22:57:59 -0500
committerBrent Cook <bcook@openbsd.org>2015-10-17 22:57:59 -0500
commita45e38e962a30307dd2034c2c032bd76333ebd2c (patch)
treed290d9f6ef87032b1cae22716acde57bf028814a
parente8c92100735f1e32d4b6f4a5a2670a0bf98ad1a8 (diff)
downloadportable-a45e38e962a30307dd2034c2c032bd76333ebd2c.tar.gz
portable-a45e38e962a30307dd2034c2c032bd76333ebd2c.tar.bz2
portable-a45e38e962a30307dd2034c2c032bd76333ebd2c.zip
disable some tests with 32-bit time_t systems
Also disable use of _mkgmtime, it does not produce correct results.
-rw-r--r--configure.ac3
-rw-r--r--crypto/Makefile.am2
-rw-r--r--include/compat/time.h4
-rw-r--r--m4/check-libc.m41
-rw-r--r--patches/rfc5280.c.patch82
5 files changed, 85 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index c103399..e97991d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,9 @@ AM_CONDITIONAL([BUILD_CERTHASH], [test "x$ac_cv_func_symlink" = xyes])
48# Check if funopen exists 48# Check if funopen exists
49AC_CHECK_FUNC([funopen]) 49AC_CHECK_FUNC([funopen])
50 50
51# Check if time_t is sized correctly
52AC_CHECK_SIZEOF([time_t], [time.h])
53
51CHECK_LIBC_COMPAT 54CHECK_LIBC_COMPAT
52CHECK_SYSCALL_COMPAT 55CHECK_SYSCALL_COMPAT
53CHECK_CRYPTO_COMPAT 56CHECK_CRYPTO_COMPAT
diff --git a/crypto/Makefile.am b/crypto/Makefile.am
index 40d82cd..b5ccf24 100644
--- a/crypto/Makefile.am
+++ b/crypto/Makefile.am
@@ -74,10 +74,8 @@ libcompat_la_SOURCES += compat/inet_pton.c
74endif 74endif
75 75
76if !HAVE_TIMEGM 76if !HAVE_TIMEGM
77if !HAVE__MKGMTIME
78libcompat_la_SOURCES += compat/timegm.c 77libcompat_la_SOURCES += compat/timegm.c
79endif 78endif
80endif
81 79
82if !HAVE_REALLOCARRAY 80if !HAVE_REALLOCARRAY
83libcompat_la_SOURCES += compat/reallocarray.c 81libcompat_la_SOURCES += compat/reallocarray.c
diff --git a/include/compat/time.h b/include/compat/time.h
index 3a87548..9ed9c03 100644
--- a/include/compat/time.h
+++ b/include/compat/time.h
@@ -15,9 +15,5 @@
15#endif 15#endif
16 16
17#ifndef HAVE_TIMEGM 17#ifndef HAVE_TIMEGM
18#ifdef HAVE__MKGMTIME
19#define timegm(tm) _mkgmtime(tm)
20#else
21time_t timegm(struct tm *tm); 18time_t timegm(struct tm *tm);
22#endif 19#endif
23#endif
diff --git a/m4/check-libc.m4 b/m4/check-libc.m4
index 3efc686..6a23e35 100644
--- a/m4/check-libc.m4
+++ b/m4/check-libc.m4
@@ -17,7 +17,6 @@ AM_CONDITIONAL([HAVE_STRNLEN], [test "x$ac_cv_func_strnlen" = xyes])
17AM_CONDITIONAL([HAVE_STRSEP], [test "x$ac_cv_func_strsep" = xyes]) 17AM_CONDITIONAL([HAVE_STRSEP], [test "x$ac_cv_func_strsep" = xyes])
18AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes]) 18AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes])
19AM_CONDITIONAL([HAVE_TIMEGM], [test "x$ac_cv_func_timegm" = xyes]) 19AM_CONDITIONAL([HAVE_TIMEGM], [test "x$ac_cv_func_timegm" = xyes])
20AM_CONDITIONAL([HAVE__MKGMTIME], [test "x$ac_cv_func__mkgmtime" = xyes])
21]) 20])
22 21
23AC_DEFUN([CHECK_SYSCALL_COMPAT], [ 22AC_DEFUN([CHECK_SYSCALL_COMPAT], [
diff --git a/patches/rfc5280.c.patch b/patches/rfc5280.c.patch
new file mode 100644
index 0000000..4281109
--- /dev/null
+++ b/patches/rfc5280.c.patch
@@ -0,0 +1,82 @@
1--- tests/rfc5280time.c.orig Sat Oct 17 22:36:27 2015
2+++ tests/rfc5280time.c Sat Oct 17 22:44:25 2015
3@@ -91,6 +91,7 @@
4 .data = "20150923032700Z",
5 .time = 1442978820,
6 },
7+#if SIZEOF_TIME_T == 8
8 {
9 /* (times before 2050 must be UTCTIME) Per RFC 5280 4.1.2.5 */
10 .str = "00000101000000Z",
11@@ -103,6 +104,7 @@
12 .data = "20491231235959Z",
13 .time = 2524607999,
14 },
15+#endif
16 {
17 /* (times before 2050 must be UTCTIME) Per RFC 5280 4.1.2.5 */
18 .str = "19500101000000Z",
19@@ -112,6 +114,7 @@
20 };
21
22 struct rfc5280_time_test rfc5280_gentime_tests[] = {
23+#if SIZEOF_TIME_T == 8
24 {
25 /* Biggest RFC 5280 time */
26 .str = "99991231235959Z",
27@@ -129,6 +132,7 @@
28 .data = "20500101000000Z",
29 .time = 2524608000,
30 },
31+#endif
32 };
33 struct rfc5280_time_test rfc5280_utctime_tests[] = {
34 {
35@@ -141,11 +145,13 @@
36 .data = "540226230640Z",
37 .time = -500000000,
38 },
39+#if SIZEOF_TIME_T == 8
40 {
41 .str = "491231235959Z",
42 .data = "491231235959Z",
43 .time = 2524607999,
44 },
45+#endif
46 {
47 .str = "700101000000Z",
48 .data = "700101000000Z",
49@@ -273,14 +279,14 @@
50
51 if ((i = X509_cmp_time(gt, &att->time)) != -1) {
52 fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
53- test_no, i, att->time);
54+ test_no, i, (long long)att->time);
55 goto done;
56 }
57
58 att->time--;
59 if ((i = X509_cmp_time(gt, &att->time)) != 1) {
60 fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
61- test_no, i, att->time);
62+ test_no, i, (long long)att->time);
63 goto done;
64 }
65 att->time++;
66@@ -325,14 +331,14 @@
67
68 if ((i = X509_cmp_time(ut, &att->time)) != -1) {
69 fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
70- test_no, i, att->time);
71+ test_no, i, (long long)att->time);
72 goto done;
73 }
74
75 att->time--;
76 if ((i = X509_cmp_time(ut, &att->time)) != 1) {
77 fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
78- test_no, i, att->time);
79+ test_no, i, (long long)att->time);
80 goto done;
81 }
82 att->time++;