[openssl-commits] [openssl] OpenSSL_1_1_0-stable update

Andy Polyakov appro at openssl.org
Mon Dec 12 10:03:06 UTC 2016


The branch OpenSSL_1_1_0-stable has been updated
       via  2ece9c1fc6c5d998dc2abe03f2caf278ec05d9d0 (commit)
      from  a08ae8fee9539ed1432f4169cea46f6e27990dd5 (commit)


- Log -----------------------------------------------------------------
commit 2ece9c1fc6c5d998dc2abe03f2caf278ec05d9d0
Author: Andy Polyakov <appro at openssl.org>
Date:   Fri Dec 9 15:26:19 2016 +0100

    perlasm/x86_64-xlate.pl: refine sign extension in ea package.
    
    $1<<32>>32 worked fine with either 32- or 64-bit perl for a good while,
    relying on quirk that [pure] 32-bit perl performed it as $1<<0>>0. But
    this apparently changed in some version past minimally required 5.10,
    and operation result became 0. Yet, it went unnoticed for another while,
    because most perl package providers configure their packages with
    -Duse64bitint option.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (cherry picked from commit 82e089308bd9a7794a45f0fa3973d7659420fbd8)

-----------------------------------------------------------------------

Summary of changes:
 crypto/perlasm/x86_64-xlate.pl | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl
index 617adf9..2d9e1a1 100755
--- a/crypto/perlasm/x86_64-xlate.pl
+++ b/crypto/perlasm/x86_64-xlate.pl
@@ -262,11 +262,18 @@ my %globals;
 	$self->{base}  =~ s/^[er](.?[0-9xpi])[d]?$/r\1/;
 
 	# Solaris /usr/ccs/bin/as can't handle multiplications
-	# in $self->{label}, new gas requires sign extension...
+	# in $self->{label}...
 	use integer;
 	$self->{label} =~ s/(?<![\w\$\.])(0x?[0-9a-f]+)/oct($1)/egi;
 	$self->{label} =~ s/\b([0-9]+\s*[\*\/\%]\s*[0-9]+)\b/eval($1)/eg;
-	$self->{label} =~ s/\b([0-9]+)\b/$1<<32>>32/eg;
+
+	# Some assemblers insist on signed presentation of 32-bit
+	# offsets, but sign extension is a tricky business in perl...
+	if ((1<<31)<<1) {
+	    $self->{label} =~ s/\b([0-9]+)\b/$1<<32>>32/eg;
+	} else {
+	    $self->{label} =~ s/\b([0-9]+)\b/$1>>0/eg;
+	}
 
 	if (!$self->{label} && $self->{index} && $self->{scale}==1 &&
 	    $self->{base} =~ /(rbp|r13)/) {


More information about the openssl-commits mailing list