diff options
author | Brent Cook <bcook@openbsd.org> | 2017-03-16 18:56:06 -0500 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2017-03-16 18:56:06 -0500 |
commit | 8f69fe98dba08e22dd1341cbaad91745c8bf7ad7 (patch) | |
tree | 5c3ed1d8c7fd32335e15e519042112ea52d912a7 | |
parent | 8622dc7536040a041d709a7d2e6717735c84e4da (diff) | |
parent | 3b4d3d754123c83270f139884269644265eaf236 (diff) | |
download | portable-8f69fe98dba08e22dd1341cbaad91745c8bf7ad7.tar.gz portable-8f69fe98dba08e22dd1341cbaad91745c8bf7ad7.tar.bz2 portable-8f69fe98dba08e22dd1341cbaad91745c8bf7ad7.zip |
Land #287, document steps to enable 64-bit time_t on mingw-w64 toolchain
-rw-r--r-- | README.windows | 22 | ||||
-rw-r--r-- | configure.ac | 6 |
2 files changed, 27 insertions, 1 deletions
diff --git a/README.windows b/README.windows index 27c2182..a88ddc9 100644 --- a/README.windows +++ b/README.windows | |||
@@ -12,7 +12,8 @@ cross compilers on Windows. | |||
12 | To configure and build LibreSSL for a 32-bit system, use the following | 12 | To configure and build LibreSSL for a 32-bit system, use the following |
13 | build steps: | 13 | build steps: |
14 | 14 | ||
15 | CC=i686-w64-mingw32-gcc ./configure --host=i686-w64-mingw32 | 15 | CC=i686-w64-mingw32-gcc CPPFLAGS=-D__MINGW_USE_VC2005_COMPAT \ |
16 | ./configure --host=i686-w64-mingw32 | ||
16 | make | 17 | make |
17 | make check | 18 | make check |
18 | 19 | ||
@@ -22,6 +23,25 @@ For 64-bit builds, use these instead: | |||
22 | make | 23 | make |
23 | make check | 24 | make check |
24 | 25 | ||
26 | # Why the -D__MINGW_USE_VC2005_COMPAT flag on 32-bit systems? | ||
27 | |||
28 | An ABI change introduced with Microsoft Visual C++ 2005 (also known as | ||
29 | Visual C++ 8.0) switched time_t from 32-bit to 64-bit. It is important to | ||
30 | build LibreSSL with 64-bit time_t whenever possible, because 32-bit time_t | ||
31 | is unable to represent times past 2038 (this is commonly known as the | ||
32 | Y2K38 problem). | ||
33 | |||
34 | If LibreSSL is built with 32-bit time_t, when verifying a certificate whose | ||
35 | expiry date is set past 19 January 2038, it will be unable to tell if the | ||
36 | certificate has expired or not, and thus take the safe stance and reject it. | ||
37 | |||
38 | In order to avoid this, you need to build LibreSSL (and everything that links | ||
39 | with it) with the -D__MINGW_USE_VC2005_COMPAT flag. This tells mingw-w64 to | ||
40 | use the new ABI. | ||
41 | |||
42 | 64-bit systems always have a 64-bit time_t and are not affected by this | ||
43 | problem. | ||
44 | |||
25 | # Using Libressl with Visual Studio | 45 | # Using Libressl with Visual Studio |
26 | 46 | ||
27 | A script for generating ready-to-use .DLL and static .LIB files is included in | 47 | A script for generating ready-to-use .DLL and static .LIB files is included in |
diff --git a/configure.ac b/configure.ac index eecfb41..9fd7c2d 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -142,6 +142,12 @@ AM_CONDITIONAL([SMALL_TIME_T], [test "$ac_cv_sizeof_time_t" = "4"]) | |||
142 | if test "$ac_cv_sizeof_time_t" = "4"; then | 142 | if test "$ac_cv_sizeof_time_t" = "4"; then |
143 | echo " ** Warning, this system is unable to represent times past 2038" | 143 | echo " ** Warning, this system is unable to represent times past 2038" |
144 | echo " ** It will behave incorrectly when handling valid RFC5280 dates" | 144 | echo " ** It will behave incorrectly when handling valid RFC5280 dates" |
145 | |||
146 | if test "$host_os" = "mingw32" ; then | ||
147 | echo " **" | ||
148 | echo " ** You can solve this by adjusting the build flags in your" | ||
149 | echo " ** mingw-w64 toolchain. Refer to README.windows for details." | ||
150 | fi | ||
145 | fi | 151 | fi |
146 | 152 | ||
147 | AC_REQUIRE_AUX_FILE([tap-driver.sh]) | 153 | AC_REQUIRE_AUX_FILE([tap-driver.sh]) |