Skip to content
Snippets Groups Projects
Commit a06b715e authored by Niels Möller's avatar Niels Möller
Browse files

(_aes_crypt): Deleted idx register. Further cleanup.

Rev: src/nettle/sparc/aes.asm:1.65
parent cf225e9e
No related branches found
No related tags found
No related merge requests found
...@@ -106,7 +106,6 @@ _aes_crypt: ...@@ -106,7 +106,6 @@ _aes_crypt:
.Lround_loop: .Lround_loop:
! 4*i ! 4*i
mov 0, i mov 0, i
! add T, AES_SIDX3, idx
.Linner_loop: .Linner_loop:
! The comments mark which j in T->table[j][ Bj(wtxt[IDXi(i)]) ] ! The comments mark which j in T->table[j][ Bj(wtxt[IDXi(i)]) ]
! the instruction is a part of. ! the instruction is a part of.
...@@ -114,68 +113,60 @@ _aes_crypt: ...@@ -114,68 +113,60 @@ _aes_crypt:
! The code uses the register %o[j], aka tj, as the primary ! The code uses the register %o[j], aka tj, as the primary
! register for that sub-expression. True for j==1,3. ! register for that sub-expression. True for j==1,3.
! AES_SIDX1
ld [IDX1+i], t1 ! 1 ld [IDX1+i], t1 ! 1
! AES_SIDX2
! IDX2(j) = j XOR 2 ! IDX2(j) = j XOR 2
xor i, 8, t2 xor i, 8, t2
! wtxt[IDX1...]
add wtxt, t1, t1 ! 1 add wtxt, t1, t1 ! 1
ldub [t1+2], t1 ! 1 ldub [t1+2], t1 ! 1
! AES_SIDX3
ld [IDX3+i], t3 ! 3 ld [IDX3+i], t3 ! 3
sll t1, 2, t1 ! 1 sll t1, 2, t1 ! 1
! wtxt[i]
ld [wtxt+i], t0 ! 0 ld [wtxt+i], t0 ! 0
! wtxt[IDX2...]
lduh [wtxt+t2], t2 ! 2 lduh [wtxt+t2], t2 ! 2
and t0, 255, t0 ! 0 and t0, 255, t0 ! 0
! wtxt[IDX3...]
ldub [wtxt+t3], t3 ! 3 ldub [wtxt+t3], t3 ! 3
sll t0, 2, t0 ! 0 sll t0, 2, t0 ! 0
ld [T0+t0], t0 ! 0 ld [T0+t0], t0 ! 0
and t2, 255, t2 ! 2 and t2, 255, t2 ! 2
ld [T1+t1], t1 ! 1 ld [T1+t1], t1 ! 1
sll t2, 2, t2 ! 2 sll t2, 2, t2 ! 2
ld [T2+t2], t2 ! 2 ld [T2+t2], t2 ! 2
sll t3, 2, t3 ! 3 sll t3, 2, t3 ! 3
ld [T3+t3], t3 ! 3 ld [T3+t3], t3 ! 3
xor t0, t1, t0 ! 0, 1 xor t0, t1, t0 ! 0, 1
xor t0, t2, t0 ! 0, 1, 2 xor t0, t2, t0 ! 0, 1, 2
! add idx, 4, idx
! Fetch roundkey ! Fetch roundkey
ld [key+i], t1 ld [key+i], t1
xor t0, t3, t0 ! 0, 1, 2, 3 xor t0, t3, t0 ! 0, 1, 2, 3
xor t0, t1, t0 xor t0, t1, t0
st t0, [tmp+i] st t0, [tmp+i]
cmp i, 8 cmp i, 8
bleu .Linner_loop bleu .Linner_loop
add i, 4, i add i, 4, i
! switch roles for tmp and wtxt ! switch roles for tmp and wtxt
xor wtxt, diff, wtxt xor wtxt, diff, wtxt
subcc round, 1, round subcc round, 1, round
add key, 16, key add key, 16, key
nop nop
bne .Lround_loop bne .Lround_loop
xor tmp, diff, tmp xor tmp, diff, tmp
! final round ! final round
! 4*i ! 4*i
mov 0, i mov 0, i
! SIDX3
! add T, AES_SIDX3, idx
.Lfinal_loop: .Lfinal_loop:
! Comments mark which j in T->sbox[Bj(wtxt[IDXj(i)])] ! Comments mark which j in T->sbox[Bj(wtxt[IDXj(i)])]
! the instruction is part of ! the instruction is part of
ld [IDX1+i], t1 ! 1 ld [IDX1+i], t1 ! 1
! IDX2(j) = j XOR 2
xor i, 8, t2 xor i, 8, t2
! ld [idx-16], t2 ! 2 ! ld [idx-16], t2 ! 2
add wtxt, t1, t1 ! 1 add wtxt, t1, t1 ! 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment