]> git.ipfire.org Git - thirdparty/openssl.git/blob - crypto/bn/asm/bn-win32.asm
Import of old SSLeay release: SSLeay 0.9.1b (unreleased)
[thirdparty/openssl.git] / crypto / bn / asm / bn-win32.asm
1 ; Don't even think of reading this code
2 ; It was automatically generated by bn-586.pl
3 ; Which is a perl program used to generate the x86 assember for
4 ; any of elf, a.out, BSDI,Win32, or Solaris
5 ; eric <eay@cryptsoft.com>
6 ;
7 TITLE bn-586.asm
8 .386
9 .model FLAT
10 _TEXT SEGMENT
11 PUBLIC _bn_mul_add_words
12
13 _bn_mul_add_words PROC NEAR
14 push ebp
15 push ebx
16 push esi
17 push edi
18 ;
19 xor esi, esi
20 mov edi, DWORD PTR 20[esp]
21 mov ecx, DWORD PTR 28[esp]
22 mov ebx, DWORD PTR 24[esp]
23 and ecx, 4294967288
24 mov ebp, DWORD PTR 32[esp]
25 push ecx
26 jz $L000maw_finish
27 L001maw_loop:
28 mov DWORD PTR [esp],ecx
29 ; Round 0
30 mov eax, DWORD PTR [ebx]
31 mul ebp
32 add eax, esi
33 mov esi, DWORD PTR [edi]
34 adc edx, 0
35 add eax, esi
36 adc edx, 0
37 mov DWORD PTR [edi],eax
38 mov esi, edx
39 ; Round 4
40 mov eax, DWORD PTR 4[ebx]
41 mul ebp
42 add eax, esi
43 mov esi, DWORD PTR 4[edi]
44 adc edx, 0
45 add eax, esi
46 adc edx, 0
47 mov DWORD PTR 4[edi],eax
48 mov esi, edx
49 ; Round 8
50 mov eax, DWORD PTR 8[ebx]
51 mul ebp
52 add eax, esi
53 mov esi, DWORD PTR 8[edi]
54 adc edx, 0
55 add eax, esi
56 adc edx, 0
57 mov DWORD PTR 8[edi],eax
58 mov esi, edx
59 ; Round 12
60 mov eax, DWORD PTR 12[ebx]
61 mul ebp
62 add eax, esi
63 mov esi, DWORD PTR 12[edi]
64 adc edx, 0
65 add eax, esi
66 adc edx, 0
67 mov DWORD PTR 12[edi],eax
68 mov esi, edx
69 ; Round 16
70 mov eax, DWORD PTR 16[ebx]
71 mul ebp
72 add eax, esi
73 mov esi, DWORD PTR 16[edi]
74 adc edx, 0
75 add eax, esi
76 adc edx, 0
77 mov DWORD PTR 16[edi],eax
78 mov esi, edx
79 ; Round 20
80 mov eax, DWORD PTR 20[ebx]
81 mul ebp
82 add eax, esi
83 mov esi, DWORD PTR 20[edi]
84 adc edx, 0
85 add eax, esi
86 adc edx, 0
87 mov DWORD PTR 20[edi],eax
88 mov esi, edx
89 ; Round 24
90 mov eax, DWORD PTR 24[ebx]
91 mul ebp
92 add eax, esi
93 mov esi, DWORD PTR 24[edi]
94 adc edx, 0
95 add eax, esi
96 adc edx, 0
97 mov DWORD PTR 24[edi],eax
98 mov esi, edx
99 ; Round 28
100 mov eax, DWORD PTR 28[ebx]
101 mul ebp
102 add eax, esi
103 mov esi, DWORD PTR 28[edi]
104 adc edx, 0
105 add eax, esi
106 adc edx, 0
107 mov DWORD PTR 28[edi],eax
108 mov esi, edx
109 ;
110 mov ecx, DWORD PTR [esp]
111 add ebx, 32
112 add edi, 32
113 sub ecx, 8
114 jnz L001maw_loop
115 $L000maw_finish:
116 mov ecx, DWORD PTR 32[esp]
117 and ecx, 7
118 jnz $L002maw_finish2
119 jmp $L003maw_end
120 $L002maw_finish2:
121 ; Tail Round 0
122 mov eax, DWORD PTR [ebx]
123 mul ebp
124 add eax, esi
125 mov esi, DWORD PTR [edi]
126 adc edx, 0
127 add eax, esi
128 adc edx, 0
129 dec ecx
130 mov DWORD PTR [edi],eax
131 mov esi, edx
132 jz $L003maw_end
133 ; Tail Round 1
134 mov eax, DWORD PTR 4[ebx]
135 mul ebp
136 add eax, esi
137 mov esi, DWORD PTR 4[edi]
138 adc edx, 0
139 add eax, esi
140 adc edx, 0
141 dec ecx
142 mov DWORD PTR 4[edi],eax
143 mov esi, edx
144 jz $L003maw_end
145 ; Tail Round 2
146 mov eax, DWORD PTR 8[ebx]
147 mul ebp
148 add eax, esi
149 mov esi, DWORD PTR 8[edi]
150 adc edx, 0
151 add eax, esi
152 adc edx, 0
153 dec ecx
154 mov DWORD PTR 8[edi],eax
155 mov esi, edx
156 jz $L003maw_end
157 ; Tail Round 3
158 mov eax, DWORD PTR 12[ebx]
159 mul ebp
160 add eax, esi
161 mov esi, DWORD PTR 12[edi]
162 adc edx, 0
163 add eax, esi
164 adc edx, 0
165 dec ecx
166 mov DWORD PTR 12[edi],eax
167 mov esi, edx
168 jz $L003maw_end
169 ; Tail Round 4
170 mov eax, DWORD PTR 16[ebx]
171 mul ebp
172 add eax, esi
173 mov esi, DWORD PTR 16[edi]
174 adc edx, 0
175 add eax, esi
176 adc edx, 0
177 dec ecx
178 mov DWORD PTR 16[edi],eax
179 mov esi, edx
180 jz $L003maw_end
181 ; Tail Round 5
182 mov eax, DWORD PTR 20[ebx]
183 mul ebp
184 add eax, esi
185 mov esi, DWORD PTR 20[edi]
186 adc edx, 0
187 add eax, esi
188 adc edx, 0
189 dec ecx
190 mov DWORD PTR 20[edi],eax
191 mov esi, edx
192 jz $L003maw_end
193 ; Tail Round 6
194 mov eax, DWORD PTR 24[ebx]
195 mul ebp
196 add eax, esi
197 mov esi, DWORD PTR 24[edi]
198 adc edx, 0
199 add eax, esi
200 adc edx, 0
201 mov DWORD PTR 24[edi],eax
202 mov esi, edx
203 $L003maw_end:
204 mov eax, esi
205 pop ecx
206 pop edi
207 pop esi
208 pop ebx
209 pop ebp
210 ret
211 _bn_mul_add_words ENDP
212 _TEXT ENDS
213 _TEXT SEGMENT
214 PUBLIC _bn_mul_words
215
216 _bn_mul_words PROC NEAR
217 push ebp
218 push ebx
219 push esi
220 push edi
221 ;
222 xor esi, esi
223 mov edi, DWORD PTR 20[esp]
224 mov ebx, DWORD PTR 24[esp]
225 mov ebp, DWORD PTR 28[esp]
226 mov ecx, DWORD PTR 32[esp]
227 and ebp, 4294967288
228 jz $L004mw_finish
229 L005mw_loop:
230 ; Round 0
231 mov eax, DWORD PTR [ebx]
232 mul ecx
233 add eax, esi
234 adc edx, 0
235 mov DWORD PTR [edi],eax
236 mov esi, edx
237 ; Round 4
238 mov eax, DWORD PTR 4[ebx]
239 mul ecx
240 add eax, esi
241 adc edx, 0
242 mov DWORD PTR 4[edi],eax
243 mov esi, edx
244 ; Round 8
245 mov eax, DWORD PTR 8[ebx]
246 mul ecx
247 add eax, esi
248 adc edx, 0
249 mov DWORD PTR 8[edi],eax
250 mov esi, edx
251 ; Round 12
252 mov eax, DWORD PTR 12[ebx]
253 mul ecx
254 add eax, esi
255 adc edx, 0
256 mov DWORD PTR 12[edi],eax
257 mov esi, edx
258 ; Round 16
259 mov eax, DWORD PTR 16[ebx]
260 mul ecx
261 add eax, esi
262 adc edx, 0
263 mov DWORD PTR 16[edi],eax
264 mov esi, edx
265 ; Round 20
266 mov eax, DWORD PTR 20[ebx]
267 mul ecx
268 add eax, esi
269 adc edx, 0
270 mov DWORD PTR 20[edi],eax
271 mov esi, edx
272 ; Round 24
273 mov eax, DWORD PTR 24[ebx]
274 mul ecx
275 add eax, esi
276 adc edx, 0
277 mov DWORD PTR 24[edi],eax
278 mov esi, edx
279 ; Round 28
280 mov eax, DWORD PTR 28[ebx]
281 mul ecx
282 add eax, esi
283 adc edx, 0
284 mov DWORD PTR 28[edi],eax
285 mov esi, edx
286 ;
287 add ebx, 32
288 add edi, 32
289 sub ebp, 8
290 jz $L004mw_finish
291 jmp L005mw_loop
292 $L004mw_finish:
293 mov ebp, DWORD PTR 28[esp]
294 and ebp, 7
295 jnz $L006mw_finish2
296 jmp $L007mw_end
297 $L006mw_finish2:
298 ; Tail Round 0
299 mov eax, DWORD PTR [ebx]
300 mul ecx
301 add eax, esi
302 adc edx, 0
303 mov DWORD PTR [edi],eax
304 mov esi, edx
305 dec ebp
306 jz $L007mw_end
307 ; Tail Round 1
308 mov eax, DWORD PTR 4[ebx]
309 mul ecx
310 add eax, esi
311 adc edx, 0
312 mov DWORD PTR 4[edi],eax
313 mov esi, edx
314 dec ebp
315 jz $L007mw_end
316 ; Tail Round 2
317 mov eax, DWORD PTR 8[ebx]
318 mul ecx
319 add eax, esi
320 adc edx, 0
321 mov DWORD PTR 8[edi],eax
322 mov esi, edx
323 dec ebp
324 jz $L007mw_end
325 ; Tail Round 3
326 mov eax, DWORD PTR 12[ebx]
327 mul ecx
328 add eax, esi
329 adc edx, 0
330 mov DWORD PTR 12[edi],eax
331 mov esi, edx
332 dec ebp
333 jz $L007mw_end
334 ; Tail Round 4
335 mov eax, DWORD PTR 16[ebx]
336 mul ecx
337 add eax, esi
338 adc edx, 0
339 mov DWORD PTR 16[edi],eax
340 mov esi, edx
341 dec ebp
342 jz $L007mw_end
343 ; Tail Round 5
344 mov eax, DWORD PTR 20[ebx]
345 mul ecx
346 add eax, esi
347 adc edx, 0
348 mov DWORD PTR 20[edi],eax
349 mov esi, edx
350 dec ebp
351 jz $L007mw_end
352 ; Tail Round 6
353 mov eax, DWORD PTR 24[ebx]
354 mul ecx
355 add eax, esi
356 adc edx, 0
357 mov DWORD PTR 24[edi],eax
358 mov esi, edx
359 $L007mw_end:
360 mov eax, esi
361 pop edi
362 pop esi
363 pop ebx
364 pop ebp
365 ret
366 _bn_mul_words ENDP
367 _TEXT ENDS
368 _TEXT SEGMENT
369 PUBLIC _bn_sqr_words
370
371 _bn_sqr_words PROC NEAR
372 push ebp
373 push ebx
374 push esi
375 push edi
376 ;
377 mov esi, DWORD PTR 20[esp]
378 mov edi, DWORD PTR 24[esp]
379 mov ebx, DWORD PTR 28[esp]
380 and ebx, 4294967288
381 jz $L008sw_finish
382 L009sw_loop:
383 ; Round 0
384 mov eax, DWORD PTR [edi]
385 mul eax
386 mov DWORD PTR [esi],eax
387 mov DWORD PTR 4[esi],edx
388 ; Round 4
389 mov eax, DWORD PTR 4[edi]
390 mul eax
391 mov DWORD PTR 8[esi],eax
392 mov DWORD PTR 12[esi],edx
393 ; Round 8
394 mov eax, DWORD PTR 8[edi]
395 mul eax
396 mov DWORD PTR 16[esi],eax
397 mov DWORD PTR 20[esi],edx
398 ; Round 12
399 mov eax, DWORD PTR 12[edi]
400 mul eax
401 mov DWORD PTR 24[esi],eax
402 mov DWORD PTR 28[esi],edx
403 ; Round 16
404 mov eax, DWORD PTR 16[edi]
405 mul eax
406 mov DWORD PTR 32[esi],eax
407 mov DWORD PTR 36[esi],edx
408 ; Round 20
409 mov eax, DWORD PTR 20[edi]
410 mul eax
411 mov DWORD PTR 40[esi],eax
412 mov DWORD PTR 44[esi],edx
413 ; Round 24
414 mov eax, DWORD PTR 24[edi]
415 mul eax
416 mov DWORD PTR 48[esi],eax
417 mov DWORD PTR 52[esi],edx
418 ; Round 28
419 mov eax, DWORD PTR 28[edi]
420 mul eax
421 mov DWORD PTR 56[esi],eax
422 mov DWORD PTR 60[esi],edx
423 ;
424 add edi, 32
425 add esi, 64
426 sub ebx, 8
427 jnz L009sw_loop
428 $L008sw_finish:
429 mov ebx, DWORD PTR 28[esp]
430 and ebx, 7
431 jz $L010sw_end
432 ; Tail Round 0
433 mov eax, DWORD PTR [edi]
434 mul eax
435 mov DWORD PTR [esi],eax
436 dec ebx
437 mov DWORD PTR 4[esi],edx
438 jz $L010sw_end
439 ; Tail Round 1
440 mov eax, DWORD PTR 4[edi]
441 mul eax
442 mov DWORD PTR 8[esi],eax
443 dec ebx
444 mov DWORD PTR 12[esi],edx
445 jz $L010sw_end
446 ; Tail Round 2
447 mov eax, DWORD PTR 8[edi]
448 mul eax
449 mov DWORD PTR 16[esi],eax
450 dec ebx
451 mov DWORD PTR 20[esi],edx
452 jz $L010sw_end
453 ; Tail Round 3
454 mov eax, DWORD PTR 12[edi]
455 mul eax
456 mov DWORD PTR 24[esi],eax
457 dec ebx
458 mov DWORD PTR 28[esi],edx
459 jz $L010sw_end
460 ; Tail Round 4
461 mov eax, DWORD PTR 16[edi]
462 mul eax
463 mov DWORD PTR 32[esi],eax
464 dec ebx
465 mov DWORD PTR 36[esi],edx
466 jz $L010sw_end
467 ; Tail Round 5
468 mov eax, DWORD PTR 20[edi]
469 mul eax
470 mov DWORD PTR 40[esi],eax
471 dec ebx
472 mov DWORD PTR 44[esi],edx
473 jz $L010sw_end
474 ; Tail Round 6
475 mov eax, DWORD PTR 24[edi]
476 mul eax
477 mov DWORD PTR 48[esi],eax
478 mov DWORD PTR 52[esi],edx
479 $L010sw_end:
480 pop edi
481 pop esi
482 pop ebx
483 pop ebp
484 ret
485 _bn_sqr_words ENDP
486 _TEXT ENDS
487 _TEXT SEGMENT
488 PUBLIC _bn_div_words
489
490 _bn_div_words PROC NEAR
491 push ebp
492 push ebx
493 push esi
494 push edi
495 mov edx, DWORD PTR 20[esp]
496 mov eax, DWORD PTR 24[esp]
497 mov ebx, DWORD PTR 28[esp]
498 div ebx
499 pop edi
500 pop esi
501 pop ebx
502 pop ebp
503 ret
504 _bn_div_words ENDP
505 _TEXT ENDS
506 _TEXT SEGMENT
507 PUBLIC _bn_add_words
508
509 _bn_add_words PROC NEAR
510 push ebp
511 push ebx
512 push esi
513 push edi
514 ;
515 mov ebx, DWORD PTR 20[esp]
516 mov esi, DWORD PTR 24[esp]
517 mov edi, DWORD PTR 28[esp]
518 mov ebp, DWORD PTR 32[esp]
519 xor eax, eax
520 and ebp, 4294967288
521 jz $L011aw_finish
522 L012aw_loop:
523 ; Round 0
524 mov ecx, DWORD PTR [esi]
525 mov edx, DWORD PTR [edi]
526 add ecx, eax
527 mov eax, 0
528 adc eax, eax
529 add ecx, edx
530 adc eax, 0
531 mov DWORD PTR [ebx],ecx
532 ; Round 1
533 mov ecx, DWORD PTR 4[esi]
534 mov edx, DWORD PTR 4[edi]
535 add ecx, eax
536 mov eax, 0
537 adc eax, eax
538 add ecx, edx
539 adc eax, 0
540 mov DWORD PTR 4[ebx],ecx
541 ; Round 2
542 mov ecx, DWORD PTR 8[esi]
543 mov edx, DWORD PTR 8[edi]
544 add ecx, eax
545 mov eax, 0
546 adc eax, eax
547 add ecx, edx
548 adc eax, 0
549 mov DWORD PTR 8[ebx],ecx
550 ; Round 3
551 mov ecx, DWORD PTR 12[esi]
552 mov edx, DWORD PTR 12[edi]
553 add ecx, eax
554 mov eax, 0
555 adc eax, eax
556 add ecx, edx
557 adc eax, 0
558 mov DWORD PTR 12[ebx],ecx
559 ; Round 4
560 mov ecx, DWORD PTR 16[esi]
561 mov edx, DWORD PTR 16[edi]
562 add ecx, eax
563 mov eax, 0
564 adc eax, eax
565 add ecx, edx
566 adc eax, 0
567 mov DWORD PTR 16[ebx],ecx
568 ; Round 5
569 mov ecx, DWORD PTR 20[esi]
570 mov edx, DWORD PTR 20[edi]
571 add ecx, eax
572 mov eax, 0
573 adc eax, eax
574 add ecx, edx
575 adc eax, 0
576 mov DWORD PTR 20[ebx],ecx
577 ; Round 6
578 mov ecx, DWORD PTR 24[esi]
579 mov edx, DWORD PTR 24[edi]
580 add ecx, eax
581 mov eax, 0
582 adc eax, eax
583 add ecx, edx
584 adc eax, 0
585 mov DWORD PTR 24[ebx],ecx
586 ; Round 7
587 mov ecx, DWORD PTR 28[esi]
588 mov edx, DWORD PTR 28[edi]
589 add ecx, eax
590 mov eax, 0
591 adc eax, eax
592 add ecx, edx
593 adc eax, 0
594 mov DWORD PTR 28[ebx],ecx
595 ;
596 add esi, 32
597 add edi, 32
598 add ebx, 32
599 sub ebp, 8
600 jnz L012aw_loop
601 $L011aw_finish:
602 mov ebp, DWORD PTR 32[esp]
603 and ebp, 7
604 jz $L013aw_end
605 ; Tail Round 0
606 mov ecx, DWORD PTR [esi]
607 mov edx, DWORD PTR [edi]
608 add ecx, eax
609 mov eax, 0
610 adc eax, eax
611 add ecx, edx
612 adc eax, 0
613 dec ebp
614 mov DWORD PTR [ebx],ecx
615 jz $L013aw_end
616 ; Tail Round 1
617 mov ecx, DWORD PTR 4[esi]
618 mov edx, DWORD PTR 4[edi]
619 add ecx, eax
620 mov eax, 0
621 adc eax, eax
622 add ecx, edx
623 adc eax, 0
624 dec ebp
625 mov DWORD PTR 4[ebx],ecx
626 jz $L013aw_end
627 ; Tail Round 2
628 mov ecx, DWORD PTR 8[esi]
629 mov edx, DWORD PTR 8[edi]
630 add ecx, eax
631 mov eax, 0
632 adc eax, eax
633 add ecx, edx
634 adc eax, 0
635 dec ebp
636 mov DWORD PTR 8[ebx],ecx
637 jz $L013aw_end
638 ; Tail Round 3
639 mov ecx, DWORD PTR 12[esi]
640 mov edx, DWORD PTR 12[edi]
641 add ecx, eax
642 mov eax, 0
643 adc eax, eax
644 add ecx, edx
645 adc eax, 0
646 dec ebp
647 mov DWORD PTR 12[ebx],ecx
648 jz $L013aw_end
649 ; Tail Round 4
650 mov ecx, DWORD PTR 16[esi]
651 mov edx, DWORD PTR 16[edi]
652 add ecx, eax
653 mov eax, 0
654 adc eax, eax
655 add ecx, edx
656 adc eax, 0
657 dec ebp
658 mov DWORD PTR 16[ebx],ecx
659 jz $L013aw_end
660 ; Tail Round 5
661 mov ecx, DWORD PTR 20[esi]
662 mov edx, DWORD PTR 20[edi]
663 add ecx, eax
664 mov eax, 0
665 adc eax, eax
666 add ecx, edx
667 adc eax, 0
668 dec ebp
669 mov DWORD PTR 20[ebx],ecx
670 jz $L013aw_end
671 ; Tail Round 6
672 mov ecx, DWORD PTR 24[esi]
673 mov edx, DWORD PTR 24[edi]
674 add ecx, eax
675 mov eax, 0
676 adc eax, eax
677 add ecx, edx
678 adc eax, 0
679 mov DWORD PTR 24[ebx],ecx
680 $L013aw_end:
681 pop edi
682 pop esi
683 pop ebx
684 pop ebp
685 ret
686 _bn_add_words ENDP
687 _TEXT ENDS
688 _TEXT SEGMENT
689 PUBLIC _bn_sub_words
690
691 _bn_sub_words PROC NEAR
692 push ebp
693 push ebx
694 push esi
695 push edi
696 ;
697 mov ebx, DWORD PTR 20[esp]
698 mov esi, DWORD PTR 24[esp]
699 mov edi, DWORD PTR 28[esp]
700 mov ebp, DWORD PTR 32[esp]
701 xor eax, eax
702 and ebp, 4294967288
703 jz $L014aw_finish
704 L015aw_loop:
705 ; Round 0
706 mov ecx, DWORD PTR [esi]
707 mov edx, DWORD PTR [edi]
708 sub ecx, eax
709 mov eax, 0
710 adc eax, eax
711 sub ecx, edx
712 adc eax, 0
713 mov DWORD PTR [ebx],ecx
714 ; Round 1
715 mov ecx, DWORD PTR 4[esi]
716 mov edx, DWORD PTR 4[edi]
717 sub ecx, eax
718 mov eax, 0
719 adc eax, eax
720 sub ecx, edx
721 adc eax, 0
722 mov DWORD PTR 4[ebx],ecx
723 ; Round 2
724 mov ecx, DWORD PTR 8[esi]
725 mov edx, DWORD PTR 8[edi]
726 sub ecx, eax
727 mov eax, 0
728 adc eax, eax
729 sub ecx, edx
730 adc eax, 0
731 mov DWORD PTR 8[ebx],ecx
732 ; Round 3
733 mov ecx, DWORD PTR 12[esi]
734 mov edx, DWORD PTR 12[edi]
735 sub ecx, eax
736 mov eax, 0
737 adc eax, eax
738 sub ecx, edx
739 adc eax, 0
740 mov DWORD PTR 12[ebx],ecx
741 ; Round 4
742 mov ecx, DWORD PTR 16[esi]
743 mov edx, DWORD PTR 16[edi]
744 sub ecx, eax
745 mov eax, 0
746 adc eax, eax
747 sub ecx, edx
748 adc eax, 0
749 mov DWORD PTR 16[ebx],ecx
750 ; Round 5
751 mov ecx, DWORD PTR 20[esi]
752 mov edx, DWORD PTR 20[edi]
753 sub ecx, eax
754 mov eax, 0
755 adc eax, eax
756 sub ecx, edx
757 adc eax, 0
758 mov DWORD PTR 20[ebx],ecx
759 ; Round 6
760 mov ecx, DWORD PTR 24[esi]
761 mov edx, DWORD PTR 24[edi]
762 sub ecx, eax
763 mov eax, 0
764 adc eax, eax
765 sub ecx, edx
766 adc eax, 0
767 mov DWORD PTR 24[ebx],ecx
768 ; Round 7
769 mov ecx, DWORD PTR 28[esi]
770 mov edx, DWORD PTR 28[edi]
771 sub ecx, eax
772 mov eax, 0
773 adc eax, eax
774 sub ecx, edx
775 adc eax, 0
776 mov DWORD PTR 28[ebx],ecx
777 ;
778 add esi, 32
779 add edi, 32
780 add ebx, 32
781 sub ebp, 8
782 jnz L015aw_loop
783 $L014aw_finish:
784 mov ebp, DWORD PTR 32[esp]
785 and ebp, 7
786 jz $L016aw_end
787 ; Tail Round 0
788 mov ecx, DWORD PTR [esi]
789 mov edx, DWORD PTR [edi]
790 sub ecx, eax
791 mov eax, 0
792 adc eax, eax
793 sub ecx, edx
794 adc eax, 0
795 dec ebp
796 mov DWORD PTR [ebx],ecx
797 jz $L016aw_end
798 ; Tail Round 1
799 mov ecx, DWORD PTR 4[esi]
800 mov edx, DWORD PTR 4[edi]
801 sub ecx, eax
802 mov eax, 0
803 adc eax, eax
804 sub ecx, edx
805 adc eax, 0
806 dec ebp
807 mov DWORD PTR 4[ebx],ecx
808 jz $L016aw_end
809 ; Tail Round 2
810 mov ecx, DWORD PTR 8[esi]
811 mov edx, DWORD PTR 8[edi]
812 sub ecx, eax
813 mov eax, 0
814 adc eax, eax
815 sub ecx, edx
816 adc eax, 0
817 dec ebp
818 mov DWORD PTR 8[ebx],ecx
819 jz $L016aw_end
820 ; Tail Round 3
821 mov ecx, DWORD PTR 12[esi]
822 mov edx, DWORD PTR 12[edi]
823 sub ecx, eax
824 mov eax, 0
825 adc eax, eax
826 sub ecx, edx
827 adc eax, 0
828 dec ebp
829 mov DWORD PTR 12[ebx],ecx
830 jz $L016aw_end
831 ; Tail Round 4
832 mov ecx, DWORD PTR 16[esi]
833 mov edx, DWORD PTR 16[edi]
834 sub ecx, eax
835 mov eax, 0
836 adc eax, eax
837 sub ecx, edx
838 adc eax, 0
839 dec ebp
840 mov DWORD PTR 16[ebx],ecx
841 jz $L016aw_end
842 ; Tail Round 5
843 mov ecx, DWORD PTR 20[esi]
844 mov edx, DWORD PTR 20[edi]
845 sub ecx, eax
846 mov eax, 0
847 adc eax, eax
848 sub ecx, edx
849 adc eax, 0
850 dec ebp
851 mov DWORD PTR 20[ebx],ecx
852 jz $L016aw_end
853 ; Tail Round 6
854 mov ecx, DWORD PTR 24[esi]
855 mov edx, DWORD PTR 24[edi]
856 sub ecx, eax
857 mov eax, 0
858 adc eax, eax
859 sub ecx, edx
860 adc eax, 0
861 mov DWORD PTR 24[ebx],ecx
862 $L016aw_end:
863 pop edi
864 pop esi
865 pop ebx
866 pop ebp
867 ret
868 _bn_sub_words ENDP
869 _TEXT ENDS
870 _TEXT SEGMENT
871 PUBLIC _bn_mul_comba8
872
873 _bn_mul_comba8 PROC NEAR
874 push esi
875 mov esi, DWORD PTR 12[esp]
876 push edi
877 mov edi, DWORD PTR 20[esp]
878 push ebp
879 push ebx
880 xor ebx, ebx
881 mov eax, DWORD PTR [esi]
882 xor ecx, ecx
883 mov edx, DWORD PTR [edi]
884 ; ################## Calculate word 0
885 xor ebp, ebp
886 ; mul a[0]*b[0]
887 mul edx
888 add ebx, eax
889 mov eax, DWORD PTR 20[esp]
890 adc ecx, edx
891 mov edx, DWORD PTR [edi]
892 adc ebp, 0
893 mov DWORD PTR [eax],ebx
894 mov eax, DWORD PTR 4[esi]
895 ; saved r[0]
896 ; ################## Calculate word 1
897 xor ebx, ebx
898 ; mul a[1]*b[0]
899 mul edx
900 add ecx, eax
901 mov eax, DWORD PTR [esi]
902 adc ebp, edx
903 mov edx, DWORD PTR 4[edi]
904 adc ebx, 0
905 ; mul a[0]*b[1]
906 mul edx
907 add ecx, eax
908 mov eax, DWORD PTR 20[esp]
909 adc ebp, edx
910 mov edx, DWORD PTR [edi]
911 adc ebx, 0
912 mov DWORD PTR 4[eax],ecx
913 mov eax, DWORD PTR 8[esi]
914 ; saved r[1]
915 ; ################## Calculate word 2
916 xor ecx, ecx
917 ; mul a[2]*b[0]
918 mul edx
919 add ebp, eax
920 mov eax, DWORD PTR 4[esi]
921 adc ebx, edx
922 mov edx, DWORD PTR 4[edi]
923 adc ecx, 0
924 ; mul a[1]*b[1]
925 mul edx
926 add ebp, eax
927 mov eax, DWORD PTR [esi]
928 adc ebx, edx
929 mov edx, DWORD PTR 8[edi]
930 adc ecx, 0
931 ; mul a[0]*b[2]
932 mul edx
933 add ebp, eax
934 mov eax, DWORD PTR 20[esp]
935 adc ebx, edx
936 mov edx, DWORD PTR [edi]
937 adc ecx, 0
938 mov DWORD PTR 8[eax],ebp
939 mov eax, DWORD PTR 12[esi]
940 ; saved r[2]
941 ; ################## Calculate word 3
942 xor ebp, ebp
943 ; mul a[3]*b[0]
944 mul edx
945 add ebx, eax
946 mov eax, DWORD PTR 8[esi]
947 adc ecx, edx
948 mov edx, DWORD PTR 4[edi]
949 adc ebp, 0
950 ; mul a[2]*b[1]
951 mul edx
952 add ebx, eax
953 mov eax, DWORD PTR 4[esi]
954 adc ecx, edx
955 mov edx, DWORD PTR 8[edi]
956 adc ebp, 0
957 ; mul a[1]*b[2]
958 mul edx
959 add ebx, eax
960 mov eax, DWORD PTR [esi]
961 adc ecx, edx
962 mov edx, DWORD PTR 12[edi]
963 adc ebp, 0
964 ; mul a[0]*b[3]
965 mul edx
966 add ebx, eax
967 mov eax, DWORD PTR 20[esp]
968 adc ecx, edx
969 mov edx, DWORD PTR [edi]
970 adc ebp, 0
971 mov DWORD PTR 12[eax],ebx
972 mov eax, DWORD PTR 16[esi]
973 ; saved r[3]
974 ; ################## Calculate word 4
975 xor ebx, ebx
976 ; mul a[4]*b[0]
977 mul edx
978 add ecx, eax
979 mov eax, DWORD PTR 12[esi]
980 adc ebp, edx
981 mov edx, DWORD PTR 4[edi]
982 adc ebx, 0
983 ; mul a[3]*b[1]
984 mul edx
985 add ecx, eax
986 mov eax, DWORD PTR 8[esi]
987 adc ebp, edx
988 mov edx, DWORD PTR 8[edi]
989 adc ebx, 0
990 ; mul a[2]*b[2]
991 mul edx
992 add ecx, eax
993 mov eax, DWORD PTR 4[esi]
994 adc ebp, edx
995 mov edx, DWORD PTR 12[edi]
996 adc ebx, 0
997 ; mul a[1]*b[3]
998 mul edx
999 add ecx, eax
1000 mov eax, DWORD PTR [esi]
1001 adc ebp, edx
1002 mov edx, DWORD PTR 16[edi]
1003 adc ebx, 0
1004 ; mul a[0]*b[4]
1005 mul edx
1006 add ecx, eax
1007 mov eax, DWORD PTR 20[esp]
1008 adc ebp, edx
1009 mov edx, DWORD PTR [edi]
1010 adc ebx, 0
1011 mov DWORD PTR 16[eax],ecx
1012 mov eax, DWORD PTR 20[esi]
1013 ; saved r[4]
1014 ; ################## Calculate word 5
1015 xor ecx, ecx
1016 ; mul a[5]*b[0]
1017 mul edx
1018 add ebp, eax
1019 mov eax, DWORD PTR 16[esi]
1020 adc ebx, edx
1021 mov edx, DWORD PTR 4[edi]
1022 adc ecx, 0
1023 ; mul a[4]*b[1]
1024 mul edx
1025 add ebp, eax
1026 mov eax, DWORD PTR 12[esi]
1027 adc ebx, edx
1028 mov edx, DWORD PTR 8[edi]
1029 adc ecx, 0
1030 ; mul a[3]*b[2]
1031 mul edx
1032 add ebp, eax
1033 mov eax, DWORD PTR 8[esi]
1034 adc ebx, edx
1035 mov edx, DWORD PTR 12[edi]
1036 adc ecx, 0
1037 ; mul a[2]*b[3]
1038 mul edx
1039 add ebp, eax
1040 mov eax, DWORD PTR 4[esi]
1041 adc ebx, edx
1042 mov edx, DWORD PTR 16[edi]
1043 adc ecx, 0
1044 ; mul a[1]*b[4]
1045 mul edx
1046 add ebp, eax
1047 mov eax, DWORD PTR [esi]
1048 adc ebx, edx
1049 mov edx, DWORD PTR 20[edi]
1050 adc ecx, 0
1051 ; mul a[0]*b[5]
1052 mul edx
1053 add ebp, eax
1054 mov eax, DWORD PTR 20[esp]
1055 adc ebx, edx
1056 mov edx, DWORD PTR [edi]
1057 adc ecx, 0
1058 mov DWORD PTR 20[eax],ebp
1059 mov eax, DWORD PTR 24[esi]
1060 ; saved r[5]
1061 ; ################## Calculate word 6
1062 xor ebp, ebp
1063 ; mul a[6]*b[0]
1064 mul edx
1065 add ebx, eax
1066 mov eax, DWORD PTR 20[esi]
1067 adc ecx, edx
1068 mov edx, DWORD PTR 4[edi]
1069 adc ebp, 0
1070 ; mul a[5]*b[1]
1071 mul edx
1072 add ebx, eax
1073 mov eax, DWORD PTR 16[esi]
1074 adc ecx, edx
1075 mov edx, DWORD PTR 8[edi]
1076 adc ebp, 0
1077 ; mul a[4]*b[2]
1078 mul edx
1079 add ebx, eax
1080 mov eax, DWORD PTR 12[esi]
1081 adc ecx, edx
1082 mov edx, DWORD PTR 12[edi]
1083 adc ebp, 0
1084 ; mul a[3]*b[3]
1085 mul edx
1086 add ebx, eax
1087 mov eax, DWORD PTR 8[esi]
1088 adc ecx, edx
1089 mov edx, DWORD PTR 16[edi]
1090 adc ebp, 0
1091 ; mul a[2]*b[4]
1092 mul edx
1093 add ebx, eax
1094 mov eax, DWORD PTR 4[esi]
1095 adc ecx, edx
1096 mov edx, DWORD PTR 20[edi]
1097 adc ebp, 0
1098 ; mul a[1]*b[5]
1099 mul edx
1100 add ebx, eax
1101 mov eax, DWORD PTR [esi]
1102 adc ecx, edx
1103 mov edx, DWORD PTR 24[edi]
1104 adc ebp, 0
1105 ; mul a[0]*b[6]
1106 mul edx
1107 add ebx, eax
1108 mov eax, DWORD PTR 20[esp]
1109 adc ecx, edx
1110 mov edx, DWORD PTR [edi]
1111 adc ebp, 0
1112 mov DWORD PTR 24[eax],ebx
1113 mov eax, DWORD PTR 28[esi]
1114 ; saved r[6]
1115 ; ################## Calculate word 7
1116 xor ebx, ebx
1117 ; mul a[7]*b[0]
1118 mul edx
1119 add ecx, eax
1120 mov eax, DWORD PTR 24[esi]
1121 adc ebp, edx
1122 mov edx, DWORD PTR 4[edi]
1123 adc ebx, 0
1124 ; mul a[6]*b[1]
1125 mul edx
1126 add ecx, eax
1127 mov eax, DWORD PTR 20[esi]
1128 adc ebp, edx
1129 mov edx, DWORD PTR 8[edi]
1130 adc ebx, 0
1131 ; mul a[5]*b[2]
1132 mul edx
1133 add ecx, eax
1134 mov eax, DWORD PTR 16[esi]
1135 adc ebp, edx
1136 mov edx, DWORD PTR 12[edi]
1137 adc ebx, 0
1138 ; mul a[4]*b[3]
1139 mul edx
1140 add ecx, eax
1141 mov eax, DWORD PTR 12[esi]
1142 adc ebp, edx
1143 mov edx, DWORD PTR 16[edi]
1144 adc ebx, 0
1145 ; mul a[3]*b[4]
1146 mul edx
1147 add ecx, eax
1148 mov eax, DWORD PTR 8[esi]
1149 adc ebp, edx
1150 mov edx, DWORD PTR 20[edi]
1151 adc ebx, 0
1152 ; mul a[2]*b[5]
1153 mul edx
1154 add ecx, eax
1155 mov eax, DWORD PTR 4[esi]
1156 adc ebp, edx
1157 mov edx, DWORD PTR 24[edi]
1158 adc ebx, 0
1159 ; mul a[1]*b[6]
1160 mul edx
1161 add ecx, eax
1162 mov eax, DWORD PTR [esi]
1163 adc ebp, edx
1164 mov edx, DWORD PTR 28[edi]
1165 adc ebx, 0
1166 ; mul a[0]*b[7]
1167 mul edx
1168 add ecx, eax
1169 mov eax, DWORD PTR 20[esp]
1170 adc ebp, edx
1171 mov edx, DWORD PTR 4[edi]
1172 adc ebx, 0
1173 mov DWORD PTR 28[eax],ecx
1174 mov eax, DWORD PTR 28[esi]
1175 ; saved r[7]
1176 ; ################## Calculate word 8
1177 xor ecx, ecx
1178 ; mul a[7]*b[1]
1179 mul edx
1180 add ebp, eax
1181 mov eax, DWORD PTR 24[esi]
1182 adc ebx, edx
1183 mov edx, DWORD PTR 8[edi]
1184 adc ecx, 0
1185 ; mul a[6]*b[2]
1186 mul edx
1187 add ebp, eax
1188 mov eax, DWORD PTR 20[esi]
1189 adc ebx, edx
1190 mov edx, DWORD PTR 12[edi]
1191 adc ecx, 0
1192 ; mul a[5]*b[3]
1193 mul edx
1194 add ebp, eax
1195 mov eax, DWORD PTR 16[esi]
1196 adc ebx, edx
1197 mov edx, DWORD PTR 16[edi]
1198 adc ecx, 0
1199 ; mul a[4]*b[4]
1200 mul edx
1201 add ebp, eax
1202 mov eax, DWORD PTR 12[esi]
1203 adc ebx, edx
1204 mov edx, DWORD PTR 20[edi]
1205 adc ecx, 0
1206 ; mul a[3]*b[5]
1207 mul edx
1208 add ebp, eax
1209 mov eax, DWORD PTR 8[esi]
1210 adc ebx, edx
1211 mov edx, DWORD PTR 24[edi]
1212 adc ecx, 0
1213 ; mul a[2]*b[6]
1214 mul edx
1215 add ebp, eax
1216 mov eax, DWORD PTR 4[esi]
1217 adc ebx, edx
1218 mov edx, DWORD PTR 28[edi]
1219 adc ecx, 0
1220 ; mul a[1]*b[7]
1221 mul edx
1222 add ebp, eax
1223 mov eax, DWORD PTR 20[esp]
1224 adc ebx, edx
1225 mov edx, DWORD PTR 8[edi]
1226 adc ecx, 0
1227 mov DWORD PTR 32[eax],ebp
1228 mov eax, DWORD PTR 28[esi]
1229 ; saved r[8]
1230 ; ################## Calculate word 9
1231 xor ebp, ebp
1232 ; mul a[7]*b[2]
1233 mul edx
1234 add ebx, eax
1235 mov eax, DWORD PTR 24[esi]
1236 adc ecx, edx
1237 mov edx, DWORD PTR 12[edi]
1238 adc ebp, 0
1239 ; mul a[6]*b[3]
1240 mul edx
1241 add ebx, eax
1242 mov eax, DWORD PTR 20[esi]
1243 adc ecx, edx
1244 mov edx, DWORD PTR 16[edi]
1245 adc ebp, 0
1246 ; mul a[5]*b[4]
1247 mul edx
1248 add ebx, eax
1249 mov eax, DWORD PTR 16[esi]
1250 adc ecx, edx
1251 mov edx, DWORD PTR 20[edi]
1252 adc ebp, 0
1253 ; mul a[4]*b[5]
1254 mul edx
1255 add ebx, eax
1256 mov eax, DWORD PTR 12[esi]
1257 adc ecx, edx
1258 mov edx, DWORD PTR 24[edi]
1259 adc ebp, 0
1260 ; mul a[3]*b[6]
1261 mul edx
1262 add ebx, eax
1263 mov eax, DWORD PTR 8[esi]
1264 adc ecx, edx
1265 mov edx, DWORD PTR 28[edi]
1266 adc ebp, 0
1267 ; mul a[2]*b[7]
1268 mul edx
1269 add ebx, eax
1270 mov eax, DWORD PTR 20[esp]
1271 adc ecx, edx
1272 mov edx, DWORD PTR 12[edi]
1273 adc ebp, 0
1274 mov DWORD PTR 36[eax],ebx
1275 mov eax, DWORD PTR 28[esi]
1276 ; saved r[9]
1277 ; ################## Calculate word 10
1278 xor ebx, ebx
1279 ; mul a[7]*b[3]
1280 mul edx
1281 add ecx, eax
1282 mov eax, DWORD PTR 24[esi]
1283 adc ebp, edx
1284 mov edx, DWORD PTR 16[edi]
1285 adc ebx, 0
1286 ; mul a[6]*b[4]
1287 mul edx
1288 add ecx, eax
1289 mov eax, DWORD PTR 20[esi]
1290 adc ebp, edx
1291 mov edx, DWORD PTR 20[edi]
1292 adc ebx, 0
1293 ; mul a[5]*b[5]
1294 mul edx
1295 add ecx, eax
1296 mov eax, DWORD PTR 16[esi]
1297 adc ebp, edx
1298 mov edx, DWORD PTR 24[edi]
1299 adc ebx, 0
1300 ; mul a[4]*b[6]
1301 mul edx
1302 add ecx, eax
1303 mov eax, DWORD PTR 12[esi]
1304 adc ebp, edx
1305 mov edx, DWORD PTR 28[edi]
1306 adc ebx, 0
1307 ; mul a[3]*b[7]
1308 mul edx
1309 add ecx, eax
1310 mov eax, DWORD PTR 20[esp]
1311 adc ebp, edx
1312 mov edx, DWORD PTR 16[edi]
1313 adc ebx, 0
1314 mov DWORD PTR 40[eax],ecx
1315 mov eax, DWORD PTR 28[esi]
1316 ; saved r[10]
1317 ; ################## Calculate word 11
1318 xor ecx, ecx
1319 ; mul a[7]*b[4]
1320 mul edx
1321 add ebp, eax
1322 mov eax, DWORD PTR 24[esi]
1323 adc ebx, edx
1324 mov edx, DWORD PTR 20[edi]
1325 adc ecx, 0
1326 ; mul a[6]*b[5]
1327 mul edx
1328 add ebp, eax
1329 mov eax, DWORD PTR 20[esi]
1330 adc ebx, edx
1331 mov edx, DWORD PTR 24[edi]
1332 adc ecx, 0
1333 ; mul a[5]*b[6]
1334 mul edx
1335 add ebp, eax
1336 mov eax, DWORD PTR 16[esi]
1337 adc ebx, edx
1338 mov edx, DWORD PTR 28[edi]
1339 adc ecx, 0
1340 ; mul a[4]*b[7]
1341 mul edx
1342 add ebp, eax
1343 mov eax, DWORD PTR 20[esp]
1344 adc ebx, edx
1345 mov edx, DWORD PTR 20[edi]
1346 adc ecx, 0
1347 mov DWORD PTR 44[eax],ebp
1348 mov eax, DWORD PTR 28[esi]
1349 ; saved r[11]
1350 ; ################## Calculate word 12
1351 xor ebp, ebp
1352 ; mul a[7]*b[5]
1353 mul edx
1354 add ebx, eax
1355 mov eax, DWORD PTR 24[esi]
1356 adc ecx, edx
1357 mov edx, DWORD PTR 24[edi]
1358 adc ebp, 0
1359 ; mul a[6]*b[6]
1360 mul edx
1361 add ebx, eax
1362 mov eax, DWORD PTR 20[esi]
1363 adc ecx, edx
1364 mov edx, DWORD PTR 28[edi]
1365 adc ebp, 0
1366 ; mul a[5]*b[7]
1367 mul edx
1368 add ebx, eax
1369 mov eax, DWORD PTR 20[esp]
1370 adc ecx, edx
1371 mov edx, DWORD PTR 24[edi]
1372 adc ebp, 0
1373 mov DWORD PTR 48[eax],ebx
1374 mov eax, DWORD PTR 28[esi]
1375 ; saved r[12]
1376 ; ################## Calculate word 13
1377 xor ebx, ebx
1378 ; mul a[7]*b[6]
1379 mul edx
1380 add ecx, eax
1381 mov eax, DWORD PTR 24[esi]
1382 adc ebp, edx
1383 mov edx, DWORD PTR 28[edi]
1384 adc ebx, 0
1385 ; mul a[6]*b[7]
1386 mul edx
1387 add ecx, eax
1388 mov eax, DWORD PTR 20[esp]
1389 adc ebp, edx
1390 mov edx, DWORD PTR 28[edi]
1391 adc ebx, 0
1392 mov DWORD PTR 52[eax],ecx
1393 mov eax, DWORD PTR 28[esi]
1394 ; saved r[13]
1395 ; ################## Calculate word 14
1396 xor ecx, ecx
1397 ; mul a[7]*b[7]
1398 mul edx
1399 add ebp, eax
1400 mov eax, DWORD PTR 20[esp]
1401 adc ebx, edx
1402 adc ecx, 0
1403 mov DWORD PTR 56[eax],ebp
1404 ; saved r[14]
1405 ; save r[15]
1406 mov DWORD PTR 60[eax],ebx
1407 pop ebx
1408 pop ebp
1409 pop edi
1410 pop esi
1411 ret
1412 _bn_mul_comba8 ENDP
1413 _TEXT ENDS
1414 _TEXT SEGMENT
1415 PUBLIC _bn_mul_comba4
1416
1417 _bn_mul_comba4 PROC NEAR
1418 push esi
1419 mov esi, DWORD PTR 12[esp]
1420 push edi
1421 mov edi, DWORD PTR 20[esp]
1422 push ebp
1423 push ebx
1424 xor ebx, ebx
1425 mov eax, DWORD PTR [esi]
1426 xor ecx, ecx
1427 mov edx, DWORD PTR [edi]
1428 ; ################## Calculate word 0
1429 xor ebp, ebp
1430 ; mul a[0]*b[0]
1431 mul edx
1432 add ebx, eax
1433 mov eax, DWORD PTR 20[esp]
1434 adc ecx, edx
1435 mov edx, DWORD PTR [edi]
1436 adc ebp, 0
1437 mov DWORD PTR [eax],ebx
1438 mov eax, DWORD PTR 4[esi]
1439 ; saved r[0]
1440 ; ################## Calculate word 1
1441 xor ebx, ebx
1442 ; mul a[1]*b[0]
1443 mul edx
1444 add ecx, eax
1445 mov eax, DWORD PTR [esi]
1446 adc ebp, edx
1447 mov edx, DWORD PTR 4[edi]
1448 adc ebx, 0
1449 ; mul a[0]*b[1]
1450 mul edx
1451 add ecx, eax
1452 mov eax, DWORD PTR 20[esp]
1453 adc ebp, edx
1454 mov edx, DWORD PTR [edi]
1455 adc ebx, 0
1456 mov DWORD PTR 4[eax],ecx
1457 mov eax, DWORD PTR 8[esi]
1458 ; saved r[1]
1459 ; ################## Calculate word 2
1460 xor ecx, ecx
1461 ; mul a[2]*b[0]
1462 mul edx
1463 add ebp, eax
1464 mov eax, DWORD PTR 4[esi]
1465 adc ebx, edx
1466 mov edx, DWORD PTR 4[edi]
1467 adc ecx, 0
1468 ; mul a[1]*b[1]
1469 mul edx
1470 add ebp, eax
1471 mov eax, DWORD PTR [esi]
1472 adc ebx, edx
1473 mov edx, DWORD PTR 8[edi]
1474 adc ecx, 0
1475 ; mul a[0]*b[2]
1476 mul edx
1477 add ebp, eax
1478 mov eax, DWORD PTR 20[esp]
1479 adc ebx, edx
1480 mov edx, DWORD PTR [edi]
1481 adc ecx, 0
1482 mov DWORD PTR 8[eax],ebp
1483 mov eax, DWORD PTR 12[esi]
1484 ; saved r[2]
1485 ; ################## Calculate word 3
1486 xor ebp, ebp
1487 ; mul a[3]*b[0]
1488 mul edx
1489 add ebx, eax
1490 mov eax, DWORD PTR 8[esi]
1491 adc ecx, edx
1492 mov edx, DWORD PTR 4[edi]
1493 adc ebp, 0
1494 ; mul a[2]*b[1]
1495 mul edx
1496 add ebx, eax
1497 mov eax, DWORD PTR 4[esi]
1498 adc ecx, edx
1499 mov edx, DWORD PTR 8[edi]
1500 adc ebp, 0
1501 ; mul a[1]*b[2]
1502 mul edx
1503 add ebx, eax
1504 mov eax, DWORD PTR [esi]
1505 adc ecx, edx
1506 mov edx, DWORD PTR 12[edi]
1507 adc ebp, 0
1508 ; mul a[0]*b[3]
1509 mul edx
1510 add ebx, eax
1511 mov eax, DWORD PTR 20[esp]
1512 adc ecx, edx
1513 mov edx, DWORD PTR 4[edi]
1514 adc ebp, 0
1515 mov DWORD PTR 12[eax],ebx
1516 mov eax, DWORD PTR 12[esi]
1517 ; saved r[3]
1518 ; ################## Calculate word 4
1519 xor ebx, ebx
1520 ; mul a[3]*b[1]
1521 mul edx
1522 add ecx, eax
1523 mov eax, DWORD PTR 8[esi]
1524 adc ebp, edx
1525 mov edx, DWORD PTR 8[edi]
1526 adc ebx, 0
1527 ; mul a[2]*b[2]
1528 mul edx
1529 add ecx, eax
1530 mov eax, DWORD PTR 4[esi]
1531 adc ebp, edx
1532 mov edx, DWORD PTR 12[edi]
1533 adc ebx, 0
1534 ; mul a[1]*b[3]
1535 mul edx
1536 add ecx, eax
1537 mov eax, DWORD PTR 20[esp]
1538 adc ebp, edx
1539 mov edx, DWORD PTR 8[edi]
1540 adc ebx, 0
1541 mov DWORD PTR 16[eax],ecx
1542 mov eax, DWORD PTR 12[esi]
1543 ; saved r[4]
1544 ; ################## Calculate word 5
1545 xor ecx, ecx
1546 ; mul a[3]*b[2]
1547 mul edx
1548 add ebp, eax
1549 mov eax, DWORD PTR 8[esi]
1550 adc ebx, edx
1551 mov edx, DWORD PTR 12[edi]
1552 adc ecx, 0
1553 ; mul a[2]*b[3]
1554 mul edx
1555 add ebp, eax
1556 mov eax, DWORD PTR 20[esp]
1557 adc ebx, edx
1558 mov edx, DWORD PTR 12[edi]
1559 adc ecx, 0
1560 mov DWORD PTR 20[eax],ebp
1561 mov eax, DWORD PTR 12[esi]
1562 ; saved r[5]
1563 ; ################## Calculate word 6
1564 xor ebp, ebp
1565 ; mul a[3]*b[3]
1566 mul edx
1567 add ebx, eax
1568 mov eax, DWORD PTR 20[esp]
1569 adc ecx, edx
1570 adc ebp, 0
1571 mov DWORD PTR 24[eax],ebx
1572 ; saved r[6]
1573 ; save r[7]
1574 mov DWORD PTR 28[eax],ecx
1575 pop ebx
1576 pop ebp
1577 pop edi
1578 pop esi
1579 ret
1580 _bn_mul_comba4 ENDP
1581 _TEXT ENDS
1582 _TEXT SEGMENT
1583 PUBLIC _bn_sqr_comba8
1584
1585 _bn_sqr_comba8 PROC NEAR
1586 push esi
1587 push edi
1588 push ebp
1589 push ebx
1590 mov edi, DWORD PTR 20[esp]
1591 mov esi, DWORD PTR 24[esp]
1592 xor ebx, ebx
1593 xor ecx, ecx
1594 mov eax, DWORD PTR [esi]
1595 ; ############### Calculate word 0
1596 xor ebp, ebp
1597 ; sqr a[0]*a[0]
1598 mul eax
1599 add ebx, eax
1600 adc ecx, edx
1601 mov edx, DWORD PTR [esi]
1602 adc ebp, 0
1603 mov DWORD PTR [edi],ebx
1604 mov eax, DWORD PTR 4[esi]
1605 ; saved r[0]
1606 ; ############### Calculate word 1
1607 xor ebx, ebx
1608 ; sqr a[1]*a[0]
1609 mul edx
1610 add eax, eax
1611 adc edx, edx
1612 adc ebx, 0
1613 add ecx, eax
1614 adc ebp, edx
1615 mov eax, DWORD PTR 8[esi]
1616 adc ebx, 0
1617 mov DWORD PTR 4[edi],ecx
1618 mov edx, DWORD PTR [esi]
1619 ; saved r[1]
1620 ; ############### Calculate word 2
1621 xor ecx, ecx
1622 ; sqr a[2]*a[0]
1623 mul edx
1624 add eax, eax
1625 adc edx, edx
1626 adc ecx, 0
1627 add ebp, eax
1628 adc ebx, edx
1629 mov eax, DWORD PTR 4[esi]
1630 adc ecx, 0
1631 ; sqr a[1]*a[1]
1632 mul eax
1633 add ebp, eax
1634 adc ebx, edx
1635 mov edx, DWORD PTR [esi]
1636 adc ecx, 0
1637 mov DWORD PTR 8[edi],ebp
1638 mov eax, DWORD PTR 12[esi]
1639 ; saved r[2]
1640 ; ############### Calculate word 3
1641 xor ebp, ebp
1642 ; sqr a[3]*a[0]
1643 mul edx
1644 add eax, eax
1645 adc edx, edx
1646 adc ebp, 0
1647 add ebx, eax
1648 adc ecx, edx
1649 mov eax, DWORD PTR 8[esi]
1650 adc ebp, 0
1651 mov edx, DWORD PTR 4[esi]
1652 ; sqr a[2]*a[1]
1653 mul edx
1654 add eax, eax
1655 adc edx, edx
1656 adc ebp, 0
1657 add ebx, eax
1658 adc ecx, edx
1659 mov eax, DWORD PTR 16[esi]
1660 adc ebp, 0
1661 mov DWORD PTR 12[edi],ebx
1662 mov edx, DWORD PTR [esi]
1663 ; saved r[3]
1664 ; ############### Calculate word 4
1665 xor ebx, ebx
1666 ; sqr a[4]*a[0]
1667 mul edx
1668 add eax, eax
1669 adc edx, edx
1670 adc ebx, 0
1671 add ecx, eax
1672 adc ebp, edx
1673 mov eax, DWORD PTR 12[esi]
1674 adc ebx, 0
1675 mov edx, DWORD PTR 4[esi]
1676 ; sqr a[3]*a[1]
1677 mul edx
1678 add eax, eax
1679 adc edx, edx
1680 adc ebx, 0
1681 add ecx, eax
1682 adc ebp, edx
1683 mov eax, DWORD PTR 8[esi]
1684 adc ebx, 0
1685 ; sqr a[2]*a[2]
1686 mul eax
1687 add ecx, eax
1688 adc ebp, edx
1689 mov edx, DWORD PTR [esi]
1690 adc ebx, 0
1691 mov DWORD PTR 16[edi],ecx
1692 mov eax, DWORD PTR 20[esi]
1693 ; saved r[4]
1694 ; ############### Calculate word 5
1695 xor ecx, ecx
1696 ; sqr a[5]*a[0]
1697 mul edx
1698 add eax, eax
1699 adc edx, edx
1700 adc ecx, 0
1701 add ebp, eax
1702 adc ebx, edx
1703 mov eax, DWORD PTR 16[esi]
1704 adc ecx, 0
1705 mov edx, DWORD PTR 4[esi]
1706 ; sqr a[4]*a[1]
1707 mul edx
1708 add eax, eax
1709 adc edx, edx
1710 adc ecx, 0
1711 add ebp, eax
1712 adc ebx, edx
1713 mov eax, DWORD PTR 12[esi]
1714 adc ecx, 0
1715 mov edx, DWORD PTR 8[esi]
1716 ; sqr a[3]*a[2]
1717 mul edx
1718 add eax, eax
1719 adc edx, edx
1720 adc ecx, 0
1721 add ebp, eax
1722 adc ebx, edx
1723 mov eax, DWORD PTR 24[esi]
1724 adc ecx, 0
1725 mov DWORD PTR 20[edi],ebp
1726 mov edx, DWORD PTR [esi]
1727 ; saved r[5]
1728 ; ############### Calculate word 6
1729 xor ebp, ebp
1730 ; sqr a[6]*a[0]
1731 mul edx
1732 add eax, eax
1733 adc edx, edx
1734 adc ebp, 0
1735 add ebx, eax
1736 adc ecx, edx
1737 mov eax, DWORD PTR 20[esi]
1738 adc ebp, 0
1739 mov edx, DWORD PTR 4[esi]
1740 ; sqr a[5]*a[1]
1741 mul edx
1742 add eax, eax
1743 adc edx, edx
1744 adc ebp, 0
1745 add ebx, eax
1746 adc ecx, edx
1747 mov eax, DWORD PTR 16[esi]
1748 adc ebp, 0
1749 mov edx, DWORD PTR 8[esi]
1750 ; sqr a[4]*a[2]
1751 mul edx
1752 add eax, eax
1753 adc edx, edx
1754 adc ebp, 0
1755 add ebx, eax
1756 adc ecx, edx
1757 mov eax, DWORD PTR 12[esi]
1758 adc ebp, 0
1759 ; sqr a[3]*a[3]
1760 mul eax
1761 add ebx, eax
1762 adc ecx, edx
1763 mov edx, DWORD PTR [esi]
1764 adc ebp, 0
1765 mov DWORD PTR 24[edi],ebx
1766 mov eax, DWORD PTR 28[esi]
1767 ; saved r[6]
1768 ; ############### Calculate word 7
1769 xor ebx, ebx
1770 ; sqr a[7]*a[0]
1771 mul edx
1772 add eax, eax
1773 adc edx, edx
1774 adc ebx, 0
1775 add ecx, eax
1776 adc ebp, edx
1777 mov eax, DWORD PTR 24[esi]
1778 adc ebx, 0
1779 mov edx, DWORD PTR 4[esi]
1780 ; sqr a[6]*a[1]
1781 mul edx
1782 add eax, eax
1783 adc edx, edx
1784 adc ebx, 0
1785 add ecx, eax
1786 adc ebp, edx
1787 mov eax, DWORD PTR 20[esi]
1788 adc ebx, 0
1789 mov edx, DWORD PTR 8[esi]
1790 ; sqr a[5]*a[2]
1791 mul edx
1792 add eax, eax
1793 adc edx, edx
1794 adc ebx, 0
1795 add ecx, eax
1796 adc ebp, edx
1797 mov eax, DWORD PTR 16[esi]
1798 adc ebx, 0
1799 mov edx, DWORD PTR 12[esi]
1800 ; sqr a[4]*a[3]
1801 mul edx
1802 add eax, eax
1803 adc edx, edx
1804 adc ebx, 0
1805 add ecx, eax
1806 adc ebp, edx
1807 mov eax, DWORD PTR 28[esi]
1808 adc ebx, 0
1809 mov DWORD PTR 28[edi],ecx
1810 mov edx, DWORD PTR 4[esi]
1811 ; saved r[7]
1812 ; ############### Calculate word 8
1813 xor ecx, ecx
1814 ; sqr a[7]*a[1]
1815 mul edx
1816 add eax, eax
1817 adc edx, edx
1818 adc ecx, 0
1819 add ebp, eax
1820 adc ebx, edx
1821 mov eax, DWORD PTR 24[esi]
1822 adc ecx, 0
1823 mov edx, DWORD PTR 8[esi]
1824 ; sqr a[6]*a[2]
1825 mul edx
1826 add eax, eax
1827 adc edx, edx
1828 adc ecx, 0
1829 add ebp, eax
1830 adc ebx, edx
1831 mov eax, DWORD PTR 20[esi]
1832 adc ecx, 0
1833 mov edx, DWORD PTR 12[esi]
1834 ; sqr a[5]*a[3]
1835 mul edx
1836 add eax, eax
1837 adc edx, edx
1838 adc ecx, 0
1839 add ebp, eax
1840 adc ebx, edx
1841 mov eax, DWORD PTR 16[esi]
1842 adc ecx, 0
1843 ; sqr a[4]*a[4]
1844 mul eax
1845 add ebp, eax
1846 adc ebx, edx
1847 mov edx, DWORD PTR 8[esi]
1848 adc ecx, 0
1849 mov DWORD PTR 32[edi],ebp
1850 mov eax, DWORD PTR 28[esi]
1851 ; saved r[8]
1852 ; ############### Calculate word 9
1853 xor ebp, ebp
1854 ; sqr a[7]*a[2]
1855 mul edx
1856 add eax, eax
1857 adc edx, edx
1858 adc ebp, 0
1859 add ebx, eax
1860 adc ecx, edx
1861 mov eax, DWORD PTR 24[esi]
1862 adc ebp, 0
1863 mov edx, DWORD PTR 12[esi]
1864 ; sqr a[6]*a[3]
1865 mul edx
1866 add eax, eax
1867 adc edx, edx
1868 adc ebp, 0
1869 add ebx, eax
1870 adc ecx, edx
1871 mov eax, DWORD PTR 20[esi]
1872 adc ebp, 0
1873 mov edx, DWORD PTR 16[esi]
1874 ; sqr a[5]*a[4]
1875 mul edx
1876 add eax, eax
1877 adc edx, edx
1878 adc ebp, 0
1879 add ebx, eax
1880 adc ecx, edx
1881 mov eax, DWORD PTR 28[esi]
1882 adc ebp, 0
1883 mov DWORD PTR 36[edi],ebx
1884 mov edx, DWORD PTR 12[esi]
1885 ; saved r[9]
1886 ; ############### Calculate word 10
1887 xor ebx, ebx
1888 ; sqr a[7]*a[3]
1889 mul edx
1890 add eax, eax
1891 adc edx, edx
1892 adc ebx, 0
1893 add ecx, eax
1894 adc ebp, edx
1895 mov eax, DWORD PTR 24[esi]
1896 adc ebx, 0
1897 mov edx, DWORD PTR 16[esi]
1898 ; sqr a[6]*a[4]
1899 mul edx
1900 add eax, eax
1901 adc edx, edx
1902 adc ebx, 0
1903 add ecx, eax
1904 adc ebp, edx
1905 mov eax, DWORD PTR 20[esi]
1906 adc ebx, 0
1907 ; sqr a[5]*a[5]
1908 mul eax
1909 add ecx, eax
1910 adc ebp, edx
1911 mov edx, DWORD PTR 16[esi]
1912 adc ebx, 0
1913 mov DWORD PTR 40[edi],ecx
1914 mov eax, DWORD PTR 28[esi]
1915 ; saved r[10]
1916 ; ############### Calculate word 11
1917 xor ecx, ecx
1918 ; sqr a[7]*a[4]
1919 mul edx
1920 add eax, eax
1921 adc edx, edx
1922 adc ecx, 0
1923 add ebp, eax
1924 adc ebx, edx
1925 mov eax, DWORD PTR 24[esi]
1926 adc ecx, 0
1927 mov edx, DWORD PTR 20[esi]
1928 ; sqr a[6]*a[5]
1929 mul edx
1930 add eax, eax
1931 adc edx, edx
1932 adc ecx, 0
1933 add ebp, eax
1934 adc ebx, edx
1935 mov eax, DWORD PTR 28[esi]
1936 adc ecx, 0
1937 mov DWORD PTR 44[edi],ebp
1938 mov edx, DWORD PTR 20[esi]
1939 ; saved r[11]
1940 ; ############### Calculate word 12
1941 xor ebp, ebp
1942 ; sqr a[7]*a[5]
1943 mul edx
1944 add eax, eax
1945 adc edx, edx
1946 adc ebp, 0
1947 add ebx, eax
1948 adc ecx, edx
1949 mov eax, DWORD PTR 24[esi]
1950 adc ebp, 0
1951 ; sqr a[6]*a[6]
1952 mul eax
1953 add ebx, eax
1954 adc ecx, edx
1955 mov edx, DWORD PTR 24[esi]
1956 adc ebp, 0
1957 mov DWORD PTR 48[edi],ebx
1958 mov eax, DWORD PTR 28[esi]
1959 ; saved r[12]
1960 ; ############### Calculate word 13
1961 xor ebx, ebx
1962 ; sqr a[7]*a[6]
1963 mul edx
1964 add eax, eax
1965 adc edx, edx
1966 adc ebx, 0
1967 add ecx, eax
1968 adc ebp, edx
1969 mov eax, DWORD PTR 28[esi]
1970 adc ebx, 0
1971 mov DWORD PTR 52[edi],ecx
1972 ; saved r[13]
1973 ; ############### Calculate word 14
1974 xor ecx, ecx
1975 ; sqr a[7]*a[7]
1976 mul eax
1977 add ebp, eax
1978 adc ebx, edx
1979 adc ecx, 0
1980 mov DWORD PTR 56[edi],ebp
1981 ; saved r[14]
1982 mov DWORD PTR 60[edi],ebx
1983 pop ebx
1984 pop ebp
1985 pop edi
1986 pop esi
1987 ret
1988 _bn_sqr_comba8 ENDP
1989 _TEXT ENDS
1990 _TEXT SEGMENT
1991 PUBLIC _bn_sqr_comba4
1992
1993 _bn_sqr_comba4 PROC NEAR
1994 push esi
1995 push edi
1996 push ebp
1997 push ebx
1998 mov edi, DWORD PTR 20[esp]
1999 mov esi, DWORD PTR 24[esp]
2000 xor ebx, ebx
2001 xor ecx, ecx
2002 mov eax, DWORD PTR [esi]
2003 ; ############### Calculate word 0
2004 xor ebp, ebp
2005 ; sqr a[0]*a[0]
2006 mul eax
2007 add ebx, eax
2008 adc ecx, edx
2009 mov edx, DWORD PTR [esi]
2010 adc ebp, 0
2011 mov DWORD PTR [edi],ebx
2012 mov eax, DWORD PTR 4[esi]
2013 ; saved r[0]
2014 ; ############### Calculate word 1
2015 xor ebx, ebx
2016 ; sqr a[1]*a[0]
2017 mul edx
2018 add eax, eax
2019 adc edx, edx
2020 adc ebx, 0
2021 add ecx, eax
2022 adc ebp, edx
2023 mov eax, DWORD PTR 8[esi]
2024 adc ebx, 0
2025 mov DWORD PTR 4[edi],ecx
2026 mov edx, DWORD PTR [esi]
2027 ; saved r[1]
2028 ; ############### Calculate word 2
2029 xor ecx, ecx
2030 ; sqr a[2]*a[0]
2031 mul edx
2032 add eax, eax
2033 adc edx, edx
2034 adc ecx, 0
2035 add ebp, eax
2036 adc ebx, edx
2037 mov eax, DWORD PTR 4[esi]
2038 adc ecx, 0
2039 ; sqr a[1]*a[1]
2040 mul eax
2041 add ebp, eax
2042 adc ebx, edx
2043 mov edx, DWORD PTR [esi]
2044 adc ecx, 0
2045 mov DWORD PTR 8[edi],ebp
2046 mov eax, DWORD PTR 12[esi]
2047 ; saved r[2]
2048 ; ############### Calculate word 3
2049 xor ebp, ebp
2050 ; sqr a[3]*a[0]
2051 mul edx
2052 add eax, eax
2053 adc edx, edx
2054 adc ebp, 0
2055 add ebx, eax
2056 adc ecx, edx
2057 mov eax, DWORD PTR 8[esi]
2058 adc ebp, 0
2059 mov edx, DWORD PTR 4[esi]
2060 ; sqr a[2]*a[1]
2061 mul edx
2062 add eax, eax
2063 adc edx, edx
2064 adc ebp, 0
2065 add ebx, eax
2066 adc ecx, edx
2067 mov eax, DWORD PTR 12[esi]
2068 adc ebp, 0
2069 mov DWORD PTR 12[edi],ebx
2070 mov edx, DWORD PTR 4[esi]
2071 ; saved r[3]
2072 ; ############### Calculate word 4
2073 xor ebx, ebx
2074 ; sqr a[3]*a[1]
2075 mul edx
2076 add eax, eax
2077 adc edx, edx
2078 adc ebx, 0
2079 add ecx, eax
2080 adc ebp, edx
2081 mov eax, DWORD PTR 8[esi]
2082 adc ebx, 0
2083 ; sqr a[2]*a[2]
2084 mul eax
2085 add ecx, eax
2086 adc ebp, edx
2087 mov edx, DWORD PTR 8[esi]
2088 adc ebx, 0
2089 mov DWORD PTR 16[edi],ecx
2090 mov eax, DWORD PTR 12[esi]
2091 ; saved r[4]
2092 ; ############### Calculate word 5
2093 xor ecx, ecx
2094 ; sqr a[3]*a[2]
2095 mul edx
2096 add eax, eax
2097 adc edx, edx
2098 adc ecx, 0
2099 add ebp, eax
2100 adc ebx, edx
2101 mov eax, DWORD PTR 12[esi]
2102 adc ecx, 0
2103 mov DWORD PTR 20[edi],ebp
2104 ; saved r[5]
2105 ; ############### Calculate word 6
2106 xor ebp, ebp
2107 ; sqr a[3]*a[3]
2108 mul eax
2109 add ebx, eax
2110 adc ecx, edx
2111 adc ebp, 0
2112 mov DWORD PTR 24[edi],ebx
2113 ; saved r[6]
2114 mov DWORD PTR 28[edi],ecx
2115 pop ebx
2116 pop ebp
2117 pop edi
2118 pop esi
2119 ret
2120 _bn_sqr_comba4 ENDP
2121 _TEXT ENDS
2122 END