1# This file is generated from a similarly-named Perl script in the BoringSSL
2# source tree. Do not edit by hand.
3
4#if defined(__has_feature)
5#if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM)
6#define OPENSSL_NO_ASM
7#endif
8#endif
9
10#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
11#if defined(BORINGSSL_PREFIX)
12#include <boringssl_prefix_symbols_asm.h>
13#endif
14.text
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31.type _vpaes_encrypt_core,@function
32.align 16
33_vpaes_encrypt_core:
34.cfi_startproc
35 movq %rdx,%r9
36 movq $16,%r11
37 movl 240(%rdx),%eax
38 movdqa %xmm9,%xmm1
39 movdqa .Lk_ipt(%rip),%xmm2
40 pandn %xmm0,%xmm1
41 movdqu (%r9),%xmm5
42 psrld $4,%xmm1
43 pand %xmm9,%xmm0
44.byte 102,15,56,0,208
45 movdqa .Lk_ipt+16(%rip),%xmm0
46.byte 102,15,56,0,193
47 pxor %xmm5,%xmm2
48 addq $16,%r9
49 pxor %xmm2,%xmm0
50 leaq .Lk_mc_backward(%rip),%r10
51 jmp .Lenc_entry
52
53.align 16
54.Lenc_loop:
55
56 movdqa %xmm13,%xmm4
57 movdqa %xmm12,%xmm0
58.byte 102,15,56,0,226
59.byte 102,15,56,0,195
60 pxor %xmm5,%xmm4
61 movdqa %xmm15,%xmm5
62 pxor %xmm4,%xmm0
63 movdqa -64(%r11,%r10,1),%xmm1
64.byte 102,15,56,0,234
65 movdqa (%r11,%r10,1),%xmm4
66 movdqa %xmm14,%xmm2
67.byte 102,15,56,0,211
68 movdqa %xmm0,%xmm3
69 pxor %xmm5,%xmm2
70.byte 102,15,56,0,193
71 addq $16,%r9
72 pxor %xmm2,%xmm0
73.byte 102,15,56,0,220
74 addq $16,%r11
75 pxor %xmm0,%xmm3
76.byte 102,15,56,0,193
77 andq $0x30,%r11
78 subq $1,%rax
79 pxor %xmm3,%xmm0
80
81.Lenc_entry:
82
83 movdqa %xmm9,%xmm1
84 movdqa %xmm11,%xmm5
85 pandn %xmm0,%xmm1
86 psrld $4,%xmm1
87 pand %xmm9,%xmm0
88.byte 102,15,56,0,232
89 movdqa %xmm10,%xmm3
90 pxor %xmm1,%xmm0
91.byte 102,15,56,0,217
92 movdqa %xmm10,%xmm4
93 pxor %xmm5,%xmm3
94.byte 102,15,56,0,224
95 movdqa %xmm10,%xmm2
96 pxor %xmm5,%xmm4
97.byte 102,15,56,0,211
98 movdqa %xmm10,%xmm3
99 pxor %xmm0,%xmm2
100.byte 102,15,56,0,220
101 movdqu (%r9),%xmm5
102 pxor %xmm1,%xmm3
103 jnz .Lenc_loop
104
105
106 movdqa -96(%r10),%xmm4
107 movdqa -80(%r10),%xmm0
108.byte 102,15,56,0,226
109 pxor %xmm5,%xmm4
110.byte 102,15,56,0,195
111 movdqa 64(%r11,%r10,1),%xmm1
112 pxor %xmm4,%xmm0
113.byte 102,15,56,0,193
114 .byte 0xf3,0xc3
115.cfi_endproc
116.size _vpaes_encrypt_core,.-_vpaes_encrypt_core
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147.type _vpaes_encrypt_core_2x,@function
148.align 16
149_vpaes_encrypt_core_2x:
150.cfi_startproc
151 movq %rdx,%r9
152 movq $16,%r11
153 movl 240(%rdx),%eax
154 movdqa %xmm9,%xmm1
155 movdqa %xmm9,%xmm7
156 movdqa .Lk_ipt(%rip),%xmm2
157 movdqa %xmm2,%xmm8
158 pandn %xmm0,%xmm1
159 pandn %xmm6,%xmm7
160 movdqu (%r9),%xmm5
161
162 psrld $4,%xmm1
163 psrld $4,%xmm7
164 pand %xmm9,%xmm0
165 pand %xmm9,%xmm6
166.byte 102,15,56,0,208
167.byte 102,68,15,56,0,198
168 movdqa .Lk_ipt+16(%rip),%xmm0
169 movdqa %xmm0,%xmm6
170.byte 102,15,56,0,193
171.byte 102,15,56,0,247
172 pxor %xmm5,%xmm2
173 pxor %xmm5,%xmm8
174 addq $16,%r9
175 pxor %xmm2,%xmm0
176 pxor %xmm8,%xmm6
177 leaq .Lk_mc_backward(%rip),%r10
178 jmp .Lenc2x_entry
179
180.align 16
181.Lenc2x_loop:
182
183 movdqa .Lk_sb1(%rip),%xmm4
184 movdqa .Lk_sb1+16(%rip),%xmm0
185 movdqa %xmm4,%xmm12
186 movdqa %xmm0,%xmm6
187.byte 102,15,56,0,226
188.byte 102,69,15,56,0,224
189.byte 102,15,56,0,195
190.byte 102,65,15,56,0,243
191 pxor %xmm5,%xmm4
192 pxor %xmm5,%xmm12
193 movdqa .Lk_sb2(%rip),%xmm5
194 movdqa %xmm5,%xmm13
195 pxor %xmm4,%xmm0
196 pxor %xmm12,%xmm6
197 movdqa -64(%r11,%r10,1),%xmm1
198
199.byte 102,15,56,0,234
200.byte 102,69,15,56,0,232
201 movdqa (%r11,%r10,1),%xmm4
202
203 movdqa .Lk_sb2+16(%rip),%xmm2
204 movdqa %xmm2,%xmm8
205.byte 102,15,56,0,211
206.byte 102,69,15,56,0,195
207 movdqa %xmm0,%xmm3
208 movdqa %xmm6,%xmm11
209 pxor %xmm5,%xmm2
210 pxor %xmm13,%xmm8
211.byte 102,15,56,0,193
212.byte 102,15,56,0,241
213 addq $16,%r9
214 pxor %xmm2,%xmm0
215 pxor %xmm8,%xmm6
216.byte 102,15,56,0,220
217.byte 102,68,15,56,0,220
218 addq $16,%r11
219 pxor %xmm0,%xmm3
220 pxor %xmm6,%xmm11
221.byte 102,15,56,0,193
222.byte 102,15,56,0,241
223 andq $0x30,%r11
224 subq $1,%rax
225 pxor %xmm3,%xmm0
226 pxor %xmm11,%xmm6
227
228.Lenc2x_entry:
229
230 movdqa %xmm9,%xmm1
231 movdqa %xmm9,%xmm7
232 movdqa .Lk_inv+16(%rip),%xmm5
233 movdqa %xmm5,%xmm13
234 pandn %xmm0,%xmm1
235 pandn %xmm6,%xmm7
236 psrld $4,%xmm1
237 psrld $4,%xmm7
238 pand %xmm9,%xmm0
239 pand %xmm9,%xmm6
240.byte 102,15,56,0,232
241.byte 102,68,15,56,0,238
242 movdqa %xmm10,%xmm3
243 movdqa %xmm10,%xmm11
244 pxor %xmm1,%xmm0
245 pxor %xmm7,%xmm6
246.byte 102,15,56,0,217
247.byte 102,68,15,56,0,223
248 movdqa %xmm10,%xmm4
249 movdqa %xmm10,%xmm12
250 pxor %xmm5,%xmm3
251 pxor %xmm13,%xmm11
252.byte 102,15,56,0,224
253.byte 102,68,15,56,0,230
254 movdqa %xmm10,%xmm2
255 movdqa %xmm10,%xmm8
256 pxor %xmm5,%xmm4
257 pxor %xmm13,%xmm12
258.byte 102,15,56,0,211
259.byte 102,69,15,56,0,195
260 movdqa %xmm10,%xmm3
261 movdqa %xmm10,%xmm11
262 pxor %xmm0,%xmm2
263 pxor %xmm6,%xmm8
264.byte 102,15,56,0,220
265.byte 102,69,15,56,0,220
266 movdqu (%r9),%xmm5
267
268 pxor %xmm1,%xmm3
269 pxor %xmm7,%xmm11
270 jnz .Lenc2x_loop
271
272
273 movdqa -96(%r10),%xmm4
274 movdqa -80(%r10),%xmm0
275 movdqa %xmm4,%xmm12
276 movdqa %xmm0,%xmm6
277.byte 102,15,56,0,226
278.byte 102,69,15,56,0,224
279 pxor %xmm5,%xmm4
280 pxor %xmm5,%xmm12
281.byte 102,15,56,0,195
282.byte 102,65,15,56,0,243
283 movdqa 64(%r11,%r10,1),%xmm1
284
285 pxor %xmm4,%xmm0
286 pxor %xmm12,%xmm6
287.byte 102,15,56,0,193
288.byte 102,15,56,0,241
289 .byte 0xf3,0xc3
290.cfi_endproc
291.size _vpaes_encrypt_core_2x,.-_vpaes_encrypt_core_2x
292
293
294
295
296
297
298.type _vpaes_decrypt_core,@function
299.align 16
300_vpaes_decrypt_core:
301.cfi_startproc
302 movq %rdx,%r9
303 movl 240(%rdx),%eax
304 movdqa %xmm9,%xmm1
305 movdqa .Lk_dipt(%rip),%xmm2
306 pandn %xmm0,%xmm1
307 movq %rax,%r11
308 psrld $4,%xmm1
309 movdqu (%r9),%xmm5
310 shlq $4,%r11
311 pand %xmm9,%xmm0
312.byte 102,15,56,0,208
313 movdqa .Lk_dipt+16(%rip),%xmm0
314 xorq $0x30,%r11
315 leaq .Lk_dsbd(%rip),%r10
316.byte 102,15,56,0,193
317 andq $0x30,%r11
318 pxor %xmm5,%xmm2
319 movdqa .Lk_mc_forward+48(%rip),%xmm5
320 pxor %xmm2,%xmm0
321 addq $16,%r9
322 addq %r10,%r11
323 jmp .Ldec_entry
324
325.align 16
326.Ldec_loop:
327
328
329
330 movdqa -32(%r10),%xmm4
331 movdqa -16(%r10),%xmm1
332.byte 102,15,56,0,226
333.byte 102,15,56,0,203
334 pxor %xmm4,%xmm0
335 movdqa 0(%r10),%xmm4
336 pxor %xmm1,%xmm0
337 movdqa 16(%r10),%xmm1
338
339.byte 102,15,56,0,226
340.byte 102,15,56,0,197
341.byte 102,15,56,0,203
342 pxor %xmm4,%xmm0
343 movdqa 32(%r10),%xmm4
344 pxor %xmm1,%xmm0
345 movdqa 48(%r10),%xmm1
346
347.byte 102,15,56,0,226
348.byte 102,15,56,0,197
349.byte 102,15,56,0,203
350 pxor %xmm4,%xmm0
351 movdqa 64(%r10),%xmm4
352 pxor %xmm1,%xmm0
353 movdqa 80(%r10),%xmm1
354
355.byte 102,15,56,0,226
356.byte 102,15,56,0,197
357.byte 102,15,56,0,203
358 pxor %xmm4,%xmm0
359 addq $16,%r9
360.byte 102,15,58,15,237,12
361 pxor %xmm1,%xmm0
362 subq $1,%rax
363
364.Ldec_entry:
365
366 movdqa %xmm9,%xmm1
367 pandn %xmm0,%xmm1
368 movdqa %xmm11,%xmm2
369 psrld $4,%xmm1
370 pand %xmm9,%xmm0
371.byte 102,15,56,0,208
372 movdqa %xmm10,%xmm3
373 pxor %xmm1,%xmm0
374.byte 102,15,56,0,217
375 movdqa %xmm10,%xmm4
376 pxor %xmm2,%xmm3
377.byte 102,15,56,0,224
378 pxor %xmm2,%xmm4
379 movdqa %xmm10,%xmm2
380.byte 102,15,56,0,211
381 movdqa %xmm10,%xmm3
382 pxor %xmm0,%xmm2
383.byte 102,15,56,0,220
384 movdqu (%r9),%xmm0
385 pxor %xmm1,%xmm3
386 jnz .Ldec_loop
387
388
389 movdqa 96(%r10),%xmm4
390.byte 102,15,56,0,226
391 pxor %xmm0,%xmm4
392 movdqa 112(%r10),%xmm0
393 movdqa -352(%r11),%xmm2
394.byte 102,15,56,0,195
395 pxor %xmm4,%xmm0
396.byte 102,15,56,0,194
397 .byte 0xf3,0xc3
398.cfi_endproc
399.size _vpaes_decrypt_core,.-_vpaes_decrypt_core
400
401
402
403
404
405
406.type _vpaes_schedule_core,@function
407.align 16
408_vpaes_schedule_core:
409.cfi_startproc
410
411
412
413
414
415 call _vpaes_preheat
416 movdqa .Lk_rcon(%rip),%xmm8
417 movdqu (%rdi),%xmm0
418
419
420 movdqa %xmm0,%xmm3
421 leaq .Lk_ipt(%rip),%r11
422 call _vpaes_schedule_transform
423 movdqa %xmm0,%xmm7
424
425 leaq .Lk_sr(%rip),%r10
426 testq %rcx,%rcx
427 jnz .Lschedule_am_decrypting
428
429
430 movdqu %xmm0,(%rdx)
431 jmp .Lschedule_go
432
433.Lschedule_am_decrypting:
434
435 movdqa (%r8,%r10,1),%xmm1
436.byte 102,15,56,0,217
437 movdqu %xmm3,(%rdx)
438 xorq $0x30,%r8
439
440.Lschedule_go:
441 cmpl $192,%esi
442 ja .Lschedule_256
443 je .Lschedule_192
444
445
446
447
448
449
450
451
452
453
454.Lschedule_128:
455 movl $10,%esi
456
457.Loop_schedule_128:
458 call _vpaes_schedule_round
459 decq %rsi
460 jz .Lschedule_mangle_last
461 call _vpaes_schedule_mangle
462 jmp .Loop_schedule_128
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479.align 16
480.Lschedule_192:
481 movdqu 8(%rdi),%xmm0
482 call _vpaes_schedule_transform
483 movdqa %xmm0,%xmm6
484 pxor %xmm4,%xmm4
485 movhlps %xmm4,%xmm6
486 movl $4,%esi
487
488.Loop_schedule_192:
489 call _vpaes_schedule_round
490.byte 102,15,58,15,198,8
491 call _vpaes_schedule_mangle
492 call _vpaes_schedule_192_smear
493 call _vpaes_schedule_mangle
494 call _vpaes_schedule_round
495 decq %rsi
496 jz .Lschedule_mangle_last
497 call _vpaes_schedule_mangle
498 call _vpaes_schedule_192_smear
499 jmp .Loop_schedule_192
500
501
502
503
504
505
506
507
508
509
510
511.align 16
512.Lschedule_256:
513 movdqu 16(%rdi),%xmm0
514 call _vpaes_schedule_transform
515 movl $7,%esi
516
517.Loop_schedule_256:
518 call _vpaes_schedule_mangle
519 movdqa %xmm0,%xmm6
520
521
522 call _vpaes_schedule_round
523 decq %rsi
524 jz .Lschedule_mangle_last
525 call _vpaes_schedule_mangle
526
527
528 pshufd $0xFF,%xmm0,%xmm0
529 movdqa %xmm7,%xmm5
530 movdqa %xmm6,%xmm7
531 call _vpaes_schedule_low_round
532 movdqa %xmm5,%xmm7
533
534 jmp .Loop_schedule_256
535
536
537
538
539
540
541
542
543
544
545
546
547.align 16
548.Lschedule_mangle_last:
549
550 leaq .Lk_deskew(%rip),%r11
551 testq %rcx,%rcx
552 jnz .Lschedule_mangle_last_dec
553
554
555 movdqa (%r8,%r10,1),%xmm1
556.byte 102,15,56,0,193
557 leaq .Lk_opt(%rip),%r11
558 addq $32,%rdx
559
560.Lschedule_mangle_last_dec:
561 addq $-16,%rdx
562 pxor .Lk_s63(%rip),%xmm0
563 call _vpaes_schedule_transform
564 movdqu %xmm0,(%rdx)
565
566
567 pxor %xmm0,%xmm0
568 pxor %xmm1,%xmm1
569 pxor %xmm2,%xmm2
570 pxor %xmm3,%xmm3
571 pxor %xmm4,%xmm4
572 pxor %xmm5,%xmm5
573 pxor %xmm6,%xmm6
574 pxor %xmm7,%xmm7
575 .byte 0xf3,0xc3
576.cfi_endproc
577.size _vpaes_schedule_core,.-_vpaes_schedule_core
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593.type _vpaes_schedule_192_smear,@function
594.align 16
595_vpaes_schedule_192_smear:
596.cfi_startproc
597 pshufd $0x80,%xmm6,%xmm1
598 pshufd $0xFE,%xmm7,%xmm0
599 pxor %xmm1,%xmm6
600 pxor %xmm1,%xmm1
601 pxor %xmm0,%xmm6
602 movdqa %xmm6,%xmm0
603 movhlps %xmm1,%xmm6
604 .byte 0xf3,0xc3
605.cfi_endproc
606.size _vpaes_schedule_192_smear,.-_vpaes_schedule_192_smear
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626.type _vpaes_schedule_round,@function
627.align 16
628_vpaes_schedule_round:
629.cfi_startproc
630
631 pxor %xmm1,%xmm1
632.byte 102,65,15,58,15,200,15
633.byte 102,69,15,58,15,192,15
634 pxor %xmm1,%xmm7
635
636
637 pshufd $0xFF,%xmm0,%xmm0
638.byte 102,15,58,15,192,1
639
640
641
642
643_vpaes_schedule_low_round:
644
645 movdqa %xmm7,%xmm1
646 pslldq $4,%xmm7
647 pxor %xmm1,%xmm7
648 movdqa %xmm7,%xmm1
649 pslldq $8,%xmm7
650 pxor %xmm1,%xmm7
651 pxor .Lk_s63(%rip),%xmm7
652
653
654 movdqa %xmm9,%xmm1
655 pandn %xmm0,%xmm1
656 psrld $4,%xmm1
657 pand %xmm9,%xmm0
658 movdqa %xmm11,%xmm2
659.byte 102,15,56,0,208
660 pxor %xmm1,%xmm0
661 movdqa %xmm10,%xmm3
662.byte 102,15,56,0,217
663 pxor %xmm2,%xmm3
664 movdqa %xmm10,%xmm4
665.byte 102,15,56,0,224
666 pxor %xmm2,%xmm4
667 movdqa %xmm10,%xmm2
668.byte 102,15,56,0,211
669 pxor %xmm0,%xmm2
670 movdqa %xmm10,%xmm3
671.byte 102,15,56,0,220
672 pxor %xmm1,%xmm3
673 movdqa %xmm13,%xmm4
674.byte 102,15,56,0,226
675 movdqa %xmm12,%xmm0
676.byte 102,15,56,0,195
677 pxor %xmm4,%xmm0
678
679
680 pxor %xmm7,%xmm0
681 movdqa %xmm0,%xmm7
682 .byte 0xf3,0xc3
683.cfi_endproc
684.size _vpaes_schedule_round,.-_vpaes_schedule_round
685
686
687
688
689
690
691
692
693
694
695.type _vpaes_schedule_transform,@function
696.align 16
697_vpaes_schedule_transform:
698.cfi_startproc
699 movdqa %xmm9,%xmm1
700 pandn %xmm0,%xmm1
701 psrld $4,%xmm1
702 pand %xmm9,%xmm0
703 movdqa (%r11),%xmm2
704.byte 102,15,56,0,208
705 movdqa 16(%r11),%xmm0
706.byte 102,15,56,0,193
707 pxor %xmm2,%xmm0
708 .byte 0xf3,0xc3
709.cfi_endproc
710.size _vpaes_schedule_transform,.-_vpaes_schedule_transform
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735.type _vpaes_schedule_mangle,@function
736.align 16
737_vpaes_schedule_mangle:
738.cfi_startproc
739 movdqa %xmm0,%xmm4
740 movdqa .Lk_mc_forward(%rip),%xmm5
741 testq %rcx,%rcx
742 jnz .Lschedule_mangle_dec
743
744
745 addq $16,%rdx
746 pxor .Lk_s63(%rip),%xmm4
747.byte 102,15,56,0,229
748 movdqa %xmm4,%xmm3
749.byte 102,15,56,0,229
750 pxor %xmm4,%xmm3
751.byte 102,15,56,0,229
752 pxor %xmm4,%xmm3
753
754 jmp .Lschedule_mangle_both
755.align 16
756.Lschedule_mangle_dec:
757
758 leaq .Lk_dksd(%rip),%r11
759 movdqa %xmm9,%xmm1
760 pandn %xmm4,%xmm1
761 psrld $4,%xmm1
762 pand %xmm9,%xmm4
763
764 movdqa 0(%r11),%xmm2
765.byte 102,15,56,0,212
766 movdqa 16(%r11),%xmm3
767.byte 102,15,56,0,217
768 pxor %xmm2,%xmm3
769.byte 102,15,56,0,221
770
771 movdqa 32(%r11),%xmm2
772.byte 102,15,56,0,212
773 pxor %xmm3,%xmm2
774 movdqa 48(%r11),%xmm3
775.byte 102,15,56,0,217
776 pxor %xmm2,%xmm3
777.byte 102,15,56,0,221
778
779 movdqa 64(%r11),%xmm2
780.byte 102,15,56,0,212
781 pxor %xmm3,%xmm2
782 movdqa 80(%r11),%xmm3
783.byte 102,15,56,0,217
784 pxor %xmm2,%xmm3
785.byte 102,15,56,0,221
786
787 movdqa 96(%r11),%xmm2
788.byte 102,15,56,0,212
789 pxor %xmm3,%xmm2
790 movdqa 112(%r11),%xmm3
791.byte 102,15,56,0,217
792 pxor %xmm2,%xmm3
793
794 addq $-16,%rdx
795
796.Lschedule_mangle_both:
797 movdqa (%r8,%r10,1),%xmm1
798.byte 102,15,56,0,217
799 addq $-16,%r8
800 andq $0x30,%r8
801 movdqu %xmm3,(%rdx)
802 .byte 0xf3,0xc3
803.cfi_endproc
804.size _vpaes_schedule_mangle,.-_vpaes_schedule_mangle
805
806
807
808
809.globl vpaes_set_encrypt_key
810.hidden vpaes_set_encrypt_key
811.type vpaes_set_encrypt_key,@function
812.align 16
813vpaes_set_encrypt_key:
814.cfi_startproc
815#ifndef NDEBUG
816#ifndef BORINGSSL_FIPS
817.extern BORINGSSL_function_hit
818.hidden BORINGSSL_function_hit
819 movb $1,BORINGSSL_function_hit+5(%rip)
820#endif
821#endif
822
823 movl %esi,%eax
824 shrl $5,%eax
825 addl $5,%eax
826 movl %eax,240(%rdx)
827
828 movl $0,%ecx
829 movl $0x30,%r8d
830 call _vpaes_schedule_core
831 xorl %eax,%eax
832 .byte 0xf3,0xc3
833.cfi_endproc
834.size vpaes_set_encrypt_key,.-vpaes_set_encrypt_key
835
836.globl vpaes_set_decrypt_key
837.hidden vpaes_set_decrypt_key
838.type vpaes_set_decrypt_key,@function
839.align 16
840vpaes_set_decrypt_key:
841.cfi_startproc
842 movl %esi,%eax
843 shrl $5,%eax
844 addl $5,%eax
845 movl %eax,240(%rdx)
846 shll $4,%eax
847 leaq 16(%rdx,%rax,1),%rdx
848
849 movl $1,%ecx
850 movl %esi,%r8d
851 shrl $1,%r8d
852 andl $32,%r8d
853 xorl $32,%r8d
854 call _vpaes_schedule_core
855 xorl %eax,%eax
856 .byte 0xf3,0xc3
857.cfi_endproc
858.size vpaes_set_decrypt_key,.-vpaes_set_decrypt_key
859
860.globl vpaes_encrypt
861.hidden vpaes_encrypt
862.type vpaes_encrypt,@function
863.align 16
864vpaes_encrypt:
865.cfi_startproc
866#ifndef NDEBUG
867#ifndef BORINGSSL_FIPS
868.extern BORINGSSL_function_hit
869.hidden BORINGSSL_function_hit
870 movb $1,BORINGSSL_function_hit+4(%rip)
871#endif
872#endif
873 movdqu (%rdi),%xmm0
874 call _vpaes_preheat
875 call _vpaes_encrypt_core
876 movdqu %xmm0,(%rsi)
877 .byte 0xf3,0xc3
878.cfi_endproc
879.size vpaes_encrypt,.-vpaes_encrypt
880
881.globl vpaes_decrypt
882.hidden vpaes_decrypt
883.type vpaes_decrypt,@function
884.align 16
885vpaes_decrypt:
886.cfi_startproc
887 movdqu (%rdi),%xmm0
888 call _vpaes_preheat
889 call _vpaes_decrypt_core
890 movdqu %xmm0,(%rsi)
891 .byte 0xf3,0xc3
892.cfi_endproc
893.size vpaes_decrypt,.-vpaes_decrypt
894.globl vpaes_cbc_encrypt
895.hidden vpaes_cbc_encrypt
896.type vpaes_cbc_encrypt,@function
897.align 16
898vpaes_cbc_encrypt:
899.cfi_startproc
900 xchgq %rcx,%rdx
901 subq $16,%rcx
902 jc .Lcbc_abort
903 movdqu (%r8),%xmm6
904 subq %rdi,%rsi
905 call _vpaes_preheat
906 cmpl $0,%r9d
907 je .Lcbc_dec_loop
908 jmp .Lcbc_enc_loop
909.align 16
910.Lcbc_enc_loop:
911 movdqu (%rdi),%xmm0
912 pxor %xmm6,%xmm0
913 call _vpaes_encrypt_core
914 movdqa %xmm0,%xmm6
915 movdqu %xmm0,(%rsi,%rdi,1)
916 leaq 16(%rdi),%rdi
917 subq $16,%rcx
918 jnc .Lcbc_enc_loop
919 jmp .Lcbc_done
920.align 16
921.Lcbc_dec_loop:
922 movdqu (%rdi),%xmm0
923 movdqa %xmm0,%xmm7
924 call _vpaes_decrypt_core
925 pxor %xmm6,%xmm0
926 movdqa %xmm7,%xmm6
927 movdqu %xmm0,(%rsi,%rdi,1)
928 leaq 16(%rdi),%rdi
929 subq $16,%rcx
930 jnc .Lcbc_dec_loop
931.Lcbc_done:
932 movdqu %xmm6,(%r8)
933.Lcbc_abort:
934 .byte 0xf3,0xc3
935.cfi_endproc
936.size vpaes_cbc_encrypt,.-vpaes_cbc_encrypt
937.globl vpaes_ctr32_encrypt_blocks
938.hidden vpaes_ctr32_encrypt_blocks
939.type vpaes_ctr32_encrypt_blocks,@function
940.align 16
941vpaes_ctr32_encrypt_blocks:
942.cfi_startproc
943
944 xchgq %rcx,%rdx
945 testq %rcx,%rcx
946 jz .Lctr32_abort
947 movdqu (%r8),%xmm0
948 movdqa .Lctr_add_one(%rip),%xmm8
949 subq %rdi,%rsi
950 call _vpaes_preheat
951 movdqa %xmm0,%xmm6
952 pshufb .Lrev_ctr(%rip),%xmm6
953
954 testq $1,%rcx
955 jz .Lctr32_prep_loop
956
957
958
959 movdqu (%rdi),%xmm7
960 call _vpaes_encrypt_core
961 pxor %xmm7,%xmm0
962 paddd %xmm8,%xmm6
963 movdqu %xmm0,(%rsi,%rdi,1)
964 subq $1,%rcx
965 leaq 16(%rdi),%rdi
966 jz .Lctr32_done
967
968.Lctr32_prep_loop:
969
970
971 movdqa %xmm6,%xmm14
972 movdqa %xmm6,%xmm15
973 paddd %xmm8,%xmm15
974
975.Lctr32_loop:
976 movdqa .Lrev_ctr(%rip),%xmm1
977 movdqa %xmm14,%xmm0
978 movdqa %xmm15,%xmm6
979.byte 102,15,56,0,193
980.byte 102,15,56,0,241
981 call _vpaes_encrypt_core_2x
982 movdqu (%rdi),%xmm1
983 movdqu 16(%rdi),%xmm2
984 movdqa .Lctr_add_two(%rip),%xmm3
985 pxor %xmm1,%xmm0
986 pxor %xmm2,%xmm6
987 paddd %xmm3,%xmm14
988 paddd %xmm3,%xmm15
989 movdqu %xmm0,(%rsi,%rdi,1)
990 movdqu %xmm6,16(%rsi,%rdi,1)
991 subq $2,%rcx
992 leaq 32(%rdi),%rdi
993 jnz .Lctr32_loop
994
995.Lctr32_done:
996.Lctr32_abort:
997 .byte 0xf3,0xc3
998.cfi_endproc
999.size vpaes_ctr32_encrypt_blocks,.-vpaes_ctr32_encrypt_blocks
1000
1001
1002
1003
1004
1005
1006.type _vpaes_preheat,@function
1007.align 16
1008_vpaes_preheat:
1009.cfi_startproc
1010 leaq .Lk_s0F(%rip),%r10
1011 movdqa -32(%r10),%xmm10
1012 movdqa -16(%r10),%xmm11
1013 movdqa 0(%r10),%xmm9
1014 movdqa 48(%r10),%xmm13
1015 movdqa 64(%r10),%xmm12
1016 movdqa 80(%r10),%xmm15
1017 movdqa 96(%r10),%xmm14
1018 .byte 0xf3,0xc3
1019.cfi_endproc
1020.size _vpaes_preheat,.-_vpaes_preheat
1021
1022
1023
1024
1025
1026.type _vpaes_consts,@object
1027.align 64
1028_vpaes_consts:
1029.Lk_inv:
1030.quad 0x0E05060F0D080180, 0x040703090A0B0C02
1031.quad 0x01040A060F0B0780, 0x030D0E0C02050809
1032
1033.Lk_s0F:
1034.quad 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F
1035
1036.Lk_ipt:
1037.quad 0xC2B2E8985A2A7000, 0xCABAE09052227808
1038.quad 0x4C01307D317C4D00, 0xCD80B1FCB0FDCC81
1039
1040.Lk_sb1:
1041.quad 0xB19BE18FCB503E00, 0xA5DF7A6E142AF544
1042.quad 0x3618D415FAE22300, 0x3BF7CCC10D2ED9EF
1043.Lk_sb2:
1044.quad 0xE27A93C60B712400, 0x5EB7E955BC982FCD
1045.quad 0x69EB88400AE12900, 0xC2A163C8AB82234A
1046.Lk_sbo:
1047.quad 0xD0D26D176FBDC700, 0x15AABF7AC502A878
1048.quad 0xCFE474A55FBB6A00, 0x8E1E90D1412B35FA
1049
1050.Lk_mc_forward:
1051.quad 0x0407060500030201, 0x0C0F0E0D080B0A09
1052.quad 0x080B0A0904070605, 0x000302010C0F0E0D
1053.quad 0x0C0F0E0D080B0A09, 0x0407060500030201
1054.quad 0x000302010C0F0E0D, 0x080B0A0904070605
1055
1056.Lk_mc_backward:
1057.quad 0x0605040702010003, 0x0E0D0C0F0A09080B
1058.quad 0x020100030E0D0C0F, 0x0A09080B06050407
1059.quad 0x0E0D0C0F0A09080B, 0x0605040702010003
1060.quad 0x0A09080B06050407, 0x020100030E0D0C0F
1061
1062.Lk_sr:
1063.quad 0x0706050403020100, 0x0F0E0D0C0B0A0908
1064.quad 0x030E09040F0A0500, 0x0B06010C07020D08
1065.quad 0x0F060D040B020900, 0x070E050C030A0108
1066.quad 0x0B0E0104070A0D00, 0x0306090C0F020508
1067
1068.Lk_rcon:
1069.quad 0x1F8391B9AF9DEEB6, 0x702A98084D7C7D81
1070
1071.Lk_s63:
1072.quad 0x5B5B5B5B5B5B5B5B, 0x5B5B5B5B5B5B5B5B
1073
1074.Lk_opt:
1075.quad 0xFF9F4929D6B66000, 0xF7974121DEBE6808
1076.quad 0x01EDBD5150BCEC00, 0xE10D5DB1B05C0CE0
1077
1078.Lk_deskew:
1079.quad 0x07E4A34047A4E300, 0x1DFEB95A5DBEF91A
1080.quad 0x5F36B5DC83EA6900, 0x2841C2ABF49D1E77
1081
1082
1083
1084
1085
1086.Lk_dksd:
1087.quad 0xFEB91A5DA3E44700, 0x0740E3A45A1DBEF9
1088.quad 0x41C277F4B5368300, 0x5FDC69EAAB289D1E
1089.Lk_dksb:
1090.quad 0x9A4FCA1F8550D500, 0x03D653861CC94C99
1091.quad 0x115BEDA7B6FC4A00, 0xD993256F7E3482C8
1092.Lk_dkse:
1093.quad 0xD5031CCA1FC9D600, 0x53859A4C994F5086
1094.quad 0xA23196054FDC7BE8, 0xCD5EF96A20B31487
1095.Lk_dks9:
1096.quad 0xB6116FC87ED9A700, 0x4AED933482255BFC
1097.quad 0x4576516227143300, 0x8BB89FACE9DAFDCE
1098
1099
1100
1101
1102
1103.Lk_dipt:
1104.quad 0x0F505B040B545F00, 0x154A411E114E451A
1105.quad 0x86E383E660056500, 0x12771772F491F194
1106
1107.Lk_dsb9:
1108.quad 0x851C03539A86D600, 0xCAD51F504F994CC9
1109.quad 0xC03B1789ECD74900, 0x725E2C9EB2FBA565
1110.Lk_dsbd:
1111.quad 0x7D57CCDFE6B1A200, 0xF56E9B13882A4439
1112.quad 0x3CE2FAF724C6CB00, 0x2931180D15DEEFD3
1113.Lk_dsbb:
1114.quad 0xD022649296B44200, 0x602646F6B0F2D404
1115.quad 0xC19498A6CD596700, 0xF3FF0C3E3255AA6B
1116.Lk_dsbe:
1117.quad 0x46F2929626D4D000, 0x2242600464B4F6B0
1118.quad 0x0C55A6CDFFAAC100, 0x9467F36B98593E32
1119.Lk_dsbo:
1120.quad 0x1387EA537EF94000, 0xC7AA6DB9D4943E2D
1121.quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C
1122
1123
1124.Lrev_ctr:
1125.quad 0x0706050403020100, 0x0c0d0e0f0b0a0908
1126
1127
1128.Lctr_add_one:
1129.quad 0x0000000000000000, 0x0000000100000000
1130.Lctr_add_two:
1131.quad 0x0000000000000000, 0x0000000200000000
1132
1133.byte 86,101,99,116,111,114,32,80,101,114,109,117,116,97,116,105,111,110,32,65,69,83,32,102,111,114,32,120,56,54,95,54,52,47,83,83,83,69,51,44,32,77,105,107,101,32,72,97,109,98,117,114,103,32,40,83,116,97,110,102,111,114,100,32,85,110,105,118,101,114,115,105,116,121,41,0
1134.align 64
1135.size _vpaes_consts,.-_vpaes_consts
1136#endif
1137