summaryrefslogtreecommitdiffstats
path: root/crypto/ec
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2023-08-28 18:49:02 +0200
committerTomas Mraz <tomas@openssl.org>2023-08-31 09:40:51 +0200
commit8a7f30ef67d59f808610275e8bc1723510cf062b (patch)
treead4fccb4be65024583a02e0e3cefda8c0e227373 /crypto/ec
parent9f5102bffc8bb3a9b02a0a5e3c1de4326622fe04 (diff)
ecp_sm2p256-armv8.pl: Copy the argument handling from ecp_nistz256-armv8.pl
Popping the $output argument is more robust and it also needs to be placed in double quotes to handle spaces in paths. Fixes #21874 Fixes #21876 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/21877)
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/asm/ecp_sm2p256-armv8.pl9
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/ec/asm/ecp_sm2p256-armv8.pl b/crypto/ec/asm/ecp_sm2p256-armv8.pl
index da4c16c309..50950865e4 100644
--- a/crypto/ec/asm/ecp_sm2p256-armv8.pl
+++ b/crypto/ec/asm/ecp_sm2p256-armv8.pl
@@ -6,15 +6,18 @@
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
-$flavour = shift;
-while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {}
+# $output is the last argument if it looks like a file (it has an extension)
+# $flavour is the first argument if it doesn't look like a file
+$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
+$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl";
-open OUT,"| \"$^X\" $xlate $flavour $output";
+open OUT,"| \"$^X\" $xlate $flavour \"$output\""
+ or die "can't call $xlate: $!";
*STDOUT=*OUT;
my ($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7)=map("x$_",(7..14));