Skip to content

Commit db42920

Browse files
committed
openssl: also treat Cygwin Perl like MSYS Perl in test guards
Git for Windows recently stopped building its own Perl and switched to the MSYS2-provided one. That Perl reports $^O as 'cygwin' rather than 'msys', which means OpenSSL's test skip guards that check for 'msys' no longer fire. Tests that open listening sockets (notably 82-test_ocsp_cert_chain.t and 90-test_store.t) then hang indefinitely because Windows Defender's firewall prompts for permission to allow the connection, which blocks in CI where nobody can click "Allow". The fix has two parts. For guards that were introduced by our own carried patches (0005-Fix-Text-comparison, 0006-Mangle-Absolute-path, 0007-Fix-OS-detection), the patches themselves are updated to match 'cygwin' alongside 'msys' from the start. For guards that exist in upstream OpenSSL (in 02-test_errstr.t, 25-test_eai_data.t, 25-test_x509.t, 80-test_cmp_http.t, 82-test_ocsp_cert_chain.t, 82-test_tfo_cli.t, and 90-test_store.t), a new patch 0009-Also-treat-Cygwin-Perl-like-MSYS-Perl-in-test-skip-g.patch is added. MSYS2 upstream does not carry this patch because they have not encountered the firewall hang in their CI, but it is a safety measure that costs nothing and prevents real hangs on Windows build agents where Defender is active. The patches were produced from the playground repository at mingw-w64-openssl/src/playground, which can be recreated as follows: git init playground && cd playground /usr/src/git/contrib/fast-import/import-tars.perl \ ../openssl-3.5.6.tar.gz git checkout import-tars git am ../../000[1-9]-*.patch git fast-export --no-data HEAD | \ awk '/^author /{a=$0} /^committer /{$0="committer " substr(a,8)} 1' | \ git fast-import --force --quiet The fast-export/fast-import awk trick forces committer identity and timestamp to match the author on every commit, including the import commit created by import-tars.perl (which otherwise uses the identity of whoever runs the script). This makes the resulting OIDs fully reproducible, so `git format-patch --no-signature -o ../.. -9 HEAD` always exports identical patches. Assisted-by: Claude Opus 4.6 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 1431b40 commit db42920

10 files changed

+228
-56
lines changed

mingw-w64-openssl/0001-support-aarch64.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
From b3431910bb8956041d8edd15cd0a3afa0a149efd Mon Sep 17 00:00:00 2001
1+
From b3a145a437302ebc822c81695f4b9a4d6c47de2c Mon Sep 17 00:00:00 2001
22
From: =?UTF-8?q?=D9=85=D9=87=D8=AF=D9=8A=20=D8=B4=D9=8A=D9=86=D9=88=D9=86?=
33
=?UTF-8?q?=20=28Mehdi=20Chinoune=29?= <mehdi.chinoune@hotmail.com>
44
Date: Sat, 7 Jan 2023 08:19:23 +0100
5-
Subject: [PATCH 1/7] support-aarch64
5+
Subject: [PATCH 1/9] support-aarch64
66

77
openssl: update to 3.0.7
88
---
99
Configurations/10-main.conf | 12 ++++++++++++
1010
1 file changed, 12 insertions(+)
1111

1212
diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
13-
index cba57b4..dd8dd5e 100644
13+
index 692eccb..c27dcae 100644
1414
--- a/Configurations/10-main.conf
1515
+++ b/Configurations/10-main.conf
16-
@@ -1746,6 +1746,18 @@ my %targets = (
16+
@@ -1747,6 +1747,18 @@ my %targets = (
1717
multilib => "64",
1818
},
1919

mingw-w64-openssl/0002-relocation.patch

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
From 993b0cec8ad81b84a42236b007f1bca623db1520 Mon Sep 17 00:00:00 2001
1+
From e64549f98276b31ab4a6c45d0b837b8cc22b8bfc Mon Sep 17 00:00:00 2001
22
From: =?UTF-8?q?=D9=85=D9=87=D8=AF=D9=8A=20=D8=B4=D9=8A=D9=86=D9=88=D9=86?=
33
=?UTF-8?q?=20=28Mehdi=20Chinoune=29?= <mehdi.chinoune@hotmail.com>
44
Date: Sat, 7 Jan 2023 08:19:23 +0100
5-
Subject: [PATCH 2/7] relocation
5+
Subject: [PATCH 2/9] relocation
66

77
openssl: update to 3.0.7
88
---
@@ -26,7 +26,7 @@ index aee5c46..9a97547 100644
2626

2727
SOURCE[../libcrypto]=$UPLINKSRC
2828
diff --git a/crypto/engine/eng_list.c b/crypto/engine/eng_list.c
29-
index 0f24f2f..a9b2206 100644
29+
index 917fa84..8d8e3cf 100644
3030
--- a/crypto/engine/eng_list.c
3131
+++ b/crypto/engine/eng_list.c
3232
@@ -12,6 +12,7 @@
@@ -51,10 +51,10 @@ index 0f24f2f..a9b2206 100644
5151
+ load_dir = reloc;
5252
+ }
5353
iterator = ENGINE_by_id("dynamic");
54-
if (!iterator || !ENGINE_ctrl_cmd_string(iterator, "ID", id, 0) ||
55-
!ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) ||
54+
if (!iterator || !ENGINE_ctrl_cmd_string(iterator, "ID", id, 0) || !ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) || !ENGINE_ctrl_cmd_string(iterator, "DIR_ADD", load_dir, 0) || !ENGINE_ctrl_cmd_string(iterator, "LIST_ADD", "1", 0) || !ENGINE_ctrl_cmd_string(iterator, "LOAD", NULL, 0))
55+
goto notfound;
5656
diff --git a/crypto/provider_core.c b/crypto/provider_core.c
57-
index c71c1e7..19c3dbb 100644
57+
index 507be35..0f8da50 100644
5858
--- a/crypto/provider_core.c
5959
+++ b/crypto/provider_core.c
6060
@@ -30,6 +30,7 @@
@@ -63,9 +63,9 @@ index c71c1e7..19c3dbb 100644
6363
#include "crypto/context.h"
6464
+#include "pathtools.h"
6565
#ifndef FIPS_MODULE
66-
# include <openssl/self_test.h>
67-
# include <openssl/indicator.h>
68-
@@ -991,8 +992,13 @@ static int provider_init(OSSL_PROVIDER *prov)
66+
#include <openssl/self_test.h>
67+
#include <openssl/indicator.h>
68+
@@ -997,8 +998,13 @@ static int provider_init(OSSL_PROVIDER *prov)
6969

7070
if (load_dir == NULL) {
7171
load_dir = ossl_safe_getenv("OPENSSL_MODULES");
@@ -82,7 +82,7 @@ index c71c1e7..19c3dbb 100644
8282

8383
DSO_ctrl(prov->module, DSO_CTRL_SET_FLAGS,
8484
diff --git a/crypto/x509/x509_def.c b/crypto/x509/x509_def.c
85-
index 7d5b642..7f0a1d1 100644
85+
index 5a6ecaf..447a45a 100644
8686
--- a/crypto/x509/x509_def.c
8787
+++ b/crypto/x509/x509_def.c
8888
@@ -10,6 +10,7 @@

mingw-w64-openssl/0003-test_rand-use-the-better-chomp.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From fbb81a899dabd443737e726fde930906fce5f846 Mon Sep 17 00:00:00 2001
1+
From 0eda9fae1ece0f89b08cbcfcf55fe0099711cf49 Mon Sep 17 00:00:00 2001
22
From: Johannes Schindelin <johannes.schindelin@gmx.de>
33
Date: Wed, 25 Oct 2023 17:10:17 +0200
4-
Subject: [PATCH 3/7] test_rand: use the "better chomp"
4+
Subject: [PATCH 3/9] test_rand: use the "better chomp"
55

66
Following in the footsteps of
77
https://github.com/openssl/openssl/commit/9ba96fbb2523cb12747c559c704c58bd8f9e7982

mingw-w64-openssl/0004-mingw32-broken-test.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
From c4e21984736e7837d0aa160f2007cc92c1d3710e Mon Sep 17 00:00:00 2001
1+
From d21e01aa7fa2981c3897fe8e170d03c66b3a2c1d Mon Sep 17 00:00:00 2001
22
From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= <mha1993@live.de>
33
Date: Fri, 24 Nov 2023 06:47:04 +0000
4-
Subject: [PATCH 4/7] mingw32-broken-test
4+
Subject: [PATCH 4/9] mingw32-broken-test
55

66
---
77
test/asn1_time_test.c | 7 -------
88
1 file changed, 7 deletions(-)
99

1010
diff --git a/test/asn1_time_test.c b/test/asn1_time_test.c
11-
index 32bc4ff..4d1fdbe 100644
11+
index 6e18cd0..450f470 100644
1212
--- a/test/asn1_time_test.c
1313
+++ b/test/asn1_time_test.c
1414
@@ -68,13 +68,6 @@ static const struct TESTDATA_asn1_to_utc asn1_to_utc[] = {

mingw-w64-openssl/0005-Fix-Text-comparison.patch

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
From f208d3920935f0efeac542391305e5baffe47687 Mon Sep 17 00:00:00 2001
1+
From 2313d1d189ac8d0107778b69fd7d93093bc8546c Mon Sep 17 00:00:00 2001
22
From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= <mha1993@live.de>
33
Date: Tue, 16 Sep 2025 15:23:00 +0200
4-
Subject: [PATCH 5/7] Fix Text comparison
4+
Subject: [PATCH 5/9] Fix Text comparison
55

66
0615d3a (Use text compare for PEM and text files, 2025-03-19) introduced perls
77
compare_text into the tests, but didn't account for a scenario like our
88
MINGW-Packages where openssl uses CRLF as an EOL, but the perl running the tests
99
expects just LF.
1010

1111
Teach the affected tests to compare while accounting for differences in EOLs.
12+
13+
Since Git for Windows recently stopped building its own Perl and now uses
14+
the MSYS2-provided one, $^O reports 'cygwin' rather than 'msys'. Account
15+
for both values so the CRLF normalization fires in either case.
1216
---
1317
test/recipes/15-test_dsaparam.t | 3 +--
1418
test/recipes/15-test_ml_kem_codecs.t | 2 +-
@@ -48,7 +52,7 @@ index bebb8b8..71292f1 100644
4852
use OpenSSL::Glob;
4953
use OpenSSL::Test qw/:DEFAULT data_file srctop_file bldtop_dir/;
5054
diff --git a/test/recipes/15-test_pkey.t b/test/recipes/15-test_pkey.t
51-
index 70bb083..e01ccd6 100644
55+
index 1f23795..6dd7b09 100644
5256
--- a/test/recipes/15-test_pkey.t
5357
+++ b/test/recipes/15-test_pkey.t
5458
@@ -11,8 +11,8 @@ use warnings;
@@ -87,7 +91,7 @@ index 50cb01a..6d40cfd 100644
8791

8892
setup("test_pkcs8");
8993
diff --git a/util/perl/OpenSSL/Test/Utils.pm b/util/perl/OpenSSL/Test/Utils.pm
90-
index 34eafc4..daeb155 100644
94+
index 34eafc4..7a70d53 100644
9195
--- a/util/perl/OpenSSL/Test/Utils.pm
9296
+++ b/util/perl/OpenSSL/Test/Utils.pm
9397
@@ -11,11 +11,12 @@ use strict;
@@ -108,7 +112,7 @@ index 34eafc4..daeb155 100644
108112
return $have_IPv6;
109113
}
110114

111-
+if ($^O eq 'msys') {
115+
+if ($^O eq 'msys' || $^O eq 'cygwin') {
112116
+ no warnings 'redefine';
113117
+ sub compare_text {
114118
+ return File::Compare::compare_text($_[0], $_[1], sub {$_[0]=~ s/\r\n/\n/;$_[1]=~ s/\r\n/\n/; $_[0] ne $_[1]});

mingw-w64-openssl/0006-Mangle-Absolute-path.patch

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1-
From 2c09395d987f18c333b15b3a33f4f412a3aac7ff Mon Sep 17 00:00:00 2001
1+
From de78b43696852c8e403d40527e3478209545463f Mon Sep 17 00:00:00 2001
22
From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= <mha1993@live.de>
33
Date: Wed, 17 Sep 2025 10:53:00 +0200
4-
Subject: [PATCH 6/7] Mangle Absolute path
4+
Subject: [PATCH 6/9] Mangle Absolute path
55

66
Test 25-test_verify.t tries to test some file:// URLs containing an absolute path,
77
but perls abs_path() creates MSYS2 absolute paths in our case, which our native
88
openssl doesn't understand.
99

1010
Run the path through cygpath to convert it into the expected format.
11+
12+
Since Git for Windows recently stopped building its own Perl and now uses
13+
the MSYS2-provided one, $^O reports 'cygwin' rather than 'msys'. Account
14+
for both values so the cygpath conversion fires in either case.
1115
---
1216
test/recipes/25-test_verify.t | 4 ++++
1317
1 file changed, 4 insertions(+)
1418

1519
diff --git a/test/recipes/25-test_verify.t b/test/recipes/25-test_verify.t
16-
index 673c3d5..786a302 100644
20+
index ab8cdff..b7a6029 100644
1721
--- a/test/recipes/25-test_verify.t
1822
+++ b/test/recipes/25-test_verify.t
19-
@@ -614,6 +614,10 @@ my $foo_file = "cert.pem";
23+
@@ -626,6 +626,10 @@ my $foo_file = "cert.pem";
2024
copy($rootcert, $foo_file);
2125
ok(vfy_root("-CAstore", $foo_file), "CAstore foo:file");
2226
my $abs_cert = abs_path($rootcert);
23-
+if ($^O eq "msys") {
27+
+if ($^O eq "msys" || $^O eq "cygwin") {
2428
+ $abs_cert = `cygpath -m $abs_cert`;
2529
+ chomp $abs_cert;
2630
+}
Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
From f4413c73dc50a0b249bc7ca629dbf5906e7a23c1 Mon Sep 17 00:00:00 2001
1+
From 68e41868b1711ae6a4fee3e77e1f0bb37d9e1546 Mon Sep 17 00:00:00 2001
22
From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= <mha1993@live.de>
33
Date: Tue, 16 Sep 2025 17:29:00 +0200
4-
Subject: [PATCH 7/7] Fix OS detection
4+
Subject: [PATCH 7/9] Fix OS detection
55

66
OpenSSL tests assume the perl that runs the tests to be native to the platform
77
of the openssl being tested. This isn't the case for our MINGW-Packages.
88

99
Teach the affected tests to treat msys perl the same as they would MSWin32 perl.
10+
11+
Since Git for Windows recently stopped building its own Perl and now uses
12+
the MSYS2-provided one, $^O reports 'cygwin' rather than 'msys'. Account
13+
for both values in the OS detection guards.
1014
---
1115
test/recipes/20-test_speed.t | 4 ++--
1216
test/recipes/25-test_verify.t | 4 ++--
1317
test/recipes/70-test_sslrecords.t | 2 +-
1418
3 files changed, 5 insertions(+), 5 deletions(-)
1519

1620
diff --git a/test/recipes/20-test_speed.t b/test/recipes/20-test_speed.t
17-
index 3c3c5fa..1c37d5d 100644
21+
index c6a9824..cff981b 100644
1822
--- a/test/recipes/20-test_speed.t
1923
+++ b/test/recipes/20-test_speed.t
2024
@@ -29,7 +29,7 @@ ok(run(app(['openssl', 'speed', '-testmode'])),
2125

2226
SKIP: {
2327
skip "Multi option is not supported by this OpenSSL build", 1
2428
- if $^O =~ /^(VMS|MSWin32)$/;
25-
+ if $^O =~ /^(VMS|MSWin32|msys)$/;
29+
+ if $^O =~ /^(VMS|MSWin32|msys|cygwin)$/;
2630

2731
ok(run(app(['openssl', 'speed', '-testmode', '-multi', 2])),
2832
"Test the multi option");
@@ -31,42 +35,42 @@ index 3c3c5fa..1c37d5d 100644
3135
SKIP: {
3236
skip "Mlock option is not supported by this OpenSSL build", 1
3337
- if $^O !~ /^(linux|MSWin32)$/;
34-
+ if $^O =~ /^(linux|MSWin32|msys)$/;
38+
+ if $^O =~ /^(linux|MSWin32|msys|cygwin)$/;
3539

3640
ok(run(app(['openssl', 'speed', '-testmode', '-mlock'])),
3741
"Test the mlock option");
3842
diff --git a/test/recipes/25-test_verify.t b/test/recipes/25-test_verify.t
39-
index 786a302..0f9b7b5 100644
43+
index b7a6029..4e1bb67 100644
4044
--- a/test/recipes/25-test_verify.t
4145
+++ b/test/recipes/25-test_verify.t
42-
@@ -605,7 +605,7 @@ ok(!vfy_root("-CAstore", "non-existing", "-CAfile", $rootcert), "CAfile and non-
46+
@@ -617,7 +617,7 @@ ok(!vfy_root("-CAstore", "non-existing", "-CAfile", $rootcert), "CAfile and non-
4347

4448
SKIP: {
4549
skip "file names with colons aren't supported on Windows and VMS", 1
4650
- if $^O =~ /^(MSWin32|VMS)$/;
47-
+ if $^O =~ /^(MsWin32|VMS|msys)$/;
51+
+ if $^O =~ /^(MsWin32|VMS|msys|cygwin)$/;
4852
my $foo_file = "foo:cert.pem";
4953
copy($rootcert, $foo_file);
5054
ok(vfy_root("-CAstore", $foo_file), "CAstore foo:file");
51-
@@ -622,7 +622,7 @@ if ($^O eq "msys") {
55+
@@ -634,7 +634,7 @@ if ($^O eq "msys" || $^O eq "cygwin") {
5256
# file://authority/C:/what/ever/foo.pem and file:///C:/what/ever/foo.pem
5357
# file://C:/what/ever/foo.pem is non-standard and may not be accepted.
5458
# See RFC 8089 for details.
5559
-$abs_cert = "/" . $abs_cert if ($^O eq "MSWin32");
56-
+$abs_cert = "/" . $abs_cert if ($^O eq "MSWin32" or $^O eq "msys");
60+
+$abs_cert = "/" . $abs_cert if ($^O eq "MSWin32" or $^O eq "msys" or $^O eq "cygwin");
5761
ok(vfy_root("-CAstore", "file://".$abs_cert), "CAstore file:///path");
5862
ok(vfy_root("-CAstore", "file://localhost".$abs_cert), "CAstore file://localhost/path");
5963
ok(!vfy_root("-CAstore", "file://otherhost".$abs_cert), "CAstore file://otherhost/path");
6064
diff --git a/test/recipes/70-test_sslrecords.t b/test/recipes/70-test_sslrecords.t
61-
index 299ecb6..8efbca4 100644
65+
index 299ecb6..13192e3 100644
6266
--- a/test/recipes/70-test_sslrecords.t
6367
+++ b/test/recipes/70-test_sslrecords.t
6468
@@ -43,7 +43,7 @@ SKIP: {
6569

6670
SKIP: {
6771
skip "DTLS 1.2 is disabled", 22 if disabled("dtls1_2");
6872
- skip "DTLSProxy does not work on Windows", 22 if $^O =~ /^(MSWin32)$/;
69-
+ skip "DTLSProxy does not work on Windows", 22 if $^O =~ /^(MSWin32|msys)$/;
73+
+ skip "DTLSProxy does not work on Windows", 22 if $^O =~ /^(MSWin32|msys|cygwin)$/;
7074
run_tests(1);
7175
}
7276

mingw-w64-openssl/0008-Define-SIO_UDP_NETRESET-if-necessary.patch

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From c3c28ed00601a2fbab8efbdc787cb0e1696b1fea Mon Sep 17 00:00:00 2001
1+
From f482755719e780a0655d1c0b8c1fcf1183a188b0 Mon Sep 17 00:00:00 2001
22
From: Johannes Schindelin <johannes.schindelin@gmx.de>
33
Date: Tue, 27 Jan 2026 17:48:43 +0100
4-
Subject: [PATCH] Define `SIO_UDP_NETRESET` if necessary
4+
Subject: [PATCH 8/9] Define `SIO_UDP_NETRESET` if necessary
55

66
Older `mingw-w64-headers` versions seem not to define this constant, but
77
OpenSSL started using it in v3.5.5.
@@ -12,7 +12,7 @@ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1212
1 file changed, 3 insertions(+)
1313

1414
diff --git a/ssl/quic/quic_reactor.c b/ssl/quic/quic_reactor.c
15-
index 1a95f13..fd913c7 100644
15+
index c30bc3c..0c8c5ac 100644
1616
--- a/ssl/quic/quic_reactor.c
1717
+++ b/ssl/quic/quic_reactor.c
1818
@@ -15,6 +15,9 @@
@@ -25,6 +25,3 @@ index 1a95f13..fd913c7 100644
2525
#endif
2626

2727
/*
28-
--
29-
2.52.0.windows.1
30-

0 commit comments

Comments
 (0)