diff options
author | David Benjamin <davidben@google.com> | 2020-01-17 16:53:56 -0500 |
---|---|---|
committer | Tomas Mraz <tmraz@fedoraproject.org> | 2020-01-22 18:11:30 +0100 |
commit | 32be631ca1f2b73c92e4f7f5d23f1c3aee80ec69 (patch) | |
tree | 96311da5899ffe99a38af33e37d95f7426e80840 /crypto/bn | |
parent | 3b740f6ec0562a97046277c8246b21163b1a7553 (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).
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10883)
Diffstat (limited to 'crypto/bn')
29 files changed, 29 insertions, 29 deletions
diff --git a/crypto/bn/asm/alpha-mont.pl b/crypto/bn/asm/alpha-mont.pl index b46c79ca4f..b242098c75 100644 --- a/crypto/bn/asm/alpha-mont.pl +++ b/crypto/bn/asm/alpha-mont.pl @@ -324,4 +324,4 @@ bn_mul_mont: ___ print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/armv4-gf2m.pl b/crypto/bn/asm/armv4-gf2m.pl index e7a865581f..400712f052 100644 --- a/crypto/bn/asm/armv4-gf2m.pl +++ b/crypto/bn/asm/armv4-gf2m.pl @@ -338,4 +338,4 @@ foreach (split("\n",$code)) { print $_,"\n"; } -close STDOUT; # enforce flush +close STDOUT or die "error closing STDOUT"; # enforce flush diff --git a/crypto/bn/asm/armv4-mont.pl b/crypto/bn/asm/armv4-mont.pl index 72c883fe9f..85ec79344c 100644 --- a/crypto/bn/asm/armv4-mont.pl +++ b/crypto/bn/asm/armv4-mont.pl @@ -763,4 +763,4 @@ foreach (split("\n",$code)) { print $_,"\n"; } -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/armv8-mont.pl b/crypto/bn/asm/armv8-mont.pl index 3e92881bc0..77e77ae03f 100755 --- a/crypto/bn/asm/armv8-mont.pl +++ b/crypto/bn/asm/armv8-mont.pl @@ -1514,4 +1514,4 @@ ___ print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/bn-586.pl b/crypto/bn/asm/bn-586.pl index 287162161c..3bd422ceb6 100644 --- a/crypto/bn/asm/bn-586.pl +++ b/crypto/bn/asm/bn-586.pl @@ -30,7 +30,7 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } &asm_finish(); -close STDOUT; +close STDOUT or die "error closing STDOUT"; sub bn_mul_add_words { diff --git a/crypto/bn/asm/c64xplus-gf2m.pl b/crypto/bn/asm/c64xplus-gf2m.pl index d4913867d0..da9b24a5ba 100644 --- a/crypto/bn/asm/c64xplus-gf2m.pl +++ b/crypto/bn/asm/c64xplus-gf2m.pl @@ -156,4 +156,4 @@ $code.=<<___; ___ print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/co-586.pl b/crypto/bn/asm/co-586.pl index d9263094b4..a9be2729e2 100644 --- a/crypto/bn/asm/co-586.pl +++ b/crypto/bn/asm/co-586.pl @@ -21,7 +21,7 @@ $output = pop and open STDOUT,">$output"; &asm_finish(); -close STDOUT; +close STDOUT or die "error closing STDOUT"; sub mul_add_c { diff --git a/crypto/bn/asm/ia64-mont.pl b/crypto/bn/asm/ia64-mont.pl index ce51b17ef9..63db78367b 100644 --- a/crypto/bn/asm/ia64-mont.pl +++ b/crypto/bn/asm/ia64-mont.pl @@ -858,4 +858,4 @@ ___ open STDOUT,">$output" if $output; print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/mips-mont.pl b/crypto/bn/asm/mips-mont.pl index c0b4629184..93aa1bf456 100644 --- a/crypto/bn/asm/mips-mont.pl +++ b/crypto/bn/asm/mips-mont.pl @@ -433,4 +433,4 @@ ___ $code =~ s/\`([^\`]*)\`/eval $1/gem; print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/mips.pl b/crypto/bn/asm/mips.pl index af44c9786e..e24fe2e827 100644 --- a/crypto/bn/asm/mips.pl +++ b/crypto/bn/asm/mips.pl @@ -2262,4 +2262,4 @@ $code.=<<___; .end bn_sqr_comba4 ___ print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/parisc-mont.pl b/crypto/bn/asm/parisc-mont.pl index 1420840d62..757f68af21 100644 --- a/crypto/bn/asm/parisc-mont.pl +++ b/crypto/bn/asm/parisc-mont.pl @@ -1005,4 +1005,4 @@ foreach (split("\n",$code)) { print $_,"\n"; } -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/ppc-mont.pl b/crypto/bn/asm/ppc-mont.pl index 01c8d11bae..b208f2dc6f 100644 --- a/crypto/bn/asm/ppc-mont.pl +++ b/crypto/bn/asm/ppc-mont.pl @@ -1991,4 +1991,4 @@ ___ $code =~ s/\`([^\`]*)\`/eval $1/gem; print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/ppc.pl b/crypto/bn/asm/ppc.pl index 4b4e6c6100..a9f50a8ebf 100644 --- a/crypto/bn/asm/ppc.pl +++ b/crypto/bn/asm/ppc.pl @@ -2013,4 +2013,4 @@ Lppcasm_maw_adios: EOF $data =~ s/\`([^\`]*)\`/eval $1/gem; print $data; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/ppc64-mont.pl b/crypto/bn/asm/ppc64-mont.pl index 4420a14a0a..e869ec87f9 100644 --- a/crypto/bn/asm/ppc64-mont.pl +++ b/crypto/bn/asm/ppc64-mont.pl @@ -1653,4 +1653,4 @@ ___ $code =~ s/\`([^\`]*)\`/eval $1/gem; print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/rsaz-avx2.pl b/crypto/bn/asm/rsaz-avx2.pl index b68a8d61c7..e0332426a9 100755 --- a/crypto/bn/asm/rsaz-avx2.pl +++ b/crypto/bn/asm/rsaz-avx2.pl @@ -1981,4 +1981,4 @@ rsaz_1024_gather5_avx2: ___ }}} -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/rsaz-x86_64.pl b/crypto/bn/asm/rsaz-x86_64.pl index e9ff9834c6..ee92dfe3c4 100755 --- a/crypto/bn/asm/rsaz-x86_64.pl +++ b/crypto/bn/asm/rsaz-x86_64.pl @@ -2430,4 +2430,4 @@ ___ $code =~ s/\`([^\`]*)\`/eval $1/gem; print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/s390x-gf2m.pl b/crypto/bn/asm/s390x-gf2m.pl index 85e5eaa84f..4e85800178 100644 --- a/crypto/bn/asm/s390x-gf2m.pl +++ b/crypto/bn/asm/s390x-gf2m.pl @@ -227,4 +227,4 @@ ___ $code =~ s/\`([^\`]*)\`/eval($1)/gem; print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/s390x-mont.pl b/crypto/bn/asm/s390x-mont.pl index 6ca0c43769..f7b1dc2111 100644 --- a/crypto/bn/asm/s390x-mont.pl +++ b/crypto/bn/asm/s390x-mont.pl @@ -283,4 +283,4 @@ foreach (split("\n",$code)) { s/_dswap\s+(%r[0-9]+)/sprintf("rllg\t%s,%s,32",$1,$1) if($SIZE_T==4)/e; print $_,"\n"; } -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/sparct4-mont.pl b/crypto/bn/asm/sparct4-mont.pl index 76fffaf268..1d4b5ee9e5 100755 --- a/crypto/bn/asm/sparct4-mont.pl +++ b/crypto/bn/asm/sparct4-mont.pl @@ -1224,4 +1224,4 @@ ___ &emit_assembler(); -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/sparcv9-gf2m.pl b/crypto/bn/asm/sparcv9-gf2m.pl index d4dda79219..40bac74a89 100644 --- a/crypto/bn/asm/sparcv9-gf2m.pl +++ b/crypto/bn/asm/sparcv9-gf2m.pl @@ -196,4 +196,4 @@ ___ $code =~ s/\`([^\`]*)\`/eval($1)/gem; print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/sparcv9-mont.pl b/crypto/bn/asm/sparcv9-mont.pl index 6348c2a63b..33c4ffb5ae 100644 --- a/crypto/bn/asm/sparcv9-mont.pl +++ b/crypto/bn/asm/sparcv9-mont.pl @@ -616,4 +616,4 @@ $code.=<<___; ___ $code =~ s/\`([^\`]*)\`/eval($1)/gem; print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/sparcv9a-mont.pl b/crypto/bn/asm/sparcv9a-mont.pl index a1170c7639..a91e40edb0 100755 --- a/crypto/bn/asm/sparcv9a-mont.pl +++ b/crypto/bn/asm/sparcv9a-mont.pl @@ -886,4 +886,4 @@ $code =~ s/fzeros\s+%f([0-9]+)/ print $code; # flush -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/via-mont.pl b/crypto/bn/asm/via-mont.pl index d873082d4b..3c27628890 100644 --- a/crypto/bn/asm/via-mont.pl +++ b/crypto/bn/asm/via-mont.pl @@ -247,4 +247,4 @@ $sp=&DWP(28,"esp"); &asm_finish(); -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/vis3-mont.pl b/crypto/bn/asm/vis3-mont.pl index 53f9920efe..827679b396 100644 --- a/crypto/bn/asm/vis3-mont.pl +++ b/crypto/bn/asm/vis3-mont.pl @@ -380,4 +380,4 @@ foreach (split("\n",$code)) { print $_,"\n"; } -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/x86-gf2m.pl b/crypto/bn/asm/x86-gf2m.pl index bcc6de08a9..c909065fd9 100644 --- a/crypto/bn/asm/x86-gf2m.pl +++ b/crypto/bn/asm/x86-gf2m.pl @@ -321,4 +321,4 @@ if ($sse2) { &asm_finish(); -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/x86-mont.pl b/crypto/bn/asm/x86-mont.pl index 864816fb1a..e23433594b 100755 --- a/crypto/bn/asm/x86-mont.pl +++ b/crypto/bn/asm/x86-mont.pl @@ -627,4 +627,4 @@ $sbit=$num; &asm_finish(); -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/x86_64-gf2m.pl b/crypto/bn/asm/x86_64-gf2m.pl index f312a0c72a..27034285de 100644 --- a/crypto/bn/asm/x86_64-gf2m.pl +++ b/crypto/bn/asm/x86_64-gf2m.pl @@ -423,4 +423,4 @@ ___ $code =~ s/\`([^\`]*)\`/eval($1)/gem; print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/x86_64-mont.pl b/crypto/bn/asm/x86_64-mont.pl index 9e425b227b..bcc0f83ec0 100755 --- a/crypto/bn/asm/x86_64-mont.pl +++ b/crypto/bn/asm/x86_64-mont.pl @@ -1591,4 +1591,4 @@ ___ } print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; diff --git a/crypto/bn/asm/x86_64-mont5.pl b/crypto/bn/asm/x86_64-mont5.pl index 5e70547704..0eb127b4e7 100755 --- a/crypto/bn/asm/x86_64-mont5.pl +++ b/crypto/bn/asm/x86_64-mont5.pl @@ -3962,4 +3962,4 @@ ___ $code =~ s/\`([^\`]*)\`/eval($1)/gem; print $code; -close STDOUT; +close STDOUT or die "error closing STDOUT"; |