From 301021e75e44ade5451b512ceea90cf0eb1fd345 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Mon, 26 Jun 2017 20:53:17 -0500 Subject: [PATCH] Cut out a few instructions by reusing subexpressions in registers. --- aes.macros | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/aes.macros b/aes.macros index 6662357..63d14c7 100644 --- a/aes.macros +++ b/aes.macros @@ -31,45 +31,39 @@ macro MixColumn &i,&A,&B,&C,&D,&state,&out - ldy &state+&A - lda Xtime2Sbox,Y + ldx &state+&A + lda Xtime2Sbox,X ldy &state+&B eor Xtime3Sbox,Y - ldy &state+&C - eor Sbox,Y ldy &state+&D eor Sbox,Y + ldy &state+&C + eor Sbox,Y eor rk+&round*16+&i sta &out+&i - - ldy &state+&A - lda Sbox,Y + + lda Xtime3Sbox,Y + eor Sbox,X ldy &state+&B eor Xtime2Sbox,Y - ldy &state+&C - eor Xtime3Sbox,Y ldy &state+&D eor Sbox,Y eor rk+&round*16+&i+1 sta &out+&i+1 - - ldy &state+&A - lda Sbox,Y + + lda Xtime3Sbox,Y + eor Sbox,X ldy &state+&B eor Sbox,Y ldy &state+&C eor Xtime2Sbox,Y - ldy &state+&D - eor Xtime3Sbox,Y eor rk+&round*16+&i+2 sta &out+&i+2 - - ldy &state+&A - lda Xtime3Sbox,Y + + lda Sbox,Y + eor Xtime3Sbox,X ldy &state+&B eor Sbox,Y - ldy &state+&C - eor Sbox,Y ldy &state+&D eor Xtime2Sbox,Y eor rk+&round*16+&i+3