Optimize decryption a bit.

This commit is contained in:
Stephen Heumann 2017-06-27 19:24:06 -05:00
parent 46fcb3badc
commit a522ab6d88

View File

@ -259,10 +259,10 @@
aif &round=0,.skip aif &round=0,.skip
ShortRegs ShortRegs
InvMixColumn 12,1,6,11,12
InvMixColumn 0,5,10,15,0 InvMixColumn 0,5,10,15,0
InvMixColumn 4,9,14,3,4 InvMixColumn 4,9,14,3,4
InvMixColumn 8,13,2,7,8 InvMixColumn 8,13,2,7,8
InvMixColumn 12,1,6,11,12
LongRegs LongRegs
.skip .skip
mend mend
@ -271,12 +271,28 @@
macro macro
InvMixColumn &A,&B,&C,&D,&i InvMixColumn &A,&B,&C,&D,&i
aif (&i+2)=14,.dotax
ldx &state+&i+2
ago .cont
.dotax
tax ;value left from AddRoundKey step
.cont
lda Xtime9,X
ldy &state+&i+0
eor XtimeB,Y
ldy &state+&i+1
eor XtimeD,Y
ldy &state+&i+3
eor XtimeE,Y
tay
lda InvSbox,Y
sta &out+&D
ldy &state+&i+0 ldy &state+&i+0
lda XtimeE,Y lda XtimeE,Y
ldy &state+&i+1 ldy &state+&i+1
eor XtimeB,Y eor XtimeB,Y
ldy &state+&i+2 eor XtimeD,X
eor XtimeD,Y
ldy &state+&i+3 ldy &state+&i+3
eor Xtime9,Y eor Xtime9,Y
tay tay
@ -287,8 +303,7 @@
lda Xtime9,Y lda Xtime9,Y
ldy &state+&i+1 ldy &state+&i+1
eor XtimeE,Y eor XtimeE,Y
ldy &state+&i+2 eor XtimeB,X
eor XtimeB,Y
ldy &state+&i+3 ldy &state+&i+3
eor XtimeD,Y eor XtimeD,Y
tay tay
@ -299,25 +314,12 @@
lda XtimeD,Y lda XtimeD,Y
ldy &state+&i+1 ldy &state+&i+1
eor Xtime9,Y eor Xtime9,Y
ldy &state+&i+2 eor XtimeE,X
eor XtimeE,Y
ldy &state+&i+3 ldy &state+&i+3
eor XtimeB,Y eor XtimeB,Y
tay tay
lda InvSbox,Y lda InvSbox,Y
sta &out+&C sta &out+&C
ldy &state+&i+0
lda XtimeB,Y
ldy &state+&i+1
eor XtimeD,Y
ldy &state+&i+2
eor Xtime9,Y
ldy &state+&i+3
eor XtimeE,Y
tay
lda InvSbox,Y
sta &out+&D
mend mend