VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.3/crypto/genasm-nasm/x25519-x86_64.S@ 96159

最後變更 在這個檔案從96159是 95221,由 vboxsync 提交於 3 年 前

libs/openssl-3.0.3: Recreated openssl assembler files, bugref:10128

檔案大小: 8.5 KB
 
1default rel
2%define XMMWORD
3%define YMMWORD
4%define ZMMWORD
5section .text code align=64
6
7
8global x25519_fe51_mul
9
10ALIGN 32
11x25519_fe51_mul:
12 mov QWORD[8+rsp],rdi ;WIN64 prologue
13 mov QWORD[16+rsp],rsi
14 mov rax,rsp
15$L$SEH_begin_x25519_fe51_mul:
16 mov rdi,rcx
17 mov rsi,rdx
18 mov rdx,r8
19
20
21
22 push rbp
23
24 push rbx
25
26 push r12
27
28 push r13
29
30 push r14
31
32 push r15
33
34 lea rsp,[((-40))+rsp]
35
36$L$fe51_mul_body:
37
38 mov rax,QWORD[rsi]
39 mov r11,QWORD[rdx]
40 mov r12,QWORD[8+rdx]
41 mov r13,QWORD[16+rdx]
42 mov rbp,QWORD[24+rdx]
43 mov r14,QWORD[32+rdx]
44
45 mov QWORD[32+rsp],rdi
46 mov rdi,rax
47 mul r11
48 mov QWORD[rsp],r11
49 mov rbx,rax
50 mov rax,rdi
51 mov rcx,rdx
52 mul r12
53 mov QWORD[8+rsp],r12
54 mov r8,rax
55 mov rax,rdi
56 lea r15,[r14*8+r14]
57 mov r9,rdx
58 mul r13
59 mov QWORD[16+rsp],r13
60 mov r10,rax
61 mov rax,rdi
62 lea rdi,[r15*2+r14]
63 mov r11,rdx
64 mul rbp
65 mov r12,rax
66 mov rax,QWORD[rsi]
67 mov r13,rdx
68 mul r14
69 mov r14,rax
70 mov rax,QWORD[8+rsi]
71 mov r15,rdx
72
73 mul rdi
74 add rbx,rax
75 mov rax,QWORD[16+rsi]
76 adc rcx,rdx
77 mul rdi
78 add r8,rax
79 mov rax,QWORD[24+rsi]
80 adc r9,rdx
81 mul rdi
82 add r10,rax
83 mov rax,QWORD[32+rsi]
84 adc r11,rdx
85 mul rdi
86 imul rdi,rbp,19
87 add r12,rax
88 mov rax,QWORD[8+rsi]
89 adc r13,rdx
90 mul rbp
91 mov rbp,QWORD[16+rsp]
92 add r14,rax
93 mov rax,QWORD[16+rsi]
94 adc r15,rdx
95
96 mul rdi
97 add rbx,rax
98 mov rax,QWORD[24+rsi]
99 adc rcx,rdx
100 mul rdi
101 add r8,rax
102 mov rax,QWORD[32+rsi]
103 adc r9,rdx
104 mul rdi
105 imul rdi,rbp,19
106 add r10,rax
107 mov rax,QWORD[8+rsi]
108 adc r11,rdx
109 mul rbp
110 add r12,rax
111 mov rax,QWORD[16+rsi]
112 adc r13,rdx
113 mul rbp
114 mov rbp,QWORD[8+rsp]
115 add r14,rax
116 mov rax,QWORD[24+rsi]
117 adc r15,rdx
118
119 mul rdi
120 add rbx,rax
121 mov rax,QWORD[32+rsi]
122 adc rcx,rdx
123 mul rdi
124 add r8,rax
125 mov rax,QWORD[8+rsi]
126 adc r9,rdx
127 mul rbp
128 imul rdi,rbp,19
129 add r10,rax
130 mov rax,QWORD[16+rsi]
131 adc r11,rdx
132 mul rbp
133 add r12,rax
134 mov rax,QWORD[24+rsi]
135 adc r13,rdx
136 mul rbp
137 mov rbp,QWORD[rsp]
138 add r14,rax
139 mov rax,QWORD[32+rsi]
140 adc r15,rdx
141
142 mul rdi
143 add rbx,rax
144 mov rax,QWORD[8+rsi]
145 adc rcx,rdx
146 mul rbp
147 add r8,rax
148 mov rax,QWORD[16+rsi]
149 adc r9,rdx
150 mul rbp
151 add r10,rax
152 mov rax,QWORD[24+rsi]
153 adc r11,rdx
154 mul rbp
155 add r12,rax
156 mov rax,QWORD[32+rsi]
157 adc r13,rdx
158 mul rbp
159 add r14,rax
160 adc r15,rdx
161
162 mov rdi,QWORD[32+rsp]
163 jmp NEAR $L$reduce51
164$L$fe51_mul_epilogue:
165
166$L$SEH_end_x25519_fe51_mul:
167
168global x25519_fe51_sqr
169
170ALIGN 32
171x25519_fe51_sqr:
172 mov QWORD[8+rsp],rdi ;WIN64 prologue
173 mov QWORD[16+rsp],rsi
174 mov rax,rsp
175$L$SEH_begin_x25519_fe51_sqr:
176 mov rdi,rcx
177 mov rsi,rdx
178
179
180
181 push rbp
182
183 push rbx
184
185 push r12
186
187 push r13
188
189 push r14
190
191 push r15
192
193 lea rsp,[((-40))+rsp]
194
195$L$fe51_sqr_body:
196
197 mov rax,QWORD[rsi]
198 mov r15,QWORD[16+rsi]
199 mov rbp,QWORD[32+rsi]
200
201 mov QWORD[32+rsp],rdi
202 lea r14,[rax*1+rax]
203 mul rax
204 mov rbx,rax
205 mov rax,QWORD[8+rsi]
206 mov rcx,rdx
207 mul r14
208 mov r8,rax
209 mov rax,r15
210 mov QWORD[rsp],r15
211 mov r9,rdx
212 mul r14
213 mov r10,rax
214 mov rax,QWORD[24+rsi]
215 mov r11,rdx
216 imul rdi,rbp,19
217 mul r14
218 mov r12,rax
219 mov rax,rbp
220 mov r13,rdx
221 mul r14
222 mov r14,rax
223 mov rax,rbp
224 mov r15,rdx
225
226 mul rdi
227 add r12,rax
228 mov rax,QWORD[8+rsi]
229 adc r13,rdx
230
231 mov rsi,QWORD[24+rsi]
232 lea rbp,[rax*1+rax]
233 mul rax
234 add r10,rax
235 mov rax,QWORD[rsp]
236 adc r11,rdx
237 mul rbp
238 add r12,rax
239 mov rax,rbp
240 adc r13,rdx
241 mul rsi
242 add r14,rax
243 mov rax,rbp
244 adc r15,rdx
245 imul rbp,rsi,19
246 mul rdi
247 add rbx,rax
248 lea rax,[rsi*1+rsi]
249 adc rcx,rdx
250
251 mul rdi
252 add r10,rax
253 mov rax,rsi
254 adc r11,rdx
255 mul rbp
256 add r8,rax
257 mov rax,QWORD[rsp]
258 adc r9,rdx
259
260 lea rsi,[rax*1+rax]
261 mul rax
262 add r14,rax
263 mov rax,rbp
264 adc r15,rdx
265 mul rsi
266 add rbx,rax
267 mov rax,rsi
268 adc rcx,rdx
269 mul rdi
270 add r8,rax
271 adc r9,rdx
272
273 mov rdi,QWORD[32+rsp]
274 jmp NEAR $L$reduce51
275
276ALIGN 32
277$L$reduce51:
278 mov rbp,0x7ffffffffffff
279
280 mov rdx,r10
281 shr r10,51
282 shl r11,13
283 and rdx,rbp
284 or r11,r10
285 add r12,r11
286 adc r13,0
287
288 mov rax,rbx
289 shr rbx,51
290 shl rcx,13
291 and rax,rbp
292 or rcx,rbx
293 add r8,rcx
294 adc r9,0
295
296 mov rbx,r12
297 shr r12,51
298 shl r13,13
299 and rbx,rbp
300 or r13,r12
301 add r14,r13
302 adc r15,0
303
304 mov rcx,r8
305 shr r8,51
306 shl r9,13
307 and rcx,rbp
308 or r9,r8
309 add rdx,r9
310
311 mov r10,r14
312 shr r14,51
313 shl r15,13
314 and r10,rbp
315 or r15,r14
316
317 lea r14,[r15*8+r15]
318 lea r15,[r14*2+r15]
319 add rax,r15
320
321 mov r8,rdx
322 and rdx,rbp
323 shr r8,51
324 add rbx,r8
325
326 mov r9,rax
327 and rax,rbp
328 shr r9,51
329 add rcx,r9
330
331 mov QWORD[rdi],rax
332 mov QWORD[8+rdi],rcx
333 mov QWORD[16+rdi],rdx
334 mov QWORD[24+rdi],rbx
335 mov QWORD[32+rdi],r10
336
337 mov r15,QWORD[40+rsp]
338
339 mov r14,QWORD[48+rsp]
340
341 mov r13,QWORD[56+rsp]
342
343 mov r12,QWORD[64+rsp]
344
345 mov rbx,QWORD[72+rsp]
346
347 mov rbp,QWORD[80+rsp]
348
349 lea rsp,[88+rsp]
350
351$L$fe51_sqr_epilogue:
352 mov rdi,QWORD[8+rsp] ;WIN64 epilogue
353 mov rsi,QWORD[16+rsp]
354 DB 0F3h,0C3h ;repret
355
356$L$SEH_end_x25519_fe51_sqr:
357
358global x25519_fe51_mul121666
359
360ALIGN 32
361x25519_fe51_mul121666:
362 mov QWORD[8+rsp],rdi ;WIN64 prologue
363 mov QWORD[16+rsp],rsi
364 mov rax,rsp
365$L$SEH_begin_x25519_fe51_mul121666:
366 mov rdi,rcx
367 mov rsi,rdx
368
369
370
371 push rbp
372
373 push rbx
374
375 push r12
376
377 push r13
378
379 push r14
380
381 push r15
382
383 lea rsp,[((-40))+rsp]
384
385$L$fe51_mul121666_body:
386 mov eax,121666
387
388 mul QWORD[rsi]
389 mov rbx,rax
390 mov eax,121666
391 mov rcx,rdx
392 mul QWORD[8+rsi]
393 mov r8,rax
394 mov eax,121666
395 mov r9,rdx
396 mul QWORD[16+rsi]
397 mov r10,rax
398 mov eax,121666
399 mov r11,rdx
400 mul QWORD[24+rsi]
401 mov r12,rax
402 mov eax,121666
403 mov r13,rdx
404 mul QWORD[32+rsi]
405 mov r14,rax
406 mov r15,rdx
407
408 jmp NEAR $L$reduce51
409$L$fe51_mul121666_epilogue:
410
411$L$SEH_end_x25519_fe51_mul121666:
412global x25519_fe64_eligible
413
414ALIGN 32
415x25519_fe64_eligible:
416
417 xor eax,eax
418 DB 0F3h,0C3h ;repret
419
420
421
422global x25519_fe64_mul
423
424global x25519_fe64_sqr
425global x25519_fe64_mul121666
426global x25519_fe64_add
427global x25519_fe64_sub
428global x25519_fe64_tobytes
429x25519_fe64_mul:
430x25519_fe64_sqr:
431x25519_fe64_mul121666:
432x25519_fe64_add:
433x25519_fe64_sub:
434x25519_fe64_tobytes:
435
436DB 0x0f,0x0b
437 DB 0F3h,0C3h ;repret
438
439
440DB 88,50,53,53,49,57,32,112,114,105,109,105,116,105,118,101
441DB 115,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82
442DB 89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112
443DB 114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
444EXTERN __imp_RtlVirtualUnwind
445
446
447ALIGN 16
448short_handler:
449 push rsi
450 push rdi
451 push rbx
452 push rbp
453 push r12
454 push r13
455 push r14
456 push r15
457 pushfq
458 sub rsp,64
459
460 mov rax,QWORD[120+r8]
461 mov rbx,QWORD[248+r8]
462
463 mov rsi,QWORD[8+r9]
464 mov r11,QWORD[56+r9]
465
466 mov r10d,DWORD[r11]
467 lea r10,[r10*1+rsi]
468 cmp rbx,r10
469 jb NEAR $L$common_seh_tail
470
471 mov rax,QWORD[152+r8]
472 jmp NEAR $L$common_seh_tail
473
474
475
476ALIGN 16
477full_handler:
478 push rsi
479 push rdi
480 push rbx
481 push rbp
482 push r12
483 push r13
484 push r14
485 push r15
486 pushfq
487 sub rsp,64
488
489 mov rax,QWORD[120+r8]
490 mov rbx,QWORD[248+r8]
491
492 mov rsi,QWORD[8+r9]
493 mov r11,QWORD[56+r9]
494
495 mov r10d,DWORD[r11]
496 lea r10,[r10*1+rsi]
497 cmp rbx,r10
498 jb NEAR $L$common_seh_tail
499
500 mov rax,QWORD[152+r8]
501
502 mov r10d,DWORD[4+r11]
503 lea r10,[r10*1+rsi]
504 cmp rbx,r10
505 jae NEAR $L$common_seh_tail
506
507 mov r10d,DWORD[8+r11]
508 lea rax,[r10*1+rax]
509
510 mov rbp,QWORD[((-8))+rax]
511 mov rbx,QWORD[((-16))+rax]
512 mov r12,QWORD[((-24))+rax]
513 mov r13,QWORD[((-32))+rax]
514 mov r14,QWORD[((-40))+rax]
515 mov r15,QWORD[((-48))+rax]
516 mov QWORD[144+r8],rbx
517 mov QWORD[160+r8],rbp
518 mov QWORD[216+r8],r12
519 mov QWORD[224+r8],r13
520 mov QWORD[232+r8],r14
521 mov QWORD[240+r8],r15
522
523$L$common_seh_tail:
524 mov rdi,QWORD[8+rax]
525 mov rsi,QWORD[16+rax]
526 mov QWORD[152+r8],rax
527 mov QWORD[168+r8],rsi
528 mov QWORD[176+r8],rdi
529
530 mov rdi,QWORD[40+r9]
531 mov rsi,r8
532 mov ecx,154
533 DD 0xa548f3fc
534
535 mov rsi,r9
536 xor rcx,rcx
537 mov rdx,QWORD[8+rsi]
538 mov r8,QWORD[rsi]
539 mov r9,QWORD[16+rsi]
540 mov r10,QWORD[40+rsi]
541 lea r11,[56+rsi]
542 lea r12,[24+rsi]
543 mov QWORD[32+rsp],r10
544 mov QWORD[40+rsp],r11
545 mov QWORD[48+rsp],r12
546 mov QWORD[56+rsp],rcx
547 call QWORD[__imp_RtlVirtualUnwind]
548
549 mov eax,1
550 add rsp,64
551 popfq
552 pop r15
553 pop r14
554 pop r13
555 pop r12
556 pop rbp
557 pop rbx
558 pop rdi
559 pop rsi
560 DB 0F3h,0C3h ;repret
561
562
563section .pdata rdata align=4
564ALIGN 4
565 DD $L$SEH_begin_x25519_fe51_mul wrt ..imagebase
566 DD $L$SEH_end_x25519_fe51_mul wrt ..imagebase
567 DD $L$SEH_info_x25519_fe51_mul wrt ..imagebase
568
569 DD $L$SEH_begin_x25519_fe51_sqr wrt ..imagebase
570 DD $L$SEH_end_x25519_fe51_sqr wrt ..imagebase
571 DD $L$SEH_info_x25519_fe51_sqr wrt ..imagebase
572
573 DD $L$SEH_begin_x25519_fe51_mul121666 wrt ..imagebase
574 DD $L$SEH_end_x25519_fe51_mul121666 wrt ..imagebase
575 DD $L$SEH_info_x25519_fe51_mul121666 wrt ..imagebase
576section .xdata rdata align=8
577ALIGN 8
578$L$SEH_info_x25519_fe51_mul:
579DB 9,0,0,0
580 DD full_handler wrt ..imagebase
581 DD $L$fe51_mul_body wrt ..imagebase,$L$fe51_mul_epilogue wrt ..imagebase
582 DD 88,0
583$L$SEH_info_x25519_fe51_sqr:
584DB 9,0,0,0
585 DD full_handler wrt ..imagebase
586 DD $L$fe51_sqr_body wrt ..imagebase,$L$fe51_sqr_epilogue wrt ..imagebase
587 DD 88,0
588$L$SEH_info_x25519_fe51_mul121666:
589DB 9,0,0,0
590 DD full_handler wrt ..imagebase
591 DD $L$fe51_mul121666_body wrt ..imagebase,$L$fe51_mul121666_epilogue wrt ..imagebase
592 DD 88,0
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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