From f8d4f1c892fe383bdecc7ad410833332d6f02cdf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Fri, 15 Feb 2002 23:24:05 +0100
Subject: [PATCH] (_aes_crypt): Renamed more variables in the inner loop. Now
 the primary variables are t0, t1, t2, t3. (t1 and t3 done so far).

Rev: src/nettle/sparc/aes.asm:1.35
---
 sparc/aes.asm | 40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/sparc/aes.asm b/sparc/aes.asm
index 271dc0c4..26ff6af2 100644
--- a/sparc/aes.asm
+++ b/sparc/aes.asm
@@ -1,6 +1,6 @@
 	! Used registers:	%l0,1,2,3,4,5
 	!			%i0,1,2,3,4,5 (%i6=%fp, %i7 = return)
-	!			%o0,2,3,4,5,7 (%o6=%sp)
+	!			%o0,1,2,3,4,5,7 (%o6=%sp)
 	!			%g2,3,4
 include(`asm.m4')
 	
@@ -28,7 +28,11 @@ define(nround, %l3)
 ! Loop variables
 define(round, %l4) ! Should perhaps be 16 * round
 define(i, %l5)
-	
+
+! Teporaries
+define(t1, %o1)
+define(t3, %o3)
+
 _aes_crypt:
 ! Why -136?
 	save	%sp, -136, %sp
@@ -104,21 +108,23 @@ _aes_crypt:
 	add	T, AES_SIDX3, %o2
 .Linner_loop:
 	! The comments mark which j in T->table[j][ Bj(wtxt[IDXi(i)]) ]
-	! the instruction is a part of. Uses the %o[j] as the primary 
-	! register for that sub-expression. True for j==1.
+	! the instruction is a part of. 
+	!
+	! The code uses the register %o[j], aka tj, as the primary 
+	! register for that sub-expression. True for j==1,3.
 	
 	! AES_SIDX1
-	ld	[%o2-32], %o1		! 1
+	ld	[%o2-32], t1		! 1
 
 	! AES_SIDX2
 	ld	[%o2-16], %o4		! 2
 	! wtxt[IDX1...]
-	add	wtxt, %o1, %o1		! 1
-	ldub	[%o1+2], %o1		! 1
+	add	wtxt, t1, t1		! 1
+	ldub	[t1+2], t1		! 1
 
 	! AES_SIDX3
-	ld	[%o2], %g2		! 3
-	sll	%o1, 2, %o1		! 1
+	ld	[%o2], t3		! 3
+	sll	t1, 2, t1		! 1
 	
 	! wtxt[i]
 	ld	[wtxt+i], %o5		! 0
@@ -129,22 +135,22 @@ _aes_crypt:
 	and	%o5, 255, %o5		! 0
 
 	! wtxt[IDX3...]
-	ldub	[wtxt+%g2], %o4		! 3
+	ldub	[wtxt+t3], t3		! 3
 	
 	sll	%o5, 2, %o5		! 0
 	add	%o5, AES_TABLE0, %o5	! 0
 	ld	[T+%o5], %g2		! 0
 
-	add	%o1, AES_TABLE1, %o1	! 1
+	add	t1, AES_TABLE1, t1	! 1
 	and	%g3, 255, %g3		! 2
-	ld	[T+%o1], %o1		! 1
+	ld	[T+t1], t1		! 1
 	sll	%g3, 2, %g3		! 2
 	add	%g3, AES_TABLE2, %g3	! 2
 	ld	[T+%g3], %o0		! 2
-	sll	%o4, 2, %o4		! 3
-	add	%o4, AES_TABLE3, %o4	! 3
-	ld	[T+%o4], %g3		! 3
-	xor	%g2, %o1, %g2		! 0, 1
+	sll	t3, 2, t3		! 3
+	add	t3, AES_TABLE3, t3	! 3
+	ld	[T+t3], t3		! 3
+	xor	%g2, t1, %g2		! 0, 1
 	xor	%g2, %o0, %g2		! 0, 1, 2
 
 	add	%o2, 4, %o2		
@@ -154,7 +160,7 @@ _aes_crypt:
 ! 	add	%o5, ctx, %o5
 ! 	ld	[%o5], %o5
 		
-	xor	%g2, %g3, %g2		! 0, 1, 2, 3
+	xor	%g2, t3, %g2		! 0, 1, 2, 3
 
 !	xor	%g2, %o5, %g2
 	st	%g2, [tmp+i]
-- 
GitLab