From 8a7f30ef67d59f808610275e8bc1723510cf062b Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Mon, 28 Aug 2023 18:49:02 +0200 Subject: 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) --- crypto/ec/asm/ecp_sm2p256-armv8.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'crypto/ec') 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)); -- cgit v1.2.3