summaryrefslogtreecommitdiffstats
path: root/crypto/sha
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2020-02-17 12:21:27 +1000
committerPauli <paul.dale@oracle.com>2020-02-17 12:21:27 +1000
commit218e740f850f77c9f2720d56886eab166d1a6727 (patch)
treef1691e347bca452b568a9df238f15098d95ba88c /crypto/sha
parent57225c99ef848f0d0d1a7ab586a61ef71740f1ff (diff)
Do not silently truncate files on perlasm errors
If one of the perlasm xlate drivers crashes, OpenSSL's build will currently swallow the error and silently truncate the output to however far the driver got. This will hopefully fail to build, but better to check such things. Handle this by checking for errors when closing STDOUT (which is a pipe to the xlate driver). This is the OpenSSL 1.1.1 version of https://github.com/openssl/openssl/pull/10883 and https://github.com/openssl/openssl/pull/10930. Reviewed-by: Mark J. Cox <mark@awe.com> Reviewed-by: Paul Dale David Benjamin <davidben@google.com> (Merged from https://github.com/openssl/openssl/pull/10931)
Diffstat (limited to 'crypto/sha')
-rwxr-xr-xcrypto/sha/asm/keccak1600-armv4.pl2
-rwxr-xr-xcrypto/sha/asm/keccak1600-armv8.pl2
-rwxr-xr-xcrypto/sha/asm/keccak1600-avx2.pl2
-rwxr-xr-xcrypto/sha/asm/keccak1600-avx512.pl2
-rwxr-xr-xcrypto/sha/asm/keccak1600-avx512vl.pl2
-rwxr-xr-xcrypto/sha/asm/keccak1600-c64x.pl2
-rwxr-xr-xcrypto/sha/asm/keccak1600-mmx.pl2
-rwxr-xr-xcrypto/sha/asm/keccak1600-ppc64.pl2
-rwxr-xr-xcrypto/sha/asm/keccak1600-s390x.pl2
-rwxr-xr-xcrypto/sha/asm/keccak1600-x86_64.pl2
-rwxr-xr-xcrypto/sha/asm/keccak1600p8-ppc.pl2
-rw-r--r--crypto/sha/asm/sha1-586.pl2
-rw-r--r--crypto/sha/asm/sha1-alpha.pl2
-rw-r--r--crypto/sha/asm/sha1-armv4-large.pl2
-rw-r--r--crypto/sha/asm/sha1-armv8.pl2
-rw-r--r--crypto/sha/asm/sha1-c64xplus.pl2
-rw-r--r--crypto/sha/asm/sha1-mb-x86_64.pl2
-rw-r--r--crypto/sha/asm/sha1-mips.pl2
-rw-r--r--crypto/sha/asm/sha1-parisc.pl2
-rwxr-xr-xcrypto/sha/asm/sha1-ppc.pl2
-rw-r--r--crypto/sha/asm/sha1-s390x.pl2
-rw-r--r--crypto/sha/asm/sha1-sparcv9.pl2
-rw-r--r--crypto/sha/asm/sha1-sparcv9a.pl2
-rw-r--r--crypto/sha/asm/sha1-thumb.pl2
-rwxr-xr-xcrypto/sha/asm/sha1-x86_64.pl2
-rw-r--r--crypto/sha/asm/sha256-586.pl2
-rw-r--r--crypto/sha/asm/sha256-armv4.pl2
-rw-r--r--crypto/sha/asm/sha256-c64xplus.pl2
-rw-r--r--crypto/sha/asm/sha256-mb-x86_64.pl2
-rw-r--r--crypto/sha/asm/sha512-586.pl2
-rw-r--r--crypto/sha/asm/sha512-armv4.pl2
-rw-r--r--crypto/sha/asm/sha512-armv8.pl2
-rw-r--r--crypto/sha/asm/sha512-c64xplus.pl2
-rw-r--r--crypto/sha/asm/sha512-mips.pl2
-rwxr-xr-xcrypto/sha/asm/sha512-parisc.pl2
-rwxr-xr-xcrypto/sha/asm/sha512-ppc.pl2
-rw-r--r--crypto/sha/asm/sha512-s390x.pl2
-rw-r--r--crypto/sha/asm/sha512-sparcv9.pl2
-rwxr-xr-xcrypto/sha/asm/sha512-x86_64.pl2
-rwxr-xr-xcrypto/sha/asm/sha512p8-ppc.pl2
40 files changed, 40 insertions, 40 deletions
diff --git a/crypto/sha/asm/keccak1600-armv4.pl b/crypto/sha/asm/keccak1600-armv4.pl
index cb8ccc90f5..a58c3ffb5c 100755
--- a/crypto/sha/asm/keccak1600-armv4.pl
+++ b/crypto/sha/asm/keccak1600-armv4.pl
@@ -1603,4 +1603,4 @@ foreach (split($/,$code)) {
print $_,"\n";
}
-close STDOUT; # enforce flush
+close STDOUT or die "error closing STDOUT: $!"; # enforce flush
diff --git a/crypto/sha/asm/keccak1600-armv8.pl b/crypto/sha/asm/keccak1600-armv8.pl
index 3173c77f53..9bd6776d1f 100755
--- a/crypto/sha/asm/keccak1600-armv8.pl
+++ b/crypto/sha/asm/keccak1600-armv8.pl
@@ -877,4 +877,4 @@ foreach(split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/keccak1600-avx2.pl b/crypto/sha/asm/keccak1600-avx2.pl
index d9fc1c59ec..ce4f5a4b78 100755
--- a/crypto/sha/asm/keccak1600-avx2.pl
+++ b/crypto/sha/asm/keccak1600-avx2.pl
@@ -479,4 +479,4 @@ ___
$output=pop;
open STDOUT,">$output";
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/keccak1600-avx512.pl b/crypto/sha/asm/keccak1600-avx512.pl
index 9074ff02de..41fd2fb446 100755
--- a/crypto/sha/asm/keccak1600-avx512.pl
+++ b/crypto/sha/asm/keccak1600-avx512.pl
@@ -548,4 +548,4 @@ ___
$output=pop;
open STDOUT,">$output";
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/keccak1600-avx512vl.pl b/crypto/sha/asm/keccak1600-avx512vl.pl
index a21bb8615a..ee630d685d 100755
--- a/crypto/sha/asm/keccak1600-avx512vl.pl
+++ b/crypto/sha/asm/keccak1600-avx512vl.pl
@@ -389,4 +389,4 @@ ___
$output=pop;
open STDOUT,">$output";
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/keccak1600-c64x.pl b/crypto/sha/asm/keccak1600-c64x.pl
index b00af9af91..1e49b508d6 100755
--- a/crypto/sha/asm/keccak1600-c64x.pl
+++ b/crypto/sha/asm/keccak1600-c64x.pl
@@ -882,4 +882,4 @@ ___
$output=pop;
open STDOUT,">$output";
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/keccak1600-mmx.pl b/crypto/sha/asm/keccak1600-mmx.pl
index be24394d35..b390309b80 100755
--- a/crypto/sha/asm/keccak1600-mmx.pl
+++ b/crypto/sha/asm/keccak1600-mmx.pl
@@ -437,4 +437,4 @@ sub Rho() { ######### regular Rho step
&asm_finish();
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/keccak1600-ppc64.pl b/crypto/sha/asm/keccak1600-ppc64.pl
index 30e70c5d6d..c46c8530ee 100755
--- a/crypto/sha/asm/keccak1600-ppc64.pl
+++ b/crypto/sha/asm/keccak1600-ppc64.pl
@@ -755,4 +755,4 @@ ___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/keccak1600-s390x.pl b/crypto/sha/asm/keccak1600-s390x.pl
index 1184cf233e..188231e2b1 100755
--- a/crypto/sha/asm/keccak1600-s390x.pl
+++ b/crypto/sha/asm/keccak1600-s390x.pl
@@ -557,4 +557,4 @@ ___
$code =~ s/(srlg\s+)(%r[0-9]+),/$1$2,$2,/gm;
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/keccak1600-x86_64.pl b/crypto/sha/asm/keccak1600-x86_64.pl
index 34457034bf..a48d40dbf5 100755
--- a/crypto/sha/asm/keccak1600-x86_64.pl
+++ b/crypto/sha/asm/keccak1600-x86_64.pl
@@ -606,4 +606,4 @@ foreach (split("\n",$code)) {
print $_, "\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/keccak1600p8-ppc.pl b/crypto/sha/asm/keccak1600p8-ppc.pl
index de2bcd660a..0dfb962096 100755
--- a/crypto/sha/asm/keccak1600p8-ppc.pl
+++ b/crypto/sha/asm/keccak1600p8-ppc.pl
@@ -847,4 +847,4 @@ foreach (split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-586.pl b/crypto/sha/asm/sha1-586.pl
index 38167b9c5c..c0679a31ce 100644
--- a/crypto/sha/asm/sha1-586.pl
+++ b/crypto/sha/asm/sha1-586.pl
@@ -1488,4 +1488,4 @@ sub Xtail_avx()
&asm_finish();
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-alpha.pl b/crypto/sha/asm/sha1-alpha.pl
index c1a0b0c690..241853b347 100644
--- a/crypto/sha/asm/sha1-alpha.pl
+++ b/crypto/sha/asm/sha1-alpha.pl
@@ -326,4 +326,4 @@ $code.=<<___;
___
$output=pop and open STDOUT,">$output";
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-armv4-large.pl b/crypto/sha/asm/sha1-armv4-large.pl
index 7ff5bfbba6..61c832808d 100644
--- a/crypto/sha/asm/sha1-armv4-large.pl
+++ b/crypto/sha/asm/sha1-armv4-large.pl
@@ -739,4 +739,4 @@ foreach (split($/,$code)) {
print $_,$/;
}
-close STDOUT; # enforce flush
+close STDOUT or die "error closing STDOUT: $!"; # enforce flush
diff --git a/crypto/sha/asm/sha1-armv8.pl b/crypto/sha/asm/sha1-armv8.pl
index 3ba871fede..008f6959d4 100644
--- a/crypto/sha/asm/sha1-armv8.pl
+++ b/crypto/sha/asm/sha1-armv8.pl
@@ -361,4 +361,4 @@ foreach(split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-c64xplus.pl b/crypto/sha/asm/sha1-c64xplus.pl
index 4db2bcb06b..a47b663b47 100644
--- a/crypto/sha/asm/sha1-c64xplus.pl
+++ b/crypto/sha/asm/sha1-c64xplus.pl
@@ -334,4 +334,4 @@ $code.=<<___;
___
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-mb-x86_64.pl b/crypto/sha/asm/sha1-mb-x86_64.pl
index 9ac233abc9..6edadeed74 100644
--- a/crypto/sha/asm/sha1-mb-x86_64.pl
+++ b/crypto/sha/asm/sha1-mb-x86_64.pl
@@ -1625,4 +1625,4 @@ foreach (split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-mips.pl b/crypto/sha/asm/sha1-mips.pl
index 08f84bc3b3..de0a4ee7f2 100644
--- a/crypto/sha/asm/sha1-mips.pl
+++ b/crypto/sha/asm/sha1-mips.pl
@@ -458,4 +458,4 @@ $code.=<<___;
.asciiz "SHA1 for MIPS, CRYPTOGAMS by <appro\@openssl.org>"
___
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-parisc.pl b/crypto/sha/asm/sha1-parisc.pl
index b001be16a2..e5260d5ef8 100644
--- a/crypto/sha/asm/sha1-parisc.pl
+++ b/crypto/sha/asm/sha1-parisc.pl
@@ -276,4 +276,4 @@ foreach(split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-ppc.pl b/crypto/sha/asm/sha1-ppc.pl
index 0cda0a3e15..1518a5e560 100755
--- a/crypto/sha/asm/sha1-ppc.pl
+++ b/crypto/sha/asm/sha1-ppc.pl
@@ -348,4 +348,4 @@ ___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-s390x.pl b/crypto/sha/asm/sha1-s390x.pl
index 5729c30898..92de811a02 100644
--- a/crypto/sha/asm/sha1-s390x.pl
+++ b/crypto/sha/asm/sha1-s390x.pl
@@ -246,4 +246,4 @@ ___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-sparcv9.pl b/crypto/sha/asm/sha1-sparcv9.pl
index 3e612e3d5f..311cfa8adc 100644
--- a/crypto/sha/asm/sha1-sparcv9.pl
+++ b/crypto/sha/asm/sha1-sparcv9.pl
@@ -431,4 +431,4 @@ foreach (split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-sparcv9a.pl b/crypto/sha/asm/sha1-sparcv9a.pl
index 50d3e136a1..2ad651f68e 100644
--- a/crypto/sha/asm/sha1-sparcv9a.pl
+++ b/crypto/sha/asm/sha1-sparcv9a.pl
@@ -605,4 +605,4 @@ $code =~ s/\b(alignaddr)\s+(%[goli][0-7]),(%[goli][0-7]),(%[goli][0-7])/
&unalignaddr($1,$2,$3,$4)
/gem;
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha1-thumb.pl b/crypto/sha/asm/sha1-thumb.pl
index ac74a25d6e..b87248e1c7 100644
--- a/crypto/sha/asm/sha1-thumb.pl
+++ b/crypto/sha/asm/sha1-thumb.pl
@@ -263,4 +263,4 @@ $code.=<<___;
___
print $code;
-close STDOUT; # enforce flush
+close STDOUT or die "error closing STDOUT: $!"; # enforce flush
diff --git a/crypto/sha/asm/sha1-x86_64.pl b/crypto/sha/asm/sha1-x86_64.pl
index ef080f235a..e700133349 100755
--- a/crypto/sha/asm/sha1-x86_64.pl
+++ b/crypto/sha/asm/sha1-x86_64.pl
@@ -2129,4 +2129,4 @@ foreach (split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha256-586.pl b/crypto/sha/asm/sha256-586.pl
index 913fca3105..645d21cc74 100644
--- a/crypto/sha/asm/sha256-586.pl
+++ b/crypto/sha/asm/sha256-586.pl
@@ -1293,4 +1293,4 @@ sub bodyx_00_15 () { # +10%
&asm_finish();
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha256-armv4.pl b/crypto/sha/asm/sha256-armv4.pl
index edcfc31278..c2e46be79f 100644
--- a/crypto/sha/asm/sha256-armv4.pl
+++ b/crypto/sha/asm/sha256-armv4.pl
@@ -729,4 +729,4 @@ foreach (split($/,$code)) {
print $_,"\n";
}
-close STDOUT; # enforce flush
+close STDOUT or die "error closing STDOUT: $!"; # enforce flush
diff --git a/crypto/sha/asm/sha256-c64xplus.pl b/crypto/sha/asm/sha256-c64xplus.pl
index 3ab7d9b689..1ed1313149 100644
--- a/crypto/sha/asm/sha256-c64xplus.pl
+++ b/crypto/sha/asm/sha256-c64xplus.pl
@@ -317,4 +317,4 @@ K256:
___
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha256-mb-x86_64.pl b/crypto/sha/asm/sha256-mb-x86_64.pl
index 7556b2123b..e122356017 100644
--- a/crypto/sha/asm/sha256-mb-x86_64.pl
+++ b/crypto/sha/asm/sha256-mb-x86_64.pl
@@ -1611,4 +1611,4 @@ foreach (split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha512-586.pl b/crypto/sha/asm/sha512-586.pl
index 867ce30b97..4fca59ec0a 100644
--- a/crypto/sha/asm/sha512-586.pl
+++ b/crypto/sha/asm/sha512-586.pl
@@ -922,4 +922,4 @@ sub BODY_00_15_ssse3 { # "phase-less" copy of BODY_00_15_sse2
&asm_finish();
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha512-armv4.pl b/crypto/sha/asm/sha512-armv4.pl
index 0b4c5674d9..d880d2c422 100644
--- a/crypto/sha/asm/sha512-armv4.pl
+++ b/crypto/sha/asm/sha512-armv4.pl
@@ -665,4 +665,4 @@ while(<SELF>) {
close SELF;
print $code;
-close STDOUT; # enforce flush
+close STDOUT or die "error closing STDOUT: $!"; # enforce flush
diff --git a/crypto/sha/asm/sha512-armv8.pl b/crypto/sha/asm/sha512-armv8.pl
index 01ffe9f98c..ea0ed5877e 100644
--- a/crypto/sha/asm/sha512-armv8.pl
+++ b/crypto/sha/asm/sha512-armv8.pl
@@ -902,4 +902,4 @@ foreach(split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha512-c64xplus.pl b/crypto/sha/asm/sha512-c64xplus.pl
index 9ebfc92e23..b5b9e7cf97 100644
--- a/crypto/sha/asm/sha512-c64xplus.pl
+++ b/crypto/sha/asm/sha512-c64xplus.pl
@@ -435,4 +435,4 @@ K512:
___
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha512-mips.pl b/crypto/sha/asm/sha512-mips.pl
index dab684dde5..ffcf4d3bc1 100644
--- a/crypto/sha/asm/sha512-mips.pl
+++ b/crypto/sha/asm/sha512-mips.pl
@@ -518,4 +518,4 @@ ___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha512-parisc.pl b/crypto/sha/asm/sha512-parisc.pl
index 59eb320ab6..9423fe1093 100755
--- a/crypto/sha/asm/sha512-parisc.pl
+++ b/crypto/sha/asm/sha512-parisc.pl
@@ -804,4 +804,4 @@ foreach (split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha512-ppc.pl b/crypto/sha/asm/sha512-ppc.pl
index 71699f6637..0f909c80a6 100755
--- a/crypto/sha/asm/sha512-ppc.pl
+++ b/crypto/sha/asm/sha512-ppc.pl
@@ -796,4 +796,4 @@ ___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha512-s390x.pl b/crypto/sha/asm/sha512-s390x.pl
index 4c0f4e7931..6ca62f2b05 100644
--- a/crypto/sha/asm/sha512-s390x.pl
+++ b/crypto/sha/asm/sha512-s390x.pl
@@ -321,4 +321,4 @@ $code =~ s/\`([^\`]*)\`/eval $1/gem;
$code =~ s/(srlg\s+)(%r[0-9]+),/$1$2,$2,/gm;
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha512-sparcv9.pl b/crypto/sha/asm/sha512-sparcv9.pl
index c215909633..8824a7889d 100644
--- a/crypto/sha/asm/sha512-sparcv9.pl
+++ b/crypto/sha/asm/sha512-sparcv9.pl
@@ -854,4 +854,4 @@ foreach (split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha512-x86_64.pl b/crypto/sha/asm/sha512-x86_64.pl
index 6259dc2469..d2b5f751fa 100755
--- a/crypto/sha/asm/sha512-x86_64.pl
+++ b/crypto/sha/asm/sha512-x86_64.pl
@@ -2555,4 +2555,4 @@ foreach (split("\n",$code)) {
print $_,"\n";
}
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/sha512p8-ppc.pl b/crypto/sha/asm/sha512p8-ppc.pl
index 0d4fdd292c..cd162ed920 100755
--- a/crypto/sha/asm/sha512p8-ppc.pl
+++ b/crypto/sha/asm/sha512p8-ppc.pl
@@ -417,4 +417,4 @@ ___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";