From: Tomas Mraz Date: Mon, 28 Aug 2023 16:49:02 +0000 (+0200) Subject: ecp_sm2p256-armv8.pl: Copy the argument handling from ecp_nistz256-armv8.pl X-Git-Tag: openssl-3.2.0-alpha1~107 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8a7f30ef67d59f808610275e8bc1723510cf062b;p=thirdparty%2Fopenssl.git 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 Reviewed-by: Tom Cosgrove (Merged from https://github.com/openssl/openssl/pull/21877) --- diff --git a/crypto/ec/asm/ecp_sm2p256-armv8.pl b/crypto/ec/asm/ecp_sm2p256-armv8.pl index da4c16c309c..50950865e43 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));