Fix running mingw dhparam test under wine
authorMatt Caswell <matt@openssl.org>
Thu, 21 Jan 2021 16:55:42 +0000 (16:55 +0000)
committerMatt Caswell <matt@openssl.org>
Wed, 27 Jan 2021 15:00:35 +0000 (15:00 +0000)
The dhparam test was failing to properly handle line endings when
running a mingw configured build under wine.

Fixes #13557

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13923)

test/recipes/20-test_dhparam.t

index 42eef173b741549b72a473bc78816c722ad7e809..a4d05dea7adc40e9b9873abb0b2b35a99185e340 100644 (file)
@@ -36,11 +36,13 @@ sub checkdhparams {
         #Text file. Check it looks like PEM
         open(PEMFILE, '<', $file) or die $!;
         if (my $firstline = <PEMFILE>) {
-            chomp($firstline);
+            $firstline =~ s/\R$//;
             if ($firstline eq "-----BEGIN DH PARAMETERS-----") {
                 $pemtype = "PKCS3";
             } elsif ($firstline eq "-----BEGIN X9.42 DH PARAMETERS-----") {
                 $pemtype = "X9.42";
+            } else {
+                $pemtype = "";
             }
         } else {
             $pemtype = "";