[git commit] libbb/sha256: explicitly use sha256rnds2's %xmm0 (MSG) argument

Denys Vlasenko vda.linux at googlemail.com
Fri Feb 11 23:52:12 UTC 2022


commit: https://git.busybox.net/busybox/commit/?id=c2e7780e526b0f421c3b43367a53019d1dc5f2d6
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Else, the code seemingly does not use MSG.

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/hash_md5_sha256_x86-32_shaNI.S | 64 +++++++++++++++---------------
 libbb/hash_md5_sha256_x86-64_shaNI.S | 76 ++++++++++++++++++------------------
 2 files changed, 70 insertions(+), 70 deletions(-)

diff --git a/libbb/hash_md5_sha256_x86-32_shaNI.S b/libbb/hash_md5_sha256_x86-32_shaNI.S
index c059fb18d..3905bad9a 100644
--- a/libbb/hash_md5_sha256_x86-32_shaNI.S
+++ b/libbb/hash_md5_sha256_x86-32_shaNI.S
@@ -60,18 +60,18 @@ sha256_process_block64_shaNI:
 	pshufb		XMMTMP, MSG
 	mova128		MSG, MSGTMP0
 		paddd		0*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 
 	/* Rounds 4-7 */
 	movu128		1*16(DATA_PTR), MSG
 	pshufb		XMMTMP, MSG
 	mova128		MSG, MSGTMP1
 		paddd		1*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP1, MSGTMP0
 
 	/* Rounds 8-11 */
@@ -79,9 +79,9 @@ sha256_process_block64_shaNI:
 	pshufb		XMMTMP, MSG
 	mova128		MSG, MSGTMP2
 		paddd		2*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP2, MSGTMP1
 
 	/* Rounds 12-15 */
@@ -90,151 +90,151 @@ sha256_process_block64_shaNI:
 /* ...to here */
 	mova128		MSG, MSGTMP3
 		paddd		3*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP3, XMMTMP
 	palignr		$4, MSGTMP2, XMMTMP
 	paddd		XMMTMP, MSGTMP0
 	sha256msg2	MSGTMP3, MSGTMP0
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP3, MSGTMP2
 
 	/* Rounds 16-19 */
 	mova128		MSGTMP0, MSG
 		paddd		4*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP0, XMMTMP
 	palignr		$4, MSGTMP3, XMMTMP
 	paddd		XMMTMP, MSGTMP1
 	sha256msg2	MSGTMP0, MSGTMP1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP0, MSGTMP3
 
 	/* Rounds 20-23 */
 	mova128		MSGTMP1, MSG
 		paddd		5*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP1, XMMTMP
 	palignr		$4, MSGTMP0, XMMTMP
 	paddd		XMMTMP, MSGTMP2
 	sha256msg2	MSGTMP1, MSGTMP2
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP1, MSGTMP0
 
 	/* Rounds 24-27 */
 	mova128		MSGTMP2, MSG
 		paddd		6*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP2, XMMTMP
 	palignr		$4, MSGTMP1, XMMTMP
 	paddd		XMMTMP, MSGTMP3
 	sha256msg2	MSGTMP2, MSGTMP3
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP2, MSGTMP1
 
 	/* Rounds 28-31 */
 	mova128		MSGTMP3, MSG
 		paddd		7*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP3, XMMTMP
 	palignr		$4, MSGTMP2, XMMTMP
 	paddd		XMMTMP, MSGTMP0
 	sha256msg2	MSGTMP3, MSGTMP0
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP3, MSGTMP2
 
 	/* Rounds 32-35 */
 	mova128		MSGTMP0, MSG
 		paddd		8*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP0, XMMTMP
 	palignr		$4, MSGTMP3, XMMTMP
 	paddd		XMMTMP, MSGTMP1
 	sha256msg2	MSGTMP0, MSGTMP1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP0, MSGTMP3
 
 	/* Rounds 36-39 */
 	mova128		MSGTMP1, MSG
 		paddd		9*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP1, XMMTMP
 	palignr		$4, MSGTMP0, XMMTMP
 	paddd		XMMTMP, MSGTMP2
 	sha256msg2	MSGTMP1, MSGTMP2
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP1, MSGTMP0
 
 	/* Rounds 40-43 */
 	mova128		MSGTMP2, MSG
 		paddd		10*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP2, XMMTMP
 	palignr		$4, MSGTMP1, XMMTMP
 	paddd		XMMTMP, MSGTMP3
 	sha256msg2	MSGTMP2, MSGTMP3
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP2, MSGTMP1
 
 	/* Rounds 44-47 */
 	mova128		MSGTMP3, MSG
 		paddd		11*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP3, XMMTMP
 	palignr		$4, MSGTMP2, XMMTMP
 	paddd		XMMTMP, MSGTMP0
 	sha256msg2	MSGTMP3, MSGTMP0
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP3, MSGTMP2
 
 	/* Rounds 48-51 */
 	mova128		MSGTMP0, MSG
 		paddd		12*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP0, XMMTMP
 	palignr		$4, MSGTMP3, XMMTMP
 	paddd		XMMTMP, MSGTMP1
 	sha256msg2	MSGTMP0, MSGTMP1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP0, MSGTMP3
 
 	/* Rounds 52-55 */
 	mova128		MSGTMP1, MSG
 		paddd		13*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP1, XMMTMP
 	palignr		$4, MSGTMP0, XMMTMP
 	paddd		XMMTMP, MSGTMP2
 	sha256msg2	MSGTMP1, MSGTMP2
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 
 	/* Rounds 56-59 */
 	mova128		MSGTMP2, MSG
 		paddd		14*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP2, XMMTMP
 	palignr		$4, MSGTMP1, XMMTMP
 	paddd		XMMTMP, MSGTMP3
 	sha256msg2	MSGTMP2, MSGTMP3
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 
 	/* Rounds 60-63 */
 	mova128		MSGTMP3, MSG
 		paddd		15*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 
 	/* Write hash values back in the correct order */
 	mova128		STATE0, XMMTMP
diff --git a/libbb/hash_md5_sha256_x86-64_shaNI.S b/libbb/hash_md5_sha256_x86-64_shaNI.S
index 9578441f8..082ceafe4 100644
--- a/libbb/hash_md5_sha256_x86-64_shaNI.S
+++ b/libbb/hash_md5_sha256_x86-64_shaNI.S
@@ -38,8 +38,8 @@
 
 #define XMMTMP		%xmm7
 
-#define ABEF_SAVE	%xmm9
-#define CDGH_SAVE	%xmm10
+#define SAVE0		%xmm8
+#define SAVE1		%xmm9
 
 #define SHUF(a,b,c,d) $(a+(b<<2)+(c<<4)+(d<<6))
 
@@ -59,26 +59,26 @@ sha256_process_block64_shaNI:
 	leaq		K256+8*16(%rip), SHA256CONSTANTS
 
 	/* Save hash values for addition after rounds */
-	mova128		STATE0, ABEF_SAVE
-	mova128		STATE1, CDGH_SAVE
+	mova128		STATE0, SAVE0
+	mova128		STATE1, SAVE1
 
 	/* Rounds 0-3 */
 	movu128		0*16(DATA_PTR), MSG
 	pshufb		XMMTMP, MSG
 	mova128		MSG, MSGTMP0
 		paddd		0*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 
 	/* Rounds 4-7 */
 	movu128		1*16(DATA_PTR), MSG
 	pshufb		XMMTMP, MSG
 	mova128		MSG, MSGTMP1
 		paddd		1*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP1, MSGTMP0
 
 	/* Rounds 8-11 */
@@ -86,9 +86,9 @@ sha256_process_block64_shaNI:
 	pshufb		XMMTMP, MSG
 	mova128		MSG, MSGTMP2
 		paddd		2*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP2, MSGTMP1
 
 	/* Rounds 12-15 */
@@ -97,155 +97,155 @@ sha256_process_block64_shaNI:
 /* ...to here */
 	mova128		MSG, MSGTMP3
 		paddd		3*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP3, XMMTMP
 	palignr		$4, MSGTMP2, XMMTMP
 	paddd		XMMTMP, MSGTMP0
 	sha256msg2	MSGTMP3, MSGTMP0
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP3, MSGTMP2
 
 	/* Rounds 16-19 */
 	mova128		MSGTMP0, MSG
 		paddd		4*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP0, XMMTMP
 	palignr		$4, MSGTMP3, XMMTMP
 	paddd		XMMTMP, MSGTMP1
 	sha256msg2	MSGTMP0, MSGTMP1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP0, MSGTMP3
 
 	/* Rounds 20-23 */
 	mova128		MSGTMP1, MSG
 		paddd		5*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP1, XMMTMP
 	palignr		$4, MSGTMP0, XMMTMP
 	paddd		XMMTMP, MSGTMP2
 	sha256msg2	MSGTMP1, MSGTMP2
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP1, MSGTMP0
 
 	/* Rounds 24-27 */
 	mova128		MSGTMP2, MSG
 		paddd		6*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP2, XMMTMP
 	palignr		$4, MSGTMP1, XMMTMP
 	paddd		XMMTMP, MSGTMP3
 	sha256msg2	MSGTMP2, MSGTMP3
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP2, MSGTMP1
 
 	/* Rounds 28-31 */
 	mova128		MSGTMP3, MSG
 		paddd		7*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP3, XMMTMP
 	palignr		$4, MSGTMP2, XMMTMP
 	paddd		XMMTMP, MSGTMP0
 	sha256msg2	MSGTMP3, MSGTMP0
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP3, MSGTMP2
 
 	/* Rounds 32-35 */
 	mova128		MSGTMP0, MSG
 		paddd		8*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP0, XMMTMP
 	palignr		$4, MSGTMP3, XMMTMP
 	paddd		XMMTMP, MSGTMP1
 	sha256msg2	MSGTMP0, MSGTMP1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP0, MSGTMP3
 
 	/* Rounds 36-39 */
 	mova128		MSGTMP1, MSG
 		paddd		9*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP1, XMMTMP
 	palignr		$4, MSGTMP0, XMMTMP
 	paddd		XMMTMP, MSGTMP2
 	sha256msg2	MSGTMP1, MSGTMP2
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP1, MSGTMP0
 
 	/* Rounds 40-43 */
 	mova128		MSGTMP2, MSG
 		paddd		10*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP2, XMMTMP
 	palignr		$4, MSGTMP1, XMMTMP
 	paddd		XMMTMP, MSGTMP3
 	sha256msg2	MSGTMP2, MSGTMP3
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP2, MSGTMP1
 
 	/* Rounds 44-47 */
 	mova128		MSGTMP3, MSG
 		paddd		11*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP3, XMMTMP
 	palignr		$4, MSGTMP2, XMMTMP
 	paddd		XMMTMP, MSGTMP0
 	sha256msg2	MSGTMP3, MSGTMP0
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP3, MSGTMP2
 
 	/* Rounds 48-51 */
 	mova128		MSGTMP0, MSG
 		paddd		12*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP0, XMMTMP
 	palignr		$4, MSGTMP3, XMMTMP
 	paddd		XMMTMP, MSGTMP1
 	sha256msg2	MSGTMP0, MSGTMP1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 	sha256msg1	MSGTMP0, MSGTMP3
 
 	/* Rounds 52-55 */
 	mova128		MSGTMP1, MSG
 		paddd		13*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP1, XMMTMP
 	palignr		$4, MSGTMP0, XMMTMP
 	paddd		XMMTMP, MSGTMP2
 	sha256msg2	MSGTMP1, MSGTMP2
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 
 	/* Rounds 56-59 */
 	mova128		MSGTMP2, MSG
 		paddd		14*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 	mova128		MSGTMP2, XMMTMP
 	palignr		$4, MSGTMP1, XMMTMP
 	paddd		XMMTMP, MSGTMP3
 	sha256msg2	MSGTMP2, MSGTMP3
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 
 	/* Rounds 60-63 */
 	mova128		MSGTMP3, MSG
 		paddd		15*16-8*16(SHA256CONSTANTS), MSG
-		sha256rnds2	STATE0, STATE1
+		sha256rnds2	MSG, STATE0, STATE1
 		shuf128_32	$0x0E, MSG, MSG
-		sha256rnds2	STATE1, STATE0
+		sha256rnds2	MSG, STATE1, STATE0
 
 	/* Add current hash values with previously saved */
-	paddd		ABEF_SAVE, STATE0
-	paddd		CDGH_SAVE, STATE1
+	paddd		SAVE0, STATE0
+	paddd		SAVE1, STATE1
 
 	/* Write hash values back in the correct order */
 	mova128		STATE0, XMMTMP


More information about the busybox-cvs mailing list