diff options
author | David Benjamin <davidben@google.com> | 2016-06-26 20:18:50 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2016-06-28 00:59:26 +0300 |
commit | fdd8e9c8c7547c523bd5219de1c6d739cafee461 (patch) | |
tree | 5589ffdebb74f9e699dec7566e8df06ad555acb9 /crypto/sha | |
parent | ac81d929682d9693d91af0a7443d454d856c7592 (diff) |
Switch perlasm calling convention.
Depending on architecture, perlasm differed on which one or both of:
perl foo.pl flavor output.S
perl foo.pl flavor > output.S
Upstream has now unified on the first form after making a number of
changes to their files (the second does not even work for their x86
files anymore). Sync those portions of our perlasm scripts with upstream
and update CMakeLists.txt and generate_build_files.py per the new
convention.
This imports various commits like this one:
184bc45f683c76531d7e065b6553ca9086564576 (this was done by taking a
diff, so I don't have the full list)
Confirmed that generate_build_files.py sees no change.
BUG=14
Change-Id: Id2fb5b8bc2a7369d077221b5df9a6947d41f50d2
Reviewed-on: https://boringssl-review.googlesource.com/8518
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/sha')
-rw-r--r-- | crypto/sha/CMakeLists.txt | 8 | ||||
-rw-r--r-- | crypto/sha/asm/sha1-586.pl | 5 | ||||
-rw-r--r-- | crypto/sha/asm/sha1-armv4-large.pl | 4 | ||||
-rw-r--r-- | crypto/sha/asm/sha1-x86_64.pl | 2 | ||||
-rw-r--r-- | crypto/sha/asm/sha256-586.pl | 5 | ||||
-rw-r--r-- | crypto/sha/asm/sha256-armv4.pl | 4 | ||||
-rw-r--r-- | crypto/sha/asm/sha512-586.pl | 5 | ||||
-rw-r--r-- | crypto/sha/asm/sha512-armv4.pl | 4 | ||||
-rw-r--r-- | crypto/sha/asm/sha512-armv8.pl | 10 | ||||
-rw-r--r-- | crypto/sha/asm/sha512-x86_64.pl | 2 |
10 files changed, 29 insertions, 20 deletions
diff --git a/crypto/sha/CMakeLists.txt b/crypto/sha/CMakeLists.txt index ecff09b8..49147d38 100644 --- a/crypto/sha/CMakeLists.txt +++ b/crypto/sha/CMakeLists.txt @@ -53,8 +53,8 @@ add_library( ) perlasm(sha1-x86_64.${ASM_EXT} asm/sha1-x86_64.pl) -perlasm(sha256-x86_64.${ASM_EXT} asm/sha512-x86_64.pl sha256) -perlasm(sha512-x86_64.${ASM_EXT} asm/sha512-x86_64.pl sha512) +perlasm(sha256-x86_64.${ASM_EXT} asm/sha512-x86_64.pl) +perlasm(sha512-x86_64.${ASM_EXT} asm/sha512-x86_64.pl) perlasm(sha1-586.${ASM_EXT} asm/sha1-586.pl) perlasm(sha256-586.${ASM_EXT} asm/sha256-586.pl) perlasm(sha512-586.${ASM_EXT} asm/sha512-586.pl) @@ -62,5 +62,5 @@ perlasm(sha1-armv4-large.${ASM_EXT} asm/sha1-armv4-large.pl) perlasm(sha256-armv4.${ASM_EXT} asm/sha256-armv4.pl) perlasm(sha512-armv4.${ASM_EXT} asm/sha512-armv4.pl) perlasm(sha1-armv8.${ASM_EXT} asm/sha1-armv8.pl) -perlasm(sha256-armv8.${ASM_EXT} asm/sha512-armv8.pl sha256) -perlasm(sha512-armv8.${ASM_EXT} asm/sha512-armv8.pl sha512) +perlasm(sha256-armv8.${ASM_EXT} asm/sha512-armv8.pl) +perlasm(sha512-armv8.${ASM_EXT} asm/sha512-armv8.pl) diff --git a/crypto/sha/asm/sha1-586.pl b/crypto/sha/asm/sha1-586.pl index 35142737..e815e2b5 100644 --- a/crypto/sha/asm/sha1-586.pl +++ b/crypto/sha/asm/sha1-586.pl @@ -113,6 +113,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; push(@INC,"${dir}","${dir}../../perlasm"); require "x86asm.pl"; +$output=pop; +open STDOUT,">$output"; + &asm_init($ARGV[0],"sha1-586.pl",$ARGV[$#ARGV] eq "386"); $xmm=$ymm=0; @@ -1469,3 +1472,5 @@ sub Xtail_avx() &asciz("SHA1 block transform for x86, CRYPTOGAMS by <appro\@openssl.org>"); &asm_finish(); + +close STDOUT; diff --git a/crypto/sha/asm/sha1-armv4-large.pl b/crypto/sha/asm/sha1-armv4-large.pl index 64e2ed61..4fef524c 100644 --- a/crypto/sha/asm/sha1-armv4-large.pl +++ b/crypto/sha/asm/sha1-armv4-large.pl @@ -69,8 +69,8 @@ # Add ARMv8 code path performing at 2.35 cpb on Apple A7. $flavour = shift; -if ($flavour=~/^\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } -else { while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {} } +if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } +else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} } if ($flavour && $flavour ne "void") { $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; diff --git a/crypto/sha/asm/sha1-x86_64.pl b/crypto/sha/asm/sha1-x86_64.pl index 4895f922..cdc72857 100644 --- a/crypto/sha/asm/sha1-x86_64.pl +++ b/crypto/sha/asm/sha1-x86_64.pl @@ -106,7 +106,7 @@ $avx = 1; $shaext=0; ### set to zero if compiling for 1.0.1 $avx=1 if (!$shaext && $avx); -open OUT,"| \"$^X\" $xlate $flavour $output"; +open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; *STDOUT=*OUT; $ctx="%rdi"; # 1st arg diff --git a/crypto/sha/asm/sha256-586.pl b/crypto/sha/asm/sha256-586.pl index fa8f264d..8f4311b6 100644 --- a/crypto/sha/asm/sha256-586.pl +++ b/crypto/sha/asm/sha256-586.pl @@ -63,6 +63,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; push(@INC,"${dir}","${dir}../../perlasm"); require "x86asm.pl"; +$output=pop; +open STDOUT,">$output"; + &asm_init($ARGV[0],"sha512-586.pl",$ARGV[$#ARGV] eq "386"); $xmm=$avx=0; @@ -1273,3 +1276,5 @@ sub bodyx_00_15 () { # +10% &function_end_B("sha256_block_data_order"); &asm_finish(); + +close STDOUT; diff --git a/crypto/sha/asm/sha256-armv4.pl b/crypto/sha/asm/sha256-armv4.pl index 7e071474..e1be2269 100644 --- a/crypto/sha/asm/sha256-armv4.pl +++ b/crypto/sha/asm/sha256-armv4.pl @@ -38,8 +38,8 @@ # Add ARMv8 code path performing at 2.0 cpb on Apple A7. $flavour = shift; -if ($flavour=~/^\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } -else { while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {} } +if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } +else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} } if ($flavour && $flavour ne "void") { $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; diff --git a/crypto/sha/asm/sha512-586.pl b/crypto/sha/asm/sha512-586.pl index 2f6a202c..d0f91010 100644 --- a/crypto/sha/asm/sha512-586.pl +++ b/crypto/sha/asm/sha512-586.pl @@ -50,6 +50,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; push(@INC,"${dir}","${dir}../../perlasm"); require "x86asm.pl"; +$output=pop; +open STDOUT,">$output"; + &asm_init($ARGV[0],"sha512-586.pl",$ARGV[$#ARGV] eq "386"); $sse2=0; @@ -909,3 +912,5 @@ sub BODY_00_15_ssse3 { # "phase-less" copy of BODY_00_15_sse2 &asciz("SHA512 block transform for x86, CRYPTOGAMS by <appro\@openssl.org>"); &asm_finish(); + +close STDOUT; diff --git a/crypto/sha/asm/sha512-armv4.pl b/crypto/sha/asm/sha512-armv4.pl index 15d50f28..0320c168 100644 --- a/crypto/sha/asm/sha512-armv4.pl +++ b/crypto/sha/asm/sha512-armv4.pl @@ -51,8 +51,8 @@ $lo="LO"; # ==================================================================== $flavour = shift; -if ($flavour=~/^\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } -else { while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {} } +if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } +else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} } if ($flavour && $flavour ne "void") { $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; diff --git a/crypto/sha/asm/sha512-armv8.pl b/crypto/sha/asm/sha512-armv8.pl index 40eb17a7..75d40431 100644 --- a/crypto/sha/asm/sha512-armv8.pl +++ b/crypto/sha/asm/sha512-armv8.pl @@ -30,10 +30,6 @@ # and the gap is only 40-90%. $flavour=shift; -# Unlike most perlasm files, sha512-armv8.pl takes an additional argument to -# determine which hash function to emit. This differs from upstream OpenSSL so -# that the script may continue to output to stdout. -$variant=shift; $output=shift; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; @@ -44,7 +40,7 @@ die "can't locate arm-xlate.pl"; open OUT,"| \"$^X\" $xlate $flavour $output"; *STDOUT=*OUT; -if ($variant eq "sha512") { +if ($output =~ /512/) { $BITS=512; $SZ=8; @Sigma0=(28,34,39); @@ -53,7 +49,7 @@ if ($variant eq "sha512") { @sigma1=(19,61, 6); $rounds=80; $reg_t="x"; -} elsif ($variant eq "sha256") { +} else { $BITS=256; $SZ=4; @Sigma0=( 2,13,22); @@ -62,8 +58,6 @@ if ($variant eq "sha512") { @sigma1=(17,19,10); $rounds=64; $reg_t="w"; -} else { - die "Unknown variant: $variant"; } $func="sha${BITS}_block_data_order"; diff --git a/crypto/sha/asm/sha512-x86_64.pl b/crypto/sha/asm/sha512-x86_64.pl index 2bc33c65..186aa9aa 100644 --- a/crypto/sha/asm/sha512-x86_64.pl +++ b/crypto/sha/asm/sha512-x86_64.pl @@ -123,7 +123,7 @@ $avx = 1; $shaext=0; ### set to zero if compiling for 1.0.1 $avx=1 if (!$shaext && $avx); -open OUT,"| \"$^X\" $xlate $flavour"; +open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; *STDOUT=*OUT; if ($output =~ /512/) { |