VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1j/crypto/genasm-nasm/vpaes-x86.S@ 88461

Last change on this file since 88461 was 83531, checked in by vboxsync, 5 years ago

setting svn:sync-process=export for openssl-1.1.1f, all files except tests

File size: 13.0 KB
Line 
1%ifidn __OUTPUT_FORMAT__,obj
2section code use32 class=code align=64
3%elifidn __OUTPUT_FORMAT__,win32
4section .text code align=64
5%else
6section .text code
7%endif
8align 64
9L$_vpaes_consts:
10dd 218628480,235210255,168496130,67568393
11dd 252381056,17041926,33884169,51187212
12dd 252645135,252645135,252645135,252645135
13dd 1512730624,3266504856,1377990664,3401244816
14dd 830229760,1275146365,2969422977,3447763452
15dd 3411033600,2979783055,338359620,2782886510
16dd 4209124096,907596821,221174255,1006095553
17dd 191964160,3799684038,3164090317,1589111125
18dd 182528256,1777043520,2877432650,3265356744
19dd 1874708224,3503451415,3305285752,363511674
20dd 1606117888,3487855781,1093350906,2384367825
21dd 197121,67569157,134941193,202313229
22dd 67569157,134941193,202313229,197121
23dd 134941193,202313229,197121,67569157
24dd 202313229,197121,67569157,134941193
25dd 33619971,100992007,168364043,235736079
26dd 235736079,33619971,100992007,168364043
27dd 168364043,235736079,33619971,100992007
28dd 100992007,168364043,235736079,33619971
29dd 50462976,117835012,185207048,252579084
30dd 252314880,51251460,117574920,184942860
31dd 184682752,252054788,50987272,118359308
32dd 118099200,185467140,251790600,50727180
33dd 2946363062,528716217,1300004225,1881839624
34dd 1532713819,1532713819,1532713819,1532713819
35dd 3602276352,4288629033,3737020424,4153884961
36dd 1354558464,32357713,2958822624,3775749553
37dd 1201988352,132424512,1572796698,503232858
38dd 2213177600,1597421020,4103937655,675398315
39dd 2749646592,4273543773,1511898873,121693092
40dd 3040248576,1103263732,2871565598,1608280554
41dd 2236667136,2588920351,482954393,64377734
42dd 3069987328,291237287,2117370568,3650299247
43dd 533321216,3573750986,2572112006,1401264716
44dd 1339849704,2721158661,548607111,3445553514
45dd 2128193280,3054596040,2183486460,1257083700
46dd 655635200,1165381986,3923443150,2344132524
47dd 190078720,256924420,290342170,357187870
48dd 1610966272,2263057382,4103205268,309794674
49dd 2592527872,2233205587,1335446729,3402964816
50dd 3973531904,3225098121,3002836325,1918774430
51dd 3870401024,2102906079,2284471353,4117666579
52dd 617007872,1021508343,366931923,691083277
53dd 2528395776,3491914898,2968704004,1613121270
54dd 3445188352,3247741094,844474987,4093578302
55dd 651481088,1190302358,1689581232,574775300
56dd 4289380608,206939853,2555985458,2489840491
57dd 2130264064,327674451,3566485037,3349835193
58dd 2470714624,316102159,3636825756,3393945945
59db 86,101,99,116,111,114,32,80,101,114,109,117,116,97,116,105
60db 111,110,32,65,69,83,32,102,111,114,32,120,56,54,47,83
61db 83,83,69,51,44,32,77,105,107,101,32,72,97,109,98,117
62db 114,103,32,40,83,116,97,110,102,111,114,100,32,85,110,105
63db 118,101,114,115,105,116,121,41,0
64align 64
65align 16
66__vpaes_preheat:
67 add ebp,DWORD [esp]
68 movdqa xmm7,[ebp-48]
69 movdqa xmm6,[ebp-16]
70 ret
71align 16
72__vpaes_encrypt_core:
73 mov ecx,16
74 mov eax,DWORD [240+edx]
75 movdqa xmm1,xmm6
76 movdqa xmm2,[ebp]
77 pandn xmm1,xmm0
78 pand xmm0,xmm6
79 movdqu xmm5,[edx]
80db 102,15,56,0,208
81 movdqa xmm0,[16+ebp]
82 pxor xmm2,xmm5
83 psrld xmm1,4
84 add edx,16
85db 102,15,56,0,193
86 lea ebx,[192+ebp]
87 pxor xmm0,xmm2
88 jmp NEAR L$000enc_entry
89align 16
90L$001enc_loop:
91 movdqa xmm4,[32+ebp]
92 movdqa xmm0,[48+ebp]
93db 102,15,56,0,226
94db 102,15,56,0,195
95 pxor xmm4,xmm5
96 movdqa xmm5,[64+ebp]
97 pxor xmm0,xmm4
98 movdqa xmm1,[ecx*1+ebx-64]
99db 102,15,56,0,234
100 movdqa xmm2,[80+ebp]
101 movdqa xmm4,[ecx*1+ebx]
102db 102,15,56,0,211
103 movdqa xmm3,xmm0
104 pxor xmm2,xmm5
105db 102,15,56,0,193
106 add edx,16
107 pxor xmm0,xmm2
108db 102,15,56,0,220
109 add ecx,16
110 pxor xmm3,xmm0
111db 102,15,56,0,193
112 and ecx,48
113 sub eax,1
114 pxor xmm0,xmm3
115L$000enc_entry:
116 movdqa xmm1,xmm6
117 movdqa xmm5,[ebp-32]
118 pandn xmm1,xmm0
119 psrld xmm1,4
120 pand xmm0,xmm6
121db 102,15,56,0,232
122 movdqa xmm3,xmm7
123 pxor xmm0,xmm1
124db 102,15,56,0,217
125 movdqa xmm4,xmm7
126 pxor xmm3,xmm5
127db 102,15,56,0,224
128 movdqa xmm2,xmm7
129 pxor xmm4,xmm5
130db 102,15,56,0,211
131 movdqa xmm3,xmm7
132 pxor xmm2,xmm0
133db 102,15,56,0,220
134 movdqu xmm5,[edx]
135 pxor xmm3,xmm1
136 jnz NEAR L$001enc_loop
137 movdqa xmm4,[96+ebp]
138 movdqa xmm0,[112+ebp]
139db 102,15,56,0,226
140 pxor xmm4,xmm5
141db 102,15,56,0,195
142 movdqa xmm1,[64+ecx*1+ebx]
143 pxor xmm0,xmm4
144db 102,15,56,0,193
145 ret
146align 16
147__vpaes_decrypt_core:
148 lea ebx,[608+ebp]
149 mov eax,DWORD [240+edx]
150 movdqa xmm1,xmm6
151 movdqa xmm2,[ebx-64]
152 pandn xmm1,xmm0
153 mov ecx,eax
154 psrld xmm1,4
155 movdqu xmm5,[edx]
156 shl ecx,4
157 pand xmm0,xmm6
158db 102,15,56,0,208
159 movdqa xmm0,[ebx-48]
160 xor ecx,48
161db 102,15,56,0,193
162 and ecx,48
163 pxor xmm2,xmm5
164 movdqa xmm5,[176+ebp]
165 pxor xmm0,xmm2
166 add edx,16
167 lea ecx,[ecx*1+ebx-352]
168 jmp NEAR L$002dec_entry
169align 16
170L$003dec_loop:
171 movdqa xmm4,[ebx-32]
172 movdqa xmm1,[ebx-16]
173db 102,15,56,0,226
174db 102,15,56,0,203
175 pxor xmm0,xmm4
176 movdqa xmm4,[ebx]
177 pxor xmm0,xmm1
178 movdqa xmm1,[16+ebx]
179db 102,15,56,0,226
180db 102,15,56,0,197
181db 102,15,56,0,203
182 pxor xmm0,xmm4
183 movdqa xmm4,[32+ebx]
184 pxor xmm0,xmm1
185 movdqa xmm1,[48+ebx]
186db 102,15,56,0,226
187db 102,15,56,0,197
188db 102,15,56,0,203
189 pxor xmm0,xmm4
190 movdqa xmm4,[64+ebx]
191 pxor xmm0,xmm1
192 movdqa xmm1,[80+ebx]
193db 102,15,56,0,226
194db 102,15,56,0,197
195db 102,15,56,0,203
196 pxor xmm0,xmm4
197 add edx,16
198db 102,15,58,15,237,12
199 pxor xmm0,xmm1
200 sub eax,1
201L$002dec_entry:
202 movdqa xmm1,xmm6
203 movdqa xmm2,[ebp-32]
204 pandn xmm1,xmm0
205 pand xmm0,xmm6
206 psrld xmm1,4
207db 102,15,56,0,208
208 movdqa xmm3,xmm7
209 pxor xmm0,xmm1
210db 102,15,56,0,217
211 movdqa xmm4,xmm7
212 pxor xmm3,xmm2
213db 102,15,56,0,224
214 pxor xmm4,xmm2
215 movdqa xmm2,xmm7
216db 102,15,56,0,211
217 movdqa xmm3,xmm7
218 pxor xmm2,xmm0
219db 102,15,56,0,220
220 movdqu xmm0,[edx]
221 pxor xmm3,xmm1
222 jnz NEAR L$003dec_loop
223 movdqa xmm4,[96+ebx]
224db 102,15,56,0,226
225 pxor xmm4,xmm0
226 movdqa xmm0,[112+ebx]
227 movdqa xmm2,[ecx]
228db 102,15,56,0,195
229 pxor xmm0,xmm4
230db 102,15,56,0,194
231 ret
232align 16
233__vpaes_schedule_core:
234 add ebp,DWORD [esp]
235 movdqu xmm0,[esi]
236 movdqa xmm2,[320+ebp]
237 movdqa xmm3,xmm0
238 lea ebx,[ebp]
239 movdqa [4+esp],xmm2
240 call __vpaes_schedule_transform
241 movdqa xmm7,xmm0
242 test edi,edi
243 jnz NEAR L$004schedule_am_decrypting
244 movdqu [edx],xmm0
245 jmp NEAR L$005schedule_go
246L$004schedule_am_decrypting:
247 movdqa xmm1,[256+ecx*1+ebp]
248db 102,15,56,0,217
249 movdqu [edx],xmm3
250 xor ecx,48
251L$005schedule_go:
252 cmp eax,192
253 ja NEAR L$006schedule_256
254 je NEAR L$007schedule_192
255L$008schedule_128:
256 mov eax,10
257L$009loop_schedule_128:
258 call __vpaes_schedule_round
259 dec eax
260 jz NEAR L$010schedule_mangle_last
261 call __vpaes_schedule_mangle
262 jmp NEAR L$009loop_schedule_128
263align 16
264L$007schedule_192:
265 movdqu xmm0,[8+esi]
266 call __vpaes_schedule_transform
267 movdqa xmm6,xmm0
268 pxor xmm4,xmm4
269 movhlps xmm6,xmm4
270 mov eax,4
271L$011loop_schedule_192:
272 call __vpaes_schedule_round
273db 102,15,58,15,198,8
274 call __vpaes_schedule_mangle
275 call __vpaes_schedule_192_smear
276 call __vpaes_schedule_mangle
277 call __vpaes_schedule_round
278 dec eax
279 jz NEAR L$010schedule_mangle_last
280 call __vpaes_schedule_mangle
281 call __vpaes_schedule_192_smear
282 jmp NEAR L$011loop_schedule_192
283align 16
284L$006schedule_256:
285 movdqu xmm0,[16+esi]
286 call __vpaes_schedule_transform
287 mov eax,7
288L$012loop_schedule_256:
289 call __vpaes_schedule_mangle
290 movdqa xmm6,xmm0
291 call __vpaes_schedule_round
292 dec eax
293 jz NEAR L$010schedule_mangle_last
294 call __vpaes_schedule_mangle
295 pshufd xmm0,xmm0,255
296 movdqa [20+esp],xmm7
297 movdqa xmm7,xmm6
298 call L$_vpaes_schedule_low_round
299 movdqa xmm7,[20+esp]
300 jmp NEAR L$012loop_schedule_256
301align 16
302L$010schedule_mangle_last:
303 lea ebx,[384+ebp]
304 test edi,edi
305 jnz NEAR L$013schedule_mangle_last_dec
306 movdqa xmm1,[256+ecx*1+ebp]
307db 102,15,56,0,193
308 lea ebx,[352+ebp]
309 add edx,32
310L$013schedule_mangle_last_dec:
311 add edx,-16
312 pxor xmm0,[336+ebp]
313 call __vpaes_schedule_transform
314 movdqu [edx],xmm0
315 pxor xmm0,xmm0
316 pxor xmm1,xmm1
317 pxor xmm2,xmm2
318 pxor xmm3,xmm3
319 pxor xmm4,xmm4
320 pxor xmm5,xmm5
321 pxor xmm6,xmm6
322 pxor xmm7,xmm7
323 ret
324align 16
325__vpaes_schedule_192_smear:
326 pshufd xmm1,xmm6,128
327 pshufd xmm0,xmm7,254
328 pxor xmm6,xmm1
329 pxor xmm1,xmm1
330 pxor xmm6,xmm0
331 movdqa xmm0,xmm6
332 movhlps xmm6,xmm1
333 ret
334align 16
335__vpaes_schedule_round:
336 movdqa xmm2,[8+esp]
337 pxor xmm1,xmm1
338db 102,15,58,15,202,15
339db 102,15,58,15,210,15
340 pxor xmm7,xmm1
341 pshufd xmm0,xmm0,255
342db 102,15,58,15,192,1
343 movdqa [8+esp],xmm2
344L$_vpaes_schedule_low_round:
345 movdqa xmm1,xmm7
346 pslldq xmm7,4
347 pxor xmm7,xmm1
348 movdqa xmm1,xmm7
349 pslldq xmm7,8
350 pxor xmm7,xmm1
351 pxor xmm7,[336+ebp]
352 movdqa xmm4,[ebp-16]
353 movdqa xmm5,[ebp-48]
354 movdqa xmm1,xmm4
355 pandn xmm1,xmm0
356 psrld xmm1,4
357 pand xmm0,xmm4
358 movdqa xmm2,[ebp-32]
359db 102,15,56,0,208
360 pxor xmm0,xmm1
361 movdqa xmm3,xmm5
362db 102,15,56,0,217
363 pxor xmm3,xmm2
364 movdqa xmm4,xmm5
365db 102,15,56,0,224
366 pxor xmm4,xmm2
367 movdqa xmm2,xmm5
368db 102,15,56,0,211
369 pxor xmm2,xmm0
370 movdqa xmm3,xmm5
371db 102,15,56,0,220
372 pxor xmm3,xmm1
373 movdqa xmm4,[32+ebp]
374db 102,15,56,0,226
375 movdqa xmm0,[48+ebp]
376db 102,15,56,0,195
377 pxor xmm0,xmm4
378 pxor xmm0,xmm7
379 movdqa xmm7,xmm0
380 ret
381align 16
382__vpaes_schedule_transform:
383 movdqa xmm2,[ebp-16]
384 movdqa xmm1,xmm2
385 pandn xmm1,xmm0
386 psrld xmm1,4
387 pand xmm0,xmm2
388 movdqa xmm2,[ebx]
389db 102,15,56,0,208
390 movdqa xmm0,[16+ebx]
391db 102,15,56,0,193
392 pxor xmm0,xmm2
393 ret
394align 16
395__vpaes_schedule_mangle:
396 movdqa xmm4,xmm0
397 movdqa xmm5,[128+ebp]
398 test edi,edi
399 jnz NEAR L$014schedule_mangle_dec
400 add edx,16
401 pxor xmm4,[336+ebp]
402db 102,15,56,0,229
403 movdqa xmm3,xmm4
404db 102,15,56,0,229
405 pxor xmm3,xmm4
406db 102,15,56,0,229
407 pxor xmm3,xmm4
408 jmp NEAR L$015schedule_mangle_both
409align 16
410L$014schedule_mangle_dec:
411 movdqa xmm2,[ebp-16]
412 lea esi,[416+ebp]
413 movdqa xmm1,xmm2
414 pandn xmm1,xmm4
415 psrld xmm1,4
416 pand xmm4,xmm2
417 movdqa xmm2,[esi]
418db 102,15,56,0,212
419 movdqa xmm3,[16+esi]
420db 102,15,56,0,217
421 pxor xmm3,xmm2
422db 102,15,56,0,221
423 movdqa xmm2,[32+esi]
424db 102,15,56,0,212
425 pxor xmm2,xmm3
426 movdqa xmm3,[48+esi]
427db 102,15,56,0,217
428 pxor xmm3,xmm2
429db 102,15,56,0,221
430 movdqa xmm2,[64+esi]
431db 102,15,56,0,212
432 pxor xmm2,xmm3
433 movdqa xmm3,[80+esi]
434db 102,15,56,0,217
435 pxor xmm3,xmm2
436db 102,15,56,0,221
437 movdqa xmm2,[96+esi]
438db 102,15,56,0,212
439 pxor xmm2,xmm3
440 movdqa xmm3,[112+esi]
441db 102,15,56,0,217
442 pxor xmm3,xmm2
443 add edx,-16
444L$015schedule_mangle_both:
445 movdqa xmm1,[256+ecx*1+ebp]
446db 102,15,56,0,217
447 add ecx,-16
448 and ecx,48
449 movdqu [edx],xmm3
450 ret
451global _vpaes_set_encrypt_key
452align 16
453_vpaes_set_encrypt_key:
454L$_vpaes_set_encrypt_key_begin:
455 push ebp
456 push ebx
457 push esi
458 push edi
459 mov esi,DWORD [20+esp]
460 lea ebx,[esp-56]
461 mov eax,DWORD [24+esp]
462 and ebx,-16
463 mov edx,DWORD [28+esp]
464 xchg ebx,esp
465 mov DWORD [48+esp],ebx
466 mov ebx,eax
467 shr ebx,5
468 add ebx,5
469 mov DWORD [240+edx],ebx
470 mov ecx,48
471 mov edi,0
472 lea ebp,[(L$_vpaes_consts+0x30-L$016pic_point)]
473 call __vpaes_schedule_core
474L$016pic_point:
475 mov esp,DWORD [48+esp]
476 xor eax,eax
477 pop edi
478 pop esi
479 pop ebx
480 pop ebp
481 ret
482global _vpaes_set_decrypt_key
483align 16
484_vpaes_set_decrypt_key:
485L$_vpaes_set_decrypt_key_begin:
486 push ebp
487 push ebx
488 push esi
489 push edi
490 mov esi,DWORD [20+esp]
491 lea ebx,[esp-56]
492 mov eax,DWORD [24+esp]
493 and ebx,-16
494 mov edx,DWORD [28+esp]
495 xchg ebx,esp
496 mov DWORD [48+esp],ebx
497 mov ebx,eax
498 shr ebx,5
499 add ebx,5
500 mov DWORD [240+edx],ebx
501 shl ebx,4
502 lea edx,[16+ebx*1+edx]
503 mov edi,1
504 mov ecx,eax
505 shr ecx,1
506 and ecx,32
507 xor ecx,32
508 lea ebp,[(L$_vpaes_consts+0x30-L$017pic_point)]
509 call __vpaes_schedule_core
510L$017pic_point:
511 mov esp,DWORD [48+esp]
512 xor eax,eax
513 pop edi
514 pop esi
515 pop ebx
516 pop ebp
517 ret
518global _vpaes_encrypt
519align 16
520_vpaes_encrypt:
521L$_vpaes_encrypt_begin:
522 push ebp
523 push ebx
524 push esi
525 push edi
526 lea ebp,[(L$_vpaes_consts+0x30-L$018pic_point)]
527 call __vpaes_preheat
528L$018pic_point:
529 mov esi,DWORD [20+esp]
530 lea ebx,[esp-56]
531 mov edi,DWORD [24+esp]
532 and ebx,-16
533 mov edx,DWORD [28+esp]
534 xchg ebx,esp
535 mov DWORD [48+esp],ebx
536 movdqu xmm0,[esi]
537 call __vpaes_encrypt_core
538 movdqu [edi],xmm0
539 mov esp,DWORD [48+esp]
540 pop edi
541 pop esi
542 pop ebx
543 pop ebp
544 ret
545global _vpaes_decrypt
546align 16
547_vpaes_decrypt:
548L$_vpaes_decrypt_begin:
549 push ebp
550 push ebx
551 push esi
552 push edi
553 lea ebp,[(L$_vpaes_consts+0x30-L$019pic_point)]
554 call __vpaes_preheat
555L$019pic_point:
556 mov esi,DWORD [20+esp]
557 lea ebx,[esp-56]
558 mov edi,DWORD [24+esp]
559 and ebx,-16
560 mov edx,DWORD [28+esp]
561 xchg ebx,esp
562 mov DWORD [48+esp],ebx
563 movdqu xmm0,[esi]
564 call __vpaes_decrypt_core
565 movdqu [edi],xmm0
566 mov esp,DWORD [48+esp]
567 pop edi
568 pop esi
569 pop ebx
570 pop ebp
571 ret
572global _vpaes_cbc_encrypt
573align 16
574_vpaes_cbc_encrypt:
575L$_vpaes_cbc_encrypt_begin:
576 push ebp
577 push ebx
578 push esi
579 push edi
580 mov esi,DWORD [20+esp]
581 mov edi,DWORD [24+esp]
582 mov eax,DWORD [28+esp]
583 mov edx,DWORD [32+esp]
584 sub eax,16
585 jc NEAR L$020cbc_abort
586 lea ebx,[esp-56]
587 mov ebp,DWORD [36+esp]
588 and ebx,-16
589 mov ecx,DWORD [40+esp]
590 xchg ebx,esp
591 movdqu xmm1,[ebp]
592 sub edi,esi
593 mov DWORD [48+esp],ebx
594 mov DWORD [esp],edi
595 mov DWORD [4+esp],edx
596 mov DWORD [8+esp],ebp
597 mov edi,eax
598 lea ebp,[(L$_vpaes_consts+0x30-L$021pic_point)]
599 call __vpaes_preheat
600L$021pic_point:
601 cmp ecx,0
602 je NEAR L$022cbc_dec_loop
603 jmp NEAR L$023cbc_enc_loop
604align 16
605L$023cbc_enc_loop:
606 movdqu xmm0,[esi]
607 pxor xmm0,xmm1
608 call __vpaes_encrypt_core
609 mov ebx,DWORD [esp]
610 mov edx,DWORD [4+esp]
611 movdqa xmm1,xmm0
612 movdqu [esi*1+ebx],xmm0
613 lea esi,[16+esi]
614 sub edi,16
615 jnc NEAR L$023cbc_enc_loop
616 jmp NEAR L$024cbc_done
617align 16
618L$022cbc_dec_loop:
619 movdqu xmm0,[esi]
620 movdqa [16+esp],xmm1
621 movdqa [32+esp],xmm0
622 call __vpaes_decrypt_core
623 mov ebx,DWORD [esp]
624 mov edx,DWORD [4+esp]
625 pxor xmm0,[16+esp]
626 movdqa xmm1,[32+esp]
627 movdqu [esi*1+ebx],xmm0
628 lea esi,[16+esi]
629 sub edi,16
630 jnc NEAR L$022cbc_dec_loop
631L$024cbc_done:
632 mov ebx,DWORD [8+esp]
633 mov esp,DWORD [48+esp]
634 movdqu [ebx],xmm1
635L$020cbc_abort:
636 pop edi
637 pop esi
638 pop ebx
639 pop ebp
640 ret
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette