1 #include <machine/asm.h>
5 .long 218628480,235210255,168496130,67568393
6 .long 252381056,17041926,33884169,51187212
7 .long 252645135,252645135,252645135,252645135
8 .long 1512730624,3266504856,1377990664,3401244816
9 .long 830229760,1275146365,2969422977,3447763452
10 .long 3411033600,2979783055,338359620,2782886510
11 .long 4209124096,907596821,221174255,1006095553
12 .long 191964160,3799684038,3164090317,1589111125
13 .long 182528256,1777043520,2877432650,3265356744
14 .long 1874708224,3503451415,3305285752,363511674
15 .long 1606117888,3487855781,1093350906,2384367825
16 .long 197121,67569157,134941193,202313229
17 .long 67569157,134941193,202313229,197121
18 .long 134941193,202313229,197121,67569157
19 .long 202313229,197121,67569157,134941193
20 .long 33619971,100992007,168364043,235736079
21 .long 235736079,33619971,100992007,168364043
22 .long 168364043,235736079,33619971,100992007
23 .long 100992007,168364043,235736079,33619971
24 .long 50462976,117835012,185207048,252579084
25 .long 252314880,51251460,117574920,184942860
26 .long 184682752,252054788,50987272,118359308
27 .long 118099200,185467140,251790600,50727180
28 .long 2946363062,528716217,1300004225,1881839624
29 .long 1532713819,1532713819,1532713819,1532713819
30 .long 3602276352,4288629033,3737020424,4153884961
31 .long 1354558464,32357713,2958822624,3775749553
32 .long 1201988352,132424512,1572796698,503232858
33 .long 2213177600,1597421020,4103937655,675398315
34 .long 2749646592,4273543773,1511898873,121693092
35 .long 3040248576,1103263732,2871565598,1608280554
36 .long 2236667136,2588920351,482954393,64377734
37 .long 3069987328,291237287,2117370568,3650299247
38 .long 533321216,3573750986,2572112006,1401264716
39 .long 1339849704,2721158661,548607111,3445553514
40 .long 2128193280,3054596040,2183486460,1257083700
41 .long 655635200,1165381986,3923443150,2344132524
42 .long 190078720,256924420,290342170,357187870
43 .long 1610966272,2263057382,4103205268,309794674
44 .long 2592527872,2233205587,1335446729,3402964816
45 .long 3973531904,3225098121,3002836325,1918774430
46 .long 3870401024,2102906079,2284471353,4117666579
47 .long 617007872,1021508343,366931923,691083277
48 .long 2528395776,3491914898,2968704004,1613121270
49 .long 3445188352,3247741094,844474987,4093578302
50 .long 651481088,1190302358,1689581232,574775300
51 .long 4289380608,206939853,2555985458,2489840491
52 .long 2130264064,327674451,3566485037,3349835193
53 .long 2470714624,316102159,3636825756,3393945945
54 .byte 86,101,99,116,111,114,32,80,101,114,109,117,116,97,116,105
55 .byte 111,110,32,65,69,83,32,102,111,114,32,120,56,54,47,83
56 .byte 83,83,69,51,44,32,77,105,107,101,32,72,97,109,98,117
57 .byte 114,103,32,40,83,116,97,110,102,111,114,100,32,85,110,105
58 .byte 118,101,114,115,105,116,121,41,0
60 .type _vpaes_preheat,@function
64 movdqa -48(%ebp),%xmm7
65 movdqa -16(%ebp),%xmm6
67 .size _vpaes_preheat,.-_vpaes_preheat
68 .type _vpaes_encrypt_core,@function
97 movdqa -64(%ebx,%ecx,1),%xmm1
101 movdqa (%ebx,%ecx,1),%xmm4
103 .byte 102,15,56,0,193
106 .byte 102,15,56,0,220
109 .byte 102,15,56,0,193
118 movdqa -32(%ebp),%xmm5
119 .byte 102,15,56,0,232
122 .byte 102,15,56,0,217
125 .byte 102,15,56,0,224
128 .byte 102,15,56,0,211
132 .byte 102,15,56,0,220
135 movdqa 96(%ebp),%xmm4
136 movdqa 112(%ebp),%xmm0
137 .byte 102,15,56,0,226
139 .byte 102,15,56,0,195
140 movdqa 64(%ebx,%ecx,1),%xmm1
142 .byte 102,15,56,0,193
144 .size _vpaes_encrypt_core,.-_vpaes_encrypt_core
145 .type _vpaes_decrypt_core,@function
151 movdqa -64(%ebx),%xmm2
158 .byte 102,15,56,0,208
159 movdqa -48(%ebx),%xmm0
161 .byte 102,15,56,0,193
164 movdqa 176(%ebp),%xmm5
167 leal -352(%ebx,%ecx,1),%ecx
171 movdqa -32(%ebx),%xmm4
172 .byte 102,15,56,0,226
174 movdqa -16(%ebx),%xmm0
175 .byte 102,15,56,0,195
178 .byte 102,15,56,0,197
180 .byte 102,15,56,0,226
182 movdqa 16(%ebx),%xmm0
183 .byte 102,15,56,0,195
186 .byte 102,15,56,0,197
187 movdqa 32(%ebx),%xmm4
188 .byte 102,15,56,0,226
190 movdqa 48(%ebx),%xmm0
191 .byte 102,15,56,0,195
193 .byte 102,15,56,0,197
194 movdqa 64(%ebx),%xmm4
195 .byte 102,15,56,0,226
197 movdqa 80(%ebx),%xmm0
198 .byte 102,15,56,0,195
200 .byte 102,15,58,15,237,12
206 movdqa -32(%ebp),%xmm2
207 .byte 102,15,56,0,208
210 .byte 102,15,56,0,217
213 .byte 102,15,56,0,224
216 .byte 102,15,56,0,211
219 .byte 102,15,56,0,220
223 movdqa 96(%ebx),%xmm4
224 .byte 102,15,56,0,226
226 movdqa 112(%ebx),%xmm0
228 .byte 102,15,56,0,195
230 .byte 102,15,56,0,194
232 .size _vpaes_decrypt_core,.-_vpaes_decrypt_core
233 .type _vpaes_schedule_core,@function
235 _vpaes_schedule_core:
238 movdqa 320(%ebp),%xmm2
242 call _vpaes_schedule_transform
245 jnz .L004schedule_am_decrypting
248 .L004schedule_am_decrypting:
249 movdqa 256(%ebp,%ecx,1),%xmm1
250 .byte 102,15,56,0,217
259 .L009loop_schedule_128:
260 call _vpaes_schedule_round
262 jz .L010schedule_mangle_last
263 call _vpaes_schedule_mangle
264 jmp .L009loop_schedule_128
268 call _vpaes_schedule_transform
273 .L011loop_schedule_192:
274 call _vpaes_schedule_round
275 .byte 102,15,58,15,198,8
276 call _vpaes_schedule_mangle
277 call _vpaes_schedule_192_smear
278 call _vpaes_schedule_mangle
279 call _vpaes_schedule_round
281 jz .L010schedule_mangle_last
282 call _vpaes_schedule_mangle
283 call _vpaes_schedule_192_smear
284 jmp .L011loop_schedule_192
287 movdqu 16(%esi),%xmm0
288 call _vpaes_schedule_transform
290 .L012loop_schedule_256:
291 call _vpaes_schedule_mangle
293 call _vpaes_schedule_round
295 jz .L010schedule_mangle_last
296 call _vpaes_schedule_mangle
297 pshufd $255,%xmm0,%xmm0
298 movdqa %xmm7,20(%esp)
300 call .L_vpaes_schedule_low_round
301 movdqa 20(%esp),%xmm7
302 jmp .L012loop_schedule_256
304 .L010schedule_mangle_last:
307 jnz .L013schedule_mangle_last_dec
308 movdqa 256(%ebp,%ecx,1),%xmm1
309 .byte 102,15,56,0,193
312 .L013schedule_mangle_last_dec:
315 call _vpaes_schedule_transform
326 .size _vpaes_schedule_core,.-_vpaes_schedule_core
327 .type _vpaes_schedule_192_smear,@function
329 _vpaes_schedule_192_smear:
330 pshufd $128,%xmm6,%xmm0
332 pshufd $254,%xmm7,%xmm0
338 .size _vpaes_schedule_192_smear,.-_vpaes_schedule_192_smear
339 .type _vpaes_schedule_round,@function
341 _vpaes_schedule_round:
344 .byte 102,15,58,15,202,15
345 .byte 102,15,58,15,210,15
347 pshufd $255,%xmm0,%xmm0
348 .byte 102,15,58,15,192,1
350 .L_vpaes_schedule_low_round:
358 movdqa -16(%ebp),%xmm4
359 movdqa -48(%ebp),%xmm5
364 movdqa -32(%ebp),%xmm2
365 .byte 102,15,56,0,208
368 .byte 102,15,56,0,217
371 .byte 102,15,56,0,224
374 .byte 102,15,56,0,211
377 .byte 102,15,56,0,220
379 movdqa 32(%ebp),%xmm4
380 .byte 102,15,56,0,226
381 movdqa 48(%ebp),%xmm0
382 .byte 102,15,56,0,195
387 .size _vpaes_schedule_round,.-_vpaes_schedule_round
388 .type _vpaes_schedule_transform,@function
390 _vpaes_schedule_transform:
391 movdqa -16(%ebp),%xmm2
397 .byte 102,15,56,0,208
398 movdqa 16(%ebx),%xmm0
399 .byte 102,15,56,0,193
402 .size _vpaes_schedule_transform,.-_vpaes_schedule_transform
403 .type _vpaes_schedule_mangle,@function
405 _vpaes_schedule_mangle:
407 movdqa 128(%ebp),%xmm5
409 jnz .L014schedule_mangle_dec
412 .byte 102,15,56,0,229
414 .byte 102,15,56,0,229
416 .byte 102,15,56,0,229
418 jmp .L015schedule_mangle_both
420 .L014schedule_mangle_dec:
421 movdqa -16(%ebp),%xmm2
428 .byte 102,15,56,0,212
429 movdqa 16(%esi),%xmm3
430 .byte 102,15,56,0,217
432 .byte 102,15,56,0,221
433 movdqa 32(%esi),%xmm2
434 .byte 102,15,56,0,212
436 movdqa 48(%esi),%xmm3
437 .byte 102,15,56,0,217
439 .byte 102,15,56,0,221
440 movdqa 64(%esi),%xmm2
441 .byte 102,15,56,0,212
443 movdqa 80(%esi),%xmm3
444 .byte 102,15,56,0,217
446 .byte 102,15,56,0,221
447 movdqa 96(%esi),%xmm2
448 .byte 102,15,56,0,212
450 movdqa 112(%esi),%xmm3
451 .byte 102,15,56,0,217
454 .L015schedule_mangle_both:
455 movdqa 256(%ebp,%ecx,1),%xmm1
456 .byte 102,15,56,0,217
461 .size _vpaes_schedule_mangle,.-_vpaes_schedule_mangle
462 .globl vpaes_set_encrypt_key
463 .type vpaes_set_encrypt_key,@function
465 vpaes_set_encrypt_key:
466 .L_vpaes_set_encrypt_key_begin:
484 leal .L_vpaes_consts+0x30-.L016pic_point,%ebp
485 call _vpaes_schedule_core
494 .size vpaes_set_encrypt_key,.-.L_vpaes_set_encrypt_key_begin
495 .globl vpaes_set_decrypt_key
496 .type vpaes_set_decrypt_key,@function
498 vpaes_set_decrypt_key:
499 .L_vpaes_set_decrypt_key_begin:
516 leal 16(%edx,%ebx,1),%edx
522 leal .L_vpaes_consts+0x30-.L017pic_point,%ebp
523 call _vpaes_schedule_core
532 .size vpaes_set_decrypt_key,.-.L_vpaes_set_decrypt_key_begin
534 .type vpaes_encrypt,@function
537 .L_vpaes_encrypt_begin:
542 leal .L_vpaes_consts+0x30-.L018pic_point,%ebp
553 call _vpaes_encrypt_core
561 .size vpaes_encrypt,.-.L_vpaes_encrypt_begin
563 .type vpaes_decrypt,@function
566 .L_vpaes_decrypt_begin:
571 leal .L_vpaes_consts+0x30-.L019pic_point,%ebp
582 call _vpaes_decrypt_core
590 .size vpaes_decrypt,.-.L_vpaes_decrypt_begin
591 .globl vpaes_cbc_encrypt
592 .type vpaes_cbc_encrypt,@function
595 .L_vpaes_cbc_encrypt_begin:
618 leal .L_vpaes_consts+0x30-.L021pic_point,%ebp
623 jmp .L023cbc_enc_loop
628 call _vpaes_encrypt_core
632 movdqu %xmm0,(%ebx,%esi,1)
635 jnc .L023cbc_enc_loop
640 movdqa %xmm1,16(%esp)
641 movdqa %xmm0,32(%esp)
642 call _vpaes_decrypt_core
646 movdqa 32(%esp),%xmm1
647 movdqu %xmm0,(%ebx,%esi,1)
650 jnc .L022cbc_dec_loop
661 .size vpaes_cbc_encrypt,.-.L_vpaes_cbc_encrypt_begin