sha512-mips.pl: add missing 64-bit byte swap.

This commit is contained in:
Andy Polyakov 2010-10-22 20:16:22 +00:00
parent bb55003882
commit c242dda4a4

View file

@ -123,8 +123,8 @@ $code.=<<___ if ($i<15);
${LD}l @X[1],`($i+1)*$SZ+$MSB`($inp) ${LD}l @X[1],`($i+1)*$SZ+$MSB`($inp)
${LD}r @X[1],`($i+1)*$SZ+$LSB`($inp) ${LD}r @X[1],`($i+1)*$SZ+$LSB`($inp)
___ ___
$code.=<<___ if (!$big_endian && $i<16); # XXX no 64-bit byte swap yet $code.=<<___ if (!$big_endian && $i<16 && $SZ==4);
srl $tmp0,@X[0],24 # byte swap($i) srl $tmp0,@X[0],24 # byte swap($i)
srl $tmp1,@X[0],8 srl $tmp1,@X[0],8
andi $tmp2,@X[0],0xFF00 andi $tmp2,@X[0],0xFF00
sll @X[0],@X[0],24 sll @X[0],@X[0],24
@ -134,6 +134,26 @@ $code.=<<___ if (!$big_endian && $i<16); # XXX no 64-bit byte swap yet
or $tmp1,$tmp2 or $tmp1,$tmp2
or @X[0],$tmp1 or @X[0],$tmp1
___ ___
$code.=<<___ if (!$big_endian && $i<16 && $SZ==8);
ori $tmp0,$zero,0xFF
dsll $tmp2,$tmp0,32
or $tmp0,$tmp2 # 0x000000FF000000FF
and $tmp1,@X[0],$tmp0 # byte swap($i)
dsrl $tmp2,@X[0],24
dsll $tmp1,24
and $tmp2,$tmp0
dsll $tmp0,8 # 0x0000FF000000FF00
or $tmp1,$tmp2
and $tmp2,@X[0],$tmp0
dsrl @X[0],8
dsll $tmp2,8
and @X[0],$tmp0
or $tmp1,$tmp2
or @X[0],$tmp1
dsrl $tmp1,@X[0],32
dsll @X[0],32
or @X[0],$tmp1
___
$code.=<<___; $code.=<<___;
$ADDU $T1,$X[0],$h # $i $ADDU $T1,$X[0],$h # $i
$SRL $h,$e,@Sigma1[0] $SRL $h,$e,@Sigma1[0]