Skip to content

Commit

Permalink
Handle errors from close in perlasm scripts.
Browse files Browse the repository at this point in the history
If the xlate filter script fails, the outer script swallows the error,
unless we check the return value of close.

Change-Id: Ib506bb745a5d27b9d1df9329535bf81ad090f41f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/35724
Reviewed-by: Adam Langley <agl@google.com>
  • Loading branch information
davidben authored and agl committed Apr 26, 2019
1 parent 777a239 commit c1d8c5b
Show file tree
Hide file tree
Showing 53 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion crypto/chacha/asm/chacha-armv4.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1161,4 +1161,4 @@ sub NEONROUND {

print $_,"\n";
}
close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/chacha/asm/chacha-armv8.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1134,4 +1134,4 @@ sub NEONROUND {

print $_,"\n";
}
close STDOUT; # flush
close STDOUT or die "error closing STDOUT"; # flush
2 changes: 1 addition & 1 deletion crypto/chacha/asm/chacha-x86.pl
Original file line number Diff line number Diff line change
Expand Up @@ -769,4 +769,4 @@ sub SSSE3ROUND { # critical path is 20 "SIMD ticks" per round

&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/chacha/asm/chacha-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2782,4 +2782,4 @@ sub AVX512_lane_ROUND {
print $_,"\n";
}

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/cipher_extra/asm/aes128gcmsiv-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2253,4 +2253,4 @@ sub aes256gcmsiv_kdf {

print $code;

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2485,4 +2485,4 @@ sub gen_chacha_round_avx2 {
___
}

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/aes/asm/aes-586.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2997,4 +2997,4 @@ ()

&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/aes/asm/aes-armv4.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1247,4 +1247,4 @@
close SELF;

print $code;
close STDOUT; # enforce flush
close STDOUT or die "error closing STDOUT"; # enforce flush
2 changes: 1 addition & 1 deletion crypto/fipsmodule/aes/asm/aes-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2906,4 +2906,4 @@ ()

print $code;

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/aes/asm/aesni-x86.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2551,4 +2551,4 @@ sub aesni_generate6

&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/aes/asm/aesni-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5108,4 +5108,4 @@ sub movbe {

print $code;

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/aes/asm/aesp8-ppc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3802,4 +3802,4 @@ ()
print $_,"\n";
}

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/aes/asm/aesv8-armx.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1018,4 +1018,4 @@ ()
}
}

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/aes/asm/bsaes-armv7.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2431,4 +2431,4 @@ sub bitslice_key {

print $code;

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/aes/asm/vpaes-armv8.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1359,4 +1359,4 @@

print $code;

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/aes/asm/vpaes-x86.pl
Original file line number Diff line number Diff line change
Expand Up @@ -920,4 +920,4 @@

&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/aes/asm/vpaes-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1550,4 +1550,4 @@

print $code;

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/bn/asm/armv4-mont.pl
Original file line number Diff line number Diff line change
Expand Up @@ -759,4 +759,4 @@
print $_,"\n";
}

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/bn/asm/armv8-mont.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1507,4 +1507,4 @@

print $code;

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/bn/asm/bn-586.pl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";

sub bn_mul_add_words
{
Expand Down
2 changes: 1 addition & 1 deletion crypto/fipsmodule/bn/asm/co-586.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";

sub mul_add_c
{
Expand Down
2 changes: 1 addition & 1 deletion crypto/fipsmodule/bn/asm/rsaz-avx2.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1940,4 +1940,4 @@
___
}}}

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/bn/asm/x86-mont.pl
Original file line number Diff line number Diff line change
Expand Up @@ -628,4 +628,4 @@

&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/bn/asm/x86_64-mont.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1578,4 +1578,4 @@
}

print $code;
close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/bn/asm/x86_64-mont5.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3930,4 +3930,4 @@
$code =~ s/\`([^\`]*)\`/eval($1)/gem;

print $code;
close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/ec/asm/p256-x86_64-asm.pl
Original file line number Diff line number Diff line change
Expand Up @@ -4146,4 +4146,4 @@ ()

$code =~ s/\`([^\`]*)\`/eval $1/gem;
print $code;
close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/ec/asm/p256_beeu-x86_64-asm.pl
Original file line number Diff line number Diff line change
Expand Up @@ -400,4 +400,4 @@ sub SHIFT256 {
___

print $code;
close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/md5/asm/md5-586.pl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
&md5_block("md5_block_asm_data_order");
&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";

sub Np
{
Expand Down
2 changes: 1 addition & 1 deletion crypto/fipsmodule/md5/asm/md5-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,4 @@ sub round4_step

print $code;

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/modes/asm/aesni-gcm-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1143,4 +1143,4 @@

print $code;

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/modes/asm/ghash-armv4.pl
Original file line number Diff line number Diff line change
Expand Up @@ -553,4 +553,4 @@ sub clmul64x64 {

print $_,"\n";
}
close STDOUT; # enforce flush
close STDOUT or die "error closing STDOUT"; # enforce flush
2 changes: 1 addition & 1 deletion crypto/fipsmodule/modes/asm/ghash-neon-armv8.pl
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,4 @@ sub clmul64x64 {

print $_,"\n";
}
close STDOUT; # enforce flush
close STDOUT or die "error closing STDOUT"; # enforce flush
2 changes: 1 addition & 1 deletion crypto/fipsmodule/modes/asm/ghash-ssse3-x86.pl
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,4 @@ sub process_rows {

&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/modes/asm/ghash-ssse3-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,4 @@ sub process_rows {
}

print $code;
close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/modes/asm/ghash-x86.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ sub reduction_alg5 { # 19/16 times faster than Intel version
&asciz("GHASH for x86, CRYPTOGAMS by <appro\@openssl.org>");
&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";

# A question was risen about choice of vanilla MMX. Or rather why wasn't
# SSE2 chosen instead? In addition to the fact that MMX runs on legacy
Expand Down
2 changes: 1 addition & 1 deletion crypto/fipsmodule/modes/asm/ghash-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1803,4 +1803,4 @@ sub reduction_avx {

print $code;

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/modes/asm/ghashp8-ppc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -667,4 +667,4 @@
print $_,"\n";
}

close STDOUT; # enforce flush
close STDOUT or die "error closing STDOUT"; # enforce flush
2 changes: 1 addition & 1 deletion crypto/fipsmodule/modes/asm/ghashv8-armx.pl
Original file line number Diff line number Diff line change
Expand Up @@ -425,4 +425,4 @@
}
}

close STDOUT; # enforce flush
close STDOUT or die "error closing STDOUT"; # enforce flush
2 changes: 1 addition & 1 deletion crypto/fipsmodule/rand/asm/rdrand-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@
.size CRYPTO_rdrand_multiple8_buf,.-CRYPTO_rdrand_multiple8_buf
___

close STDOUT; # flush
close STDOUT or die "error closing STDOUT"; # flush
2 changes: 1 addition & 1 deletion crypto/fipsmodule/sha/asm/sha1-586.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1483,4 +1483,4 @@ ()

&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/sha/asm/sha1-armv4-large.pl
Original file line number Diff line number Diff line change
Expand Up @@ -740,4 +740,4 @@ ()
print $_,$/;
}

close STDOUT; # enforce flush
close STDOUT or die "error closing STDOUT"; # enforce flush
2 changes: 1 addition & 1 deletion crypto/fipsmodule/sha/asm/sha1-armv8.pl
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,4 @@ sub BODY_20_39 {
print $_,"\n";
}

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/sha/asm/sha1-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2122,4 +2122,4 @@ sub sha1op38 {

print $_,"\n";
}
close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/sha/asm/sha256-586.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1287,4 +1287,4 @@ ()

&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/sha/asm/sha256-armv4.pl
Original file line number Diff line number Diff line change
Expand Up @@ -735,4 +735,4 @@ ()
print $_,"\n";
}

close STDOUT; # enforce flush
close STDOUT or die "error closing STDOUT"; # enforce flush
2 changes: 1 addition & 1 deletion crypto/fipsmodule/sha/asm/sha512-586.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/sha/asm/sha512-armv4.pl
Original file line number Diff line number Diff line change
Expand Up @@ -670,4 +670,4 @@ ()
close SELF;

print $code;
close STDOUT; # enforce flush
close STDOUT or die "error closing STDOUT"; # enforce flush
2 changes: 1 addition & 1 deletion crypto/fipsmodule/sha/asm/sha512-armv8.pl
Original file line number Diff line number Diff line change
Expand Up @@ -457,4 +457,4 @@ sub BODY_00_xx {
print $_,"\n";
}

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/fipsmodule/sha/asm/sha512-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2083,4 +2083,4 @@ sub sha256op38 {

print $_,"\n";
}
close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/test/asm/trampoline-armv4.pl
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@
}

print $code;
close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/test/asm/trampoline-armv8.pl
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,4 @@
}

print $code;
close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/test/asm/trampoline-x86.pl
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@

&asm_finish();

close STDOUT;
close STDOUT or die "error closing STDOUT";
2 changes: 1 addition & 1 deletion crypto/test/asm/trampoline-x86_64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -556,4 +556,4 @@ sub store_caller_state {
}

print $code;
close STDOUT;
close STDOUT or die "error closing STDOUT";

0 comments on commit c1d8c5b

Please sign in to comment.