summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2010-10-22 20:16:22 +0000
committerAndy Polyakov <appro@openssl.org>2010-10-22 20:16:22 +0000
commitc242dda4a40301ae284e6756969e9735c80c885d (patch)
tree9355a7cc085b400590d42fcde6d26a589e896bf6 /crypto
parentbb550038820e20b730659d28412d0e46bbd01490 (diff)
sha512-mips.pl: add missing 64-bit byte swap.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/sha/asm/sha512-mips.pl24
1 files changed, 22 insertions, 2 deletions
diff --git a/crypto/sha/asm/sha512-mips.pl b/crypto/sha/asm/sha512-mips.pl
index d8f95308b4..8cd88dbda2 100644
--- a/crypto/sha/asm/sha512-mips.pl
+++ b/crypto/sha/asm/sha512-mips.pl
@@ -123,8 +123,8 @@ $code.=<<___ if ($i<15);
${LD}l @X[1],`($i+1)*$SZ+$MSB`($inp)
${LD}r @X[1],`($i+1)*$SZ+$LSB`($inp)
___
-$code.=<<___ if (!$big_endian && $i<16); # XXX no 64-bit byte swap yet
- srl $tmp0,@X[0],24 # byte swap($i)
+$code.=<<___ if (!$big_endian && $i<16 && $SZ==4);
+ srl $tmp0,@X[0],24 # byte swap($i)
srl $tmp1,@X[0],8
andi $tmp2,@X[0],0xFF00
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 @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.=<<___;
$ADDU $T1,$X[0],$h # $i
$SRL $h,$e,@Sigma1[0]