OLD | NEW |
| (Empty) |
1 #if defined(__x86_64__) | |
2 .text | |
3 | |
4 .extern asm_AES_encrypt | |
5 .hidden asm_AES_encrypt | |
6 .extern asm_AES_decrypt | |
7 .hidden asm_AES_decrypt | |
8 | |
9 .type _bsaes_encrypt8,@function | |
10 .align 64 | |
11 _bsaes_encrypt8: | |
12 leaq .LBS0(%rip),%r11 | |
13 | |
14 movdqa (%rax),%xmm8 | |
15 leaq 16(%rax),%rax | |
16 movdqa 80(%r11),%xmm7 | |
17 pxor %xmm8,%xmm15 | |
18 pxor %xmm8,%xmm0 | |
19 pxor %xmm8,%xmm1 | |
20 pxor %xmm8,%xmm2 | |
21 .byte 102,68,15,56,0,255 | |
22 .byte 102,15,56,0,199 | |
23 pxor %xmm8,%xmm3 | |
24 pxor %xmm8,%xmm4 | |
25 .byte 102,15,56,0,207 | |
26 .byte 102,15,56,0,215 | |
27 pxor %xmm8,%xmm5 | |
28 pxor %xmm8,%xmm6 | |
29 .byte 102,15,56,0,223 | |
30 .byte 102,15,56,0,231 | |
31 .byte 102,15,56,0,239 | |
32 .byte 102,15,56,0,247 | |
33 _bsaes_encrypt8_bitslice: | |
34 movdqa 0(%r11),%xmm7 | |
35 movdqa 16(%r11),%xmm8 | |
36 movdqa %xmm5,%xmm9 | |
37 psrlq $1,%xmm5 | |
38 movdqa %xmm3,%xmm10 | |
39 psrlq $1,%xmm3 | |
40 pxor %xmm6,%xmm5 | |
41 pxor %xmm4,%xmm3 | |
42 pand %xmm7,%xmm5 | |
43 pand %xmm7,%xmm3 | |
44 pxor %xmm5,%xmm6 | |
45 psllq $1,%xmm5 | |
46 pxor %xmm3,%xmm4 | |
47 psllq $1,%xmm3 | |
48 pxor %xmm9,%xmm5 | |
49 pxor %xmm10,%xmm3 | |
50 movdqa %xmm1,%xmm9 | |
51 psrlq $1,%xmm1 | |
52 movdqa %xmm15,%xmm10 | |
53 psrlq $1,%xmm15 | |
54 pxor %xmm2,%xmm1 | |
55 pxor %xmm0,%xmm15 | |
56 pand %xmm7,%xmm1 | |
57 pand %xmm7,%xmm15 | |
58 pxor %xmm1,%xmm2 | |
59 psllq $1,%xmm1 | |
60 pxor %xmm15,%xmm0 | |
61 psllq $1,%xmm15 | |
62 pxor %xmm9,%xmm1 | |
63 pxor %xmm10,%xmm15 | |
64 movdqa 32(%r11),%xmm7 | |
65 movdqa %xmm4,%xmm9 | |
66 psrlq $2,%xmm4 | |
67 movdqa %xmm3,%xmm10 | |
68 psrlq $2,%xmm3 | |
69 pxor %xmm6,%xmm4 | |
70 pxor %xmm5,%xmm3 | |
71 pand %xmm8,%xmm4 | |
72 pand %xmm8,%xmm3 | |
73 pxor %xmm4,%xmm6 | |
74 psllq $2,%xmm4 | |
75 pxor %xmm3,%xmm5 | |
76 psllq $2,%xmm3 | |
77 pxor %xmm9,%xmm4 | |
78 pxor %xmm10,%xmm3 | |
79 movdqa %xmm0,%xmm9 | |
80 psrlq $2,%xmm0 | |
81 movdqa %xmm15,%xmm10 | |
82 psrlq $2,%xmm15 | |
83 pxor %xmm2,%xmm0 | |
84 pxor %xmm1,%xmm15 | |
85 pand %xmm8,%xmm0 | |
86 pand %xmm8,%xmm15 | |
87 pxor %xmm0,%xmm2 | |
88 psllq $2,%xmm0 | |
89 pxor %xmm15,%xmm1 | |
90 psllq $2,%xmm15 | |
91 pxor %xmm9,%xmm0 | |
92 pxor %xmm10,%xmm15 | |
93 movdqa %xmm2,%xmm9 | |
94 psrlq $4,%xmm2 | |
95 movdqa %xmm1,%xmm10 | |
96 psrlq $4,%xmm1 | |
97 pxor %xmm6,%xmm2 | |
98 pxor %xmm5,%xmm1 | |
99 pand %xmm7,%xmm2 | |
100 pand %xmm7,%xmm1 | |
101 pxor %xmm2,%xmm6 | |
102 psllq $4,%xmm2 | |
103 pxor %xmm1,%xmm5 | |
104 psllq $4,%xmm1 | |
105 pxor %xmm9,%xmm2 | |
106 pxor %xmm10,%xmm1 | |
107 movdqa %xmm0,%xmm9 | |
108 psrlq $4,%xmm0 | |
109 movdqa %xmm15,%xmm10 | |
110 psrlq $4,%xmm15 | |
111 pxor %xmm4,%xmm0 | |
112 pxor %xmm3,%xmm15 | |
113 pand %xmm7,%xmm0 | |
114 pand %xmm7,%xmm15 | |
115 pxor %xmm0,%xmm4 | |
116 psllq $4,%xmm0 | |
117 pxor %xmm15,%xmm3 | |
118 psllq $4,%xmm15 | |
119 pxor %xmm9,%xmm0 | |
120 pxor %xmm10,%xmm15 | |
121 decl %r10d | |
122 jmp .Lenc_sbox | |
123 .align 16 | |
124 .Lenc_loop: | |
125 pxor 0(%rax),%xmm15 | |
126 pxor 16(%rax),%xmm0 | |
127 pxor 32(%rax),%xmm1 | |
128 pxor 48(%rax),%xmm2 | |
129 .byte 102,68,15,56,0,255 | |
130 .byte 102,15,56,0,199 | |
131 pxor 64(%rax),%xmm3 | |
132 pxor 80(%rax),%xmm4 | |
133 .byte 102,15,56,0,207 | |
134 .byte 102,15,56,0,215 | |
135 pxor 96(%rax),%xmm5 | |
136 pxor 112(%rax),%xmm6 | |
137 .byte 102,15,56,0,223 | |
138 .byte 102,15,56,0,231 | |
139 .byte 102,15,56,0,239 | |
140 .byte 102,15,56,0,247 | |
141 leaq 128(%rax),%rax | |
142 .Lenc_sbox: | |
143 pxor %xmm5,%xmm4 | |
144 pxor %xmm0,%xmm1 | |
145 pxor %xmm15,%xmm2 | |
146 pxor %xmm1,%xmm5 | |
147 pxor %xmm15,%xmm4 | |
148 | |
149 pxor %xmm2,%xmm5 | |
150 pxor %xmm6,%xmm2 | |
151 pxor %xmm4,%xmm6 | |
152 pxor %xmm3,%xmm2 | |
153 pxor %xmm4,%xmm3 | |
154 pxor %xmm0,%xmm2 | |
155 | |
156 pxor %xmm6,%xmm1 | |
157 pxor %xmm4,%xmm0 | |
158 movdqa %xmm6,%xmm10 | |
159 movdqa %xmm0,%xmm9 | |
160 movdqa %xmm4,%xmm8 | |
161 movdqa %xmm1,%xmm12 | |
162 movdqa %xmm5,%xmm11 | |
163 | |
164 pxor %xmm3,%xmm10 | |
165 pxor %xmm1,%xmm9 | |
166 pxor %xmm2,%xmm8 | |
167 movdqa %xmm10,%xmm13 | |
168 pxor %xmm3,%xmm12 | |
169 movdqa %xmm9,%xmm7 | |
170 pxor %xmm15,%xmm11 | |
171 movdqa %xmm10,%xmm14 | |
172 | |
173 por %xmm8,%xmm9 | |
174 por %xmm11,%xmm10 | |
175 pxor %xmm7,%xmm14 | |
176 pand %xmm11,%xmm13 | |
177 pxor %xmm8,%xmm11 | |
178 pand %xmm8,%xmm7 | |
179 pand %xmm11,%xmm14 | |
180 movdqa %xmm2,%xmm11 | |
181 pxor %xmm15,%xmm11 | |
182 pand %xmm11,%xmm12 | |
183 pxor %xmm12,%xmm10 | |
184 pxor %xmm12,%xmm9 | |
185 movdqa %xmm6,%xmm12 | |
186 movdqa %xmm4,%xmm11 | |
187 pxor %xmm0,%xmm12 | |
188 pxor %xmm5,%xmm11 | |
189 movdqa %xmm12,%xmm8 | |
190 pand %xmm11,%xmm12 | |
191 por %xmm11,%xmm8 | |
192 pxor %xmm12,%xmm7 | |
193 pxor %xmm14,%xmm10 | |
194 pxor %xmm13,%xmm9 | |
195 pxor %xmm14,%xmm8 | |
196 movdqa %xmm1,%xmm11 | |
197 pxor %xmm13,%xmm7 | |
198 movdqa %xmm3,%xmm12 | |
199 pxor %xmm13,%xmm8 | |
200 movdqa %xmm0,%xmm13 | |
201 pand %xmm2,%xmm11 | |
202 movdqa %xmm6,%xmm14 | |
203 pand %xmm15,%xmm12 | |
204 pand %xmm4,%xmm13 | |
205 por %xmm5,%xmm14 | |
206 pxor %xmm11,%xmm10 | |
207 pxor %xmm12,%xmm9 | |
208 pxor %xmm13,%xmm8 | |
209 pxor %xmm14,%xmm7 | |
210 | |
211 | |
212 | |
213 | |
214 | |
215 movdqa %xmm10,%xmm11 | |
216 pand %xmm8,%xmm10 | |
217 pxor %xmm9,%xmm11 | |
218 | |
219 movdqa %xmm7,%xmm13 | |
220 movdqa %xmm11,%xmm14 | |
221 pxor %xmm10,%xmm13 | |
222 pand %xmm13,%xmm14 | |
223 | |
224 movdqa %xmm8,%xmm12 | |
225 pxor %xmm9,%xmm14 | |
226 pxor %xmm7,%xmm12 | |
227 | |
228 pxor %xmm9,%xmm10 | |
229 | |
230 pand %xmm10,%xmm12 | |
231 | |
232 movdqa %xmm13,%xmm9 | |
233 pxor %xmm7,%xmm12 | |
234 | |
235 pxor %xmm12,%xmm9 | |
236 pxor %xmm12,%xmm8 | |
237 | |
238 pand %xmm7,%xmm9 | |
239 | |
240 pxor %xmm9,%xmm13 | |
241 pxor %xmm9,%xmm8 | |
242 | |
243 pand %xmm14,%xmm13 | |
244 | |
245 pxor %xmm11,%xmm13 | |
246 movdqa %xmm5,%xmm11 | |
247 movdqa %xmm4,%xmm7 | |
248 movdqa %xmm14,%xmm9 | |
249 pxor %xmm13,%xmm9 | |
250 pand %xmm5,%xmm9 | |
251 pxor %xmm4,%xmm5 | |
252 pand %xmm14,%xmm4 | |
253 pand %xmm13,%xmm5 | |
254 pxor %xmm4,%xmm5 | |
255 pxor %xmm9,%xmm4 | |
256 pxor %xmm15,%xmm11 | |
257 pxor %xmm2,%xmm7 | |
258 pxor %xmm12,%xmm14 | |
259 pxor %xmm8,%xmm13 | |
260 movdqa %xmm14,%xmm10 | |
261 movdqa %xmm12,%xmm9 | |
262 pxor %xmm13,%xmm10 | |
263 pxor %xmm8,%xmm9 | |
264 pand %xmm11,%xmm10 | |
265 pand %xmm15,%xmm9 | |
266 pxor %xmm7,%xmm11 | |
267 pxor %xmm2,%xmm15 | |
268 pand %xmm14,%xmm7 | |
269 pand %xmm12,%xmm2 | |
270 pand %xmm13,%xmm11 | |
271 pand %xmm8,%xmm15 | |
272 pxor %xmm11,%xmm7 | |
273 pxor %xmm2,%xmm15 | |
274 pxor %xmm10,%xmm11 | |
275 pxor %xmm9,%xmm2 | |
276 pxor %xmm11,%xmm5 | |
277 pxor %xmm11,%xmm15 | |
278 pxor %xmm7,%xmm4 | |
279 pxor %xmm7,%xmm2 | |
280 | |
281 movdqa %xmm6,%xmm11 | |
282 movdqa %xmm0,%xmm7 | |
283 pxor %xmm3,%xmm11 | |
284 pxor %xmm1,%xmm7 | |
285 movdqa %xmm14,%xmm10 | |
286 movdqa %xmm12,%xmm9 | |
287 pxor %xmm13,%xmm10 | |
288 pxor %xmm8,%xmm9 | |
289 pand %xmm11,%xmm10 | |
290 pand %xmm3,%xmm9 | |
291 pxor %xmm7,%xmm11 | |
292 pxor %xmm1,%xmm3 | |
293 pand %xmm14,%xmm7 | |
294 pand %xmm12,%xmm1 | |
295 pand %xmm13,%xmm11 | |
296 pand %xmm8,%xmm3 | |
297 pxor %xmm11,%xmm7 | |
298 pxor %xmm1,%xmm3 | |
299 pxor %xmm10,%xmm11 | |
300 pxor %xmm9,%xmm1 | |
301 pxor %xmm12,%xmm14 | |
302 pxor %xmm8,%xmm13 | |
303 movdqa %xmm14,%xmm10 | |
304 pxor %xmm13,%xmm10 | |
305 pand %xmm6,%xmm10 | |
306 pxor %xmm0,%xmm6 | |
307 pand %xmm14,%xmm0 | |
308 pand %xmm13,%xmm6 | |
309 pxor %xmm0,%xmm6 | |
310 pxor %xmm10,%xmm0 | |
311 pxor %xmm11,%xmm6 | |
312 pxor %xmm11,%xmm3 | |
313 pxor %xmm7,%xmm0 | |
314 pxor %xmm7,%xmm1 | |
315 pxor %xmm15,%xmm6 | |
316 pxor %xmm5,%xmm0 | |
317 pxor %xmm6,%xmm3 | |
318 pxor %xmm15,%xmm5 | |
319 pxor %xmm0,%xmm15 | |
320 | |
321 pxor %xmm4,%xmm0 | |
322 pxor %xmm1,%xmm4 | |
323 pxor %xmm2,%xmm1 | |
324 pxor %xmm4,%xmm2 | |
325 pxor %xmm4,%xmm3 | |
326 | |
327 pxor %xmm2,%xmm5 | |
328 decl %r10d | |
329 jl .Lenc_done | |
330 pshufd $0x93,%xmm15,%xmm7 | |
331 pshufd $0x93,%xmm0,%xmm8 | |
332 pxor %xmm7,%xmm15 | |
333 pshufd $0x93,%xmm3,%xmm9 | |
334 pxor %xmm8,%xmm0 | |
335 pshufd $0x93,%xmm5,%xmm10 | |
336 pxor %xmm9,%xmm3 | |
337 pshufd $0x93,%xmm2,%xmm11 | |
338 pxor %xmm10,%xmm5 | |
339 pshufd $0x93,%xmm6,%xmm12 | |
340 pxor %xmm11,%xmm2 | |
341 pshufd $0x93,%xmm1,%xmm13 | |
342 pxor %xmm12,%xmm6 | |
343 pshufd $0x93,%xmm4,%xmm14 | |
344 pxor %xmm13,%xmm1 | |
345 pxor %xmm14,%xmm4 | |
346 | |
347 pxor %xmm15,%xmm8 | |
348 pxor %xmm4,%xmm7 | |
349 pxor %xmm4,%xmm8 | |
350 pshufd $0x4E,%xmm15,%xmm15 | |
351 pxor %xmm0,%xmm9 | |
352 pshufd $0x4E,%xmm0,%xmm0 | |
353 pxor %xmm2,%xmm12 | |
354 pxor %xmm7,%xmm15 | |
355 pxor %xmm6,%xmm13 | |
356 pxor %xmm8,%xmm0 | |
357 pxor %xmm5,%xmm11 | |
358 pshufd $0x4E,%xmm2,%xmm7 | |
359 pxor %xmm1,%xmm14 | |
360 pshufd $0x4E,%xmm6,%xmm8 | |
361 pxor %xmm3,%xmm10 | |
362 pshufd $0x4E,%xmm5,%xmm2 | |
363 pxor %xmm4,%xmm10 | |
364 pshufd $0x4E,%xmm4,%xmm6 | |
365 pxor %xmm4,%xmm11 | |
366 pshufd $0x4E,%xmm1,%xmm5 | |
367 pxor %xmm11,%xmm7 | |
368 pshufd $0x4E,%xmm3,%xmm1 | |
369 pxor %xmm12,%xmm8 | |
370 pxor %xmm10,%xmm2 | |
371 pxor %xmm14,%xmm6 | |
372 pxor %xmm13,%xmm5 | |
373 movdqa %xmm7,%xmm3 | |
374 pxor %xmm9,%xmm1 | |
375 movdqa %xmm8,%xmm4 | |
376 movdqa 48(%r11),%xmm7 | |
377 jnz .Lenc_loop | |
378 movdqa 64(%r11),%xmm7 | |
379 jmp .Lenc_loop | |
380 .align 16 | |
381 .Lenc_done: | |
382 movdqa 0(%r11),%xmm7 | |
383 movdqa 16(%r11),%xmm8 | |
384 movdqa %xmm1,%xmm9 | |
385 psrlq $1,%xmm1 | |
386 movdqa %xmm2,%xmm10 | |
387 psrlq $1,%xmm2 | |
388 pxor %xmm4,%xmm1 | |
389 pxor %xmm6,%xmm2 | |
390 pand %xmm7,%xmm1 | |
391 pand %xmm7,%xmm2 | |
392 pxor %xmm1,%xmm4 | |
393 psllq $1,%xmm1 | |
394 pxor %xmm2,%xmm6 | |
395 psllq $1,%xmm2 | |
396 pxor %xmm9,%xmm1 | |
397 pxor %xmm10,%xmm2 | |
398 movdqa %xmm3,%xmm9 | |
399 psrlq $1,%xmm3 | |
400 movdqa %xmm15,%xmm10 | |
401 psrlq $1,%xmm15 | |
402 pxor %xmm5,%xmm3 | |
403 pxor %xmm0,%xmm15 | |
404 pand %xmm7,%xmm3 | |
405 pand %xmm7,%xmm15 | |
406 pxor %xmm3,%xmm5 | |
407 psllq $1,%xmm3 | |
408 pxor %xmm15,%xmm0 | |
409 psllq $1,%xmm15 | |
410 pxor %xmm9,%xmm3 | |
411 pxor %xmm10,%xmm15 | |
412 movdqa 32(%r11),%xmm7 | |
413 movdqa %xmm6,%xmm9 | |
414 psrlq $2,%xmm6 | |
415 movdqa %xmm2,%xmm10 | |
416 psrlq $2,%xmm2 | |
417 pxor %xmm4,%xmm6 | |
418 pxor %xmm1,%xmm2 | |
419 pand %xmm8,%xmm6 | |
420 pand %xmm8,%xmm2 | |
421 pxor %xmm6,%xmm4 | |
422 psllq $2,%xmm6 | |
423 pxor %xmm2,%xmm1 | |
424 psllq $2,%xmm2 | |
425 pxor %xmm9,%xmm6 | |
426 pxor %xmm10,%xmm2 | |
427 movdqa %xmm0,%xmm9 | |
428 psrlq $2,%xmm0 | |
429 movdqa %xmm15,%xmm10 | |
430 psrlq $2,%xmm15 | |
431 pxor %xmm5,%xmm0 | |
432 pxor %xmm3,%xmm15 | |
433 pand %xmm8,%xmm0 | |
434 pand %xmm8,%xmm15 | |
435 pxor %xmm0,%xmm5 | |
436 psllq $2,%xmm0 | |
437 pxor %xmm15,%xmm3 | |
438 psllq $2,%xmm15 | |
439 pxor %xmm9,%xmm0 | |
440 pxor %xmm10,%xmm15 | |
441 movdqa %xmm5,%xmm9 | |
442 psrlq $4,%xmm5 | |
443 movdqa %xmm3,%xmm10 | |
444 psrlq $4,%xmm3 | |
445 pxor %xmm4,%xmm5 | |
446 pxor %xmm1,%xmm3 | |
447 pand %xmm7,%xmm5 | |
448 pand %xmm7,%xmm3 | |
449 pxor %xmm5,%xmm4 | |
450 psllq $4,%xmm5 | |
451 pxor %xmm3,%xmm1 | |
452 psllq $4,%xmm3 | |
453 pxor %xmm9,%xmm5 | |
454 pxor %xmm10,%xmm3 | |
455 movdqa %xmm0,%xmm9 | |
456 psrlq $4,%xmm0 | |
457 movdqa %xmm15,%xmm10 | |
458 psrlq $4,%xmm15 | |
459 pxor %xmm6,%xmm0 | |
460 pxor %xmm2,%xmm15 | |
461 pand %xmm7,%xmm0 | |
462 pand %xmm7,%xmm15 | |
463 pxor %xmm0,%xmm6 | |
464 psllq $4,%xmm0 | |
465 pxor %xmm15,%xmm2 | |
466 psllq $4,%xmm15 | |
467 pxor %xmm9,%xmm0 | |
468 pxor %xmm10,%xmm15 | |
469 movdqa (%rax),%xmm7 | |
470 pxor %xmm7,%xmm3 | |
471 pxor %xmm7,%xmm5 | |
472 pxor %xmm7,%xmm2 | |
473 pxor %xmm7,%xmm6 | |
474 pxor %xmm7,%xmm1 | |
475 pxor %xmm7,%xmm4 | |
476 pxor %xmm7,%xmm15 | |
477 pxor %xmm7,%xmm0 | |
478 .byte 0xf3,0xc3 | |
479 .size _bsaes_encrypt8,.-_bsaes_encrypt8 | |
480 | |
481 .type _bsaes_decrypt8,@function | |
482 .align 64 | |
483 _bsaes_decrypt8: | |
484 leaq .LBS0(%rip),%r11 | |
485 | |
486 movdqa (%rax),%xmm8 | |
487 leaq 16(%rax),%rax | |
488 movdqa -48(%r11),%xmm7 | |
489 pxor %xmm8,%xmm15 | |
490 pxor %xmm8,%xmm0 | |
491 pxor %xmm8,%xmm1 | |
492 pxor %xmm8,%xmm2 | |
493 .byte 102,68,15,56,0,255 | |
494 .byte 102,15,56,0,199 | |
495 pxor %xmm8,%xmm3 | |
496 pxor %xmm8,%xmm4 | |
497 .byte 102,15,56,0,207 | |
498 .byte 102,15,56,0,215 | |
499 pxor %xmm8,%xmm5 | |
500 pxor %xmm8,%xmm6 | |
501 .byte 102,15,56,0,223 | |
502 .byte 102,15,56,0,231 | |
503 .byte 102,15,56,0,239 | |
504 .byte 102,15,56,0,247 | |
505 movdqa 0(%r11),%xmm7 | |
506 movdqa 16(%r11),%xmm8 | |
507 movdqa %xmm5,%xmm9 | |
508 psrlq $1,%xmm5 | |
509 movdqa %xmm3,%xmm10 | |
510 psrlq $1,%xmm3 | |
511 pxor %xmm6,%xmm5 | |
512 pxor %xmm4,%xmm3 | |
513 pand %xmm7,%xmm5 | |
514 pand %xmm7,%xmm3 | |
515 pxor %xmm5,%xmm6 | |
516 psllq $1,%xmm5 | |
517 pxor %xmm3,%xmm4 | |
518 psllq $1,%xmm3 | |
519 pxor %xmm9,%xmm5 | |
520 pxor %xmm10,%xmm3 | |
521 movdqa %xmm1,%xmm9 | |
522 psrlq $1,%xmm1 | |
523 movdqa %xmm15,%xmm10 | |
524 psrlq $1,%xmm15 | |
525 pxor %xmm2,%xmm1 | |
526 pxor %xmm0,%xmm15 | |
527 pand %xmm7,%xmm1 | |
528 pand %xmm7,%xmm15 | |
529 pxor %xmm1,%xmm2 | |
530 psllq $1,%xmm1 | |
531 pxor %xmm15,%xmm0 | |
532 psllq $1,%xmm15 | |
533 pxor %xmm9,%xmm1 | |
534 pxor %xmm10,%xmm15 | |
535 movdqa 32(%r11),%xmm7 | |
536 movdqa %xmm4,%xmm9 | |
537 psrlq $2,%xmm4 | |
538 movdqa %xmm3,%xmm10 | |
539 psrlq $2,%xmm3 | |
540 pxor %xmm6,%xmm4 | |
541 pxor %xmm5,%xmm3 | |
542 pand %xmm8,%xmm4 | |
543 pand %xmm8,%xmm3 | |
544 pxor %xmm4,%xmm6 | |
545 psllq $2,%xmm4 | |
546 pxor %xmm3,%xmm5 | |
547 psllq $2,%xmm3 | |
548 pxor %xmm9,%xmm4 | |
549 pxor %xmm10,%xmm3 | |
550 movdqa %xmm0,%xmm9 | |
551 psrlq $2,%xmm0 | |
552 movdqa %xmm15,%xmm10 | |
553 psrlq $2,%xmm15 | |
554 pxor %xmm2,%xmm0 | |
555 pxor %xmm1,%xmm15 | |
556 pand %xmm8,%xmm0 | |
557 pand %xmm8,%xmm15 | |
558 pxor %xmm0,%xmm2 | |
559 psllq $2,%xmm0 | |
560 pxor %xmm15,%xmm1 | |
561 psllq $2,%xmm15 | |
562 pxor %xmm9,%xmm0 | |
563 pxor %xmm10,%xmm15 | |
564 movdqa %xmm2,%xmm9 | |
565 psrlq $4,%xmm2 | |
566 movdqa %xmm1,%xmm10 | |
567 psrlq $4,%xmm1 | |
568 pxor %xmm6,%xmm2 | |
569 pxor %xmm5,%xmm1 | |
570 pand %xmm7,%xmm2 | |
571 pand %xmm7,%xmm1 | |
572 pxor %xmm2,%xmm6 | |
573 psllq $4,%xmm2 | |
574 pxor %xmm1,%xmm5 | |
575 psllq $4,%xmm1 | |
576 pxor %xmm9,%xmm2 | |
577 pxor %xmm10,%xmm1 | |
578 movdqa %xmm0,%xmm9 | |
579 psrlq $4,%xmm0 | |
580 movdqa %xmm15,%xmm10 | |
581 psrlq $4,%xmm15 | |
582 pxor %xmm4,%xmm0 | |
583 pxor %xmm3,%xmm15 | |
584 pand %xmm7,%xmm0 | |
585 pand %xmm7,%xmm15 | |
586 pxor %xmm0,%xmm4 | |
587 psllq $4,%xmm0 | |
588 pxor %xmm15,%xmm3 | |
589 psllq $4,%xmm15 | |
590 pxor %xmm9,%xmm0 | |
591 pxor %xmm10,%xmm15 | |
592 decl %r10d | |
593 jmp .Ldec_sbox | |
594 .align 16 | |
595 .Ldec_loop: | |
596 pxor 0(%rax),%xmm15 | |
597 pxor 16(%rax),%xmm0 | |
598 pxor 32(%rax),%xmm1 | |
599 pxor 48(%rax),%xmm2 | |
600 .byte 102,68,15,56,0,255 | |
601 .byte 102,15,56,0,199 | |
602 pxor 64(%rax),%xmm3 | |
603 pxor 80(%rax),%xmm4 | |
604 .byte 102,15,56,0,207 | |
605 .byte 102,15,56,0,215 | |
606 pxor 96(%rax),%xmm5 | |
607 pxor 112(%rax),%xmm6 | |
608 .byte 102,15,56,0,223 | |
609 .byte 102,15,56,0,231 | |
610 .byte 102,15,56,0,239 | |
611 .byte 102,15,56,0,247 | |
612 leaq 128(%rax),%rax | |
613 .Ldec_sbox: | |
614 pxor %xmm3,%xmm2 | |
615 | |
616 pxor %xmm6,%xmm3 | |
617 pxor %xmm6,%xmm1 | |
618 pxor %xmm3,%xmm5 | |
619 pxor %xmm5,%xmm6 | |
620 pxor %xmm6,%xmm0 | |
621 | |
622 pxor %xmm0,%xmm15 | |
623 pxor %xmm4,%xmm1 | |
624 pxor %xmm15,%xmm2 | |
625 pxor %xmm15,%xmm4 | |
626 pxor %xmm2,%xmm0 | |
627 movdqa %xmm2,%xmm10 | |
628 movdqa %xmm6,%xmm9 | |
629 movdqa %xmm0,%xmm8 | |
630 movdqa %xmm3,%xmm12 | |
631 movdqa %xmm4,%xmm11 | |
632 | |
633 pxor %xmm15,%xmm10 | |
634 pxor %xmm3,%xmm9 | |
635 pxor %xmm5,%xmm8 | |
636 movdqa %xmm10,%xmm13 | |
637 pxor %xmm15,%xmm12 | |
638 movdqa %xmm9,%xmm7 | |
639 pxor %xmm1,%xmm11 | |
640 movdqa %xmm10,%xmm14 | |
641 | |
642 por %xmm8,%xmm9 | |
643 por %xmm11,%xmm10 | |
644 pxor %xmm7,%xmm14 | |
645 pand %xmm11,%xmm13 | |
646 pxor %xmm8,%xmm11 | |
647 pand %xmm8,%xmm7 | |
648 pand %xmm11,%xmm14 | |
649 movdqa %xmm5,%xmm11 | |
650 pxor %xmm1,%xmm11 | |
651 pand %xmm11,%xmm12 | |
652 pxor %xmm12,%xmm10 | |
653 pxor %xmm12,%xmm9 | |
654 movdqa %xmm2,%xmm12 | |
655 movdqa %xmm0,%xmm11 | |
656 pxor %xmm6,%xmm12 | |
657 pxor %xmm4,%xmm11 | |
658 movdqa %xmm12,%xmm8 | |
659 pand %xmm11,%xmm12 | |
660 por %xmm11,%xmm8 | |
661 pxor %xmm12,%xmm7 | |
662 pxor %xmm14,%xmm10 | |
663 pxor %xmm13,%xmm9 | |
664 pxor %xmm14,%xmm8 | |
665 movdqa %xmm3,%xmm11 | |
666 pxor %xmm13,%xmm7 | |
667 movdqa %xmm15,%xmm12 | |
668 pxor %xmm13,%xmm8 | |
669 movdqa %xmm6,%xmm13 | |
670 pand %xmm5,%xmm11 | |
671 movdqa %xmm2,%xmm14 | |
672 pand %xmm1,%xmm12 | |
673 pand %xmm0,%xmm13 | |
674 por %xmm4,%xmm14 | |
675 pxor %xmm11,%xmm10 | |
676 pxor %xmm12,%xmm9 | |
677 pxor %xmm13,%xmm8 | |
678 pxor %xmm14,%xmm7 | |
679 | |
680 | |
681 | |
682 | |
683 | |
684 movdqa %xmm10,%xmm11 | |
685 pand %xmm8,%xmm10 | |
686 pxor %xmm9,%xmm11 | |
687 | |
688 movdqa %xmm7,%xmm13 | |
689 movdqa %xmm11,%xmm14 | |
690 pxor %xmm10,%xmm13 | |
691 pand %xmm13,%xmm14 | |
692 | |
693 movdqa %xmm8,%xmm12 | |
694 pxor %xmm9,%xmm14 | |
695 pxor %xmm7,%xmm12 | |
696 | |
697 pxor %xmm9,%xmm10 | |
698 | |
699 pand %xmm10,%xmm12 | |
700 | |
701 movdqa %xmm13,%xmm9 | |
702 pxor %xmm7,%xmm12 | |
703 | |
704 pxor %xmm12,%xmm9 | |
705 pxor %xmm12,%xmm8 | |
706 | |
707 pand %xmm7,%xmm9 | |
708 | |
709 pxor %xmm9,%xmm13 | |
710 pxor %xmm9,%xmm8 | |
711 | |
712 pand %xmm14,%xmm13 | |
713 | |
714 pxor %xmm11,%xmm13 | |
715 movdqa %xmm4,%xmm11 | |
716 movdqa %xmm0,%xmm7 | |
717 movdqa %xmm14,%xmm9 | |
718 pxor %xmm13,%xmm9 | |
719 pand %xmm4,%xmm9 | |
720 pxor %xmm0,%xmm4 | |
721 pand %xmm14,%xmm0 | |
722 pand %xmm13,%xmm4 | |
723 pxor %xmm0,%xmm4 | |
724 pxor %xmm9,%xmm0 | |
725 pxor %xmm1,%xmm11 | |
726 pxor %xmm5,%xmm7 | |
727 pxor %xmm12,%xmm14 | |
728 pxor %xmm8,%xmm13 | |
729 movdqa %xmm14,%xmm10 | |
730 movdqa %xmm12,%xmm9 | |
731 pxor %xmm13,%xmm10 | |
732 pxor %xmm8,%xmm9 | |
733 pand %xmm11,%xmm10 | |
734 pand %xmm1,%xmm9 | |
735 pxor %xmm7,%xmm11 | |
736 pxor %xmm5,%xmm1 | |
737 pand %xmm14,%xmm7 | |
738 pand %xmm12,%xmm5 | |
739 pand %xmm13,%xmm11 | |
740 pand %xmm8,%xmm1 | |
741 pxor %xmm11,%xmm7 | |
742 pxor %xmm5,%xmm1 | |
743 pxor %xmm10,%xmm11 | |
744 pxor %xmm9,%xmm5 | |
745 pxor %xmm11,%xmm4 | |
746 pxor %xmm11,%xmm1 | |
747 pxor %xmm7,%xmm0 | |
748 pxor %xmm7,%xmm5 | |
749 | |
750 movdqa %xmm2,%xmm11 | |
751 movdqa %xmm6,%xmm7 | |
752 pxor %xmm15,%xmm11 | |
753 pxor %xmm3,%xmm7 | |
754 movdqa %xmm14,%xmm10 | |
755 movdqa %xmm12,%xmm9 | |
756 pxor %xmm13,%xmm10 | |
757 pxor %xmm8,%xmm9 | |
758 pand %xmm11,%xmm10 | |
759 pand %xmm15,%xmm9 | |
760 pxor %xmm7,%xmm11 | |
761 pxor %xmm3,%xmm15 | |
762 pand %xmm14,%xmm7 | |
763 pand %xmm12,%xmm3 | |
764 pand %xmm13,%xmm11 | |
765 pand %xmm8,%xmm15 | |
766 pxor %xmm11,%xmm7 | |
767 pxor %xmm3,%xmm15 | |
768 pxor %xmm10,%xmm11 | |
769 pxor %xmm9,%xmm3 | |
770 pxor %xmm12,%xmm14 | |
771 pxor %xmm8,%xmm13 | |
772 movdqa %xmm14,%xmm10 | |
773 pxor %xmm13,%xmm10 | |
774 pand %xmm2,%xmm10 | |
775 pxor %xmm6,%xmm2 | |
776 pand %xmm14,%xmm6 | |
777 pand %xmm13,%xmm2 | |
778 pxor %xmm6,%xmm2 | |
779 pxor %xmm10,%xmm6 | |
780 pxor %xmm11,%xmm2 | |
781 pxor %xmm11,%xmm15 | |
782 pxor %xmm7,%xmm6 | |
783 pxor %xmm7,%xmm3 | |
784 pxor %xmm6,%xmm0 | |
785 pxor %xmm4,%xmm5 | |
786 | |
787 pxor %xmm0,%xmm3 | |
788 pxor %xmm6,%xmm1 | |
789 pxor %xmm6,%xmm4 | |
790 pxor %xmm1,%xmm3 | |
791 pxor %xmm15,%xmm6 | |
792 pxor %xmm4,%xmm3 | |
793 pxor %xmm5,%xmm2 | |
794 pxor %xmm0,%xmm5 | |
795 pxor %xmm3,%xmm2 | |
796 | |
797 pxor %xmm15,%xmm3 | |
798 pxor %xmm2,%xmm6 | |
799 decl %r10d | |
800 jl .Ldec_done | |
801 | |
802 pshufd $0x4E,%xmm15,%xmm7 | |
803 pshufd $0x4E,%xmm2,%xmm13 | |
804 pxor %xmm15,%xmm7 | |
805 pshufd $0x4E,%xmm4,%xmm14 | |
806 pxor %xmm2,%xmm13 | |
807 pshufd $0x4E,%xmm0,%xmm8 | |
808 pxor %xmm4,%xmm14 | |
809 pshufd $0x4E,%xmm5,%xmm9 | |
810 pxor %xmm0,%xmm8 | |
811 pshufd $0x4E,%xmm3,%xmm10 | |
812 pxor %xmm5,%xmm9 | |
813 pxor %xmm13,%xmm15 | |
814 pxor %xmm13,%xmm0 | |
815 pshufd $0x4E,%xmm1,%xmm11 | |
816 pxor %xmm3,%xmm10 | |
817 pxor %xmm7,%xmm5 | |
818 pxor %xmm8,%xmm3 | |
819 pshufd $0x4E,%xmm6,%xmm12 | |
820 pxor %xmm1,%xmm11 | |
821 pxor %xmm14,%xmm0 | |
822 pxor %xmm9,%xmm1 | |
823 pxor %xmm6,%xmm12 | |
824 | |
825 pxor %xmm14,%xmm5 | |
826 pxor %xmm13,%xmm3 | |
827 pxor %xmm13,%xmm1 | |
828 pxor %xmm10,%xmm6 | |
829 pxor %xmm11,%xmm2 | |
830 pxor %xmm14,%xmm1 | |
831 pxor %xmm14,%xmm6 | |
832 pxor %xmm12,%xmm4 | |
833 pshufd $0x93,%xmm15,%xmm7 | |
834 pshufd $0x93,%xmm0,%xmm8 | |
835 pxor %xmm7,%xmm15 | |
836 pshufd $0x93,%xmm5,%xmm9 | |
837 pxor %xmm8,%xmm0 | |
838 pshufd $0x93,%xmm3,%xmm10 | |
839 pxor %xmm9,%xmm5 | |
840 pshufd $0x93,%xmm1,%xmm11 | |
841 pxor %xmm10,%xmm3 | |
842 pshufd $0x93,%xmm6,%xmm12 | |
843 pxor %xmm11,%xmm1 | |
844 pshufd $0x93,%xmm2,%xmm13 | |
845 pxor %xmm12,%xmm6 | |
846 pshufd $0x93,%xmm4,%xmm14 | |
847 pxor %xmm13,%xmm2 | |
848 pxor %xmm14,%xmm4 | |
849 | |
850 pxor %xmm15,%xmm8 | |
851 pxor %xmm4,%xmm7 | |
852 pxor %xmm4,%xmm8 | |
853 pshufd $0x4E,%xmm15,%xmm15 | |
854 pxor %xmm0,%xmm9 | |
855 pshufd $0x4E,%xmm0,%xmm0 | |
856 pxor %xmm1,%xmm12 | |
857 pxor %xmm7,%xmm15 | |
858 pxor %xmm6,%xmm13 | |
859 pxor %xmm8,%xmm0 | |
860 pxor %xmm3,%xmm11 | |
861 pshufd $0x4E,%xmm1,%xmm7 | |
862 pxor %xmm2,%xmm14 | |
863 pshufd $0x4E,%xmm6,%xmm8 | |
864 pxor %xmm5,%xmm10 | |
865 pshufd $0x4E,%xmm3,%xmm1 | |
866 pxor %xmm4,%xmm10 | |
867 pshufd $0x4E,%xmm4,%xmm6 | |
868 pxor %xmm4,%xmm11 | |
869 pshufd $0x4E,%xmm2,%xmm3 | |
870 pxor %xmm11,%xmm7 | |
871 pshufd $0x4E,%xmm5,%xmm2 | |
872 pxor %xmm12,%xmm8 | |
873 pxor %xmm1,%xmm10 | |
874 pxor %xmm14,%xmm6 | |
875 pxor %xmm3,%xmm13 | |
876 movdqa %xmm7,%xmm3 | |
877 pxor %xmm9,%xmm2 | |
878 movdqa %xmm13,%xmm5 | |
879 movdqa %xmm8,%xmm4 | |
880 movdqa %xmm2,%xmm1 | |
881 movdqa %xmm10,%xmm2 | |
882 movdqa -16(%r11),%xmm7 | |
883 jnz .Ldec_loop | |
884 movdqa -32(%r11),%xmm7 | |
885 jmp .Ldec_loop | |
886 .align 16 | |
887 .Ldec_done: | |
888 movdqa 0(%r11),%xmm7 | |
889 movdqa 16(%r11),%xmm8 | |
890 movdqa %xmm2,%xmm9 | |
891 psrlq $1,%xmm2 | |
892 movdqa %xmm1,%xmm10 | |
893 psrlq $1,%xmm1 | |
894 pxor %xmm4,%xmm2 | |
895 pxor %xmm6,%xmm1 | |
896 pand %xmm7,%xmm2 | |
897 pand %xmm7,%xmm1 | |
898 pxor %xmm2,%xmm4 | |
899 psllq $1,%xmm2 | |
900 pxor %xmm1,%xmm6 | |
901 psllq $1,%xmm1 | |
902 pxor %xmm9,%xmm2 | |
903 pxor %xmm10,%xmm1 | |
904 movdqa %xmm5,%xmm9 | |
905 psrlq $1,%xmm5 | |
906 movdqa %xmm15,%xmm10 | |
907 psrlq $1,%xmm15 | |
908 pxor %xmm3,%xmm5 | |
909 pxor %xmm0,%xmm15 | |
910 pand %xmm7,%xmm5 | |
911 pand %xmm7,%xmm15 | |
912 pxor %xmm5,%xmm3 | |
913 psllq $1,%xmm5 | |
914 pxor %xmm15,%xmm0 | |
915 psllq $1,%xmm15 | |
916 pxor %xmm9,%xmm5 | |
917 pxor %xmm10,%xmm15 | |
918 movdqa 32(%r11),%xmm7 | |
919 movdqa %xmm6,%xmm9 | |
920 psrlq $2,%xmm6 | |
921 movdqa %xmm1,%xmm10 | |
922 psrlq $2,%xmm1 | |
923 pxor %xmm4,%xmm6 | |
924 pxor %xmm2,%xmm1 | |
925 pand %xmm8,%xmm6 | |
926 pand %xmm8,%xmm1 | |
927 pxor %xmm6,%xmm4 | |
928 psllq $2,%xmm6 | |
929 pxor %xmm1,%xmm2 | |
930 psllq $2,%xmm1 | |
931 pxor %xmm9,%xmm6 | |
932 pxor %xmm10,%xmm1 | |
933 movdqa %xmm0,%xmm9 | |
934 psrlq $2,%xmm0 | |
935 movdqa %xmm15,%xmm10 | |
936 psrlq $2,%xmm15 | |
937 pxor %xmm3,%xmm0 | |
938 pxor %xmm5,%xmm15 | |
939 pand %xmm8,%xmm0 | |
940 pand %xmm8,%xmm15 | |
941 pxor %xmm0,%xmm3 | |
942 psllq $2,%xmm0 | |
943 pxor %xmm15,%xmm5 | |
944 psllq $2,%xmm15 | |
945 pxor %xmm9,%xmm0 | |
946 pxor %xmm10,%xmm15 | |
947 movdqa %xmm3,%xmm9 | |
948 psrlq $4,%xmm3 | |
949 movdqa %xmm5,%xmm10 | |
950 psrlq $4,%xmm5 | |
951 pxor %xmm4,%xmm3 | |
952 pxor %xmm2,%xmm5 | |
953 pand %xmm7,%xmm3 | |
954 pand %xmm7,%xmm5 | |
955 pxor %xmm3,%xmm4 | |
956 psllq $4,%xmm3 | |
957 pxor %xmm5,%xmm2 | |
958 psllq $4,%xmm5 | |
959 pxor %xmm9,%xmm3 | |
960 pxor %xmm10,%xmm5 | |
961 movdqa %xmm0,%xmm9 | |
962 psrlq $4,%xmm0 | |
963 movdqa %xmm15,%xmm10 | |
964 psrlq $4,%xmm15 | |
965 pxor %xmm6,%xmm0 | |
966 pxor %xmm1,%xmm15 | |
967 pand %xmm7,%xmm0 | |
968 pand %xmm7,%xmm15 | |
969 pxor %xmm0,%xmm6 | |
970 psllq $4,%xmm0 | |
971 pxor %xmm15,%xmm1 | |
972 psllq $4,%xmm15 | |
973 pxor %xmm9,%xmm0 | |
974 pxor %xmm10,%xmm15 | |
975 movdqa (%rax),%xmm7 | |
976 pxor %xmm7,%xmm5 | |
977 pxor %xmm7,%xmm3 | |
978 pxor %xmm7,%xmm1 | |
979 pxor %xmm7,%xmm6 | |
980 pxor %xmm7,%xmm2 | |
981 pxor %xmm7,%xmm4 | |
982 pxor %xmm7,%xmm15 | |
983 pxor %xmm7,%xmm0 | |
984 .byte 0xf3,0xc3 | |
985 .size _bsaes_decrypt8,.-_bsaes_decrypt8 | |
986 .type _bsaes_key_convert,@function | |
987 .align 16 | |
988 _bsaes_key_convert: | |
989 leaq .Lmasks(%rip),%r11 | |
990 movdqu (%rcx),%xmm7 | |
991 leaq 16(%rcx),%rcx | |
992 movdqa 0(%r11),%xmm0 | |
993 movdqa 16(%r11),%xmm1 | |
994 movdqa 32(%r11),%xmm2 | |
995 movdqa 48(%r11),%xmm3 | |
996 movdqa 64(%r11),%xmm4 | |
997 pcmpeqd %xmm5,%xmm5 | |
998 | |
999 movdqu (%rcx),%xmm6 | |
1000 movdqa %xmm7,(%rax) | |
1001 leaq 16(%rax),%rax | |
1002 decl %r10d | |
1003 jmp .Lkey_loop | |
1004 .align 16 | |
1005 .Lkey_loop: | |
1006 .byte 102,15,56,0,244 | |
1007 | |
1008 movdqa %xmm0,%xmm8 | |
1009 movdqa %xmm1,%xmm9 | |
1010 | |
1011 pand %xmm6,%xmm8 | |
1012 pand %xmm6,%xmm9 | |
1013 movdqa %xmm2,%xmm10 | |
1014 pcmpeqb %xmm0,%xmm8 | |
1015 psllq $4,%xmm0 | |
1016 movdqa %xmm3,%xmm11 | |
1017 pcmpeqb %xmm1,%xmm9 | |
1018 psllq $4,%xmm1 | |
1019 | |
1020 pand %xmm6,%xmm10 | |
1021 pand %xmm6,%xmm11 | |
1022 movdqa %xmm0,%xmm12 | |
1023 pcmpeqb %xmm2,%xmm10 | |
1024 psllq $4,%xmm2 | |
1025 movdqa %xmm1,%xmm13 | |
1026 pcmpeqb %xmm3,%xmm11 | |
1027 psllq $4,%xmm3 | |
1028 | |
1029 movdqa %xmm2,%xmm14 | |
1030 movdqa %xmm3,%xmm15 | |
1031 pxor %xmm5,%xmm8 | |
1032 pxor %xmm5,%xmm9 | |
1033 | |
1034 pand %xmm6,%xmm12 | |
1035 pand %xmm6,%xmm13 | |
1036 movdqa %xmm8,0(%rax) | |
1037 pcmpeqb %xmm0,%xmm12 | |
1038 psrlq $4,%xmm0 | |
1039 movdqa %xmm9,16(%rax) | |
1040 pcmpeqb %xmm1,%xmm13 | |
1041 psrlq $4,%xmm1 | |
1042 leaq 16(%rcx),%rcx | |
1043 | |
1044 pand %xmm6,%xmm14 | |
1045 pand %xmm6,%xmm15 | |
1046 movdqa %xmm10,32(%rax) | |
1047 pcmpeqb %xmm2,%xmm14 | |
1048 psrlq $4,%xmm2 | |
1049 movdqa %xmm11,48(%rax) | |
1050 pcmpeqb %xmm3,%xmm15 | |
1051 psrlq $4,%xmm3 | |
1052 movdqu (%rcx),%xmm6 | |
1053 | |
1054 pxor %xmm5,%xmm13 | |
1055 pxor %xmm5,%xmm14 | |
1056 movdqa %xmm12,64(%rax) | |
1057 movdqa %xmm13,80(%rax) | |
1058 movdqa %xmm14,96(%rax) | |
1059 movdqa %xmm15,112(%rax) | |
1060 leaq 128(%rax),%rax | |
1061 decl %r10d | |
1062 jnz .Lkey_loop | |
1063 | |
1064 movdqa 80(%r11),%xmm7 | |
1065 | |
1066 .byte 0xf3,0xc3 | |
1067 .size _bsaes_key_convert,.-_bsaes_key_convert | |
1068 .extern asm_AES_cbc_encrypt | |
1069 .hidden asm_AES_cbc_encrypt | |
1070 .globl bsaes_cbc_encrypt | |
1071 .hidden bsaes_cbc_encrypt | |
1072 .type bsaes_cbc_encrypt,@function | |
1073 .align 16 | |
1074 bsaes_cbc_encrypt: | |
1075 cmpl $0,%r9d | |
1076 jne asm_AES_cbc_encrypt | |
1077 cmpq $128,%rdx | |
1078 jb asm_AES_cbc_encrypt | |
1079 | |
1080 movq %rsp,%rax | |
1081 .Lcbc_dec_prologue: | |
1082 pushq %rbp | |
1083 pushq %rbx | |
1084 pushq %r12 | |
1085 pushq %r13 | |
1086 pushq %r14 | |
1087 pushq %r15 | |
1088 leaq -72(%rsp),%rsp | |
1089 movq %rsp,%rbp | |
1090 movl 240(%rcx),%eax | |
1091 movq %rdi,%r12 | |
1092 movq %rsi,%r13 | |
1093 movq %rdx,%r14 | |
1094 movq %rcx,%r15 | |
1095 movq %r8,%rbx | |
1096 shrq $4,%r14 | |
1097 | |
1098 movl %eax,%edx | |
1099 shlq $7,%rax | |
1100 subq $96,%rax | |
1101 subq %rax,%rsp | |
1102 | |
1103 movq %rsp,%rax | |
1104 movq %r15,%rcx | |
1105 movl %edx,%r10d | |
1106 call _bsaes_key_convert | |
1107 pxor (%rsp),%xmm7 | |
1108 movdqa %xmm6,(%rax) | |
1109 movdqa %xmm7,(%rsp) | |
1110 | |
1111 movdqu (%rbx),%xmm14 | |
1112 subq $8,%r14 | |
1113 .Lcbc_dec_loop: | |
1114 movdqu 0(%r12),%xmm15 | |
1115 movdqu 16(%r12),%xmm0 | |
1116 movdqu 32(%r12),%xmm1 | |
1117 movdqu 48(%r12),%xmm2 | |
1118 movdqu 64(%r12),%xmm3 | |
1119 movdqu 80(%r12),%xmm4 | |
1120 movq %rsp,%rax | |
1121 movdqu 96(%r12),%xmm5 | |
1122 movl %edx,%r10d | |
1123 movdqu 112(%r12),%xmm6 | |
1124 movdqa %xmm14,32(%rbp) | |
1125 | |
1126 call _bsaes_decrypt8 | |
1127 | |
1128 pxor 32(%rbp),%xmm15 | |
1129 movdqu 0(%r12),%xmm7 | |
1130 movdqu 16(%r12),%xmm8 | |
1131 pxor %xmm7,%xmm0 | |
1132 movdqu 32(%r12),%xmm9 | |
1133 pxor %xmm8,%xmm5 | |
1134 movdqu 48(%r12),%xmm10 | |
1135 pxor %xmm9,%xmm3 | |
1136 movdqu 64(%r12),%xmm11 | |
1137 pxor %xmm10,%xmm1 | |
1138 movdqu 80(%r12),%xmm12 | |
1139 pxor %xmm11,%xmm6 | |
1140 movdqu 96(%r12),%xmm13 | |
1141 pxor %xmm12,%xmm2 | |
1142 movdqu 112(%r12),%xmm14 | |
1143 pxor %xmm13,%xmm4 | |
1144 movdqu %xmm15,0(%r13) | |
1145 leaq 128(%r12),%r12 | |
1146 movdqu %xmm0,16(%r13) | |
1147 movdqu %xmm5,32(%r13) | |
1148 movdqu %xmm3,48(%r13) | |
1149 movdqu %xmm1,64(%r13) | |
1150 movdqu %xmm6,80(%r13) | |
1151 movdqu %xmm2,96(%r13) | |
1152 movdqu %xmm4,112(%r13) | |
1153 leaq 128(%r13),%r13 | |
1154 subq $8,%r14 | |
1155 jnc .Lcbc_dec_loop | |
1156 | |
1157 addq $8,%r14 | |
1158 jz .Lcbc_dec_done | |
1159 | |
1160 movdqu 0(%r12),%xmm15 | |
1161 movq %rsp,%rax | |
1162 movl %edx,%r10d | |
1163 cmpq $2,%r14 | |
1164 jb .Lcbc_dec_one | |
1165 movdqu 16(%r12),%xmm0 | |
1166 je .Lcbc_dec_two | |
1167 movdqu 32(%r12),%xmm1 | |
1168 cmpq $4,%r14 | |
1169 jb .Lcbc_dec_three | |
1170 movdqu 48(%r12),%xmm2 | |
1171 je .Lcbc_dec_four | |
1172 movdqu 64(%r12),%xmm3 | |
1173 cmpq $6,%r14 | |
1174 jb .Lcbc_dec_five | |
1175 movdqu 80(%r12),%xmm4 | |
1176 je .Lcbc_dec_six | |
1177 movdqu 96(%r12),%xmm5 | |
1178 movdqa %xmm14,32(%rbp) | |
1179 call _bsaes_decrypt8 | |
1180 pxor 32(%rbp),%xmm15 | |
1181 movdqu 0(%r12),%xmm7 | |
1182 movdqu 16(%r12),%xmm8 | |
1183 pxor %xmm7,%xmm0 | |
1184 movdqu 32(%r12),%xmm9 | |
1185 pxor %xmm8,%xmm5 | |
1186 movdqu 48(%r12),%xmm10 | |
1187 pxor %xmm9,%xmm3 | |
1188 movdqu 64(%r12),%xmm11 | |
1189 pxor %xmm10,%xmm1 | |
1190 movdqu 80(%r12),%xmm12 | |
1191 pxor %xmm11,%xmm6 | |
1192 movdqu 96(%r12),%xmm14 | |
1193 pxor %xmm12,%xmm2 | |
1194 movdqu %xmm15,0(%r13) | |
1195 movdqu %xmm0,16(%r13) | |
1196 movdqu %xmm5,32(%r13) | |
1197 movdqu %xmm3,48(%r13) | |
1198 movdqu %xmm1,64(%r13) | |
1199 movdqu %xmm6,80(%r13) | |
1200 movdqu %xmm2,96(%r13) | |
1201 jmp .Lcbc_dec_done | |
1202 .align 16 | |
1203 .Lcbc_dec_six: | |
1204 movdqa %xmm14,32(%rbp) | |
1205 call _bsaes_decrypt8 | |
1206 pxor 32(%rbp),%xmm15 | |
1207 movdqu 0(%r12),%xmm7 | |
1208 movdqu 16(%r12),%xmm8 | |
1209 pxor %xmm7,%xmm0 | |
1210 movdqu 32(%r12),%xmm9 | |
1211 pxor %xmm8,%xmm5 | |
1212 movdqu 48(%r12),%xmm10 | |
1213 pxor %xmm9,%xmm3 | |
1214 movdqu 64(%r12),%xmm11 | |
1215 pxor %xmm10,%xmm1 | |
1216 movdqu 80(%r12),%xmm14 | |
1217 pxor %xmm11,%xmm6 | |
1218 movdqu %xmm15,0(%r13) | |
1219 movdqu %xmm0,16(%r13) | |
1220 movdqu %xmm5,32(%r13) | |
1221 movdqu %xmm3,48(%r13) | |
1222 movdqu %xmm1,64(%r13) | |
1223 movdqu %xmm6,80(%r13) | |
1224 jmp .Lcbc_dec_done | |
1225 .align 16 | |
1226 .Lcbc_dec_five: | |
1227 movdqa %xmm14,32(%rbp) | |
1228 call _bsaes_decrypt8 | |
1229 pxor 32(%rbp),%xmm15 | |
1230 movdqu 0(%r12),%xmm7 | |
1231 movdqu 16(%r12),%xmm8 | |
1232 pxor %xmm7,%xmm0 | |
1233 movdqu 32(%r12),%xmm9 | |
1234 pxor %xmm8,%xmm5 | |
1235 movdqu 48(%r12),%xmm10 | |
1236 pxor %xmm9,%xmm3 | |
1237 movdqu 64(%r12),%xmm14 | |
1238 pxor %xmm10,%xmm1 | |
1239 movdqu %xmm15,0(%r13) | |
1240 movdqu %xmm0,16(%r13) | |
1241 movdqu %xmm5,32(%r13) | |
1242 movdqu %xmm3,48(%r13) | |
1243 movdqu %xmm1,64(%r13) | |
1244 jmp .Lcbc_dec_done | |
1245 .align 16 | |
1246 .Lcbc_dec_four: | |
1247 movdqa %xmm14,32(%rbp) | |
1248 call _bsaes_decrypt8 | |
1249 pxor 32(%rbp),%xmm15 | |
1250 movdqu 0(%r12),%xmm7 | |
1251 movdqu 16(%r12),%xmm8 | |
1252 pxor %xmm7,%xmm0 | |
1253 movdqu 32(%r12),%xmm9 | |
1254 pxor %xmm8,%xmm5 | |
1255 movdqu 48(%r12),%xmm14 | |
1256 pxor %xmm9,%xmm3 | |
1257 movdqu %xmm15,0(%r13) | |
1258 movdqu %xmm0,16(%r13) | |
1259 movdqu %xmm5,32(%r13) | |
1260 movdqu %xmm3,48(%r13) | |
1261 jmp .Lcbc_dec_done | |
1262 .align 16 | |
1263 .Lcbc_dec_three: | |
1264 movdqa %xmm14,32(%rbp) | |
1265 call _bsaes_decrypt8 | |
1266 pxor 32(%rbp),%xmm15 | |
1267 movdqu 0(%r12),%xmm7 | |
1268 movdqu 16(%r12),%xmm8 | |
1269 pxor %xmm7,%xmm0 | |
1270 movdqu 32(%r12),%xmm14 | |
1271 pxor %xmm8,%xmm5 | |
1272 movdqu %xmm15,0(%r13) | |
1273 movdqu %xmm0,16(%r13) | |
1274 movdqu %xmm5,32(%r13) | |
1275 jmp .Lcbc_dec_done | |
1276 .align 16 | |
1277 .Lcbc_dec_two: | |
1278 movdqa %xmm14,32(%rbp) | |
1279 call _bsaes_decrypt8 | |
1280 pxor 32(%rbp),%xmm15 | |
1281 movdqu 0(%r12),%xmm7 | |
1282 movdqu 16(%r12),%xmm14 | |
1283 pxor %xmm7,%xmm0 | |
1284 movdqu %xmm15,0(%r13) | |
1285 movdqu %xmm0,16(%r13) | |
1286 jmp .Lcbc_dec_done | |
1287 .align 16 | |
1288 .Lcbc_dec_one: | |
1289 leaq (%r12),%rdi | |
1290 leaq 32(%rbp),%rsi | |
1291 leaq (%r15),%rdx | |
1292 call asm_AES_decrypt | |
1293 pxor 32(%rbp),%xmm14 | |
1294 movdqu %xmm14,(%r13) | |
1295 movdqa %xmm15,%xmm14 | |
1296 | |
1297 .Lcbc_dec_done: | |
1298 movdqu %xmm14,(%rbx) | |
1299 leaq (%rsp),%rax | |
1300 pxor %xmm0,%xmm0 | |
1301 .Lcbc_dec_bzero: | |
1302 movdqa %xmm0,0(%rax) | |
1303 movdqa %xmm0,16(%rax) | |
1304 leaq 32(%rax),%rax | |
1305 cmpq %rax,%rbp | |
1306 ja .Lcbc_dec_bzero | |
1307 | |
1308 leaq (%rbp),%rsp | |
1309 movq 72(%rsp),%r15 | |
1310 movq 80(%rsp),%r14 | |
1311 movq 88(%rsp),%r13 | |
1312 movq 96(%rsp),%r12 | |
1313 movq 104(%rsp),%rbx | |
1314 movq 112(%rsp),%rax | |
1315 leaq 120(%rsp),%rsp | |
1316 movq %rax,%rbp | |
1317 .Lcbc_dec_epilogue: | |
1318 .byte 0xf3,0xc3 | |
1319 .size bsaes_cbc_encrypt,.-bsaes_cbc_encrypt | |
1320 | |
1321 .globl bsaes_ctr32_encrypt_blocks | |
1322 .hidden bsaes_ctr32_encrypt_blocks | |
1323 .type bsaes_ctr32_encrypt_blocks,@function | |
1324 .align 16 | |
1325 bsaes_ctr32_encrypt_blocks: | |
1326 movq %rsp,%rax | |
1327 .Lctr_enc_prologue: | |
1328 pushq %rbp | |
1329 pushq %rbx | |
1330 pushq %r12 | |
1331 pushq %r13 | |
1332 pushq %r14 | |
1333 pushq %r15 | |
1334 leaq -72(%rsp),%rsp | |
1335 movq %rsp,%rbp | |
1336 movdqu (%r8),%xmm0 | |
1337 movl 240(%rcx),%eax | |
1338 movq %rdi,%r12 | |
1339 movq %rsi,%r13 | |
1340 movq %rdx,%r14 | |
1341 movq %rcx,%r15 | |
1342 movdqa %xmm0,32(%rbp) | |
1343 cmpq $8,%rdx | |
1344 jb .Lctr_enc_short | |
1345 | |
1346 movl %eax,%ebx | |
1347 shlq $7,%rax | |
1348 subq $96,%rax | |
1349 subq %rax,%rsp | |
1350 | |
1351 movq %rsp,%rax | |
1352 movq %r15,%rcx | |
1353 movl %ebx,%r10d | |
1354 call _bsaes_key_convert | |
1355 pxor %xmm6,%xmm7 | |
1356 movdqa %xmm7,(%rax) | |
1357 | |
1358 movdqa (%rsp),%xmm8 | |
1359 leaq .LADD1(%rip),%r11 | |
1360 movdqa 32(%rbp),%xmm15 | |
1361 movdqa -32(%r11),%xmm7 | |
1362 .byte 102,68,15,56,0,199 | |
1363 .byte 102,68,15,56,0,255 | |
1364 movdqa %xmm8,(%rsp) | |
1365 jmp .Lctr_enc_loop | |
1366 .align 16 | |
1367 .Lctr_enc_loop: | |
1368 movdqa %xmm15,32(%rbp) | |
1369 movdqa %xmm15,%xmm0 | |
1370 movdqa %xmm15,%xmm1 | |
1371 paddd 0(%r11),%xmm0 | |
1372 movdqa %xmm15,%xmm2 | |
1373 paddd 16(%r11),%xmm1 | |
1374 movdqa %xmm15,%xmm3 | |
1375 paddd 32(%r11),%xmm2 | |
1376 movdqa %xmm15,%xmm4 | |
1377 paddd 48(%r11),%xmm3 | |
1378 movdqa %xmm15,%xmm5 | |
1379 paddd 64(%r11),%xmm4 | |
1380 movdqa %xmm15,%xmm6 | |
1381 paddd 80(%r11),%xmm5 | |
1382 paddd 96(%r11),%xmm6 | |
1383 | |
1384 | |
1385 | |
1386 movdqa (%rsp),%xmm8 | |
1387 leaq 16(%rsp),%rax | |
1388 movdqa -16(%r11),%xmm7 | |
1389 pxor %xmm8,%xmm15 | |
1390 pxor %xmm8,%xmm0 | |
1391 pxor %xmm8,%xmm1 | |
1392 pxor %xmm8,%xmm2 | |
1393 .byte 102,68,15,56,0,255 | |
1394 .byte 102,15,56,0,199 | |
1395 pxor %xmm8,%xmm3 | |
1396 pxor %xmm8,%xmm4 | |
1397 .byte 102,15,56,0,207 | |
1398 .byte 102,15,56,0,215 | |
1399 pxor %xmm8,%xmm5 | |
1400 pxor %xmm8,%xmm6 | |
1401 .byte 102,15,56,0,223 | |
1402 .byte 102,15,56,0,231 | |
1403 .byte 102,15,56,0,239 | |
1404 .byte 102,15,56,0,247 | |
1405 leaq .LBS0(%rip),%r11 | |
1406 movl %ebx,%r10d | |
1407 | |
1408 call _bsaes_encrypt8_bitslice | |
1409 | |
1410 subq $8,%r14 | |
1411 jc .Lctr_enc_loop_done | |
1412 | |
1413 movdqu 0(%r12),%xmm7 | |
1414 movdqu 16(%r12),%xmm8 | |
1415 movdqu 32(%r12),%xmm9 | |
1416 movdqu 48(%r12),%xmm10 | |
1417 movdqu 64(%r12),%xmm11 | |
1418 movdqu 80(%r12),%xmm12 | |
1419 movdqu 96(%r12),%xmm13 | |
1420 movdqu 112(%r12),%xmm14 | |
1421 leaq 128(%r12),%r12 | |
1422 pxor %xmm15,%xmm7 | |
1423 movdqa 32(%rbp),%xmm15 | |
1424 pxor %xmm8,%xmm0 | |
1425 movdqu %xmm7,0(%r13) | |
1426 pxor %xmm9,%xmm3 | |
1427 movdqu %xmm0,16(%r13) | |
1428 pxor %xmm10,%xmm5 | |
1429 movdqu %xmm3,32(%r13) | |
1430 pxor %xmm11,%xmm2 | |
1431 movdqu %xmm5,48(%r13) | |
1432 pxor %xmm12,%xmm6 | |
1433 movdqu %xmm2,64(%r13) | |
1434 pxor %xmm13,%xmm1 | |
1435 movdqu %xmm6,80(%r13) | |
1436 pxor %xmm14,%xmm4 | |
1437 movdqu %xmm1,96(%r13) | |
1438 leaq .LADD1(%rip),%r11 | |
1439 movdqu %xmm4,112(%r13) | |
1440 leaq 128(%r13),%r13 | |
1441 paddd 112(%r11),%xmm15 | |
1442 jnz .Lctr_enc_loop | |
1443 | |
1444 jmp .Lctr_enc_done | |
1445 .align 16 | |
1446 .Lctr_enc_loop_done: | |
1447 addq $8,%r14 | |
1448 movdqu 0(%r12),%xmm7 | |
1449 pxor %xmm7,%xmm15 | |
1450 movdqu %xmm15,0(%r13) | |
1451 cmpq $2,%r14 | |
1452 jb .Lctr_enc_done | |
1453 movdqu 16(%r12),%xmm8 | |
1454 pxor %xmm8,%xmm0 | |
1455 movdqu %xmm0,16(%r13) | |
1456 je .Lctr_enc_done | |
1457 movdqu 32(%r12),%xmm9 | |
1458 pxor %xmm9,%xmm3 | |
1459 movdqu %xmm3,32(%r13) | |
1460 cmpq $4,%r14 | |
1461 jb .Lctr_enc_done | |
1462 movdqu 48(%r12),%xmm10 | |
1463 pxor %xmm10,%xmm5 | |
1464 movdqu %xmm5,48(%r13) | |
1465 je .Lctr_enc_done | |
1466 movdqu 64(%r12),%xmm11 | |
1467 pxor %xmm11,%xmm2 | |
1468 movdqu %xmm2,64(%r13) | |
1469 cmpq $6,%r14 | |
1470 jb .Lctr_enc_done | |
1471 movdqu 80(%r12),%xmm12 | |
1472 pxor %xmm12,%xmm6 | |
1473 movdqu %xmm6,80(%r13) | |
1474 je .Lctr_enc_done | |
1475 movdqu 96(%r12),%xmm13 | |
1476 pxor %xmm13,%xmm1 | |
1477 movdqu %xmm1,96(%r13) | |
1478 jmp .Lctr_enc_done | |
1479 | |
1480 .align 16 | |
1481 .Lctr_enc_short: | |
1482 leaq 32(%rbp),%rdi | |
1483 leaq 48(%rbp),%rsi | |
1484 leaq (%r15),%rdx | |
1485 call asm_AES_encrypt | |
1486 movdqu (%r12),%xmm0 | |
1487 leaq 16(%r12),%r12 | |
1488 movl 44(%rbp),%eax | |
1489 bswapl %eax | |
1490 pxor 48(%rbp),%xmm0 | |
1491 incl %eax | |
1492 movdqu %xmm0,(%r13) | |
1493 bswapl %eax | |
1494 leaq 16(%r13),%r13 | |
1495 movl %eax,44(%rsp) | |
1496 decq %r14 | |
1497 jnz .Lctr_enc_short | |
1498 | |
1499 .Lctr_enc_done: | |
1500 leaq (%rsp),%rax | |
1501 pxor %xmm0,%xmm0 | |
1502 .Lctr_enc_bzero: | |
1503 movdqa %xmm0,0(%rax) | |
1504 movdqa %xmm0,16(%rax) | |
1505 leaq 32(%rax),%rax | |
1506 cmpq %rax,%rbp | |
1507 ja .Lctr_enc_bzero | |
1508 | |
1509 leaq (%rbp),%rsp | |
1510 movq 72(%rsp),%r15 | |
1511 movq 80(%rsp),%r14 | |
1512 movq 88(%rsp),%r13 | |
1513 movq 96(%rsp),%r12 | |
1514 movq 104(%rsp),%rbx | |
1515 movq 112(%rsp),%rax | |
1516 leaq 120(%rsp),%rsp | |
1517 movq %rax,%rbp | |
1518 .Lctr_enc_epilogue: | |
1519 .byte 0xf3,0xc3 | |
1520 .size bsaes_ctr32_encrypt_blocks,.-bsaes_ctr32_encrypt_blocks | |
1521 .globl bsaes_xts_encrypt | |
1522 .hidden bsaes_xts_encrypt | |
1523 .type bsaes_xts_encrypt,@function | |
1524 .align 16 | |
1525 bsaes_xts_encrypt: | |
1526 movq %rsp,%rax | |
1527 .Lxts_enc_prologue: | |
1528 pushq %rbp | |
1529 pushq %rbx | |
1530 pushq %r12 | |
1531 pushq %r13 | |
1532 pushq %r14 | |
1533 pushq %r15 | |
1534 leaq -72(%rsp),%rsp | |
1535 movq %rsp,%rbp | |
1536 movq %rdi,%r12 | |
1537 movq %rsi,%r13 | |
1538 movq %rdx,%r14 | |
1539 movq %rcx,%r15 | |
1540 | |
1541 leaq (%r9),%rdi | |
1542 leaq 32(%rbp),%rsi | |
1543 leaq (%r8),%rdx | |
1544 call asm_AES_encrypt | |
1545 | |
1546 movl 240(%r15),%eax | |
1547 movq %r14,%rbx | |
1548 | |
1549 movl %eax,%edx | |
1550 shlq $7,%rax | |
1551 subq $96,%rax | |
1552 subq %rax,%rsp | |
1553 | |
1554 movq %rsp,%rax | |
1555 movq %r15,%rcx | |
1556 movl %edx,%r10d | |
1557 call _bsaes_key_convert | |
1558 pxor %xmm6,%xmm7 | |
1559 movdqa %xmm7,(%rax) | |
1560 | |
1561 andq $-16,%r14 | |
1562 subq $0x80,%rsp | |
1563 movdqa 32(%rbp),%xmm6 | |
1564 | |
1565 pxor %xmm14,%xmm14 | |
1566 movdqa .Lxts_magic(%rip),%xmm12 | |
1567 pcmpgtd %xmm6,%xmm14 | |
1568 | |
1569 subq $0x80,%r14 | |
1570 jc .Lxts_enc_short | |
1571 jmp .Lxts_enc_loop | |
1572 | |
1573 .align 16 | |
1574 .Lxts_enc_loop: | |
1575 pshufd $0x13,%xmm14,%xmm13 | |
1576 pxor %xmm14,%xmm14 | |
1577 movdqa %xmm6,%xmm15 | |
1578 movdqa %xmm6,0(%rsp) | |
1579 paddq %xmm6,%xmm6 | |
1580 pand %xmm12,%xmm13 | |
1581 pcmpgtd %xmm6,%xmm14 | |
1582 pxor %xmm13,%xmm6 | |
1583 pshufd $0x13,%xmm14,%xmm13 | |
1584 pxor %xmm14,%xmm14 | |
1585 movdqa %xmm6,%xmm0 | |
1586 movdqa %xmm6,16(%rsp) | |
1587 paddq %xmm6,%xmm6 | |
1588 pand %xmm12,%xmm13 | |
1589 pcmpgtd %xmm6,%xmm14 | |
1590 pxor %xmm13,%xmm6 | |
1591 movdqu 0(%r12),%xmm7 | |
1592 pshufd $0x13,%xmm14,%xmm13 | |
1593 pxor %xmm14,%xmm14 | |
1594 movdqa %xmm6,%xmm1 | |
1595 movdqa %xmm6,32(%rsp) | |
1596 paddq %xmm6,%xmm6 | |
1597 pand %xmm12,%xmm13 | |
1598 pcmpgtd %xmm6,%xmm14 | |
1599 pxor %xmm13,%xmm6 | |
1600 movdqu 16(%r12),%xmm8 | |
1601 pxor %xmm7,%xmm15 | |
1602 pshufd $0x13,%xmm14,%xmm13 | |
1603 pxor %xmm14,%xmm14 | |
1604 movdqa %xmm6,%xmm2 | |
1605 movdqa %xmm6,48(%rsp) | |
1606 paddq %xmm6,%xmm6 | |
1607 pand %xmm12,%xmm13 | |
1608 pcmpgtd %xmm6,%xmm14 | |
1609 pxor %xmm13,%xmm6 | |
1610 movdqu 32(%r12),%xmm9 | |
1611 pxor %xmm8,%xmm0 | |
1612 pshufd $0x13,%xmm14,%xmm13 | |
1613 pxor %xmm14,%xmm14 | |
1614 movdqa %xmm6,%xmm3 | |
1615 movdqa %xmm6,64(%rsp) | |
1616 paddq %xmm6,%xmm6 | |
1617 pand %xmm12,%xmm13 | |
1618 pcmpgtd %xmm6,%xmm14 | |
1619 pxor %xmm13,%xmm6 | |
1620 movdqu 48(%r12),%xmm10 | |
1621 pxor %xmm9,%xmm1 | |
1622 pshufd $0x13,%xmm14,%xmm13 | |
1623 pxor %xmm14,%xmm14 | |
1624 movdqa %xmm6,%xmm4 | |
1625 movdqa %xmm6,80(%rsp) | |
1626 paddq %xmm6,%xmm6 | |
1627 pand %xmm12,%xmm13 | |
1628 pcmpgtd %xmm6,%xmm14 | |
1629 pxor %xmm13,%xmm6 | |
1630 movdqu 64(%r12),%xmm11 | |
1631 pxor %xmm10,%xmm2 | |
1632 pshufd $0x13,%xmm14,%xmm13 | |
1633 pxor %xmm14,%xmm14 | |
1634 movdqa %xmm6,%xmm5 | |
1635 movdqa %xmm6,96(%rsp) | |
1636 paddq %xmm6,%xmm6 | |
1637 pand %xmm12,%xmm13 | |
1638 pcmpgtd %xmm6,%xmm14 | |
1639 pxor %xmm13,%xmm6 | |
1640 movdqu 80(%r12),%xmm12 | |
1641 pxor %xmm11,%xmm3 | |
1642 movdqu 96(%r12),%xmm13 | |
1643 pxor %xmm12,%xmm4 | |
1644 movdqu 112(%r12),%xmm14 | |
1645 leaq 128(%r12),%r12 | |
1646 movdqa %xmm6,112(%rsp) | |
1647 pxor %xmm13,%xmm5 | |
1648 leaq 128(%rsp),%rax | |
1649 pxor %xmm14,%xmm6 | |
1650 movl %edx,%r10d | |
1651 | |
1652 call _bsaes_encrypt8 | |
1653 | |
1654 pxor 0(%rsp),%xmm15 | |
1655 pxor 16(%rsp),%xmm0 | |
1656 movdqu %xmm15,0(%r13) | |
1657 pxor 32(%rsp),%xmm3 | |
1658 movdqu %xmm0,16(%r13) | |
1659 pxor 48(%rsp),%xmm5 | |
1660 movdqu %xmm3,32(%r13) | |
1661 pxor 64(%rsp),%xmm2 | |
1662 movdqu %xmm5,48(%r13) | |
1663 pxor 80(%rsp),%xmm6 | |
1664 movdqu %xmm2,64(%r13) | |
1665 pxor 96(%rsp),%xmm1 | |
1666 movdqu %xmm6,80(%r13) | |
1667 pxor 112(%rsp),%xmm4 | |
1668 movdqu %xmm1,96(%r13) | |
1669 movdqu %xmm4,112(%r13) | |
1670 leaq 128(%r13),%r13 | |
1671 | |
1672 movdqa 112(%rsp),%xmm6 | |
1673 pxor %xmm14,%xmm14 | |
1674 movdqa .Lxts_magic(%rip),%xmm12 | |
1675 pcmpgtd %xmm6,%xmm14 | |
1676 pshufd $0x13,%xmm14,%xmm13 | |
1677 pxor %xmm14,%xmm14 | |
1678 paddq %xmm6,%xmm6 | |
1679 pand %xmm12,%xmm13 | |
1680 pcmpgtd %xmm6,%xmm14 | |
1681 pxor %xmm13,%xmm6 | |
1682 | |
1683 subq $0x80,%r14 | |
1684 jnc .Lxts_enc_loop | |
1685 | |
1686 .Lxts_enc_short: | |
1687 addq $0x80,%r14 | |
1688 jz .Lxts_enc_done | |
1689 pshufd $0x13,%xmm14,%xmm13 | |
1690 pxor %xmm14,%xmm14 | |
1691 movdqa %xmm6,%xmm15 | |
1692 movdqa %xmm6,0(%rsp) | |
1693 paddq %xmm6,%xmm6 | |
1694 pand %xmm12,%xmm13 | |
1695 pcmpgtd %xmm6,%xmm14 | |
1696 pxor %xmm13,%xmm6 | |
1697 pshufd $0x13,%xmm14,%xmm13 | |
1698 pxor %xmm14,%xmm14 | |
1699 movdqa %xmm6,%xmm0 | |
1700 movdqa %xmm6,16(%rsp) | |
1701 paddq %xmm6,%xmm6 | |
1702 pand %xmm12,%xmm13 | |
1703 pcmpgtd %xmm6,%xmm14 | |
1704 pxor %xmm13,%xmm6 | |
1705 movdqu 0(%r12),%xmm7 | |
1706 cmpq $16,%r14 | |
1707 je .Lxts_enc_1 | |
1708 pshufd $0x13,%xmm14,%xmm13 | |
1709 pxor %xmm14,%xmm14 | |
1710 movdqa %xmm6,%xmm1 | |
1711 movdqa %xmm6,32(%rsp) | |
1712 paddq %xmm6,%xmm6 | |
1713 pand %xmm12,%xmm13 | |
1714 pcmpgtd %xmm6,%xmm14 | |
1715 pxor %xmm13,%xmm6 | |
1716 movdqu 16(%r12),%xmm8 | |
1717 cmpq $32,%r14 | |
1718 je .Lxts_enc_2 | |
1719 pxor %xmm7,%xmm15 | |
1720 pshufd $0x13,%xmm14,%xmm13 | |
1721 pxor %xmm14,%xmm14 | |
1722 movdqa %xmm6,%xmm2 | |
1723 movdqa %xmm6,48(%rsp) | |
1724 paddq %xmm6,%xmm6 | |
1725 pand %xmm12,%xmm13 | |
1726 pcmpgtd %xmm6,%xmm14 | |
1727 pxor %xmm13,%xmm6 | |
1728 movdqu 32(%r12),%xmm9 | |
1729 cmpq $48,%r14 | |
1730 je .Lxts_enc_3 | |
1731 pxor %xmm8,%xmm0 | |
1732 pshufd $0x13,%xmm14,%xmm13 | |
1733 pxor %xmm14,%xmm14 | |
1734 movdqa %xmm6,%xmm3 | |
1735 movdqa %xmm6,64(%rsp) | |
1736 paddq %xmm6,%xmm6 | |
1737 pand %xmm12,%xmm13 | |
1738 pcmpgtd %xmm6,%xmm14 | |
1739 pxor %xmm13,%xmm6 | |
1740 movdqu 48(%r12),%xmm10 | |
1741 cmpq $64,%r14 | |
1742 je .Lxts_enc_4 | |
1743 pxor %xmm9,%xmm1 | |
1744 pshufd $0x13,%xmm14,%xmm13 | |
1745 pxor %xmm14,%xmm14 | |
1746 movdqa %xmm6,%xmm4 | |
1747 movdqa %xmm6,80(%rsp) | |
1748 paddq %xmm6,%xmm6 | |
1749 pand %xmm12,%xmm13 | |
1750 pcmpgtd %xmm6,%xmm14 | |
1751 pxor %xmm13,%xmm6 | |
1752 movdqu 64(%r12),%xmm11 | |
1753 cmpq $80,%r14 | |
1754 je .Lxts_enc_5 | |
1755 pxor %xmm10,%xmm2 | |
1756 pshufd $0x13,%xmm14,%xmm13 | |
1757 pxor %xmm14,%xmm14 | |
1758 movdqa %xmm6,%xmm5 | |
1759 movdqa %xmm6,96(%rsp) | |
1760 paddq %xmm6,%xmm6 | |
1761 pand %xmm12,%xmm13 | |
1762 pcmpgtd %xmm6,%xmm14 | |
1763 pxor %xmm13,%xmm6 | |
1764 movdqu 80(%r12),%xmm12 | |
1765 cmpq $96,%r14 | |
1766 je .Lxts_enc_6 | |
1767 pxor %xmm11,%xmm3 | |
1768 movdqu 96(%r12),%xmm13 | |
1769 pxor %xmm12,%xmm4 | |
1770 movdqa %xmm6,112(%rsp) | |
1771 leaq 112(%r12),%r12 | |
1772 pxor %xmm13,%xmm5 | |
1773 leaq 128(%rsp),%rax | |
1774 movl %edx,%r10d | |
1775 | |
1776 call _bsaes_encrypt8 | |
1777 | |
1778 pxor 0(%rsp),%xmm15 | |
1779 pxor 16(%rsp),%xmm0 | |
1780 movdqu %xmm15,0(%r13) | |
1781 pxor 32(%rsp),%xmm3 | |
1782 movdqu %xmm0,16(%r13) | |
1783 pxor 48(%rsp),%xmm5 | |
1784 movdqu %xmm3,32(%r13) | |
1785 pxor 64(%rsp),%xmm2 | |
1786 movdqu %xmm5,48(%r13) | |
1787 pxor 80(%rsp),%xmm6 | |
1788 movdqu %xmm2,64(%r13) | |
1789 pxor 96(%rsp),%xmm1 | |
1790 movdqu %xmm6,80(%r13) | |
1791 movdqu %xmm1,96(%r13) | |
1792 leaq 112(%r13),%r13 | |
1793 | |
1794 movdqa 112(%rsp),%xmm6 | |
1795 jmp .Lxts_enc_done | |
1796 .align 16 | |
1797 .Lxts_enc_6: | |
1798 pxor %xmm11,%xmm3 | |
1799 leaq 96(%r12),%r12 | |
1800 pxor %xmm12,%xmm4 | |
1801 leaq 128(%rsp),%rax | |
1802 movl %edx,%r10d | |
1803 | |
1804 call _bsaes_encrypt8 | |
1805 | |
1806 pxor 0(%rsp),%xmm15 | |
1807 pxor 16(%rsp),%xmm0 | |
1808 movdqu %xmm15,0(%r13) | |
1809 pxor 32(%rsp),%xmm3 | |
1810 movdqu %xmm0,16(%r13) | |
1811 pxor 48(%rsp),%xmm5 | |
1812 movdqu %xmm3,32(%r13) | |
1813 pxor 64(%rsp),%xmm2 | |
1814 movdqu %xmm5,48(%r13) | |
1815 pxor 80(%rsp),%xmm6 | |
1816 movdqu %xmm2,64(%r13) | |
1817 movdqu %xmm6,80(%r13) | |
1818 leaq 96(%r13),%r13 | |
1819 | |
1820 movdqa 96(%rsp),%xmm6 | |
1821 jmp .Lxts_enc_done | |
1822 .align 16 | |
1823 .Lxts_enc_5: | |
1824 pxor %xmm10,%xmm2 | |
1825 leaq 80(%r12),%r12 | |
1826 pxor %xmm11,%xmm3 | |
1827 leaq 128(%rsp),%rax | |
1828 movl %edx,%r10d | |
1829 | |
1830 call _bsaes_encrypt8 | |
1831 | |
1832 pxor 0(%rsp),%xmm15 | |
1833 pxor 16(%rsp),%xmm0 | |
1834 movdqu %xmm15,0(%r13) | |
1835 pxor 32(%rsp),%xmm3 | |
1836 movdqu %xmm0,16(%r13) | |
1837 pxor 48(%rsp),%xmm5 | |
1838 movdqu %xmm3,32(%r13) | |
1839 pxor 64(%rsp),%xmm2 | |
1840 movdqu %xmm5,48(%r13) | |
1841 movdqu %xmm2,64(%r13) | |
1842 leaq 80(%r13),%r13 | |
1843 | |
1844 movdqa 80(%rsp),%xmm6 | |
1845 jmp .Lxts_enc_done | |
1846 .align 16 | |
1847 .Lxts_enc_4: | |
1848 pxor %xmm9,%xmm1 | |
1849 leaq 64(%r12),%r12 | |
1850 pxor %xmm10,%xmm2 | |
1851 leaq 128(%rsp),%rax | |
1852 movl %edx,%r10d | |
1853 | |
1854 call _bsaes_encrypt8 | |
1855 | |
1856 pxor 0(%rsp),%xmm15 | |
1857 pxor 16(%rsp),%xmm0 | |
1858 movdqu %xmm15,0(%r13) | |
1859 pxor 32(%rsp),%xmm3 | |
1860 movdqu %xmm0,16(%r13) | |
1861 pxor 48(%rsp),%xmm5 | |
1862 movdqu %xmm3,32(%r13) | |
1863 movdqu %xmm5,48(%r13) | |
1864 leaq 64(%r13),%r13 | |
1865 | |
1866 movdqa 64(%rsp),%xmm6 | |
1867 jmp .Lxts_enc_done | |
1868 .align 16 | |
1869 .Lxts_enc_3: | |
1870 pxor %xmm8,%xmm0 | |
1871 leaq 48(%r12),%r12 | |
1872 pxor %xmm9,%xmm1 | |
1873 leaq 128(%rsp),%rax | |
1874 movl %edx,%r10d | |
1875 | |
1876 call _bsaes_encrypt8 | |
1877 | |
1878 pxor 0(%rsp),%xmm15 | |
1879 pxor 16(%rsp),%xmm0 | |
1880 movdqu %xmm15,0(%r13) | |
1881 pxor 32(%rsp),%xmm3 | |
1882 movdqu %xmm0,16(%r13) | |
1883 movdqu %xmm3,32(%r13) | |
1884 leaq 48(%r13),%r13 | |
1885 | |
1886 movdqa 48(%rsp),%xmm6 | |
1887 jmp .Lxts_enc_done | |
1888 .align 16 | |
1889 .Lxts_enc_2: | |
1890 pxor %xmm7,%xmm15 | |
1891 leaq 32(%r12),%r12 | |
1892 pxor %xmm8,%xmm0 | |
1893 leaq 128(%rsp),%rax | |
1894 movl %edx,%r10d | |
1895 | |
1896 call _bsaes_encrypt8 | |
1897 | |
1898 pxor 0(%rsp),%xmm15 | |
1899 pxor 16(%rsp),%xmm0 | |
1900 movdqu %xmm15,0(%r13) | |
1901 movdqu %xmm0,16(%r13) | |
1902 leaq 32(%r13),%r13 | |
1903 | |
1904 movdqa 32(%rsp),%xmm6 | |
1905 jmp .Lxts_enc_done | |
1906 .align 16 | |
1907 .Lxts_enc_1: | |
1908 pxor %xmm15,%xmm7 | |
1909 leaq 16(%r12),%r12 | |
1910 movdqa %xmm7,32(%rbp) | |
1911 leaq 32(%rbp),%rdi | |
1912 leaq 32(%rbp),%rsi | |
1913 leaq (%r15),%rdx | |
1914 call asm_AES_encrypt | |
1915 pxor 32(%rbp),%xmm15 | |
1916 | |
1917 | |
1918 | |
1919 | |
1920 | |
1921 movdqu %xmm15,0(%r13) | |
1922 leaq 16(%r13),%r13 | |
1923 | |
1924 movdqa 16(%rsp),%xmm6 | |
1925 | |
1926 .Lxts_enc_done: | |
1927 andl $15,%ebx | |
1928 jz .Lxts_enc_ret | |
1929 movq %r13,%rdx | |
1930 | |
1931 .Lxts_enc_steal: | |
1932 movzbl (%r12),%eax | |
1933 movzbl -16(%rdx),%ecx | |
1934 leaq 1(%r12),%r12 | |
1935 movb %al,-16(%rdx) | |
1936 movb %cl,0(%rdx) | |
1937 leaq 1(%rdx),%rdx | |
1938 subl $1,%ebx | |
1939 jnz .Lxts_enc_steal | |
1940 | |
1941 movdqu -16(%r13),%xmm15 | |
1942 leaq 32(%rbp),%rdi | |
1943 pxor %xmm6,%xmm15 | |
1944 leaq 32(%rbp),%rsi | |
1945 movdqa %xmm15,32(%rbp) | |
1946 leaq (%r15),%rdx | |
1947 call asm_AES_encrypt | |
1948 pxor 32(%rbp),%xmm6 | |
1949 movdqu %xmm6,-16(%r13) | |
1950 | |
1951 .Lxts_enc_ret: | |
1952 leaq (%rsp),%rax | |
1953 pxor %xmm0,%xmm0 | |
1954 .Lxts_enc_bzero: | |
1955 movdqa %xmm0,0(%rax) | |
1956 movdqa %xmm0,16(%rax) | |
1957 leaq 32(%rax),%rax | |
1958 cmpq %rax,%rbp | |
1959 ja .Lxts_enc_bzero | |
1960 | |
1961 leaq (%rbp),%rsp | |
1962 movq 72(%rsp),%r15 | |
1963 movq 80(%rsp),%r14 | |
1964 movq 88(%rsp),%r13 | |
1965 movq 96(%rsp),%r12 | |
1966 movq 104(%rsp),%rbx | |
1967 movq 112(%rsp),%rax | |
1968 leaq 120(%rsp),%rsp | |
1969 movq %rax,%rbp | |
1970 .Lxts_enc_epilogue: | |
1971 .byte 0xf3,0xc3 | |
1972 .size bsaes_xts_encrypt,.-bsaes_xts_encrypt | |
1973 | |
1974 .globl bsaes_xts_decrypt | |
1975 .hidden bsaes_xts_decrypt | |
1976 .type bsaes_xts_decrypt,@function | |
1977 .align 16 | |
1978 bsaes_xts_decrypt: | |
1979 movq %rsp,%rax | |
1980 .Lxts_dec_prologue: | |
1981 pushq %rbp | |
1982 pushq %rbx | |
1983 pushq %r12 | |
1984 pushq %r13 | |
1985 pushq %r14 | |
1986 pushq %r15 | |
1987 leaq -72(%rsp),%rsp | |
1988 movq %rsp,%rbp | |
1989 movq %rdi,%r12 | |
1990 movq %rsi,%r13 | |
1991 movq %rdx,%r14 | |
1992 movq %rcx,%r15 | |
1993 | |
1994 leaq (%r9),%rdi | |
1995 leaq 32(%rbp),%rsi | |
1996 leaq (%r8),%rdx | |
1997 call asm_AES_encrypt | |
1998 | |
1999 movl 240(%r15),%eax | |
2000 movq %r14,%rbx | |
2001 | |
2002 movl %eax,%edx | |
2003 shlq $7,%rax | |
2004 subq $96,%rax | |
2005 subq %rax,%rsp | |
2006 | |
2007 movq %rsp,%rax | |
2008 movq %r15,%rcx | |
2009 movl %edx,%r10d | |
2010 call _bsaes_key_convert | |
2011 pxor (%rsp),%xmm7 | |
2012 movdqa %xmm6,(%rax) | |
2013 movdqa %xmm7,(%rsp) | |
2014 | |
2015 xorl %eax,%eax | |
2016 andq $-16,%r14 | |
2017 testl $15,%ebx | |
2018 setnz %al | |
2019 shlq $4,%rax | |
2020 subq %rax,%r14 | |
2021 | |
2022 subq $0x80,%rsp | |
2023 movdqa 32(%rbp),%xmm6 | |
2024 | |
2025 pxor %xmm14,%xmm14 | |
2026 movdqa .Lxts_magic(%rip),%xmm12 | |
2027 pcmpgtd %xmm6,%xmm14 | |
2028 | |
2029 subq $0x80,%r14 | |
2030 jc .Lxts_dec_short | |
2031 jmp .Lxts_dec_loop | |
2032 | |
2033 .align 16 | |
2034 .Lxts_dec_loop: | |
2035 pshufd $0x13,%xmm14,%xmm13 | |
2036 pxor %xmm14,%xmm14 | |
2037 movdqa %xmm6,%xmm15 | |
2038 movdqa %xmm6,0(%rsp) | |
2039 paddq %xmm6,%xmm6 | |
2040 pand %xmm12,%xmm13 | |
2041 pcmpgtd %xmm6,%xmm14 | |
2042 pxor %xmm13,%xmm6 | |
2043 pshufd $0x13,%xmm14,%xmm13 | |
2044 pxor %xmm14,%xmm14 | |
2045 movdqa %xmm6,%xmm0 | |
2046 movdqa %xmm6,16(%rsp) | |
2047 paddq %xmm6,%xmm6 | |
2048 pand %xmm12,%xmm13 | |
2049 pcmpgtd %xmm6,%xmm14 | |
2050 pxor %xmm13,%xmm6 | |
2051 movdqu 0(%r12),%xmm7 | |
2052 pshufd $0x13,%xmm14,%xmm13 | |
2053 pxor %xmm14,%xmm14 | |
2054 movdqa %xmm6,%xmm1 | |
2055 movdqa %xmm6,32(%rsp) | |
2056 paddq %xmm6,%xmm6 | |
2057 pand %xmm12,%xmm13 | |
2058 pcmpgtd %xmm6,%xmm14 | |
2059 pxor %xmm13,%xmm6 | |
2060 movdqu 16(%r12),%xmm8 | |
2061 pxor %xmm7,%xmm15 | |
2062 pshufd $0x13,%xmm14,%xmm13 | |
2063 pxor %xmm14,%xmm14 | |
2064 movdqa %xmm6,%xmm2 | |
2065 movdqa %xmm6,48(%rsp) | |
2066 paddq %xmm6,%xmm6 | |
2067 pand %xmm12,%xmm13 | |
2068 pcmpgtd %xmm6,%xmm14 | |
2069 pxor %xmm13,%xmm6 | |
2070 movdqu 32(%r12),%xmm9 | |
2071 pxor %xmm8,%xmm0 | |
2072 pshufd $0x13,%xmm14,%xmm13 | |
2073 pxor %xmm14,%xmm14 | |
2074 movdqa %xmm6,%xmm3 | |
2075 movdqa %xmm6,64(%rsp) | |
2076 paddq %xmm6,%xmm6 | |
2077 pand %xmm12,%xmm13 | |
2078 pcmpgtd %xmm6,%xmm14 | |
2079 pxor %xmm13,%xmm6 | |
2080 movdqu 48(%r12),%xmm10 | |
2081 pxor %xmm9,%xmm1 | |
2082 pshufd $0x13,%xmm14,%xmm13 | |
2083 pxor %xmm14,%xmm14 | |
2084 movdqa %xmm6,%xmm4 | |
2085 movdqa %xmm6,80(%rsp) | |
2086 paddq %xmm6,%xmm6 | |
2087 pand %xmm12,%xmm13 | |
2088 pcmpgtd %xmm6,%xmm14 | |
2089 pxor %xmm13,%xmm6 | |
2090 movdqu 64(%r12),%xmm11 | |
2091 pxor %xmm10,%xmm2 | |
2092 pshufd $0x13,%xmm14,%xmm13 | |
2093 pxor %xmm14,%xmm14 | |
2094 movdqa %xmm6,%xmm5 | |
2095 movdqa %xmm6,96(%rsp) | |
2096 paddq %xmm6,%xmm6 | |
2097 pand %xmm12,%xmm13 | |
2098 pcmpgtd %xmm6,%xmm14 | |
2099 pxor %xmm13,%xmm6 | |
2100 movdqu 80(%r12),%xmm12 | |
2101 pxor %xmm11,%xmm3 | |
2102 movdqu 96(%r12),%xmm13 | |
2103 pxor %xmm12,%xmm4 | |
2104 movdqu 112(%r12),%xmm14 | |
2105 leaq 128(%r12),%r12 | |
2106 movdqa %xmm6,112(%rsp) | |
2107 pxor %xmm13,%xmm5 | |
2108 leaq 128(%rsp),%rax | |
2109 pxor %xmm14,%xmm6 | |
2110 movl %edx,%r10d | |
2111 | |
2112 call _bsaes_decrypt8 | |
2113 | |
2114 pxor 0(%rsp),%xmm15 | |
2115 pxor 16(%rsp),%xmm0 | |
2116 movdqu %xmm15,0(%r13) | |
2117 pxor 32(%rsp),%xmm5 | |
2118 movdqu %xmm0,16(%r13) | |
2119 pxor 48(%rsp),%xmm3 | |
2120 movdqu %xmm5,32(%r13) | |
2121 pxor 64(%rsp),%xmm1 | |
2122 movdqu %xmm3,48(%r13) | |
2123 pxor 80(%rsp),%xmm6 | |
2124 movdqu %xmm1,64(%r13) | |
2125 pxor 96(%rsp),%xmm2 | |
2126 movdqu %xmm6,80(%r13) | |
2127 pxor 112(%rsp),%xmm4 | |
2128 movdqu %xmm2,96(%r13) | |
2129 movdqu %xmm4,112(%r13) | |
2130 leaq 128(%r13),%r13 | |
2131 | |
2132 movdqa 112(%rsp),%xmm6 | |
2133 pxor %xmm14,%xmm14 | |
2134 movdqa .Lxts_magic(%rip),%xmm12 | |
2135 pcmpgtd %xmm6,%xmm14 | |
2136 pshufd $0x13,%xmm14,%xmm13 | |
2137 pxor %xmm14,%xmm14 | |
2138 paddq %xmm6,%xmm6 | |
2139 pand %xmm12,%xmm13 | |
2140 pcmpgtd %xmm6,%xmm14 | |
2141 pxor %xmm13,%xmm6 | |
2142 | |
2143 subq $0x80,%r14 | |
2144 jnc .Lxts_dec_loop | |
2145 | |
2146 .Lxts_dec_short: | |
2147 addq $0x80,%r14 | |
2148 jz .Lxts_dec_done | |
2149 pshufd $0x13,%xmm14,%xmm13 | |
2150 pxor %xmm14,%xmm14 | |
2151 movdqa %xmm6,%xmm15 | |
2152 movdqa %xmm6,0(%rsp) | |
2153 paddq %xmm6,%xmm6 | |
2154 pand %xmm12,%xmm13 | |
2155 pcmpgtd %xmm6,%xmm14 | |
2156 pxor %xmm13,%xmm6 | |
2157 pshufd $0x13,%xmm14,%xmm13 | |
2158 pxor %xmm14,%xmm14 | |
2159 movdqa %xmm6,%xmm0 | |
2160 movdqa %xmm6,16(%rsp) | |
2161 paddq %xmm6,%xmm6 | |
2162 pand %xmm12,%xmm13 | |
2163 pcmpgtd %xmm6,%xmm14 | |
2164 pxor %xmm13,%xmm6 | |
2165 movdqu 0(%r12),%xmm7 | |
2166 cmpq $16,%r14 | |
2167 je .Lxts_dec_1 | |
2168 pshufd $0x13,%xmm14,%xmm13 | |
2169 pxor %xmm14,%xmm14 | |
2170 movdqa %xmm6,%xmm1 | |
2171 movdqa %xmm6,32(%rsp) | |
2172 paddq %xmm6,%xmm6 | |
2173 pand %xmm12,%xmm13 | |
2174 pcmpgtd %xmm6,%xmm14 | |
2175 pxor %xmm13,%xmm6 | |
2176 movdqu 16(%r12),%xmm8 | |
2177 cmpq $32,%r14 | |
2178 je .Lxts_dec_2 | |
2179 pxor %xmm7,%xmm15 | |
2180 pshufd $0x13,%xmm14,%xmm13 | |
2181 pxor %xmm14,%xmm14 | |
2182 movdqa %xmm6,%xmm2 | |
2183 movdqa %xmm6,48(%rsp) | |
2184 paddq %xmm6,%xmm6 | |
2185 pand %xmm12,%xmm13 | |
2186 pcmpgtd %xmm6,%xmm14 | |
2187 pxor %xmm13,%xmm6 | |
2188 movdqu 32(%r12),%xmm9 | |
2189 cmpq $48,%r14 | |
2190 je .Lxts_dec_3 | |
2191 pxor %xmm8,%xmm0 | |
2192 pshufd $0x13,%xmm14,%xmm13 | |
2193 pxor %xmm14,%xmm14 | |
2194 movdqa %xmm6,%xmm3 | |
2195 movdqa %xmm6,64(%rsp) | |
2196 paddq %xmm6,%xmm6 | |
2197 pand %xmm12,%xmm13 | |
2198 pcmpgtd %xmm6,%xmm14 | |
2199 pxor %xmm13,%xmm6 | |
2200 movdqu 48(%r12),%xmm10 | |
2201 cmpq $64,%r14 | |
2202 je .Lxts_dec_4 | |
2203 pxor %xmm9,%xmm1 | |
2204 pshufd $0x13,%xmm14,%xmm13 | |
2205 pxor %xmm14,%xmm14 | |
2206 movdqa %xmm6,%xmm4 | |
2207 movdqa %xmm6,80(%rsp) | |
2208 paddq %xmm6,%xmm6 | |
2209 pand %xmm12,%xmm13 | |
2210 pcmpgtd %xmm6,%xmm14 | |
2211 pxor %xmm13,%xmm6 | |
2212 movdqu 64(%r12),%xmm11 | |
2213 cmpq $80,%r14 | |
2214 je .Lxts_dec_5 | |
2215 pxor %xmm10,%xmm2 | |
2216 pshufd $0x13,%xmm14,%xmm13 | |
2217 pxor %xmm14,%xmm14 | |
2218 movdqa %xmm6,%xmm5 | |
2219 movdqa %xmm6,96(%rsp) | |
2220 paddq %xmm6,%xmm6 | |
2221 pand %xmm12,%xmm13 | |
2222 pcmpgtd %xmm6,%xmm14 | |
2223 pxor %xmm13,%xmm6 | |
2224 movdqu 80(%r12),%xmm12 | |
2225 cmpq $96,%r14 | |
2226 je .Lxts_dec_6 | |
2227 pxor %xmm11,%xmm3 | |
2228 movdqu 96(%r12),%xmm13 | |
2229 pxor %xmm12,%xmm4 | |
2230 movdqa %xmm6,112(%rsp) | |
2231 leaq 112(%r12),%r12 | |
2232 pxor %xmm13,%xmm5 | |
2233 leaq 128(%rsp),%rax | |
2234 movl %edx,%r10d | |
2235 | |
2236 call _bsaes_decrypt8 | |
2237 | |
2238 pxor 0(%rsp),%xmm15 | |
2239 pxor 16(%rsp),%xmm0 | |
2240 movdqu %xmm15,0(%r13) | |
2241 pxor 32(%rsp),%xmm5 | |
2242 movdqu %xmm0,16(%r13) | |
2243 pxor 48(%rsp),%xmm3 | |
2244 movdqu %xmm5,32(%r13) | |
2245 pxor 64(%rsp),%xmm1 | |
2246 movdqu %xmm3,48(%r13) | |
2247 pxor 80(%rsp),%xmm6 | |
2248 movdqu %xmm1,64(%r13) | |
2249 pxor 96(%rsp),%xmm2 | |
2250 movdqu %xmm6,80(%r13) | |
2251 movdqu %xmm2,96(%r13) | |
2252 leaq 112(%r13),%r13 | |
2253 | |
2254 movdqa 112(%rsp),%xmm6 | |
2255 jmp .Lxts_dec_done | |
2256 .align 16 | |
2257 .Lxts_dec_6: | |
2258 pxor %xmm11,%xmm3 | |
2259 leaq 96(%r12),%r12 | |
2260 pxor %xmm12,%xmm4 | |
2261 leaq 128(%rsp),%rax | |
2262 movl %edx,%r10d | |
2263 | |
2264 call _bsaes_decrypt8 | |
2265 | |
2266 pxor 0(%rsp),%xmm15 | |
2267 pxor 16(%rsp),%xmm0 | |
2268 movdqu %xmm15,0(%r13) | |
2269 pxor 32(%rsp),%xmm5 | |
2270 movdqu %xmm0,16(%r13) | |
2271 pxor 48(%rsp),%xmm3 | |
2272 movdqu %xmm5,32(%r13) | |
2273 pxor 64(%rsp),%xmm1 | |
2274 movdqu %xmm3,48(%r13) | |
2275 pxor 80(%rsp),%xmm6 | |
2276 movdqu %xmm1,64(%r13) | |
2277 movdqu %xmm6,80(%r13) | |
2278 leaq 96(%r13),%r13 | |
2279 | |
2280 movdqa 96(%rsp),%xmm6 | |
2281 jmp .Lxts_dec_done | |
2282 .align 16 | |
2283 .Lxts_dec_5: | |
2284 pxor %xmm10,%xmm2 | |
2285 leaq 80(%r12),%r12 | |
2286 pxor %xmm11,%xmm3 | |
2287 leaq 128(%rsp),%rax | |
2288 movl %edx,%r10d | |
2289 | |
2290 call _bsaes_decrypt8 | |
2291 | |
2292 pxor 0(%rsp),%xmm15 | |
2293 pxor 16(%rsp),%xmm0 | |
2294 movdqu %xmm15,0(%r13) | |
2295 pxor 32(%rsp),%xmm5 | |
2296 movdqu %xmm0,16(%r13) | |
2297 pxor 48(%rsp),%xmm3 | |
2298 movdqu %xmm5,32(%r13) | |
2299 pxor 64(%rsp),%xmm1 | |
2300 movdqu %xmm3,48(%r13) | |
2301 movdqu %xmm1,64(%r13) | |
2302 leaq 80(%r13),%r13 | |
2303 | |
2304 movdqa 80(%rsp),%xmm6 | |
2305 jmp .Lxts_dec_done | |
2306 .align 16 | |
2307 .Lxts_dec_4: | |
2308 pxor %xmm9,%xmm1 | |
2309 leaq 64(%r12),%r12 | |
2310 pxor %xmm10,%xmm2 | |
2311 leaq 128(%rsp),%rax | |
2312 movl %edx,%r10d | |
2313 | |
2314 call _bsaes_decrypt8 | |
2315 | |
2316 pxor 0(%rsp),%xmm15 | |
2317 pxor 16(%rsp),%xmm0 | |
2318 movdqu %xmm15,0(%r13) | |
2319 pxor 32(%rsp),%xmm5 | |
2320 movdqu %xmm0,16(%r13) | |
2321 pxor 48(%rsp),%xmm3 | |
2322 movdqu %xmm5,32(%r13) | |
2323 movdqu %xmm3,48(%r13) | |
2324 leaq 64(%r13),%r13 | |
2325 | |
2326 movdqa 64(%rsp),%xmm6 | |
2327 jmp .Lxts_dec_done | |
2328 .align 16 | |
2329 .Lxts_dec_3: | |
2330 pxor %xmm8,%xmm0 | |
2331 leaq 48(%r12),%r12 | |
2332 pxor %xmm9,%xmm1 | |
2333 leaq 128(%rsp),%rax | |
2334 movl %edx,%r10d | |
2335 | |
2336 call _bsaes_decrypt8 | |
2337 | |
2338 pxor 0(%rsp),%xmm15 | |
2339 pxor 16(%rsp),%xmm0 | |
2340 movdqu %xmm15,0(%r13) | |
2341 pxor 32(%rsp),%xmm5 | |
2342 movdqu %xmm0,16(%r13) | |
2343 movdqu %xmm5,32(%r13) | |
2344 leaq 48(%r13),%r13 | |
2345 | |
2346 movdqa 48(%rsp),%xmm6 | |
2347 jmp .Lxts_dec_done | |
2348 .align 16 | |
2349 .Lxts_dec_2: | |
2350 pxor %xmm7,%xmm15 | |
2351 leaq 32(%r12),%r12 | |
2352 pxor %xmm8,%xmm0 | |
2353 leaq 128(%rsp),%rax | |
2354 movl %edx,%r10d | |
2355 | |
2356 call _bsaes_decrypt8 | |
2357 | |
2358 pxor 0(%rsp),%xmm15 | |
2359 pxor 16(%rsp),%xmm0 | |
2360 movdqu %xmm15,0(%r13) | |
2361 movdqu %xmm0,16(%r13) | |
2362 leaq 32(%r13),%r13 | |
2363 | |
2364 movdqa 32(%rsp),%xmm6 | |
2365 jmp .Lxts_dec_done | |
2366 .align 16 | |
2367 .Lxts_dec_1: | |
2368 pxor %xmm15,%xmm7 | |
2369 leaq 16(%r12),%r12 | |
2370 movdqa %xmm7,32(%rbp) | |
2371 leaq 32(%rbp),%rdi | |
2372 leaq 32(%rbp),%rsi | |
2373 leaq (%r15),%rdx | |
2374 call asm_AES_decrypt | |
2375 pxor 32(%rbp),%xmm15 | |
2376 | |
2377 | |
2378 | |
2379 | |
2380 | |
2381 movdqu %xmm15,0(%r13) | |
2382 leaq 16(%r13),%r13 | |
2383 | |
2384 movdqa 16(%rsp),%xmm6 | |
2385 | |
2386 .Lxts_dec_done: | |
2387 andl $15,%ebx | |
2388 jz .Lxts_dec_ret | |
2389 | |
2390 pxor %xmm14,%xmm14 | |
2391 movdqa .Lxts_magic(%rip),%xmm12 | |
2392 pcmpgtd %xmm6,%xmm14 | |
2393 pshufd $0x13,%xmm14,%xmm13 | |
2394 movdqa %xmm6,%xmm5 | |
2395 paddq %xmm6,%xmm6 | |
2396 pand %xmm12,%xmm13 | |
2397 movdqu (%r12),%xmm15 | |
2398 pxor %xmm13,%xmm6 | |
2399 | |
2400 leaq 32(%rbp),%rdi | |
2401 pxor %xmm6,%xmm15 | |
2402 leaq 32(%rbp),%rsi | |
2403 movdqa %xmm15,32(%rbp) | |
2404 leaq (%r15),%rdx | |
2405 call asm_AES_decrypt | |
2406 pxor 32(%rbp),%xmm6 | |
2407 movq %r13,%rdx | |
2408 movdqu %xmm6,(%r13) | |
2409 | |
2410 .Lxts_dec_steal: | |
2411 movzbl 16(%r12),%eax | |
2412 movzbl (%rdx),%ecx | |
2413 leaq 1(%r12),%r12 | |
2414 movb %al,(%rdx) | |
2415 movb %cl,16(%rdx) | |
2416 leaq 1(%rdx),%rdx | |
2417 subl $1,%ebx | |
2418 jnz .Lxts_dec_steal | |
2419 | |
2420 movdqu (%r13),%xmm15 | |
2421 leaq 32(%rbp),%rdi | |
2422 pxor %xmm5,%xmm15 | |
2423 leaq 32(%rbp),%rsi | |
2424 movdqa %xmm15,32(%rbp) | |
2425 leaq (%r15),%rdx | |
2426 call asm_AES_decrypt | |
2427 pxor 32(%rbp),%xmm5 | |
2428 movdqu %xmm5,(%r13) | |
2429 | |
2430 .Lxts_dec_ret: | |
2431 leaq (%rsp),%rax | |
2432 pxor %xmm0,%xmm0 | |
2433 .Lxts_dec_bzero: | |
2434 movdqa %xmm0,0(%rax) | |
2435 movdqa %xmm0,16(%rax) | |
2436 leaq 32(%rax),%rax | |
2437 cmpq %rax,%rbp | |
2438 ja .Lxts_dec_bzero | |
2439 | |
2440 leaq (%rbp),%rsp | |
2441 movq 72(%rsp),%r15 | |
2442 movq 80(%rsp),%r14 | |
2443 movq 88(%rsp),%r13 | |
2444 movq 96(%rsp),%r12 | |
2445 movq 104(%rsp),%rbx | |
2446 movq 112(%rsp),%rax | |
2447 leaq 120(%rsp),%rsp | |
2448 movq %rax,%rbp | |
2449 .Lxts_dec_epilogue: | |
2450 .byte 0xf3,0xc3 | |
2451 .size bsaes_xts_decrypt,.-bsaes_xts_decrypt | |
2452 .type _bsaes_const,@object | |
2453 .align 64 | |
2454 _bsaes_const: | |
2455 .LM0ISR: | |
2456 .quad 0x0a0e0206070b0f03, 0x0004080c0d010509 | |
2457 .LISRM0: | |
2458 .quad 0x01040b0e0205080f, 0x0306090c00070a0d | |
2459 .LISR: | |
2460 .quad 0x0504070602010003, 0x0f0e0d0c080b0a09 | |
2461 .LBS0: | |
2462 .quad 0x5555555555555555, 0x5555555555555555 | |
2463 .LBS1: | |
2464 .quad 0x3333333333333333, 0x3333333333333333 | |
2465 .LBS2: | |
2466 .quad 0x0f0f0f0f0f0f0f0f, 0x0f0f0f0f0f0f0f0f | |
2467 .LSR: | |
2468 .quad 0x0504070600030201, 0x0f0e0d0c0a09080b | |
2469 .LSRM0: | |
2470 .quad 0x0304090e00050a0f, 0x01060b0c0207080d | |
2471 .LM0SR: | |
2472 .quad 0x0a0e02060f03070b, 0x0004080c05090d01 | |
2473 .LSWPUP: | |
2474 .quad 0x0706050403020100, 0x0c0d0e0f0b0a0908 | |
2475 .LSWPUPM0SR: | |
2476 .quad 0x0a0d02060c03070b, 0x0004080f05090e01 | |
2477 .LADD1: | |
2478 .quad 0x0000000000000000, 0x0000000100000000 | |
2479 .LADD2: | |
2480 .quad 0x0000000000000000, 0x0000000200000000 | |
2481 .LADD3: | |
2482 .quad 0x0000000000000000, 0x0000000300000000 | |
2483 .LADD4: | |
2484 .quad 0x0000000000000000, 0x0000000400000000 | |
2485 .LADD5: | |
2486 .quad 0x0000000000000000, 0x0000000500000000 | |
2487 .LADD6: | |
2488 .quad 0x0000000000000000, 0x0000000600000000 | |
2489 .LADD7: | |
2490 .quad 0x0000000000000000, 0x0000000700000000 | |
2491 .LADD8: | |
2492 .quad 0x0000000000000000, 0x0000000800000000 | |
2493 .Lxts_magic: | |
2494 .long 0x87,0,1,0 | |
2495 .Lmasks: | |
2496 .quad 0x0101010101010101, 0x0101010101010101 | |
2497 .quad 0x0202020202020202, 0x0202020202020202 | |
2498 .quad 0x0404040404040404, 0x0404040404040404 | |
2499 .quad 0x0808080808080808, 0x0808080808080808 | |
2500 .LM0: | |
2501 .quad 0x02060a0e03070b0f, 0x0004080c0105090d | |
2502 .L63: | |
2503 .quad 0x6363636363636363, 0x6363636363636363 | |
2504 .byte 66,105,116,45,115,108,105,99,101,100,32,65,69,83,32,102,111,114,32,120,5
6,54,95,54,52,47,83,83,83,69,51,44,32,69,109,105,108,105,97,32,75,195,164,115,11
2,101,114,44,32,80,101,116,101,114,32,83,99,104,119,97,98,101,44,32,65,110,100,1
21,32,80,111,108,121,97,107,111,118,0 | |
2505 .align 64 | |
2506 .size _bsaes_const,.-_bsaes_const | |
2507 #endif | |
OLD | NEW |