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