1 | default rel
|
---|
2 | %define XMMWORD
|
---|
3 | %define YMMWORD
|
---|
4 | %define ZMMWORD
|
---|
5 | section .text code align=64
|
---|
6 |
|
---|
7 |
|
---|
8 | EXTERN OPENSSL_ia32cap_P
|
---|
9 |
|
---|
10 | global rsaz_512_sqr
|
---|
11 |
|
---|
12 | ALIGN 32
|
---|
13 | rsaz_512_sqr:
|
---|
14 | mov QWORD[8+rsp],rdi ;WIN64 prologue
|
---|
15 | mov QWORD[16+rsp],rsi
|
---|
16 | mov rax,rsp
|
---|
17 | $L$SEH_begin_rsaz_512_sqr:
|
---|
18 | mov rdi,rcx
|
---|
19 | mov rsi,rdx
|
---|
20 | mov rdx,r8
|
---|
21 | mov rcx,r9
|
---|
22 | mov r8,QWORD[40+rsp]
|
---|
23 |
|
---|
24 |
|
---|
25 |
|
---|
26 | push rbx
|
---|
27 |
|
---|
28 | push rbp
|
---|
29 |
|
---|
30 | push r12
|
---|
31 |
|
---|
32 | push r13
|
---|
33 |
|
---|
34 | push r14
|
---|
35 |
|
---|
36 | push r15
|
---|
37 |
|
---|
38 |
|
---|
39 | sub rsp,128+24
|
---|
40 |
|
---|
41 | $L$sqr_body:
|
---|
42 | DB 102,72,15,110,202
|
---|
43 | mov rdx,QWORD[rsi]
|
---|
44 | mov rax,QWORD[8+rsi]
|
---|
45 | mov QWORD[128+rsp],rcx
|
---|
46 | jmp NEAR $L$oop_sqr
|
---|
47 |
|
---|
48 | ALIGN 32
|
---|
49 | $L$oop_sqr:
|
---|
50 | mov DWORD[((128+8))+rsp],r8d
|
---|
51 |
|
---|
52 | mov rbx,rdx
|
---|
53 | mov rbp,rax
|
---|
54 | mul rdx
|
---|
55 | mov r8,rax
|
---|
56 | mov rax,QWORD[16+rsi]
|
---|
57 | mov r9,rdx
|
---|
58 |
|
---|
59 | mul rbx
|
---|
60 | add r9,rax
|
---|
61 | mov rax,QWORD[24+rsi]
|
---|
62 | mov r10,rdx
|
---|
63 | adc r10,0
|
---|
64 |
|
---|
65 | mul rbx
|
---|
66 | add r10,rax
|
---|
67 | mov rax,QWORD[32+rsi]
|
---|
68 | mov r11,rdx
|
---|
69 | adc r11,0
|
---|
70 |
|
---|
71 | mul rbx
|
---|
72 | add r11,rax
|
---|
73 | mov rax,QWORD[40+rsi]
|
---|
74 | mov r12,rdx
|
---|
75 | adc r12,0
|
---|
76 |
|
---|
77 | mul rbx
|
---|
78 | add r12,rax
|
---|
79 | mov rax,QWORD[48+rsi]
|
---|
80 | mov r13,rdx
|
---|
81 | adc r13,0
|
---|
82 |
|
---|
83 | mul rbx
|
---|
84 | add r13,rax
|
---|
85 | mov rax,QWORD[56+rsi]
|
---|
86 | mov r14,rdx
|
---|
87 | adc r14,0
|
---|
88 |
|
---|
89 | mul rbx
|
---|
90 | add r14,rax
|
---|
91 | mov rax,rbx
|
---|
92 | adc rdx,0
|
---|
93 |
|
---|
94 | xor rcx,rcx
|
---|
95 | add r8,r8
|
---|
96 | mov r15,rdx
|
---|
97 | adc rcx,0
|
---|
98 |
|
---|
99 | mul rax
|
---|
100 | add rdx,r8
|
---|
101 | adc rcx,0
|
---|
102 |
|
---|
103 | mov QWORD[rsp],rax
|
---|
104 | mov QWORD[8+rsp],rdx
|
---|
105 |
|
---|
106 |
|
---|
107 | mov rax,QWORD[16+rsi]
|
---|
108 | mul rbp
|
---|
109 | add r10,rax
|
---|
110 | mov rax,QWORD[24+rsi]
|
---|
111 | mov rbx,rdx
|
---|
112 | adc rbx,0
|
---|
113 |
|
---|
114 | mul rbp
|
---|
115 | add r11,rax
|
---|
116 | mov rax,QWORD[32+rsi]
|
---|
117 | adc rdx,0
|
---|
118 | add r11,rbx
|
---|
119 | mov rbx,rdx
|
---|
120 | adc rbx,0
|
---|
121 |
|
---|
122 | mul rbp
|
---|
123 | add r12,rax
|
---|
124 | mov rax,QWORD[40+rsi]
|
---|
125 | adc rdx,0
|
---|
126 | add r12,rbx
|
---|
127 | mov rbx,rdx
|
---|
128 | adc rbx,0
|
---|
129 |
|
---|
130 | mul rbp
|
---|
131 | add r13,rax
|
---|
132 | mov rax,QWORD[48+rsi]
|
---|
133 | adc rdx,0
|
---|
134 | add r13,rbx
|
---|
135 | mov rbx,rdx
|
---|
136 | adc rbx,0
|
---|
137 |
|
---|
138 | mul rbp
|
---|
139 | add r14,rax
|
---|
140 | mov rax,QWORD[56+rsi]
|
---|
141 | adc rdx,0
|
---|
142 | add r14,rbx
|
---|
143 | mov rbx,rdx
|
---|
144 | adc rbx,0
|
---|
145 |
|
---|
146 | mul rbp
|
---|
147 | add r15,rax
|
---|
148 | mov rax,rbp
|
---|
149 | adc rdx,0
|
---|
150 | add r15,rbx
|
---|
151 | adc rdx,0
|
---|
152 |
|
---|
153 | xor rbx,rbx
|
---|
154 | add r9,r9
|
---|
155 | mov r8,rdx
|
---|
156 | adc r10,r10
|
---|
157 | adc rbx,0
|
---|
158 |
|
---|
159 | mul rax
|
---|
160 |
|
---|
161 | add rax,rcx
|
---|
162 | mov rbp,QWORD[16+rsi]
|
---|
163 | add r9,rax
|
---|
164 | mov rax,QWORD[24+rsi]
|
---|
165 | adc r10,rdx
|
---|
166 | adc rbx,0
|
---|
167 |
|
---|
168 | mov QWORD[16+rsp],r9
|
---|
169 | mov QWORD[24+rsp],r10
|
---|
170 |
|
---|
171 |
|
---|
172 | mul rbp
|
---|
173 | add r12,rax
|
---|
174 | mov rax,QWORD[32+rsi]
|
---|
175 | mov rcx,rdx
|
---|
176 | adc rcx,0
|
---|
177 |
|
---|
178 | mul rbp
|
---|
179 | add r13,rax
|
---|
180 | mov rax,QWORD[40+rsi]
|
---|
181 | adc rdx,0
|
---|
182 | add r13,rcx
|
---|
183 | mov rcx,rdx
|
---|
184 | adc rcx,0
|
---|
185 |
|
---|
186 | mul rbp
|
---|
187 | add r14,rax
|
---|
188 | mov rax,QWORD[48+rsi]
|
---|
189 | adc rdx,0
|
---|
190 | add r14,rcx
|
---|
191 | mov rcx,rdx
|
---|
192 | adc rcx,0
|
---|
193 |
|
---|
194 | mul rbp
|
---|
195 | add r15,rax
|
---|
196 | mov rax,QWORD[56+rsi]
|
---|
197 | adc rdx,0
|
---|
198 | add r15,rcx
|
---|
199 | mov rcx,rdx
|
---|
200 | adc rcx,0
|
---|
201 |
|
---|
202 | mul rbp
|
---|
203 | add r8,rax
|
---|
204 | mov rax,rbp
|
---|
205 | adc rdx,0
|
---|
206 | add r8,rcx
|
---|
207 | adc rdx,0
|
---|
208 |
|
---|
209 | xor rcx,rcx
|
---|
210 | add r11,r11
|
---|
211 | mov r9,rdx
|
---|
212 | adc r12,r12
|
---|
213 | adc rcx,0
|
---|
214 |
|
---|
215 | mul rax
|
---|
216 |
|
---|
217 | add rax,rbx
|
---|
218 | mov r10,QWORD[24+rsi]
|
---|
219 | add r11,rax
|
---|
220 | mov rax,QWORD[32+rsi]
|
---|
221 | adc r12,rdx
|
---|
222 | adc rcx,0
|
---|
223 |
|
---|
224 | mov QWORD[32+rsp],r11
|
---|
225 | mov QWORD[40+rsp],r12
|
---|
226 |
|
---|
227 |
|
---|
228 | mov r11,rax
|
---|
229 | mul r10
|
---|
230 | add r14,rax
|
---|
231 | mov rax,QWORD[40+rsi]
|
---|
232 | mov rbx,rdx
|
---|
233 | adc rbx,0
|
---|
234 |
|
---|
235 | mov r12,rax
|
---|
236 | mul r10
|
---|
237 | add r15,rax
|
---|
238 | mov rax,QWORD[48+rsi]
|
---|
239 | adc rdx,0
|
---|
240 | add r15,rbx
|
---|
241 | mov rbx,rdx
|
---|
242 | adc rbx,0
|
---|
243 |
|
---|
244 | mov rbp,rax
|
---|
245 | mul r10
|
---|
246 | add r8,rax
|
---|
247 | mov rax,QWORD[56+rsi]
|
---|
248 | adc rdx,0
|
---|
249 | add r8,rbx
|
---|
250 | mov rbx,rdx
|
---|
251 | adc rbx,0
|
---|
252 |
|
---|
253 | mul r10
|
---|
254 | add r9,rax
|
---|
255 | mov rax,r10
|
---|
256 | adc rdx,0
|
---|
257 | add r9,rbx
|
---|
258 | adc rdx,0
|
---|
259 |
|
---|
260 | xor rbx,rbx
|
---|
261 | add r13,r13
|
---|
262 | mov r10,rdx
|
---|
263 | adc r14,r14
|
---|
264 | adc rbx,0
|
---|
265 |
|
---|
266 | mul rax
|
---|
267 |
|
---|
268 | add rax,rcx
|
---|
269 | add r13,rax
|
---|
270 | mov rax,r12
|
---|
271 | adc r14,rdx
|
---|
272 | adc rbx,0
|
---|
273 |
|
---|
274 | mov QWORD[48+rsp],r13
|
---|
275 | mov QWORD[56+rsp],r14
|
---|
276 |
|
---|
277 |
|
---|
278 | mul r11
|
---|
279 | add r8,rax
|
---|
280 | mov rax,rbp
|
---|
281 | mov rcx,rdx
|
---|
282 | adc rcx,0
|
---|
283 |
|
---|
284 | mul r11
|
---|
285 | add r9,rax
|
---|
286 | mov rax,QWORD[56+rsi]
|
---|
287 | adc rdx,0
|
---|
288 | add r9,rcx
|
---|
289 | mov rcx,rdx
|
---|
290 | adc rcx,0
|
---|
291 |
|
---|
292 | mov r14,rax
|
---|
293 | mul r11
|
---|
294 | add r10,rax
|
---|
295 | mov rax,r11
|
---|
296 | adc rdx,0
|
---|
297 | add r10,rcx
|
---|
298 | adc rdx,0
|
---|
299 |
|
---|
300 | xor rcx,rcx
|
---|
301 | add r15,r15
|
---|
302 | mov r11,rdx
|
---|
303 | adc r8,r8
|
---|
304 | adc rcx,0
|
---|
305 |
|
---|
306 | mul rax
|
---|
307 |
|
---|
308 | add rax,rbx
|
---|
309 | add r15,rax
|
---|
310 | mov rax,rbp
|
---|
311 | adc r8,rdx
|
---|
312 | adc rcx,0
|
---|
313 |
|
---|
314 | mov QWORD[64+rsp],r15
|
---|
315 | mov QWORD[72+rsp],r8
|
---|
316 |
|
---|
317 |
|
---|
318 | mul r12
|
---|
319 | add r10,rax
|
---|
320 | mov rax,r14
|
---|
321 | mov rbx,rdx
|
---|
322 | adc rbx,0
|
---|
323 |
|
---|
324 | mul r12
|
---|
325 | add r11,rax
|
---|
326 | mov rax,r12
|
---|
327 | adc rdx,0
|
---|
328 | add r11,rbx
|
---|
329 | adc rdx,0
|
---|
330 |
|
---|
331 | xor rbx,rbx
|
---|
332 | add r9,r9
|
---|
333 | mov r12,rdx
|
---|
334 | adc r10,r10
|
---|
335 | adc rbx,0
|
---|
336 |
|
---|
337 | mul rax
|
---|
338 |
|
---|
339 | add rax,rcx
|
---|
340 | add r9,rax
|
---|
341 | mov rax,r14
|
---|
342 | adc r10,rdx
|
---|
343 | adc rbx,0
|
---|
344 |
|
---|
345 | mov QWORD[80+rsp],r9
|
---|
346 | mov QWORD[88+rsp],r10
|
---|
347 |
|
---|
348 |
|
---|
349 | mul rbp
|
---|
350 | add r12,rax
|
---|
351 | mov rax,rbp
|
---|
352 | adc rdx,0
|
---|
353 |
|
---|
354 | xor rcx,rcx
|
---|
355 | add r11,r11
|
---|
356 | mov r13,rdx
|
---|
357 | adc r12,r12
|
---|
358 | adc rcx,0
|
---|
359 |
|
---|
360 | mul rax
|
---|
361 |
|
---|
362 | add rax,rbx
|
---|
363 | add r11,rax
|
---|
364 | mov rax,r14
|
---|
365 | adc r12,rdx
|
---|
366 | adc rcx,0
|
---|
367 |
|
---|
368 | mov QWORD[96+rsp],r11
|
---|
369 | mov QWORD[104+rsp],r12
|
---|
370 |
|
---|
371 |
|
---|
372 | xor rbx,rbx
|
---|
373 | add r13,r13
|
---|
374 | adc rbx,0
|
---|
375 |
|
---|
376 | mul rax
|
---|
377 |
|
---|
378 | add rax,rcx
|
---|
379 | add rax,r13
|
---|
380 | adc rdx,rbx
|
---|
381 |
|
---|
382 | mov r8,QWORD[rsp]
|
---|
383 | mov r9,QWORD[8+rsp]
|
---|
384 | mov r10,QWORD[16+rsp]
|
---|
385 | mov r11,QWORD[24+rsp]
|
---|
386 | mov r12,QWORD[32+rsp]
|
---|
387 | mov r13,QWORD[40+rsp]
|
---|
388 | mov r14,QWORD[48+rsp]
|
---|
389 | mov r15,QWORD[56+rsp]
|
---|
390 | DB 102,72,15,126,205
|
---|
391 |
|
---|
392 | mov QWORD[112+rsp],rax
|
---|
393 | mov QWORD[120+rsp],rdx
|
---|
394 |
|
---|
395 | call __rsaz_512_reduce
|
---|
396 |
|
---|
397 | add r8,QWORD[64+rsp]
|
---|
398 | adc r9,QWORD[72+rsp]
|
---|
399 | adc r10,QWORD[80+rsp]
|
---|
400 | adc r11,QWORD[88+rsp]
|
---|
401 | adc r12,QWORD[96+rsp]
|
---|
402 | adc r13,QWORD[104+rsp]
|
---|
403 | adc r14,QWORD[112+rsp]
|
---|
404 | adc r15,QWORD[120+rsp]
|
---|
405 | sbb rcx,rcx
|
---|
406 |
|
---|
407 | call __rsaz_512_subtract
|
---|
408 |
|
---|
409 | mov rdx,r8
|
---|
410 | mov rax,r9
|
---|
411 | mov r8d,DWORD[((128+8))+rsp]
|
---|
412 | mov rsi,rdi
|
---|
413 |
|
---|
414 | dec r8d
|
---|
415 | jnz NEAR $L$oop_sqr
|
---|
416 |
|
---|
417 | lea rax,[((128+24+48))+rsp]
|
---|
418 |
|
---|
419 | mov r15,QWORD[((-48))+rax]
|
---|
420 |
|
---|
421 | mov r14,QWORD[((-40))+rax]
|
---|
422 |
|
---|
423 | mov r13,QWORD[((-32))+rax]
|
---|
424 |
|
---|
425 | mov r12,QWORD[((-24))+rax]
|
---|
426 |
|
---|
427 | mov rbp,QWORD[((-16))+rax]
|
---|
428 |
|
---|
429 | mov rbx,QWORD[((-8))+rax]
|
---|
430 |
|
---|
431 | lea rsp,[rax]
|
---|
432 |
|
---|
433 | $L$sqr_epilogue:
|
---|
434 | mov rdi,QWORD[8+rsp] ;WIN64 epilogue
|
---|
435 | mov rsi,QWORD[16+rsp]
|
---|
436 | DB 0F3h,0C3h ;repret
|
---|
437 |
|
---|
438 | $L$SEH_end_rsaz_512_sqr:
|
---|
439 | global rsaz_512_mul
|
---|
440 |
|
---|
441 | ALIGN 32
|
---|
442 | rsaz_512_mul:
|
---|
443 | mov QWORD[8+rsp],rdi ;WIN64 prologue
|
---|
444 | mov QWORD[16+rsp],rsi
|
---|
445 | mov rax,rsp
|
---|
446 | $L$SEH_begin_rsaz_512_mul:
|
---|
447 | mov rdi,rcx
|
---|
448 | mov rsi,rdx
|
---|
449 | mov rdx,r8
|
---|
450 | mov rcx,r9
|
---|
451 | mov r8,QWORD[40+rsp]
|
---|
452 |
|
---|
453 |
|
---|
454 |
|
---|
455 | push rbx
|
---|
456 |
|
---|
457 | push rbp
|
---|
458 |
|
---|
459 | push r12
|
---|
460 |
|
---|
461 | push r13
|
---|
462 |
|
---|
463 | push r14
|
---|
464 |
|
---|
465 | push r15
|
---|
466 |
|
---|
467 |
|
---|
468 | sub rsp,128+24
|
---|
469 |
|
---|
470 | $L$mul_body:
|
---|
471 | DB 102,72,15,110,199
|
---|
472 | DB 102,72,15,110,201
|
---|
473 | mov QWORD[128+rsp],r8
|
---|
474 | mov rbx,QWORD[rdx]
|
---|
475 | mov rbp,rdx
|
---|
476 | call __rsaz_512_mul
|
---|
477 |
|
---|
478 | DB 102,72,15,126,199
|
---|
479 | DB 102,72,15,126,205
|
---|
480 |
|
---|
481 | mov r8,QWORD[rsp]
|
---|
482 | mov r9,QWORD[8+rsp]
|
---|
483 | mov r10,QWORD[16+rsp]
|
---|
484 | mov r11,QWORD[24+rsp]
|
---|
485 | mov r12,QWORD[32+rsp]
|
---|
486 | mov r13,QWORD[40+rsp]
|
---|
487 | mov r14,QWORD[48+rsp]
|
---|
488 | mov r15,QWORD[56+rsp]
|
---|
489 |
|
---|
490 | call __rsaz_512_reduce
|
---|
491 | add r8,QWORD[64+rsp]
|
---|
492 | adc r9,QWORD[72+rsp]
|
---|
493 | adc r10,QWORD[80+rsp]
|
---|
494 | adc r11,QWORD[88+rsp]
|
---|
495 | adc r12,QWORD[96+rsp]
|
---|
496 | adc r13,QWORD[104+rsp]
|
---|
497 | adc r14,QWORD[112+rsp]
|
---|
498 | adc r15,QWORD[120+rsp]
|
---|
499 | sbb rcx,rcx
|
---|
500 |
|
---|
501 | call __rsaz_512_subtract
|
---|
502 |
|
---|
503 | lea rax,[((128+24+48))+rsp]
|
---|
504 |
|
---|
505 | mov r15,QWORD[((-48))+rax]
|
---|
506 |
|
---|
507 | mov r14,QWORD[((-40))+rax]
|
---|
508 |
|
---|
509 | mov r13,QWORD[((-32))+rax]
|
---|
510 |
|
---|
511 | mov r12,QWORD[((-24))+rax]
|
---|
512 |
|
---|
513 | mov rbp,QWORD[((-16))+rax]
|
---|
514 |
|
---|
515 | mov rbx,QWORD[((-8))+rax]
|
---|
516 |
|
---|
517 | lea rsp,[rax]
|
---|
518 |
|
---|
519 | $L$mul_epilogue:
|
---|
520 | mov rdi,QWORD[8+rsp] ;WIN64 epilogue
|
---|
521 | mov rsi,QWORD[16+rsp]
|
---|
522 | DB 0F3h,0C3h ;repret
|
---|
523 |
|
---|
524 | $L$SEH_end_rsaz_512_mul:
|
---|
525 | global rsaz_512_mul_gather4
|
---|
526 |
|
---|
527 | ALIGN 32
|
---|
528 | rsaz_512_mul_gather4:
|
---|
529 | mov QWORD[8+rsp],rdi ;WIN64 prologue
|
---|
530 | mov QWORD[16+rsp],rsi
|
---|
531 | mov rax,rsp
|
---|
532 | $L$SEH_begin_rsaz_512_mul_gather4:
|
---|
533 | mov rdi,rcx
|
---|
534 | mov rsi,rdx
|
---|
535 | mov rdx,r8
|
---|
536 | mov rcx,r9
|
---|
537 | mov r8,QWORD[40+rsp]
|
---|
538 | mov r9,QWORD[48+rsp]
|
---|
539 |
|
---|
540 |
|
---|
541 |
|
---|
542 | push rbx
|
---|
543 |
|
---|
544 | push rbp
|
---|
545 |
|
---|
546 | push r12
|
---|
547 |
|
---|
548 | push r13
|
---|
549 |
|
---|
550 | push r14
|
---|
551 |
|
---|
552 | push r15
|
---|
553 |
|
---|
554 |
|
---|
555 | sub rsp,328
|
---|
556 |
|
---|
557 | movaps XMMWORD[160+rsp],xmm6
|
---|
558 | movaps XMMWORD[176+rsp],xmm7
|
---|
559 | movaps XMMWORD[192+rsp],xmm8
|
---|
560 | movaps XMMWORD[208+rsp],xmm9
|
---|
561 | movaps XMMWORD[224+rsp],xmm10
|
---|
562 | movaps XMMWORD[240+rsp],xmm11
|
---|
563 | movaps XMMWORD[256+rsp],xmm12
|
---|
564 | movaps XMMWORD[272+rsp],xmm13
|
---|
565 | movaps XMMWORD[288+rsp],xmm14
|
---|
566 | movaps XMMWORD[304+rsp],xmm15
|
---|
567 | $L$mul_gather4_body:
|
---|
568 | movd xmm8,r9d
|
---|
569 | movdqa xmm1,XMMWORD[(($L$inc+16))]
|
---|
570 | movdqa xmm0,XMMWORD[$L$inc]
|
---|
571 |
|
---|
572 | pshufd xmm8,xmm8,0
|
---|
573 | movdqa xmm7,xmm1
|
---|
574 | movdqa xmm2,xmm1
|
---|
575 | paddd xmm1,xmm0
|
---|
576 | pcmpeqd xmm0,xmm8
|
---|
577 | movdqa xmm3,xmm7
|
---|
578 | paddd xmm2,xmm1
|
---|
579 | pcmpeqd xmm1,xmm8
|
---|
580 | movdqa xmm4,xmm7
|
---|
581 | paddd xmm3,xmm2
|
---|
582 | pcmpeqd xmm2,xmm8
|
---|
583 | movdqa xmm5,xmm7
|
---|
584 | paddd xmm4,xmm3
|
---|
585 | pcmpeqd xmm3,xmm8
|
---|
586 | movdqa xmm6,xmm7
|
---|
587 | paddd xmm5,xmm4
|
---|
588 | pcmpeqd xmm4,xmm8
|
---|
589 | paddd xmm6,xmm5
|
---|
590 | pcmpeqd xmm5,xmm8
|
---|
591 | paddd xmm7,xmm6
|
---|
592 | pcmpeqd xmm6,xmm8
|
---|
593 | pcmpeqd xmm7,xmm8
|
---|
594 |
|
---|
595 | movdqa xmm8,XMMWORD[rdx]
|
---|
596 | movdqa xmm9,XMMWORD[16+rdx]
|
---|
597 | movdqa xmm10,XMMWORD[32+rdx]
|
---|
598 | movdqa xmm11,XMMWORD[48+rdx]
|
---|
599 | pand xmm8,xmm0
|
---|
600 | movdqa xmm12,XMMWORD[64+rdx]
|
---|
601 | pand xmm9,xmm1
|
---|
602 | movdqa xmm13,XMMWORD[80+rdx]
|
---|
603 | pand xmm10,xmm2
|
---|
604 | movdqa xmm14,XMMWORD[96+rdx]
|
---|
605 | pand xmm11,xmm3
|
---|
606 | movdqa xmm15,XMMWORD[112+rdx]
|
---|
607 | lea rbp,[128+rdx]
|
---|
608 | pand xmm12,xmm4
|
---|
609 | pand xmm13,xmm5
|
---|
610 | pand xmm14,xmm6
|
---|
611 | pand xmm15,xmm7
|
---|
612 | por xmm8,xmm10
|
---|
613 | por xmm9,xmm11
|
---|
614 | por xmm8,xmm12
|
---|
615 | por xmm9,xmm13
|
---|
616 | por xmm8,xmm14
|
---|
617 | por xmm9,xmm15
|
---|
618 |
|
---|
619 | por xmm8,xmm9
|
---|
620 | pshufd xmm9,xmm8,0x4e
|
---|
621 | por xmm8,xmm9
|
---|
622 | DB 102,76,15,126,195
|
---|
623 |
|
---|
624 | mov QWORD[128+rsp],r8
|
---|
625 | mov QWORD[((128+8))+rsp],rdi
|
---|
626 | mov QWORD[((128+16))+rsp],rcx
|
---|
627 |
|
---|
628 | mov rax,QWORD[rsi]
|
---|
629 | mov rcx,QWORD[8+rsi]
|
---|
630 | mul rbx
|
---|
631 | mov QWORD[rsp],rax
|
---|
632 | mov rax,rcx
|
---|
633 | mov r8,rdx
|
---|
634 |
|
---|
635 | mul rbx
|
---|
636 | add r8,rax
|
---|
637 | mov rax,QWORD[16+rsi]
|
---|
638 | mov r9,rdx
|
---|
639 | adc r9,0
|
---|
640 |
|
---|
641 | mul rbx
|
---|
642 | add r9,rax
|
---|
643 | mov rax,QWORD[24+rsi]
|
---|
644 | mov r10,rdx
|
---|
645 | adc r10,0
|
---|
646 |
|
---|
647 | mul rbx
|
---|
648 | add r10,rax
|
---|
649 | mov rax,QWORD[32+rsi]
|
---|
650 | mov r11,rdx
|
---|
651 | adc r11,0
|
---|
652 |
|
---|
653 | mul rbx
|
---|
654 | add r11,rax
|
---|
655 | mov rax,QWORD[40+rsi]
|
---|
656 | mov r12,rdx
|
---|
657 | adc r12,0
|
---|
658 |
|
---|
659 | mul rbx
|
---|
660 | add r12,rax
|
---|
661 | mov rax,QWORD[48+rsi]
|
---|
662 | mov r13,rdx
|
---|
663 | adc r13,0
|
---|
664 |
|
---|
665 | mul rbx
|
---|
666 | add r13,rax
|
---|
667 | mov rax,QWORD[56+rsi]
|
---|
668 | mov r14,rdx
|
---|
669 | adc r14,0
|
---|
670 |
|
---|
671 | mul rbx
|
---|
672 | add r14,rax
|
---|
673 | mov rax,QWORD[rsi]
|
---|
674 | mov r15,rdx
|
---|
675 | adc r15,0
|
---|
676 |
|
---|
677 | lea rdi,[8+rsp]
|
---|
678 | mov ecx,7
|
---|
679 | jmp NEAR $L$oop_mul_gather
|
---|
680 |
|
---|
681 | ALIGN 32
|
---|
682 | $L$oop_mul_gather:
|
---|
683 | movdqa xmm8,XMMWORD[rbp]
|
---|
684 | movdqa xmm9,XMMWORD[16+rbp]
|
---|
685 | movdqa xmm10,XMMWORD[32+rbp]
|
---|
686 | movdqa xmm11,XMMWORD[48+rbp]
|
---|
687 | pand xmm8,xmm0
|
---|
688 | movdqa xmm12,XMMWORD[64+rbp]
|
---|
689 | pand xmm9,xmm1
|
---|
690 | movdqa xmm13,XMMWORD[80+rbp]
|
---|
691 | pand xmm10,xmm2
|
---|
692 | movdqa xmm14,XMMWORD[96+rbp]
|
---|
693 | pand xmm11,xmm3
|
---|
694 | movdqa xmm15,XMMWORD[112+rbp]
|
---|
695 | lea rbp,[128+rbp]
|
---|
696 | pand xmm12,xmm4
|
---|
697 | pand xmm13,xmm5
|
---|
698 | pand xmm14,xmm6
|
---|
699 | pand xmm15,xmm7
|
---|
700 | por xmm8,xmm10
|
---|
701 | por xmm9,xmm11
|
---|
702 | por xmm8,xmm12
|
---|
703 | por xmm9,xmm13
|
---|
704 | por xmm8,xmm14
|
---|
705 | por xmm9,xmm15
|
---|
706 |
|
---|
707 | por xmm8,xmm9
|
---|
708 | pshufd xmm9,xmm8,0x4e
|
---|
709 | por xmm8,xmm9
|
---|
710 | DB 102,76,15,126,195
|
---|
711 |
|
---|
712 | mul rbx
|
---|
713 | add r8,rax
|
---|
714 | mov rax,QWORD[8+rsi]
|
---|
715 | mov QWORD[rdi],r8
|
---|
716 | mov r8,rdx
|
---|
717 | adc r8,0
|
---|
718 |
|
---|
719 | mul rbx
|
---|
720 | add r9,rax
|
---|
721 | mov rax,QWORD[16+rsi]
|
---|
722 | adc rdx,0
|
---|
723 | add r8,r9
|
---|
724 | mov r9,rdx
|
---|
725 | adc r9,0
|
---|
726 |
|
---|
727 | mul rbx
|
---|
728 | add r10,rax
|
---|
729 | mov rax,QWORD[24+rsi]
|
---|
730 | adc rdx,0
|
---|
731 | add r9,r10
|
---|
732 | mov r10,rdx
|
---|
733 | adc r10,0
|
---|
734 |
|
---|
735 | mul rbx
|
---|
736 | add r11,rax
|
---|
737 | mov rax,QWORD[32+rsi]
|
---|
738 | adc rdx,0
|
---|
739 | add r10,r11
|
---|
740 | mov r11,rdx
|
---|
741 | adc r11,0
|
---|
742 |
|
---|
743 | mul rbx
|
---|
744 | add r12,rax
|
---|
745 | mov rax,QWORD[40+rsi]
|
---|
746 | adc rdx,0
|
---|
747 | add r11,r12
|
---|
748 | mov r12,rdx
|
---|
749 | adc r12,0
|
---|
750 |
|
---|
751 | mul rbx
|
---|
752 | add r13,rax
|
---|
753 | mov rax,QWORD[48+rsi]
|
---|
754 | adc rdx,0
|
---|
755 | add r12,r13
|
---|
756 | mov r13,rdx
|
---|
757 | adc r13,0
|
---|
758 |
|
---|
759 | mul rbx
|
---|
760 | add r14,rax
|
---|
761 | mov rax,QWORD[56+rsi]
|
---|
762 | adc rdx,0
|
---|
763 | add r13,r14
|
---|
764 | mov r14,rdx
|
---|
765 | adc r14,0
|
---|
766 |
|
---|
767 | mul rbx
|
---|
768 | add r15,rax
|
---|
769 | mov rax,QWORD[rsi]
|
---|
770 | adc rdx,0
|
---|
771 | add r14,r15
|
---|
772 | mov r15,rdx
|
---|
773 | adc r15,0
|
---|
774 |
|
---|
775 | lea rdi,[8+rdi]
|
---|
776 |
|
---|
777 | dec ecx
|
---|
778 | jnz NEAR $L$oop_mul_gather
|
---|
779 |
|
---|
780 | mov QWORD[rdi],r8
|
---|
781 | mov QWORD[8+rdi],r9
|
---|
782 | mov QWORD[16+rdi],r10
|
---|
783 | mov QWORD[24+rdi],r11
|
---|
784 | mov QWORD[32+rdi],r12
|
---|
785 | mov QWORD[40+rdi],r13
|
---|
786 | mov QWORD[48+rdi],r14
|
---|
787 | mov QWORD[56+rdi],r15
|
---|
788 |
|
---|
789 | mov rdi,QWORD[((128+8))+rsp]
|
---|
790 | mov rbp,QWORD[((128+16))+rsp]
|
---|
791 |
|
---|
792 | mov r8,QWORD[rsp]
|
---|
793 | mov r9,QWORD[8+rsp]
|
---|
794 | mov r10,QWORD[16+rsp]
|
---|
795 | mov r11,QWORD[24+rsp]
|
---|
796 | mov r12,QWORD[32+rsp]
|
---|
797 | mov r13,QWORD[40+rsp]
|
---|
798 | mov r14,QWORD[48+rsp]
|
---|
799 | mov r15,QWORD[56+rsp]
|
---|
800 |
|
---|
801 | call __rsaz_512_reduce
|
---|
802 | add r8,QWORD[64+rsp]
|
---|
803 | adc r9,QWORD[72+rsp]
|
---|
804 | adc r10,QWORD[80+rsp]
|
---|
805 | adc r11,QWORD[88+rsp]
|
---|
806 | adc r12,QWORD[96+rsp]
|
---|
807 | adc r13,QWORD[104+rsp]
|
---|
808 | adc r14,QWORD[112+rsp]
|
---|
809 | adc r15,QWORD[120+rsp]
|
---|
810 | sbb rcx,rcx
|
---|
811 |
|
---|
812 | call __rsaz_512_subtract
|
---|
813 |
|
---|
814 | lea rax,[((128+24+48))+rsp]
|
---|
815 | movaps xmm6,XMMWORD[((160-200))+rax]
|
---|
816 | movaps xmm7,XMMWORD[((176-200))+rax]
|
---|
817 | movaps xmm8,XMMWORD[((192-200))+rax]
|
---|
818 | movaps xmm9,XMMWORD[((208-200))+rax]
|
---|
819 | movaps xmm10,XMMWORD[((224-200))+rax]
|
---|
820 | movaps xmm11,XMMWORD[((240-200))+rax]
|
---|
821 | movaps xmm12,XMMWORD[((256-200))+rax]
|
---|
822 | movaps xmm13,XMMWORD[((272-200))+rax]
|
---|
823 | movaps xmm14,XMMWORD[((288-200))+rax]
|
---|
824 | movaps xmm15,XMMWORD[((304-200))+rax]
|
---|
825 | lea rax,[176+rax]
|
---|
826 |
|
---|
827 | mov r15,QWORD[((-48))+rax]
|
---|
828 |
|
---|
829 | mov r14,QWORD[((-40))+rax]
|
---|
830 |
|
---|
831 | mov r13,QWORD[((-32))+rax]
|
---|
832 |
|
---|
833 | mov r12,QWORD[((-24))+rax]
|
---|
834 |
|
---|
835 | mov rbp,QWORD[((-16))+rax]
|
---|
836 |
|
---|
837 | mov rbx,QWORD[((-8))+rax]
|
---|
838 |
|
---|
839 | lea rsp,[rax]
|
---|
840 |
|
---|
841 | $L$mul_gather4_epilogue:
|
---|
842 | mov rdi,QWORD[8+rsp] ;WIN64 epilogue
|
---|
843 | mov rsi,QWORD[16+rsp]
|
---|
844 | DB 0F3h,0C3h ;repret
|
---|
845 |
|
---|
846 | $L$SEH_end_rsaz_512_mul_gather4:
|
---|
847 | global rsaz_512_mul_scatter4
|
---|
848 |
|
---|
849 | ALIGN 32
|
---|
850 | rsaz_512_mul_scatter4:
|
---|
851 | mov QWORD[8+rsp],rdi ;WIN64 prologue
|
---|
852 | mov QWORD[16+rsp],rsi
|
---|
853 | mov rax,rsp
|
---|
854 | $L$SEH_begin_rsaz_512_mul_scatter4:
|
---|
855 | mov rdi,rcx
|
---|
856 | mov rsi,rdx
|
---|
857 | mov rdx,r8
|
---|
858 | mov rcx,r9
|
---|
859 | mov r8,QWORD[40+rsp]
|
---|
860 | mov r9,QWORD[48+rsp]
|
---|
861 |
|
---|
862 |
|
---|
863 |
|
---|
864 | push rbx
|
---|
865 |
|
---|
866 | push rbp
|
---|
867 |
|
---|
868 | push r12
|
---|
869 |
|
---|
870 | push r13
|
---|
871 |
|
---|
872 | push r14
|
---|
873 |
|
---|
874 | push r15
|
---|
875 |
|
---|
876 |
|
---|
877 | mov r9d,r9d
|
---|
878 | sub rsp,128+24
|
---|
879 |
|
---|
880 | $L$mul_scatter4_body:
|
---|
881 | lea r8,[r9*8+r8]
|
---|
882 | DB 102,72,15,110,199
|
---|
883 | DB 102,72,15,110,202
|
---|
884 | DB 102,73,15,110,208
|
---|
885 | mov QWORD[128+rsp],rcx
|
---|
886 |
|
---|
887 | mov rbp,rdi
|
---|
888 | mov rbx,QWORD[rdi]
|
---|
889 | call __rsaz_512_mul
|
---|
890 |
|
---|
891 | DB 102,72,15,126,199
|
---|
892 | DB 102,72,15,126,205
|
---|
893 |
|
---|
894 | mov r8,QWORD[rsp]
|
---|
895 | mov r9,QWORD[8+rsp]
|
---|
896 | mov r10,QWORD[16+rsp]
|
---|
897 | mov r11,QWORD[24+rsp]
|
---|
898 | mov r12,QWORD[32+rsp]
|
---|
899 | mov r13,QWORD[40+rsp]
|
---|
900 | mov r14,QWORD[48+rsp]
|
---|
901 | mov r15,QWORD[56+rsp]
|
---|
902 |
|
---|
903 | call __rsaz_512_reduce
|
---|
904 | add r8,QWORD[64+rsp]
|
---|
905 | adc r9,QWORD[72+rsp]
|
---|
906 | adc r10,QWORD[80+rsp]
|
---|
907 | adc r11,QWORD[88+rsp]
|
---|
908 | adc r12,QWORD[96+rsp]
|
---|
909 | adc r13,QWORD[104+rsp]
|
---|
910 | adc r14,QWORD[112+rsp]
|
---|
911 | adc r15,QWORD[120+rsp]
|
---|
912 | DB 102,72,15,126,214
|
---|
913 | sbb rcx,rcx
|
---|
914 |
|
---|
915 | call __rsaz_512_subtract
|
---|
916 |
|
---|
917 | mov QWORD[rsi],r8
|
---|
918 | mov QWORD[128+rsi],r9
|
---|
919 | mov QWORD[256+rsi],r10
|
---|
920 | mov QWORD[384+rsi],r11
|
---|
921 | mov QWORD[512+rsi],r12
|
---|
922 | mov QWORD[640+rsi],r13
|
---|
923 | mov QWORD[768+rsi],r14
|
---|
924 | mov QWORD[896+rsi],r15
|
---|
925 |
|
---|
926 | lea rax,[((128+24+48))+rsp]
|
---|
927 |
|
---|
928 | mov r15,QWORD[((-48))+rax]
|
---|
929 |
|
---|
930 | mov r14,QWORD[((-40))+rax]
|
---|
931 |
|
---|
932 | mov r13,QWORD[((-32))+rax]
|
---|
933 |
|
---|
934 | mov r12,QWORD[((-24))+rax]
|
---|
935 |
|
---|
936 | mov rbp,QWORD[((-16))+rax]
|
---|
937 |
|
---|
938 | mov rbx,QWORD[((-8))+rax]
|
---|
939 |
|
---|
940 | lea rsp,[rax]
|
---|
941 |
|
---|
942 | $L$mul_scatter4_epilogue:
|
---|
943 | mov rdi,QWORD[8+rsp] ;WIN64 epilogue
|
---|
944 | mov rsi,QWORD[16+rsp]
|
---|
945 | DB 0F3h,0C3h ;repret
|
---|
946 |
|
---|
947 | $L$SEH_end_rsaz_512_mul_scatter4:
|
---|
948 | global rsaz_512_mul_by_one
|
---|
949 |
|
---|
950 | ALIGN 32
|
---|
951 | rsaz_512_mul_by_one:
|
---|
952 | mov QWORD[8+rsp],rdi ;WIN64 prologue
|
---|
953 | mov QWORD[16+rsp],rsi
|
---|
954 | mov rax,rsp
|
---|
955 | $L$SEH_begin_rsaz_512_mul_by_one:
|
---|
956 | mov rdi,rcx
|
---|
957 | mov rsi,rdx
|
---|
958 | mov rdx,r8
|
---|
959 | mov rcx,r9
|
---|
960 |
|
---|
961 |
|
---|
962 |
|
---|
963 | push rbx
|
---|
964 |
|
---|
965 | push rbp
|
---|
966 |
|
---|
967 | push r12
|
---|
968 |
|
---|
969 | push r13
|
---|
970 |
|
---|
971 | push r14
|
---|
972 |
|
---|
973 | push r15
|
---|
974 |
|
---|
975 |
|
---|
976 | sub rsp,128+24
|
---|
977 |
|
---|
978 | $L$mul_by_one_body:
|
---|
979 | mov rbp,rdx
|
---|
980 | mov QWORD[128+rsp],rcx
|
---|
981 |
|
---|
982 | mov r8,QWORD[rsi]
|
---|
983 | pxor xmm0,xmm0
|
---|
984 | mov r9,QWORD[8+rsi]
|
---|
985 | mov r10,QWORD[16+rsi]
|
---|
986 | mov r11,QWORD[24+rsi]
|
---|
987 | mov r12,QWORD[32+rsi]
|
---|
988 | mov r13,QWORD[40+rsi]
|
---|
989 | mov r14,QWORD[48+rsi]
|
---|
990 | mov r15,QWORD[56+rsi]
|
---|
991 |
|
---|
992 | movdqa XMMWORD[rsp],xmm0
|
---|
993 | movdqa XMMWORD[16+rsp],xmm0
|
---|
994 | movdqa XMMWORD[32+rsp],xmm0
|
---|
995 | movdqa XMMWORD[48+rsp],xmm0
|
---|
996 | movdqa XMMWORD[64+rsp],xmm0
|
---|
997 | movdqa XMMWORD[80+rsp],xmm0
|
---|
998 | movdqa XMMWORD[96+rsp],xmm0
|
---|
999 | call __rsaz_512_reduce
|
---|
1000 | mov QWORD[rdi],r8
|
---|
1001 | mov QWORD[8+rdi],r9
|
---|
1002 | mov QWORD[16+rdi],r10
|
---|
1003 | mov QWORD[24+rdi],r11
|
---|
1004 | mov QWORD[32+rdi],r12
|
---|
1005 | mov QWORD[40+rdi],r13
|
---|
1006 | mov QWORD[48+rdi],r14
|
---|
1007 | mov QWORD[56+rdi],r15
|
---|
1008 |
|
---|
1009 | lea rax,[((128+24+48))+rsp]
|
---|
1010 |
|
---|
1011 | mov r15,QWORD[((-48))+rax]
|
---|
1012 |
|
---|
1013 | mov r14,QWORD[((-40))+rax]
|
---|
1014 |
|
---|
1015 | mov r13,QWORD[((-32))+rax]
|
---|
1016 |
|
---|
1017 | mov r12,QWORD[((-24))+rax]
|
---|
1018 |
|
---|
1019 | mov rbp,QWORD[((-16))+rax]
|
---|
1020 |
|
---|
1021 | mov rbx,QWORD[((-8))+rax]
|
---|
1022 |
|
---|
1023 | lea rsp,[rax]
|
---|
1024 |
|
---|
1025 | $L$mul_by_one_epilogue:
|
---|
1026 | mov rdi,QWORD[8+rsp] ;WIN64 epilogue
|
---|
1027 | mov rsi,QWORD[16+rsp]
|
---|
1028 | DB 0F3h,0C3h ;repret
|
---|
1029 |
|
---|
1030 | $L$SEH_end_rsaz_512_mul_by_one:
|
---|
1031 |
|
---|
1032 | ALIGN 32
|
---|
1033 | __rsaz_512_reduce:
|
---|
1034 |
|
---|
1035 | mov rbx,r8
|
---|
1036 | imul rbx,QWORD[((128+8))+rsp]
|
---|
1037 | mov rax,QWORD[rbp]
|
---|
1038 | mov ecx,8
|
---|
1039 | jmp NEAR $L$reduction_loop
|
---|
1040 |
|
---|
1041 | ALIGN 32
|
---|
1042 | $L$reduction_loop:
|
---|
1043 | mul rbx
|
---|
1044 | mov rax,QWORD[8+rbp]
|
---|
1045 | neg r8
|
---|
1046 | mov r8,rdx
|
---|
1047 | adc r8,0
|
---|
1048 |
|
---|
1049 | mul rbx
|
---|
1050 | add r9,rax
|
---|
1051 | mov rax,QWORD[16+rbp]
|
---|
1052 | adc rdx,0
|
---|
1053 | add r8,r9
|
---|
1054 | mov r9,rdx
|
---|
1055 | adc r9,0
|
---|
1056 |
|
---|
1057 | mul rbx
|
---|
1058 | add r10,rax
|
---|
1059 | mov rax,QWORD[24+rbp]
|
---|
1060 | adc rdx,0
|
---|
1061 | add r9,r10
|
---|
1062 | mov r10,rdx
|
---|
1063 | adc r10,0
|
---|
1064 |
|
---|
1065 | mul rbx
|
---|
1066 | add r11,rax
|
---|
1067 | mov rax,QWORD[32+rbp]
|
---|
1068 | adc rdx,0
|
---|
1069 | add r10,r11
|
---|
1070 | mov rsi,QWORD[((128+8))+rsp]
|
---|
1071 |
|
---|
1072 |
|
---|
1073 | adc rdx,0
|
---|
1074 | mov r11,rdx
|
---|
1075 |
|
---|
1076 | mul rbx
|
---|
1077 | add r12,rax
|
---|
1078 | mov rax,QWORD[40+rbp]
|
---|
1079 | adc rdx,0
|
---|
1080 | imul rsi,r8
|
---|
1081 | add r11,r12
|
---|
1082 | mov r12,rdx
|
---|
1083 | adc r12,0
|
---|
1084 |
|
---|
1085 | mul rbx
|
---|
1086 | add r13,rax
|
---|
1087 | mov rax,QWORD[48+rbp]
|
---|
1088 | adc rdx,0
|
---|
1089 | add r12,r13
|
---|
1090 | mov r13,rdx
|
---|
1091 | adc r13,0
|
---|
1092 |
|
---|
1093 | mul rbx
|
---|
1094 | add r14,rax
|
---|
1095 | mov rax,QWORD[56+rbp]
|
---|
1096 | adc rdx,0
|
---|
1097 | add r13,r14
|
---|
1098 | mov r14,rdx
|
---|
1099 | adc r14,0
|
---|
1100 |
|
---|
1101 | mul rbx
|
---|
1102 | mov rbx,rsi
|
---|
1103 | add r15,rax
|
---|
1104 | mov rax,QWORD[rbp]
|
---|
1105 | adc rdx,0
|
---|
1106 | add r14,r15
|
---|
1107 | mov r15,rdx
|
---|
1108 | adc r15,0
|
---|
1109 |
|
---|
1110 | dec ecx
|
---|
1111 | jne NEAR $L$reduction_loop
|
---|
1112 |
|
---|
1113 | DB 0F3h,0C3h ;repret
|
---|
1114 |
|
---|
1115 |
|
---|
1116 |
|
---|
1117 | ALIGN 32
|
---|
1118 | __rsaz_512_subtract:
|
---|
1119 |
|
---|
1120 | mov QWORD[rdi],r8
|
---|
1121 | mov QWORD[8+rdi],r9
|
---|
1122 | mov QWORD[16+rdi],r10
|
---|
1123 | mov QWORD[24+rdi],r11
|
---|
1124 | mov QWORD[32+rdi],r12
|
---|
1125 | mov QWORD[40+rdi],r13
|
---|
1126 | mov QWORD[48+rdi],r14
|
---|
1127 | mov QWORD[56+rdi],r15
|
---|
1128 |
|
---|
1129 | mov r8,QWORD[rbp]
|
---|
1130 | mov r9,QWORD[8+rbp]
|
---|
1131 | neg r8
|
---|
1132 | not r9
|
---|
1133 | and r8,rcx
|
---|
1134 | mov r10,QWORD[16+rbp]
|
---|
1135 | and r9,rcx
|
---|
1136 | not r10
|
---|
1137 | mov r11,QWORD[24+rbp]
|
---|
1138 | and r10,rcx
|
---|
1139 | not r11
|
---|
1140 | mov r12,QWORD[32+rbp]
|
---|
1141 | and r11,rcx
|
---|
1142 | not r12
|
---|
1143 | mov r13,QWORD[40+rbp]
|
---|
1144 | and r12,rcx
|
---|
1145 | not r13
|
---|
1146 | mov r14,QWORD[48+rbp]
|
---|
1147 | and r13,rcx
|
---|
1148 | not r14
|
---|
1149 | mov r15,QWORD[56+rbp]
|
---|
1150 | and r14,rcx
|
---|
1151 | not r15
|
---|
1152 | and r15,rcx
|
---|
1153 |
|
---|
1154 | add r8,QWORD[rdi]
|
---|
1155 | adc r9,QWORD[8+rdi]
|
---|
1156 | adc r10,QWORD[16+rdi]
|
---|
1157 | adc r11,QWORD[24+rdi]
|
---|
1158 | adc r12,QWORD[32+rdi]
|
---|
1159 | adc r13,QWORD[40+rdi]
|
---|
1160 | adc r14,QWORD[48+rdi]
|
---|
1161 | adc r15,QWORD[56+rdi]
|
---|
1162 |
|
---|
1163 | mov QWORD[rdi],r8
|
---|
1164 | mov QWORD[8+rdi],r9
|
---|
1165 | mov QWORD[16+rdi],r10
|
---|
1166 | mov QWORD[24+rdi],r11
|
---|
1167 | mov QWORD[32+rdi],r12
|
---|
1168 | mov QWORD[40+rdi],r13
|
---|
1169 | mov QWORD[48+rdi],r14
|
---|
1170 | mov QWORD[56+rdi],r15
|
---|
1171 |
|
---|
1172 | DB 0F3h,0C3h ;repret
|
---|
1173 |
|
---|
1174 |
|
---|
1175 |
|
---|
1176 | ALIGN 32
|
---|
1177 | __rsaz_512_mul:
|
---|
1178 |
|
---|
1179 | lea rdi,[8+rsp]
|
---|
1180 |
|
---|
1181 | mov rax,QWORD[rsi]
|
---|
1182 | mul rbx
|
---|
1183 | mov QWORD[rdi],rax
|
---|
1184 | mov rax,QWORD[8+rsi]
|
---|
1185 | mov r8,rdx
|
---|
1186 |
|
---|
1187 | mul rbx
|
---|
1188 | add r8,rax
|
---|
1189 | mov rax,QWORD[16+rsi]
|
---|
1190 | mov r9,rdx
|
---|
1191 | adc r9,0
|
---|
1192 |
|
---|
1193 | mul rbx
|
---|
1194 | add r9,rax
|
---|
1195 | mov rax,QWORD[24+rsi]
|
---|
1196 | mov r10,rdx
|
---|
1197 | adc r10,0
|
---|
1198 |
|
---|
1199 | mul rbx
|
---|
1200 | add r10,rax
|
---|
1201 | mov rax,QWORD[32+rsi]
|
---|
1202 | mov r11,rdx
|
---|
1203 | adc r11,0
|
---|
1204 |
|
---|
1205 | mul rbx
|
---|
1206 | add r11,rax
|
---|
1207 | mov rax,QWORD[40+rsi]
|
---|
1208 | mov r12,rdx
|
---|
1209 | adc r12,0
|
---|
1210 |
|
---|
1211 | mul rbx
|
---|
1212 | add r12,rax
|
---|
1213 | mov rax,QWORD[48+rsi]
|
---|
1214 | mov r13,rdx
|
---|
1215 | adc r13,0
|
---|
1216 |
|
---|
1217 | mul rbx
|
---|
1218 | add r13,rax
|
---|
1219 | mov rax,QWORD[56+rsi]
|
---|
1220 | mov r14,rdx
|
---|
1221 | adc r14,0
|
---|
1222 |
|
---|
1223 | mul rbx
|
---|
1224 | add r14,rax
|
---|
1225 | mov rax,QWORD[rsi]
|
---|
1226 | mov r15,rdx
|
---|
1227 | adc r15,0
|
---|
1228 |
|
---|
1229 | lea rbp,[8+rbp]
|
---|
1230 | lea rdi,[8+rdi]
|
---|
1231 |
|
---|
1232 | mov ecx,7
|
---|
1233 | jmp NEAR $L$oop_mul
|
---|
1234 |
|
---|
1235 | ALIGN 32
|
---|
1236 | $L$oop_mul:
|
---|
1237 | mov rbx,QWORD[rbp]
|
---|
1238 | mul rbx
|
---|
1239 | add r8,rax
|
---|
1240 | mov rax,QWORD[8+rsi]
|
---|
1241 | mov QWORD[rdi],r8
|
---|
1242 | mov r8,rdx
|
---|
1243 | adc r8,0
|
---|
1244 |
|
---|
1245 | mul rbx
|
---|
1246 | add r9,rax
|
---|
1247 | mov rax,QWORD[16+rsi]
|
---|
1248 | adc rdx,0
|
---|
1249 | add r8,r9
|
---|
1250 | mov r9,rdx
|
---|
1251 | adc r9,0
|
---|
1252 |
|
---|
1253 | mul rbx
|
---|
1254 | add r10,rax
|
---|
1255 | mov rax,QWORD[24+rsi]
|
---|
1256 | adc rdx,0
|
---|
1257 | add r9,r10
|
---|
1258 | mov r10,rdx
|
---|
1259 | adc r10,0
|
---|
1260 |
|
---|
1261 | mul rbx
|
---|
1262 | add r11,rax
|
---|
1263 | mov rax,QWORD[32+rsi]
|
---|
1264 | adc rdx,0
|
---|
1265 | add r10,r11
|
---|
1266 | mov r11,rdx
|
---|
1267 | adc r11,0
|
---|
1268 |
|
---|
1269 | mul rbx
|
---|
1270 | add r12,rax
|
---|
1271 | mov rax,QWORD[40+rsi]
|
---|
1272 | adc rdx,0
|
---|
1273 | add r11,r12
|
---|
1274 | mov r12,rdx
|
---|
1275 | adc r12,0
|
---|
1276 |
|
---|
1277 | mul rbx
|
---|
1278 | add r13,rax
|
---|
1279 | mov rax,QWORD[48+rsi]
|
---|
1280 | adc rdx,0
|
---|
1281 | add r12,r13
|
---|
1282 | mov r13,rdx
|
---|
1283 | adc r13,0
|
---|
1284 |
|
---|
1285 | mul rbx
|
---|
1286 | add r14,rax
|
---|
1287 | mov rax,QWORD[56+rsi]
|
---|
1288 | adc rdx,0
|
---|
1289 | add r13,r14
|
---|
1290 | mov r14,rdx
|
---|
1291 | lea rbp,[8+rbp]
|
---|
1292 | adc r14,0
|
---|
1293 |
|
---|
1294 | mul rbx
|
---|
1295 | add r15,rax
|
---|
1296 | mov rax,QWORD[rsi]
|
---|
1297 | adc rdx,0
|
---|
1298 | add r14,r15
|
---|
1299 | mov r15,rdx
|
---|
1300 | adc r15,0
|
---|
1301 |
|
---|
1302 | lea rdi,[8+rdi]
|
---|
1303 |
|
---|
1304 | dec ecx
|
---|
1305 | jnz NEAR $L$oop_mul
|
---|
1306 |
|
---|
1307 | mov QWORD[rdi],r8
|
---|
1308 | mov QWORD[8+rdi],r9
|
---|
1309 | mov QWORD[16+rdi],r10
|
---|
1310 | mov QWORD[24+rdi],r11
|
---|
1311 | mov QWORD[32+rdi],r12
|
---|
1312 | mov QWORD[40+rdi],r13
|
---|
1313 | mov QWORD[48+rdi],r14
|
---|
1314 | mov QWORD[56+rdi],r15
|
---|
1315 |
|
---|
1316 | DB 0F3h,0C3h ;repret
|
---|
1317 |
|
---|
1318 |
|
---|
1319 | global rsaz_512_scatter4
|
---|
1320 |
|
---|
1321 | ALIGN 16
|
---|
1322 | rsaz_512_scatter4:
|
---|
1323 |
|
---|
1324 | lea rcx,[r8*8+rcx]
|
---|
1325 | mov r9d,8
|
---|
1326 | jmp NEAR $L$oop_scatter
|
---|
1327 | ALIGN 16
|
---|
1328 | $L$oop_scatter:
|
---|
1329 | mov rax,QWORD[rdx]
|
---|
1330 | lea rdx,[8+rdx]
|
---|
1331 | mov QWORD[rcx],rax
|
---|
1332 | lea rcx,[128+rcx]
|
---|
1333 | dec r9d
|
---|
1334 | jnz NEAR $L$oop_scatter
|
---|
1335 | DB 0F3h,0C3h ;repret
|
---|
1336 |
|
---|
1337 |
|
---|
1338 |
|
---|
1339 | global rsaz_512_gather4
|
---|
1340 |
|
---|
1341 | ALIGN 16
|
---|
1342 | rsaz_512_gather4:
|
---|
1343 |
|
---|
1344 | $L$SEH_begin_rsaz_512_gather4:
|
---|
1345 | DB 0x48,0x81,0xec,0xa8,0x00,0x00,0x00
|
---|
1346 | DB 0x0f,0x29,0x34,0x24
|
---|
1347 | DB 0x0f,0x29,0x7c,0x24,0x10
|
---|
1348 | DB 0x44,0x0f,0x29,0x44,0x24,0x20
|
---|
1349 | DB 0x44,0x0f,0x29,0x4c,0x24,0x30
|
---|
1350 | DB 0x44,0x0f,0x29,0x54,0x24,0x40
|
---|
1351 | DB 0x44,0x0f,0x29,0x5c,0x24,0x50
|
---|
1352 | DB 0x44,0x0f,0x29,0x64,0x24,0x60
|
---|
1353 | DB 0x44,0x0f,0x29,0x6c,0x24,0x70
|
---|
1354 | DB 0x44,0x0f,0x29,0xb4,0x24,0x80,0,0,0
|
---|
1355 | DB 0x44,0x0f,0x29,0xbc,0x24,0x90,0,0,0
|
---|
1356 | movd xmm8,r8d
|
---|
1357 | movdqa xmm1,XMMWORD[(($L$inc+16))]
|
---|
1358 | movdqa xmm0,XMMWORD[$L$inc]
|
---|
1359 |
|
---|
1360 | pshufd xmm8,xmm8,0
|
---|
1361 | movdqa xmm7,xmm1
|
---|
1362 | movdqa xmm2,xmm1
|
---|
1363 | paddd xmm1,xmm0
|
---|
1364 | pcmpeqd xmm0,xmm8
|
---|
1365 | movdqa xmm3,xmm7
|
---|
1366 | paddd xmm2,xmm1
|
---|
1367 | pcmpeqd xmm1,xmm8
|
---|
1368 | movdqa xmm4,xmm7
|
---|
1369 | paddd xmm3,xmm2
|
---|
1370 | pcmpeqd xmm2,xmm8
|
---|
1371 | movdqa xmm5,xmm7
|
---|
1372 | paddd xmm4,xmm3
|
---|
1373 | pcmpeqd xmm3,xmm8
|
---|
1374 | movdqa xmm6,xmm7
|
---|
1375 | paddd xmm5,xmm4
|
---|
1376 | pcmpeqd xmm4,xmm8
|
---|
1377 | paddd xmm6,xmm5
|
---|
1378 | pcmpeqd xmm5,xmm8
|
---|
1379 | paddd xmm7,xmm6
|
---|
1380 | pcmpeqd xmm6,xmm8
|
---|
1381 | pcmpeqd xmm7,xmm8
|
---|
1382 | mov r9d,8
|
---|
1383 | jmp NEAR $L$oop_gather
|
---|
1384 | ALIGN 16
|
---|
1385 | $L$oop_gather:
|
---|
1386 | movdqa xmm8,XMMWORD[rdx]
|
---|
1387 | movdqa xmm9,XMMWORD[16+rdx]
|
---|
1388 | movdqa xmm10,XMMWORD[32+rdx]
|
---|
1389 | movdqa xmm11,XMMWORD[48+rdx]
|
---|
1390 | pand xmm8,xmm0
|
---|
1391 | movdqa xmm12,XMMWORD[64+rdx]
|
---|
1392 | pand xmm9,xmm1
|
---|
1393 | movdqa xmm13,XMMWORD[80+rdx]
|
---|
1394 | pand xmm10,xmm2
|
---|
1395 | movdqa xmm14,XMMWORD[96+rdx]
|
---|
1396 | pand xmm11,xmm3
|
---|
1397 | movdqa xmm15,XMMWORD[112+rdx]
|
---|
1398 | lea rdx,[128+rdx]
|
---|
1399 | pand xmm12,xmm4
|
---|
1400 | pand xmm13,xmm5
|
---|
1401 | pand xmm14,xmm6
|
---|
1402 | pand xmm15,xmm7
|
---|
1403 | por xmm8,xmm10
|
---|
1404 | por xmm9,xmm11
|
---|
1405 | por xmm8,xmm12
|
---|
1406 | por xmm9,xmm13
|
---|
1407 | por xmm8,xmm14
|
---|
1408 | por xmm9,xmm15
|
---|
1409 |
|
---|
1410 | por xmm8,xmm9
|
---|
1411 | pshufd xmm9,xmm8,0x4e
|
---|
1412 | por xmm8,xmm9
|
---|
1413 | movq QWORD[rcx],xmm8
|
---|
1414 | lea rcx,[8+rcx]
|
---|
1415 | dec r9d
|
---|
1416 | jnz NEAR $L$oop_gather
|
---|
1417 | movaps xmm6,XMMWORD[rsp]
|
---|
1418 | movaps xmm7,XMMWORD[16+rsp]
|
---|
1419 | movaps xmm8,XMMWORD[32+rsp]
|
---|
1420 | movaps xmm9,XMMWORD[48+rsp]
|
---|
1421 | movaps xmm10,XMMWORD[64+rsp]
|
---|
1422 | movaps xmm11,XMMWORD[80+rsp]
|
---|
1423 | movaps xmm12,XMMWORD[96+rsp]
|
---|
1424 | movaps xmm13,XMMWORD[112+rsp]
|
---|
1425 | movaps xmm14,XMMWORD[128+rsp]
|
---|
1426 | movaps xmm15,XMMWORD[144+rsp]
|
---|
1427 | add rsp,0xa8
|
---|
1428 | DB 0F3h,0C3h ;repret
|
---|
1429 | $L$SEH_end_rsaz_512_gather4:
|
---|
1430 |
|
---|
1431 |
|
---|
1432 |
|
---|
1433 | ALIGN 64
|
---|
1434 | $L$inc:
|
---|
1435 | DD 0,0,1,1
|
---|
1436 | DD 2,2,2,2
|
---|
1437 | EXTERN __imp_RtlVirtualUnwind
|
---|
1438 |
|
---|
1439 | ALIGN 16
|
---|
1440 | se_handler:
|
---|
1441 | push rsi
|
---|
1442 | push rdi
|
---|
1443 | push rbx
|
---|
1444 | push rbp
|
---|
1445 | push r12
|
---|
1446 | push r13
|
---|
1447 | push r14
|
---|
1448 | push r15
|
---|
1449 | pushfq
|
---|
1450 | sub rsp,64
|
---|
1451 |
|
---|
1452 | mov rax,QWORD[120+r8]
|
---|
1453 | mov rbx,QWORD[248+r8]
|
---|
1454 |
|
---|
1455 | mov rsi,QWORD[8+r9]
|
---|
1456 | mov r11,QWORD[56+r9]
|
---|
1457 |
|
---|
1458 | mov r10d,DWORD[r11]
|
---|
1459 | lea r10,[r10*1+rsi]
|
---|
1460 | cmp rbx,r10
|
---|
1461 | jb NEAR $L$common_seh_tail
|
---|
1462 |
|
---|
1463 | mov rax,QWORD[152+r8]
|
---|
1464 |
|
---|
1465 | mov r10d,DWORD[4+r11]
|
---|
1466 | lea r10,[r10*1+rsi]
|
---|
1467 | cmp rbx,r10
|
---|
1468 | jae NEAR $L$common_seh_tail
|
---|
1469 |
|
---|
1470 | lea rax,[((128+24+48))+rax]
|
---|
1471 |
|
---|
1472 | lea rbx,[$L$mul_gather4_epilogue]
|
---|
1473 | cmp rbx,r10
|
---|
1474 | jne NEAR $L$se_not_in_mul_gather4
|
---|
1475 |
|
---|
1476 | lea rax,[176+rax]
|
---|
1477 |
|
---|
1478 | lea rsi,[((-48-168))+rax]
|
---|
1479 | lea rdi,[512+r8]
|
---|
1480 | mov ecx,20
|
---|
1481 | DD 0xa548f3fc
|
---|
1482 |
|
---|
1483 | $L$se_not_in_mul_gather4:
|
---|
1484 | mov rbx,QWORD[((-8))+rax]
|
---|
1485 | mov rbp,QWORD[((-16))+rax]
|
---|
1486 | mov r12,QWORD[((-24))+rax]
|
---|
1487 | mov r13,QWORD[((-32))+rax]
|
---|
1488 | mov r14,QWORD[((-40))+rax]
|
---|
1489 | mov r15,QWORD[((-48))+rax]
|
---|
1490 | mov QWORD[144+r8],rbx
|
---|
1491 | mov QWORD[160+r8],rbp
|
---|
1492 | mov QWORD[216+r8],r12
|
---|
1493 | mov QWORD[224+r8],r13
|
---|
1494 | mov QWORD[232+r8],r14
|
---|
1495 | mov QWORD[240+r8],r15
|
---|
1496 |
|
---|
1497 | $L$common_seh_tail:
|
---|
1498 | mov rdi,QWORD[8+rax]
|
---|
1499 | mov rsi,QWORD[16+rax]
|
---|
1500 | mov QWORD[152+r8],rax
|
---|
1501 | mov QWORD[168+r8],rsi
|
---|
1502 | mov QWORD[176+r8],rdi
|
---|
1503 |
|
---|
1504 | mov rdi,QWORD[40+r9]
|
---|
1505 | mov rsi,r8
|
---|
1506 | mov ecx,154
|
---|
1507 | DD 0xa548f3fc
|
---|
1508 |
|
---|
1509 | mov rsi,r9
|
---|
1510 | xor rcx,rcx
|
---|
1511 | mov rdx,QWORD[8+rsi]
|
---|
1512 | mov r8,QWORD[rsi]
|
---|
1513 | mov r9,QWORD[16+rsi]
|
---|
1514 | mov r10,QWORD[40+rsi]
|
---|
1515 | lea r11,[56+rsi]
|
---|
1516 | lea r12,[24+rsi]
|
---|
1517 | mov QWORD[32+rsp],r10
|
---|
1518 | mov QWORD[40+rsp],r11
|
---|
1519 | mov QWORD[48+rsp],r12
|
---|
1520 | mov QWORD[56+rsp],rcx
|
---|
1521 | call QWORD[__imp_RtlVirtualUnwind]
|
---|
1522 |
|
---|
1523 | mov eax,1
|
---|
1524 | add rsp,64
|
---|
1525 | popfq
|
---|
1526 | pop r15
|
---|
1527 | pop r14
|
---|
1528 | pop r13
|
---|
1529 | pop r12
|
---|
1530 | pop rbp
|
---|
1531 | pop rbx
|
---|
1532 | pop rdi
|
---|
1533 | pop rsi
|
---|
1534 | DB 0F3h,0C3h ;repret
|
---|
1535 |
|
---|
1536 |
|
---|
1537 | section .pdata rdata align=4
|
---|
1538 | ALIGN 4
|
---|
1539 | DD $L$SEH_begin_rsaz_512_sqr wrt ..imagebase
|
---|
1540 | DD $L$SEH_end_rsaz_512_sqr wrt ..imagebase
|
---|
1541 | DD $L$SEH_info_rsaz_512_sqr wrt ..imagebase
|
---|
1542 |
|
---|
1543 | DD $L$SEH_begin_rsaz_512_mul wrt ..imagebase
|
---|
1544 | DD $L$SEH_end_rsaz_512_mul wrt ..imagebase
|
---|
1545 | DD $L$SEH_info_rsaz_512_mul wrt ..imagebase
|
---|
1546 |
|
---|
1547 | DD $L$SEH_begin_rsaz_512_mul_gather4 wrt ..imagebase
|
---|
1548 | DD $L$SEH_end_rsaz_512_mul_gather4 wrt ..imagebase
|
---|
1549 | DD $L$SEH_info_rsaz_512_mul_gather4 wrt ..imagebase
|
---|
1550 |
|
---|
1551 | DD $L$SEH_begin_rsaz_512_mul_scatter4 wrt ..imagebase
|
---|
1552 | DD $L$SEH_end_rsaz_512_mul_scatter4 wrt ..imagebase
|
---|
1553 | DD $L$SEH_info_rsaz_512_mul_scatter4 wrt ..imagebase
|
---|
1554 |
|
---|
1555 | DD $L$SEH_begin_rsaz_512_mul_by_one wrt ..imagebase
|
---|
1556 | DD $L$SEH_end_rsaz_512_mul_by_one wrt ..imagebase
|
---|
1557 | DD $L$SEH_info_rsaz_512_mul_by_one wrt ..imagebase
|
---|
1558 |
|
---|
1559 | DD $L$SEH_begin_rsaz_512_gather4 wrt ..imagebase
|
---|
1560 | DD $L$SEH_end_rsaz_512_gather4 wrt ..imagebase
|
---|
1561 | DD $L$SEH_info_rsaz_512_gather4 wrt ..imagebase
|
---|
1562 |
|
---|
1563 | section .xdata rdata align=8
|
---|
1564 | ALIGN 8
|
---|
1565 | $L$SEH_info_rsaz_512_sqr:
|
---|
1566 | DB 9,0,0,0
|
---|
1567 | DD se_handler wrt ..imagebase
|
---|
1568 | DD $L$sqr_body wrt ..imagebase,$L$sqr_epilogue wrt ..imagebase
|
---|
1569 | $L$SEH_info_rsaz_512_mul:
|
---|
1570 | DB 9,0,0,0
|
---|
1571 | DD se_handler wrt ..imagebase
|
---|
1572 | DD $L$mul_body wrt ..imagebase,$L$mul_epilogue wrt ..imagebase
|
---|
1573 | $L$SEH_info_rsaz_512_mul_gather4:
|
---|
1574 | DB 9,0,0,0
|
---|
1575 | DD se_handler wrt ..imagebase
|
---|
1576 | DD $L$mul_gather4_body wrt ..imagebase,$L$mul_gather4_epilogue wrt ..imagebase
|
---|
1577 | $L$SEH_info_rsaz_512_mul_scatter4:
|
---|
1578 | DB 9,0,0,0
|
---|
1579 | DD se_handler wrt ..imagebase
|
---|
1580 | DD $L$mul_scatter4_body wrt ..imagebase,$L$mul_scatter4_epilogue wrt ..imagebase
|
---|
1581 | $L$SEH_info_rsaz_512_mul_by_one:
|
---|
1582 | DB 9,0,0,0
|
---|
1583 | DD se_handler wrt ..imagebase
|
---|
1584 | DD $L$mul_by_one_body wrt ..imagebase,$L$mul_by_one_epilogue wrt ..imagebase
|
---|
1585 | $L$SEH_info_rsaz_512_gather4:
|
---|
1586 | DB 0x01,0x46,0x16,0x00
|
---|
1587 | DB 0x46,0xf8,0x09,0x00
|
---|
1588 | DB 0x3d,0xe8,0x08,0x00
|
---|
1589 | DB 0x34,0xd8,0x07,0x00
|
---|
1590 | DB 0x2e,0xc8,0x06,0x00
|
---|
1591 | DB 0x28,0xb8,0x05,0x00
|
---|
1592 | DB 0x22,0xa8,0x04,0x00
|
---|
1593 | DB 0x1c,0x98,0x03,0x00
|
---|
1594 | DB 0x16,0x88,0x02,0x00
|
---|
1595 | DB 0x10,0x78,0x01,0x00
|
---|
1596 | DB 0x0b,0x68,0x00,0x00
|
---|
1597 | DB 0x07,0x01,0x15,0x00
|
---|