From 5ad83922cae0685454a8081a3c6a5b64a1d828c3 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Sat, 2 Oct 2010 12:43:04 +0000 Subject: [PATCH] sha512-mips.pl: add missing byte swap for little-endians. --- crypto/sha/asm/sha512-mips.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto/sha/asm/sha512-mips.pl b/crypto/sha/asm/sha512-mips.pl index 41f4e7fbfb..2c70663f98 100644 --- a/crypto/sha/asm/sha512-mips.pl +++ b/crypto/sha/asm/sha512-mips.pl @@ -67,8 +67,13 @@ if ($flavour =~ /64|n32/i) { ###################################################################### $output=shift; +for (@ARGV) { $big_endian=1 if (/\-DB_ENDIAN/); + $big_endian=0 if (/\-DL_ENDIAN/); + $output=$_ if (/^\w[\w\-]*\.\w+$/); } open STDOUT,">$output"; +if (!defined($big_endian)) { $big_endian=(unpack('L',pack('N',1))==1); } + if ($output =~ /512/) { $label="512"; $SZ=8; @@ -114,7 +119,7 @@ $code.=<<___ if ($i<15); ${LD}l @X[1],`($i+1)*$SZ+$MSB`($inp) ${LD}r @X[1],`($i+1)*$SZ+$LSB`($inp) ___ -$code.=<<___ if ($little_endian && $i<16); # XXX no 64-bit byte swap yet +$code.=<<___ if (!$big_endian && $i<16); # XXX no 64-bit byte swap yet srl $tmp0,@X[0],24 # byte swap($i) srl $tmp1,@X[0],8 andi $tmp2,@X[0],0xFF00 -- 2.25.1