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