Commit 7ef8c3aa authored by Niels Möller's avatar Niels Möller
Browse files

(AES_FINAL_ROUND): New macro.

(_aes_crypt): Use AES_FINAL_ROUND for the first word if the final
round.
(_aes_crypt): And for the rest of the final round.

Rev: src/nettle/sparc/aes.asm:1.99
parent dda88be4
......@@ -285,122 +285,125 @@ C stb t0, [dst]
C add dst, 4, dst
C i = 1
ld [IDX1+4], t1 ! 1
ldub [wtxt+t1], t1 ! 1
ld [wtxt+4], t0 ! 0
! IDX2(j) = j XOR 2
lduh [wtxt+12], t2 ! 2
and t0, 255, t0 ! 0
ld [IDX3 + 4], t3 ! 3
and t2, 255, t2 ! 2
ldub [T+t1], t1 ! 1
ldub [T+t0], t0 ! 0
sll t1, 8, t1 ! 1
ldub [wtxt+t3], t3 ! 3
or t0, t1, t0 ! 0, 1
ldub [T+t2], t2 ! 2
ldub [T+t3], t3 ! 3
sll t2, 16, t2 ! 2
or t0, t2, t0 ! 0, 1, 2
ld [key + 4], t2
sll t3, 24, t3 ! 3
or t0, t3, t0 ! 0, 1, 2, 3
xor t0, t2, t0
srl t0, 24, t3
srl t0, 16, t2
srl t0, 8, t1
stb t1, [dst+1]
stb t3, [dst+3]
stb t2, [dst+2]
stb t0, [dst]
add dst, 4, dst
AES_FINAL_ROUND(4) ! i = 1
C ld [IDX1+4], t1 ! 1
C
C ldub [wtxt+t1], t1 ! 1
C
C ld [wtxt+4], t0 ! 0
C ! IDX2(j) = j XOR 2
C lduh [wtxt+12], t2 ! 2
C and t0, 255, t0 ! 0
C ld [IDX3 + 4], t3 ! 3
C
C and t2, 255, t2 ! 2
C ldub [T+t1], t1 ! 1
C ldub [T+t0], t0 ! 0
C sll t1, 8, t1 ! 1
C
C ldub [wtxt+t3], t3 ! 3
C or t0, t1, t0 ! 0, 1
C ldub [T+t2], t2 ! 2
C ldub [T+t3], t3 ! 3
C
C sll t2, 16, t2 ! 2
C or t0, t2, t0 ! 0, 1, 2
C ld [key + 4], t2
C sll t3, 24, t3 ! 3
C
C or t0, t3, t0 ! 0, 1, 2, 3
C xor t0, t2, t0
C
C srl t0, 24, t3
C srl t0, 16, t2
C srl t0, 8, t1
C stb t1, [dst+1]
C
C stb t3, [dst+3]
C stb t2, [dst+2]
C stb t0, [dst]
C add dst, 4, dst
C i = 2
ld [IDX1+8], t1 ! 1
ldub [wtxt+t1], t1 ! 1
ld [wtxt+8], t0 ! 0
! IDX2(j) = j XOR 2
lduh [wtxt+0], t2 ! 2
and t0, 255, t0 ! 0
ld [IDX3 + 8], t3 ! 3
and t2, 255, t2 ! 2
ldub [T+t1], t1 ! 1
ldub [T+t0], t0 ! 0
sll t1, 8, t1 ! 1
ldub [wtxt+t3], t3 ! 3
or t0, t1, t0 ! 0, 1
ldub [T+t2], t2 ! 2
ldub [T+t3], t3 ! 3
sll t2, 16, t2 ! 2
or t0, t2, t0 ! 0, 1, 2
ld [key + 8], t2
sll t3, 24, t3 ! 3
or t0, t3, t0 ! 0, 1, 2, 3
xor t0, t2, t0
srl t0, 24, t3
srl t0, 16, t2
srl t0, 8, t1
stb t1, [dst+1]
stb t3, [dst+3]
stb t2, [dst+2]
stb t0, [dst]
add dst, 4, dst
AES_FINAL_ROUND(8) ! i = 2
C ld [IDX1+8], t1 ! 1
C
C ldub [wtxt+t1], t1 ! 1
C
C ld [wtxt+8], t0 ! 0
C ! IDX2(j) = j XOR 2
C lduh [wtxt+0], t2 ! 2
C and t0, 255, t0 ! 0
C ld [IDX3 + 8], t3 ! 3
C
C and t2, 255, t2 ! 2
C ldub [T+t1], t1 ! 1
C ldub [T+t0], t0 ! 0
C sll t1, 8, t1 ! 1
C
C ldub [wtxt+t3], t3 ! 3
C or t0, t1, t0 ! 0, 1
C ldub [T+t2], t2 ! 2
C ldub [T+t3], t3 ! 3
C
C sll t2, 16, t2 ! 2
C or t0, t2, t0 ! 0, 1, 2
C ld [key + 8], t2
C sll t3, 24, t3 ! 3
C
C or t0, t3, t0 ! 0, 1, 2, 3
C xor t0, t2, t0
C
C srl t0, 24, t3
C srl t0, 16, t2
C srl t0, 8, t1
C stb t1, [dst+1]
C
C stb t3, [dst+3]
C stb t2, [dst+2]
C stb t0, [dst]
C add dst, 4, dst
C i = 3
ld [IDX1+12], t1 ! 1
ldub [wtxt+t1], t1 ! 1
AES_FINAL_ROUND(12) ! i = 3
C ld [IDX1+12], t1 ! 1
C
C ldub [wtxt+t1], t1 ! 1
C
C ld [wtxt+12], t0 ! 0
C ! IDX2(j) = j XOR 2
C lduh [wtxt+4], t2 ! 2
C and t0, 255, t0 ! 0
C ld [IDX3 + 12], t3 ! 3
C
C and t2, 255, t2 ! 2
C ldub [T+t1], t1 ! 1
C ldub [T+t0], t0 ! 0
C sll t1, 8, t1 ! 1
C
C ldub [wtxt+t3], t3 ! 3
C or t0, t1, t0 ! 0, 1
C ldub [T+t2], t2 ! 2
C ldub [T+t3], t3 ! 3
C
C sll t2, 16, t2 ! 2
C or t0, t2, t0 ! 0, 1, 2
C ld [key + 12], t2
C sll t3, 24, t3 ! 3
C
C or t0, t3, t0 ! 0, 1, 2, 3
C xor t0, t2, t0
C
C srl t0, 24, t3
C srl t0, 16, t2
C srl t0, 8, t1
C stb t1, [dst+1]
C
C stb t3, [dst+3]
C stb t2, [dst+2]
C stb t0, [dst]
C add dst, 4, dst
ld [wtxt+12], t0 ! 0
! IDX2(j) = j XOR 2
lduh [wtxt+4], t2 ! 2
and t0, 255, t0 ! 0
ld [IDX3 + 12], t3 ! 3
and t2, 255, t2 ! 2
ldub [T+t1], t1 ! 1
ldub [T+t0], t0 ! 0
sll t1, 8, t1 ! 1
ldub [wtxt+t3], t3 ! 3
or t0, t1, t0 ! 0, 1
ldub [T+t2], t2 ! 2
ldub [T+t3], t3 ! 3
sll t2, 16, t2 ! 2
or t0, t2, t0 ! 0, 1, 2
ld [key + 12], t2
sll t3, 24, t3 ! 3
or t0, t3, t0 ! 0, 1, 2, 3
xor t0, t2, t0
srl t0, 24, t3
srl t0, 16, t2
srl t0, 8, t1
stb t1, [dst+1]
stb t3, [dst+3]
stb t2, [dst+2]
stb t0, [dst]
add dst, 4, dst
C Unrolled final loop ends
addcc length, -16, length
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment