Commit c242dda4 authored by Andy Polyakov's avatar Andy Polyakov
Browse files

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

parent bb550038
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -123,7 +123,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 (!$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	$tmp1,@X[0],8
	andi	$tmp2,@X[0],0xFF00
@@ -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]