1 ; AesOpt.asm -- Intel's AES.
2 ; 2009-12-12 : Igor Pavlov : Public domain
15 num
equ [r4
+ REG_SIZE
* 4]
21 MY_PROLOG
macro reg:req
24 movdqa
[r4
+ 8 + 16], xmm7
46 movdqa xmm7
, [r4
+ 8 + 16]
53 ways16
equ (ways
* 16)
58 op
@CatStr(xmm
,%i
), op2
63 LOAD_OP
macro op:req
, offs:req
64 op xmm0
, [r1
+ r3 offs
]
67 LOAD_OP_W
macro op:req
, offs:req
68 movdqa xmm7
, [r1
+ r3 offs
]
73 ; ---------- AES-CBC Decode ----------
75 CBC_DEC_UPDATE
macro reg
, offs
77 movdqa xmm6
, [rD
+ offs
]
78 movdqa
[rD
+ offs
], reg
91 MY_PROC AesCbc_Decode_Intel
, 3
101 OP_W movdqa
, [rD
+ i
* 16]
104 OP_W CBC_DEC_UPDATE
, i
* 16
127 movdqa
[r1
- 32], xmm6
131 ; ---------- AES-CBC Encode ----------
143 MY_PROC AesCbc_Encode_Intel
, 3
156 pxor xmm0
, [r1
+ r3
- 32]
164 movdqa
[r1
+ r6
- 64], xmm0
168 ; ---------- AES-CTR ----------
170 XOR_UPD_1
macro reg
, offs
171 pxor reg
, [rD
+ offs
]
174 XOR_UPD_2
macro reg
, offs
175 movdqa
[rD
+ offs
], reg
178 MY_PROC AesCtr_Code_Intel
, 3
186 mov DWORD PTR [r5
], 1
187 mov DWORD PTR [r5
+ 4], 0
188 mov DWORD PTR [r5
+ 8], 0
189 mov DWORD PTR [r5
+ 12], 0
204 movdqa
@CatStr(xmm
,%i
), xmm6
211 OP_W XOR_UPD_1
, i
* 16
212 OP_W XOR_UPD_2
, i
* 16
224 movdqa xmm0
, [r1
+ r3
- 32]
234 movdqa
[r1
+ r6
- 64], xmm6