diff options
author | Huang Ying <ying.huang@intel.com> | 2009-11-23 06:54:06 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2009-11-23 06:54:06 -0500 |
commit | b369e521237d6ef21c453f3ac4f4b8577ec14f87 (patch) | |
tree | cedf1e4f1287c441d1afc29efd45c0f02f21c761 /arch | |
parent | fd650a6394b3242edf125ba9c4d500349a6d7178 (diff) |
crypto: aesni-intel - Use gas macro for AES-NI instructions
Old binutils do not support AES-NI instructions, to make kernel can be
compiled by them, .byte code is used instead of AES-NI assembly
instructions. But the readability and flexibility of raw .byte code is
not good.
So corresponding assembly instruction like gas macro is used instead.
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/crypto/aesni-intel_asm.S | 517 |
1 files changed, 173 insertions, 344 deletions
diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S index eb0566e83319..20bb0e1ac681 100644 --- a/arch/x86/crypto/aesni-intel_asm.S +++ b/arch/x86/crypto/aesni-intel_asm.S | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/linkage.h> | 18 | #include <linux/linkage.h> |
19 | #include <asm/inst.h> | ||
19 | 20 | ||
20 | .text | 21 | .text |
21 | 22 | ||
@@ -122,103 +123,72 @@ ENTRY(aesni_set_key) | |||
122 | movups 0x10(%rsi), %xmm2 # other user key | 123 | movups 0x10(%rsi), %xmm2 # other user key |
123 | movaps %xmm2, (%rcx) | 124 | movaps %xmm2, (%rcx) |
124 | add $0x10, %rcx | 125 | add $0x10, %rcx |
125 | # aeskeygenassist $0x1, %xmm2, %xmm1 # round 1 | 126 | AESKEYGENASSIST 0x1 %xmm2 %xmm1 # round 1 |
126 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x01 | ||
127 | call _key_expansion_256a | 127 | call _key_expansion_256a |
128 | # aeskeygenassist $0x1, %xmm0, %xmm1 | 128 | AESKEYGENASSIST 0x1 %xmm0 %xmm1 |
129 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x01 | ||
130 | call _key_expansion_256b | 129 | call _key_expansion_256b |
131 | # aeskeygenassist $0x2, %xmm2, %xmm1 # round 2 | 130 | AESKEYGENASSIST 0x2 %xmm2 %xmm1 # round 2 |
132 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x02 | ||
133 | call _key_expansion_256a | 131 | call _key_expansion_256a |
134 | # aeskeygenassist $0x2, %xmm0, %xmm1 | 132 | AESKEYGENASSIST 0x2 %xmm0 %xmm1 |
135 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x02 | ||
136 | call _key_expansion_256b | 133 | call _key_expansion_256b |
137 | # aeskeygenassist $0x4, %xmm2, %xmm1 # round 3 | 134 | AESKEYGENASSIST 0x4 %xmm2 %xmm1 # round 3 |
138 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x04 | ||
139 | call _key_expansion_256a | 135 | call _key_expansion_256a |
140 | # aeskeygenassist $0x4, %xmm0, %xmm1 | 136 | AESKEYGENASSIST 0x4 %xmm0 %xmm1 |
141 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x04 | ||
142 | call _key_expansion_256b | 137 | call _key_expansion_256b |
143 | # aeskeygenassist $0x8, %xmm2, %xmm1 # round 4 | 138 | AESKEYGENASSIST 0x8 %xmm2 %xmm1 # round 4 |
144 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x08 | ||
145 | call _key_expansion_256a | 139 | call _key_expansion_256a |
146 | # aeskeygenassist $0x8, %xmm0, %xmm1 | 140 | AESKEYGENASSIST 0x8 %xmm0 %xmm1 |
147 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x08 | ||
148 | call _key_expansion_256b | 141 | call _key_expansion_256b |
149 | # aeskeygenassist $0x10, %xmm2, %xmm1 # round 5 | 142 | AESKEYGENASSIST 0x10 %xmm2 %xmm1 # round 5 |
150 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x10 | ||
151 | call _key_expansion_256a | 143 | call _key_expansion_256a |
152 | # aeskeygenassist $0x10, %xmm0, %xmm1 | 144 | AESKEYGENASSIST 0x10 %xmm0 %xmm1 |
153 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x10 | ||
154 | call _key_expansion_256b | 145 | call _key_expansion_256b |
155 | # aeskeygenassist $0x20, %xmm2, %xmm1 # round 6 | 146 | AESKEYGENASSIST 0x20 %xmm2 %xmm1 # round 6 |
156 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x20 | ||
157 | call _key_expansion_256a | 147 | call _key_expansion_256a |
158 | # aeskeygenassist $0x20, %xmm0, %xmm1 | 148 | AESKEYGENASSIST 0x20 %xmm0 %xmm1 |
159 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x20 | ||
160 | call _key_expansion_256b | 149 | call _key_expansion_256b |
161 | # aeskeygenassist $0x40, %xmm2, %xmm1 # round 7 | 150 | AESKEYGENASSIST 0x40 %xmm2 %xmm1 # round 7 |
162 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x40 | ||
163 | call _key_expansion_256a | 151 | call _key_expansion_256a |
164 | jmp .Ldec_key | 152 | jmp .Ldec_key |
165 | .Lenc_key192: | 153 | .Lenc_key192: |
166 | movq 0x10(%rsi), %xmm2 # other user key | 154 | movq 0x10(%rsi), %xmm2 # other user key |
167 | # aeskeygenassist $0x1, %xmm2, %xmm1 # round 1 | 155 | AESKEYGENASSIST 0x1 %xmm2 %xmm1 # round 1 |
168 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x01 | ||
169 | call _key_expansion_192a | 156 | call _key_expansion_192a |
170 | # aeskeygenassist $0x2, %xmm2, %xmm1 # round 2 | 157 | AESKEYGENASSIST 0x2 %xmm2 %xmm1 # round 2 |
171 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x02 | ||
172 | call _key_expansion_192b | 158 | call _key_expansion_192b |
173 | # aeskeygenassist $0x4, %xmm2, %xmm1 # round 3 | 159 | AESKEYGENASSIST 0x4 %xmm2 %xmm1 # round 3 |
174 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x04 | ||
175 | call _key_expansion_192a | 160 | call _key_expansion_192a |
176 | # aeskeygenassist $0x8, %xmm2, %xmm1 # round 4 | 161 | AESKEYGENASSIST 0x8 %xmm2 %xmm1 # round 4 |
177 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x08 | ||
178 | call _key_expansion_192b | 162 | call _key_expansion_192b |
179 | # aeskeygenassist $0x10, %xmm2, %xmm1 # round 5 | 163 | AESKEYGENASSIST 0x10 %xmm2 %xmm1 # round 5 |
180 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x10 | ||
181 | call _key_expansion_192a | 164 | call _key_expansion_192a |
182 | # aeskeygenassist $0x20, %xmm2, %xmm1 # round 6 | 165 | AESKEYGENASSIST 0x20 %xmm2 %xmm1 # round 6 |
183 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x20 | ||
184 | call _key_expansion_192b | 166 | call _key_expansion_192b |
185 | # aeskeygenassist $0x40, %xmm2, %xmm1 # round 7 | 167 | AESKEYGENASSIST 0x40 %xmm2 %xmm1 # round 7 |
186 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x40 | ||
187 | call _key_expansion_192a | 168 | call _key_expansion_192a |
188 | # aeskeygenassist $0x80, %xmm2, %xmm1 # round 8 | 169 | AESKEYGENASSIST 0x80 %xmm2 %xmm1 # round 8 |
189 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x80 | ||
190 | call _key_expansion_192b | 170 | call _key_expansion_192b |
191 | jmp .Ldec_key | 171 | jmp .Ldec_key |
192 | .Lenc_key128: | 172 | .Lenc_key128: |
193 | # aeskeygenassist $0x1, %xmm0, %xmm1 # round 1 | 173 | AESKEYGENASSIST 0x1 %xmm0 %xmm1 # round 1 |
194 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x01 | ||
195 | call _key_expansion_128 | 174 | call _key_expansion_128 |
196 | # aeskeygenassist $0x2, %xmm0, %xmm1 # round 2 | 175 | AESKEYGENASSIST 0x2 %xmm0 %xmm1 # round 2 |
197 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x02 | ||
198 | call _key_expansion_128 | 176 | call _key_expansion_128 |
199 | # aeskeygenassist $0x4, %xmm0, %xmm1 # round 3 | 177 | AESKEYGENASSIST 0x4 %xmm0 %xmm1 # round 3 |
200 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x04 | ||
201 | call _key_expansion_128 | 178 | call _key_expansion_128 |
202 | # aeskeygenassist $0x8, %xmm0, %xmm1 # round 4 | 179 | AESKEYGENASSIST 0x8 %xmm0 %xmm1 # round 4 |
203 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x08 | ||
204 | call _key_expansion_128 | 180 | call _key_expansion_128 |
205 | # aeskeygenassist $0x10, %xmm0, %xmm1 # round 5 | 181 | AESKEYGENASSIST 0x10 %xmm0 %xmm1 # round 5 |
206 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x10 | ||
207 | call _key_expansion_128 | 182 | call _key_expansion_128 |
208 | # aeskeygenassist $0x20, %xmm0, %xmm1 # round 6 | 183 | AESKEYGENASSIST 0x20 %xmm0 %xmm1 # round 6 |
209 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x20 | ||
210 | call _key_expansion_128 | 184 | call _key_expansion_128 |
211 | # aeskeygenassist $0x40, %xmm0, %xmm1 # round 7 | 185 | AESKEYGENASSIST 0x40 %xmm0 %xmm1 # round 7 |
212 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x40 | ||
213 | call _key_expansion_128 | 186 | call _key_expansion_128 |
214 | # aeskeygenassist $0x80, %xmm0, %xmm1 # round 8 | 187 | AESKEYGENASSIST 0x80 %xmm0 %xmm1 # round 8 |
215 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x80 | ||
216 | call _key_expansion_128 | 188 | call _key_expansion_128 |
217 | # aeskeygenassist $0x1b, %xmm0, %xmm1 # round 9 | 189 | AESKEYGENASSIST 0x1b %xmm0 %xmm1 # round 9 |
218 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x1b | ||
219 | call _key_expansion_128 | 190 | call _key_expansion_128 |
220 | # aeskeygenassist $0x36, %xmm0, %xmm1 # round 10 | 191 | AESKEYGENASSIST 0x36 %xmm0 %xmm1 # round 10 |
221 | .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x36 | ||
222 | call _key_expansion_128 | 192 | call _key_expansion_128 |
223 | .Ldec_key: | 193 | .Ldec_key: |
224 | sub $0x10, %rcx | 194 | sub $0x10, %rcx |
@@ -231,8 +201,7 @@ ENTRY(aesni_set_key) | |||
231 | .align 4 | 201 | .align 4 |
232 | .Ldec_key_loop: | 202 | .Ldec_key_loop: |
233 | movaps (%rdi), %xmm0 | 203 | movaps (%rdi), %xmm0 |
234 | # aesimc %xmm0, %xmm1 | 204 | AESIMC %xmm0 %xmm1 |
235 | .byte 0x66, 0x0f, 0x38, 0xdb, 0xc8 | ||
236 | movaps %xmm1, (%rsi) | 205 | movaps %xmm1, (%rsi) |
237 | add $0x10, %rdi | 206 | add $0x10, %rdi |
238 | sub $0x10, %rsi | 207 | sub $0x10, %rsi |
@@ -274,51 +243,37 @@ _aesni_enc1: | |||
274 | je .Lenc192 | 243 | je .Lenc192 |
275 | add $0x20, TKEYP | 244 | add $0x20, TKEYP |
276 | movaps -0x60(TKEYP), KEY | 245 | movaps -0x60(TKEYP), KEY |
277 | # aesenc KEY, STATE | 246 | AESENC KEY STATE |
278 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
279 | movaps -0x50(TKEYP), KEY | 247 | movaps -0x50(TKEYP), KEY |
280 | # aesenc KEY, STATE | 248 | AESENC KEY STATE |
281 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
282 | .align 4 | 249 | .align 4 |
283 | .Lenc192: | 250 | .Lenc192: |
284 | movaps -0x40(TKEYP), KEY | 251 | movaps -0x40(TKEYP), KEY |
285 | # aesenc KEY, STATE | 252 | AESENC KEY STATE |
286 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
287 | movaps -0x30(TKEYP), KEY | 253 | movaps -0x30(TKEYP), KEY |
288 | # aesenc KEY, STATE | 254 | AESENC KEY STATE |
289 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
290 | .align 4 | 255 | .align 4 |
291 | .Lenc128: | 256 | .Lenc128: |
292 | movaps -0x20(TKEYP), KEY | 257 | movaps -0x20(TKEYP), KEY |
293 | # aesenc KEY, STATE | 258 | AESENC KEY STATE |
294 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
295 | movaps -0x10(TKEYP), KEY | 259 | movaps -0x10(TKEYP), KEY |
296 | # aesenc KEY, STATE | 260 | AESENC KEY STATE |
297 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
298 | movaps (TKEYP), KEY | 261 | movaps (TKEYP), KEY |
299 | # aesenc KEY, STATE | 262 | AESENC KEY STATE |
300 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
301 | movaps 0x10(TKEYP), KEY | 263 | movaps 0x10(TKEYP), KEY |
302 | # aesenc KEY, STATE | 264 | AESENC KEY STATE |
303 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
304 | movaps 0x20(TKEYP), KEY | 265 | movaps 0x20(TKEYP), KEY |
305 | # aesenc KEY, STATE | 266 | AESENC KEY STATE |
306 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
307 | movaps 0x30(TKEYP), KEY | 267 | movaps 0x30(TKEYP), KEY |
308 | # aesenc KEY, STATE | 268 | AESENC KEY STATE |
309 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
310 | movaps 0x40(TKEYP), KEY | 269 | movaps 0x40(TKEYP), KEY |
311 | # aesenc KEY, STATE | 270 | AESENC KEY STATE |
312 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
313 | movaps 0x50(TKEYP), KEY | 271 | movaps 0x50(TKEYP), KEY |
314 | # aesenc KEY, STATE | 272 | AESENC KEY STATE |
315 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
316 | movaps 0x60(TKEYP), KEY | 273 | movaps 0x60(TKEYP), KEY |
317 | # aesenc KEY, STATE | 274 | AESENC KEY STATE |
318 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | ||
319 | movaps 0x70(TKEYP), KEY | 275 | movaps 0x70(TKEYP), KEY |
320 | # aesenclast KEY, STATE # last round | 276 | AESENCLAST KEY STATE |
321 | .byte 0x66, 0x0f, 0x38, 0xdd, 0xc2 | ||
322 | ret | 277 | ret |
323 | 278 | ||
324 | /* | 279 | /* |
@@ -353,135 +308,79 @@ _aesni_enc4: | |||
353 | je .L4enc192 | 308 | je .L4enc192 |
354 | add $0x20, TKEYP | 309 | add $0x20, TKEYP |
355 | movaps -0x60(TKEYP), KEY | 310 | movaps -0x60(TKEYP), KEY |
356 | # aesenc KEY, STATE1 | 311 | AESENC KEY STATE1 |
357 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 312 | AESENC KEY STATE2 |
358 | # aesenc KEY, STATE2 | 313 | AESENC KEY STATE3 |
359 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 314 | AESENC KEY STATE4 |
360 | # aesenc KEY, STATE3 | ||
361 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
362 | # aesenc KEY, STATE4 | ||
363 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
364 | movaps -0x50(TKEYP), KEY | 315 | movaps -0x50(TKEYP), KEY |
365 | # aesenc KEY, STATE1 | 316 | AESENC KEY STATE1 |
366 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 317 | AESENC KEY STATE2 |
367 | # aesenc KEY, STATE2 | 318 | AESENC KEY STATE3 |
368 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 319 | AESENC KEY STATE4 |
369 | # aesenc KEY, STATE3 | ||
370 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
371 | # aesenc KEY, STATE4 | ||
372 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
373 | #.align 4 | 320 | #.align 4 |
374 | .L4enc192: | 321 | .L4enc192: |
375 | movaps -0x40(TKEYP), KEY | 322 | movaps -0x40(TKEYP), KEY |
376 | # aesenc KEY, STATE1 | 323 | AESENC KEY STATE1 |
377 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 324 | AESENC KEY STATE2 |
378 | # aesenc KEY, STATE2 | 325 | AESENC KEY STATE3 |
379 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 326 | AESENC KEY STATE4 |
380 | # aesenc KEY, STATE3 | ||
381 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
382 | # aesenc KEY, STATE4 | ||
383 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
384 | movaps -0x30(TKEYP), KEY | 327 | movaps -0x30(TKEYP), KEY |
385 | # aesenc KEY, STATE1 | 328 | AESENC KEY STATE1 |
386 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 329 | AESENC KEY STATE2 |
387 | # aesenc KEY, STATE2 | 330 | AESENC KEY STATE3 |
388 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 331 | AESENC KEY STATE4 |
389 | # aesenc KEY, STATE3 | ||
390 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
391 | # aesenc KEY, STATE4 | ||
392 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
393 | #.align 4 | 332 | #.align 4 |
394 | .L4enc128: | 333 | .L4enc128: |
395 | movaps -0x20(TKEYP), KEY | 334 | movaps -0x20(TKEYP), KEY |
396 | # aesenc KEY, STATE1 | 335 | AESENC KEY STATE1 |
397 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 336 | AESENC KEY STATE2 |
398 | # aesenc KEY, STATE2 | 337 | AESENC KEY STATE3 |
399 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 338 | AESENC KEY STATE4 |
400 | # aesenc KEY, STATE3 | ||
401 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
402 | # aesenc KEY, STATE4 | ||
403 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
404 | movaps -0x10(TKEYP), KEY | 339 | movaps -0x10(TKEYP), KEY |
405 | # aesenc KEY, STATE1 | 340 | AESENC KEY STATE1 |
406 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 341 | AESENC KEY STATE2 |
407 | # aesenc KEY, STATE2 | 342 | AESENC KEY STATE3 |
408 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 343 | AESENC KEY STATE4 |
409 | # aesenc KEY, STATE3 | ||
410 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
411 | # aesenc KEY, STATE4 | ||
412 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
413 | movaps (TKEYP), KEY | 344 | movaps (TKEYP), KEY |
414 | # aesenc KEY, STATE1 | 345 | AESENC KEY STATE1 |
415 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 346 | AESENC KEY STATE2 |
416 | # aesenc KEY, STATE2 | 347 | AESENC KEY STATE3 |
417 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 348 | AESENC KEY STATE4 |
418 | # aesenc KEY, STATE3 | ||
419 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
420 | # aesenc KEY, STATE4 | ||
421 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
422 | movaps 0x10(TKEYP), KEY | 349 | movaps 0x10(TKEYP), KEY |
423 | # aesenc KEY, STATE1 | 350 | AESENC KEY STATE1 |
424 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 351 | AESENC KEY STATE2 |
425 | # aesenc KEY, STATE2 | 352 | AESENC KEY STATE3 |
426 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 353 | AESENC KEY STATE4 |
427 | # aesenc KEY, STATE3 | ||
428 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
429 | # aesenc KEY, STATE4 | ||
430 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
431 | movaps 0x20(TKEYP), KEY | 354 | movaps 0x20(TKEYP), KEY |
432 | # aesenc KEY, STATE1 | 355 | AESENC KEY STATE1 |
433 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 356 | AESENC KEY STATE2 |
434 | # aesenc KEY, STATE2 | 357 | AESENC KEY STATE3 |
435 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 358 | AESENC KEY STATE4 |
436 | # aesenc KEY, STATE3 | ||
437 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
438 | # aesenc KEY, STATE4 | ||
439 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
440 | movaps 0x30(TKEYP), KEY | 359 | movaps 0x30(TKEYP), KEY |
441 | # aesenc KEY, STATE1 | 360 | AESENC KEY STATE1 |
442 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 361 | AESENC KEY STATE2 |
443 | # aesenc KEY, STATE2 | 362 | AESENC KEY STATE3 |
444 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 363 | AESENC KEY STATE4 |
445 | # aesenc KEY, STATE3 | ||
446 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
447 | # aesenc KEY, STATE4 | ||
448 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
449 | movaps 0x40(TKEYP), KEY | 364 | movaps 0x40(TKEYP), KEY |
450 | # aesenc KEY, STATE1 | 365 | AESENC KEY STATE1 |
451 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 366 | AESENC KEY STATE2 |
452 | # aesenc KEY, STATE2 | 367 | AESENC KEY STATE3 |
453 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 368 | AESENC KEY STATE4 |
454 | # aesenc KEY, STATE3 | ||
455 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
456 | # aesenc KEY, STATE4 | ||
457 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
458 | movaps 0x50(TKEYP), KEY | 369 | movaps 0x50(TKEYP), KEY |
459 | # aesenc KEY, STATE1 | 370 | AESENC KEY STATE1 |
460 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 371 | AESENC KEY STATE2 |
461 | # aesenc KEY, STATE2 | 372 | AESENC KEY STATE3 |
462 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 373 | AESENC KEY STATE4 |
463 | # aesenc KEY, STATE3 | ||
464 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
465 | # aesenc KEY, STATE4 | ||
466 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
467 | movaps 0x60(TKEYP), KEY | 374 | movaps 0x60(TKEYP), KEY |
468 | # aesenc KEY, STATE1 | 375 | AESENC KEY STATE1 |
469 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2 | 376 | AESENC KEY STATE2 |
470 | # aesenc KEY, STATE2 | 377 | AESENC KEY STATE3 |
471 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2 | 378 | AESENC KEY STATE4 |
472 | # aesenc KEY, STATE3 | ||
473 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xea | ||
474 | # aesenc KEY, STATE4 | ||
475 | .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2 | ||
476 | movaps 0x70(TKEYP), KEY | 379 | movaps 0x70(TKEYP), KEY |
477 | # aesenclast KEY, STATE1 # last round | 380 | AESENCLAST KEY STATE1 # last round |
478 | .byte 0x66, 0x0f, 0x38, 0xdd, 0xc2 | 381 | AESENCLAST KEY STATE2 |
479 | # aesenclast KEY, STATE2 | 382 | AESENCLAST KEY STATE3 |
480 | .byte 0x66, 0x0f, 0x38, 0xdd, 0xe2 | 383 | AESENCLAST KEY STATE4 |
481 | # aesenclast KEY, STATE3 | ||
482 | .byte 0x66, 0x0f, 0x38, 0xdd, 0xea | ||
483 | # aesenclast KEY, STATE4 | ||
484 | .byte 0x66, 0x0f, 0x38, 0xdd, 0xf2 | ||
485 | ret | 384 | ret |
486 | 385 | ||
487 | /* | 386 | /* |
@@ -518,51 +417,37 @@ _aesni_dec1: | |||
518 | je .Ldec192 | 417 | je .Ldec192 |
519 | add $0x20, TKEYP | 418 | add $0x20, TKEYP |
520 | movaps -0x60(TKEYP), KEY | 419 | movaps -0x60(TKEYP), KEY |
521 | # aesdec KEY, STATE | 420 | AESDEC KEY STATE |
522 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
523 | movaps -0x50(TKEYP), KEY | 421 | movaps -0x50(TKEYP), KEY |
524 | # aesdec KEY, STATE | 422 | AESDEC KEY STATE |
525 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
526 | .align 4 | 423 | .align 4 |
527 | .Ldec192: | 424 | .Ldec192: |
528 | movaps -0x40(TKEYP), KEY | 425 | movaps -0x40(TKEYP), KEY |
529 | # aesdec KEY, STATE | 426 | AESDEC KEY STATE |
530 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
531 | movaps -0x30(TKEYP), KEY | 427 | movaps -0x30(TKEYP), KEY |
532 | # aesdec KEY, STATE | 428 | AESDEC KEY STATE |
533 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
534 | .align 4 | 429 | .align 4 |
535 | .Ldec128: | 430 | .Ldec128: |
536 | movaps -0x20(TKEYP), KEY | 431 | movaps -0x20(TKEYP), KEY |
537 | # aesdec KEY, STATE | 432 | AESDEC KEY STATE |
538 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
539 | movaps -0x10(TKEYP), KEY | 433 | movaps -0x10(TKEYP), KEY |
540 | # aesdec KEY, STATE | 434 | AESDEC KEY STATE |
541 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
542 | movaps (TKEYP), KEY | 435 | movaps (TKEYP), KEY |
543 | # aesdec KEY, STATE | 436 | AESDEC KEY STATE |
544 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
545 | movaps 0x10(TKEYP), KEY | 437 | movaps 0x10(TKEYP), KEY |
546 | # aesdec KEY, STATE | 438 | AESDEC KEY STATE |
547 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
548 | movaps 0x20(TKEYP), KEY | 439 | movaps 0x20(TKEYP), KEY |
549 | # aesdec KEY, STATE | 440 | AESDEC KEY STATE |
550 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
551 | movaps 0x30(TKEYP), KEY | 441 | movaps 0x30(TKEYP), KEY |
552 | # aesdec KEY, STATE | 442 | AESDEC KEY STATE |
553 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
554 | movaps 0x40(TKEYP), KEY | 443 | movaps 0x40(TKEYP), KEY |
555 | # aesdec KEY, STATE | 444 | AESDEC KEY STATE |
556 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
557 | movaps 0x50(TKEYP), KEY | 445 | movaps 0x50(TKEYP), KEY |
558 | # aesdec KEY, STATE | 446 | AESDEC KEY STATE |
559 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
560 | movaps 0x60(TKEYP), KEY | 447 | movaps 0x60(TKEYP), KEY |
561 | # aesdec KEY, STATE | 448 | AESDEC KEY STATE |
562 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | ||
563 | movaps 0x70(TKEYP), KEY | 449 | movaps 0x70(TKEYP), KEY |
564 | # aesdeclast KEY, STATE # last round | 450 | AESDECLAST KEY STATE |
565 | .byte 0x66, 0x0f, 0x38, 0xdf, 0xc2 | ||
566 | ret | 451 | ret |
567 | 452 | ||
568 | /* | 453 | /* |
@@ -597,135 +482,79 @@ _aesni_dec4: | |||
597 | je .L4dec192 | 482 | je .L4dec192 |
598 | add $0x20, TKEYP | 483 | add $0x20, TKEYP |
599 | movaps -0x60(TKEYP), KEY | 484 | movaps -0x60(TKEYP), KEY |
600 | # aesdec KEY, STATE1 | 485 | AESDEC KEY STATE1 |
601 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 486 | AESDEC KEY STATE2 |
602 | # aesdec KEY, STATE2 | 487 | AESDEC KEY STATE3 |
603 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 488 | AESDEC KEY STATE4 |
604 | # aesdec KEY, STATE3 | ||
605 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
606 | # aesdec KEY, STATE4 | ||
607 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
608 | movaps -0x50(TKEYP), KEY | 489 | movaps -0x50(TKEYP), KEY |
609 | # aesdec KEY, STATE1 | 490 | AESDEC KEY STATE1 |
610 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 491 | AESDEC KEY STATE2 |
611 | # aesdec KEY, STATE2 | 492 | AESDEC KEY STATE3 |
612 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 493 | AESDEC KEY STATE4 |
613 | # aesdec KEY, STATE3 | ||
614 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
615 | # aesdec KEY, STATE4 | ||
616 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
617 | .align 4 | 494 | .align 4 |
618 | .L4dec192: | 495 | .L4dec192: |
619 | movaps -0x40(TKEYP), KEY | 496 | movaps -0x40(TKEYP), KEY |
620 | # aesdec KEY, STATE1 | 497 | AESDEC KEY STATE1 |
621 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 498 | AESDEC KEY STATE2 |
622 | # aesdec KEY, STATE2 | 499 | AESDEC KEY STATE3 |
623 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 500 | AESDEC KEY STATE4 |
624 | # aesdec KEY, STATE3 | ||
625 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
626 | # aesdec KEY, STATE4 | ||
627 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
628 | movaps -0x30(TKEYP), KEY | 501 | movaps -0x30(TKEYP), KEY |
629 | # aesdec KEY, STATE1 | 502 | AESDEC KEY STATE1 |
630 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 503 | AESDEC KEY STATE2 |
631 | # aesdec KEY, STATE2 | 504 | AESDEC KEY STATE3 |
632 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 505 | AESDEC KEY STATE4 |
633 | # aesdec KEY, STATE3 | ||
634 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
635 | # aesdec KEY, STATE4 | ||
636 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
637 | .align 4 | 506 | .align 4 |
638 | .L4dec128: | 507 | .L4dec128: |
639 | movaps -0x20(TKEYP), KEY | 508 | movaps -0x20(TKEYP), KEY |
640 | # aesdec KEY, STATE1 | 509 | AESDEC KEY STATE1 |
641 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 510 | AESDEC KEY STATE2 |
642 | # aesdec KEY, STATE2 | 511 | AESDEC KEY STATE3 |
643 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 512 | AESDEC KEY STATE4 |
644 | # aesdec KEY, STATE3 | ||
645 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
646 | # aesdec KEY, STATE4 | ||
647 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
648 | movaps -0x10(TKEYP), KEY | 513 | movaps -0x10(TKEYP), KEY |
649 | # aesdec KEY, STATE1 | 514 | AESDEC KEY STATE1 |
650 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 515 | AESDEC KEY STATE2 |
651 | # aesdec KEY, STATE2 | 516 | AESDEC KEY STATE3 |
652 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 517 | AESDEC KEY STATE4 |
653 | # aesdec KEY, STATE3 | ||
654 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
655 | # aesdec KEY, STATE4 | ||
656 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
657 | movaps (TKEYP), KEY | 518 | movaps (TKEYP), KEY |
658 | # aesdec KEY, STATE1 | 519 | AESDEC KEY STATE1 |
659 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 520 | AESDEC KEY STATE2 |
660 | # aesdec KEY, STATE2 | 521 | AESDEC KEY STATE3 |
661 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 522 | AESDEC KEY STATE4 |
662 | # aesdec KEY, STATE3 | ||
663 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
664 | # aesdec KEY, STATE4 | ||
665 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
666 | movaps 0x10(TKEYP), KEY | 523 | movaps 0x10(TKEYP), KEY |
667 | # aesdec KEY, STATE1 | 524 | AESDEC KEY STATE1 |
668 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 525 | AESDEC KEY STATE2 |
669 | # aesdec KEY, STATE2 | 526 | AESDEC KEY STATE3 |
670 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 527 | AESDEC KEY STATE4 |
671 | # aesdec KEY, STATE3 | ||
672 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
673 | # aesdec KEY, STATE4 | ||
674 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
675 | movaps 0x20(TKEYP), KEY | 528 | movaps 0x20(TKEYP), KEY |
676 | # aesdec KEY, STATE1 | 529 | AESDEC KEY STATE1 |
677 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 530 | AESDEC KEY STATE2 |
678 | # aesdec KEY, STATE2 | 531 | AESDEC KEY STATE3 |
679 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 532 | AESDEC KEY STATE4 |
680 | # aesdec KEY, STATE3 | ||
681 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
682 | # aesdec KEY, STATE4 | ||
683 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
684 | movaps 0x30(TKEYP), KEY | 533 | movaps 0x30(TKEYP), KEY |
685 | # aesdec KEY, STATE1 | 534 | AESDEC KEY STATE1 |
686 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 535 | AESDEC KEY STATE2 |
687 | # aesdec KEY, STATE2 | 536 | AESDEC KEY STATE3 |
688 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 537 | AESDEC KEY STATE4 |
689 | # aesdec KEY, STATE3 | ||
690 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
691 | # aesdec KEY, STATE4 | ||
692 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
693 | movaps 0x40(TKEYP), KEY | 538 | movaps 0x40(TKEYP), KEY |
694 | # aesdec KEY, STATE1 | 539 | AESDEC KEY STATE1 |
695 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 540 | AESDEC KEY STATE2 |
696 | # aesdec KEY, STATE2 | 541 | AESDEC KEY STATE3 |
697 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 542 | AESDEC KEY STATE4 |
698 | # aesdec KEY, STATE3 | ||
699 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
700 | # aesdec KEY, STATE4 | ||
701 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
702 | movaps 0x50(TKEYP), KEY | 543 | movaps 0x50(TKEYP), KEY |
703 | # aesdec KEY, STATE1 | 544 | AESDEC KEY STATE1 |
704 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 545 | AESDEC KEY STATE2 |
705 | # aesdec KEY, STATE2 | 546 | AESDEC KEY STATE3 |
706 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 547 | AESDEC KEY STATE4 |
707 | # aesdec KEY, STATE3 | ||
708 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
709 | # aesdec KEY, STATE4 | ||
710 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
711 | movaps 0x60(TKEYP), KEY | 548 | movaps 0x60(TKEYP), KEY |
712 | # aesdec KEY, STATE1 | 549 | AESDEC KEY STATE1 |
713 | .byte 0x66, 0x0f, 0x38, 0xde, 0xc2 | 550 | AESDEC KEY STATE2 |
714 | # aesdec KEY, STATE2 | 551 | AESDEC KEY STATE3 |
715 | .byte 0x66, 0x0f, 0x38, 0xde, 0xe2 | 552 | AESDEC KEY STATE4 |
716 | # aesdec KEY, STATE3 | ||
717 | .byte 0x66, 0x0f, 0x38, 0xde, 0xea | ||
718 | # aesdec KEY, STATE4 | ||
719 | .byte 0x66, 0x0f, 0x38, 0xde, 0xf2 | ||
720 | movaps 0x70(TKEYP), KEY | 553 | movaps 0x70(TKEYP), KEY |
721 | # aesdeclast KEY, STATE1 # last round | 554 | AESDECLAST KEY STATE1 # last round |
722 | .byte 0x66, 0x0f, 0x38, 0xdf, 0xc2 | 555 | AESDECLAST KEY STATE2 |
723 | # aesdeclast KEY, STATE2 | 556 | AESDECLAST KEY STATE3 |
724 | .byte 0x66, 0x0f, 0x38, 0xdf, 0xe2 | 557 | AESDECLAST KEY STATE4 |
725 | # aesdeclast KEY, STATE3 | ||
726 | .byte 0x66, 0x0f, 0x38, 0xdf, 0xea | ||
727 | # aesdeclast KEY, STATE4 | ||
728 | .byte 0x66, 0x0f, 0x38, 0xdf, 0xf2 | ||
729 | ret | 558 | ret |
730 | 559 | ||
731 | /* | 560 | /* |