summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn
diff options
context:
space:
mode:
authorbeck <>2000-04-15 06:18:51 +0000
committerbeck <>2000-04-15 06:18:51 +0000
commitb608c7f2b175e121f2c22d53341a317153afdc8e (patch)
treee94b160b3fcd8180df79e4251d68d24d665f0195 /src/lib/libcrypto/bn
parentc8d6701c396cebdcd0d45eac73b762e9498f6b01 (diff)
downloadopenbsd-b608c7f2b175e121f2c22d53341a317153afdc8e.tar.gz
openbsd-b608c7f2b175e121f2c22d53341a317153afdc8e.tar.bz2
openbsd-b608c7f2b175e121f2c22d53341a317153afdc8e.zip
OpenSSL 0.9.5a merge
Diffstat (limited to 'src/lib/libcrypto/bn')
-rw-r--r--src/lib/libcrypto/bn/Makefile.ssl9
-rw-r--r--src/lib/libcrypto/bn/asm/bn-win32.asm2122
-rw-r--r--src/lib/libcrypto/bn/asm/x86w16.asm297
-rw-r--r--src/lib/libcrypto/bn/asm/x86w32.asm360
-rw-r--r--src/lib/libcrypto/bn/bn.h2
-rw-r--r--src/lib/libcrypto/bn/bn_err.c3
-rw-r--r--src/lib/libcrypto/bn/bn_mont.c7
-rw-r--r--src/lib/libcrypto/bn/bn_mul.c3
-rw-r--r--src/lib/libcrypto/bn/bntest.c3
9 files changed, 17 insertions, 2789 deletions
diff --git a/src/lib/libcrypto/bn/Makefile.ssl b/src/lib/libcrypto/bn/Makefile.ssl
index fa23a43fa0..beb9c1b523 100644
--- a/src/lib/libcrypto/bn/Makefile.ssl
+++ b/src/lib/libcrypto/bn/Makefile.ssl
@@ -5,6 +5,7 @@
5DIR= bn 5DIR= bn
6TOP= ../.. 6TOP= ../..
7CC= cc 7CC= cc
8CPP= $(CC) -E
8INCLUDES= -I.. -I../../include 9INCLUDES= -I.. -I../../include
9CFLAG=-g 10CFLAG=-g
10INSTALL_PREFIX= 11INSTALL_PREFIX=
@@ -72,10 +73,10 @@ lib: $(LIBOBJ)
72 73
73# elf 74# elf
74asm/bn86-elf.o: asm/bn86unix.cpp 75asm/bn86-elf.o: asm/bn86unix.cpp
75 $(CPP) -DELF asm/bn86unix.cpp | as -o asm/bn86-elf.o 76 $(CPP) -DELF -x c asm/bn86unix.cpp | as -o asm/bn86-elf.o
76 77
77asm/co86-elf.o: asm/co86unix.cpp 78asm/co86-elf.o: asm/co86unix.cpp
78 $(CPP) -DELF asm/co86unix.cpp | as -o asm/co86-elf.o 79 $(CPP) -DELF -x c asm/co86unix.cpp | as -o asm/co86-elf.o
79 80
80# solaris 81# solaris
81asm/bn86-sol.o: asm/bn86unix.cpp 82asm/bn86-sol.o: asm/bn86unix.cpp
@@ -102,10 +103,10 @@ asm/bn86bsdi.o: asm/bn86unix.cpp
102asm/co86bsdi.o: asm/co86unix.cpp 103asm/co86bsdi.o: asm/co86unix.cpp
103 $(CPP) -DBSDI asm/co86unix.cpp | sed 's/ :/:/' | as -o asm/co86bsdi.o 104 $(CPP) -DBSDI asm/co86unix.cpp | sed 's/ :/:/' | as -o asm/co86bsdi.o
104 105
105asm/bn86unix.cpp: asm/bn-586.pl 106asm/bn86unix.cpp: asm/bn-586.pl ../perlasm/x86asm.pl
106 (cd asm; $(PERL) bn-586.pl cpp >bn86unix.cpp ) 107 (cd asm; $(PERL) bn-586.pl cpp >bn86unix.cpp )
107 108
108asm/co86unix.cpp: asm/co-586.pl 109asm/co86unix.cpp: asm/co-586.pl ../perlasm/x86asm.pl
109 (cd asm; $(PERL) co-586.pl cpp >co86unix.cpp ) 110 (cd asm; $(PERL) co-586.pl cpp >co86unix.cpp )
110 111
111asm/sparcv8.o: asm/sparcv8.S 112asm/sparcv8.o: asm/sparcv8.S
diff --git a/src/lib/libcrypto/bn/asm/bn-win32.asm b/src/lib/libcrypto/bn/asm/bn-win32.asm
index 871bd88d77..e69de29bb2 100644
--- a/src/lib/libcrypto/bn/asm/bn-win32.asm
+++ b/src/lib/libcrypto/bn/asm/bn-win32.asm
@@ -1,2122 +0,0 @@
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
11PUBLIC _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
27L001maw_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
214PUBLIC _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
229L005mw_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
369PUBLIC _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
382L009sw_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
488PUBLIC _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
507PUBLIC _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
522L012aw_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
689PUBLIC _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
704L015aw_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
871PUBLIC _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
1415PUBLIC _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
1583PUBLIC _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
1991PUBLIC _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
2122END
diff --git a/src/lib/libcrypto/bn/asm/x86w16.asm b/src/lib/libcrypto/bn/asm/x86w16.asm
index 80a9ed6eef..e69de29bb2 100644
--- a/src/lib/libcrypto/bn/asm/x86w16.asm
+++ b/src/lib/libcrypto/bn/asm/x86w16.asm
@@ -1,297 +0,0 @@
1; Static Name Aliases
2;
3 TITLE bn_mulw.c
4 .8087
5F_TEXT SEGMENT WORD PUBLIC 'CODE'
6F_TEXT ENDS
7_DATA SEGMENT WORD PUBLIC 'DATA'
8_DATA ENDS
9_CONST SEGMENT WORD PUBLIC 'CONST'
10_CONST ENDS
11_BSS SEGMENT WORD PUBLIC 'BSS'
12_BSS ENDS
13DGROUP GROUP _CONST, _BSS, _DATA
14 ASSUME DS: DGROUP, SS: DGROUP
15F_TEXT SEGMENT
16 ASSUME CS: F_TEXT
17 PUBLIC _bn_mul_add_words
18_bn_mul_add_words PROC FAR
19; Line 58
20 push bp
21 push bx
22 push si
23 push di
24 push ds
25 push es
26 mov bp,sp
27; w = 26
28; num = 24
29; ap = 20
30; rp = 16
31 xor si,si ;c=0;
32 mov di,WORD PTR [bp+16] ; load r
33 mov ds,WORD PTR [bp+18] ; load r
34 mov bx,WORD PTR [bp+20] ; load a
35 mov es,WORD PTR [bp+22] ; load a
36 mov cx,WORD PTR [bp+26] ; load w
37 mov bp,WORD PTR [bp+24] ; load num
38
39 shr bp,1 ; div count by 4 and do groups of 4
40 shr bp,1
41 je $L555
42
43$L546:
44 mov ax,cx
45 mul WORD PTR es:[bx] ; w* *a
46 add ax,WORD PTR ds:[di] ; + *r
47 adc dx,0
48 adc ax,si
49 adc dx,0
50 mov WORD PTR ds:[di],ax
51 mov si,dx
52 ;
53 mov ax,cx
54 mul WORD PTR es:[bx+2] ; w* *a
55 add ax,WORD PTR ds:[di+2] ; + *r
56 adc dx,0
57 adc ax,si
58 adc dx,0
59 mov WORD PTR ds:[di+2],ax
60 mov si,dx
61 ;
62 mov ax,cx
63 mul WORD PTR es:[bx+4] ; w* *a
64 add ax,WORD PTR ds:[di+4] ; + *r
65 adc dx,0
66 adc ax,si
67 adc dx,0
68 mov WORD PTR ds:[di+4],ax
69 mov si,dx
70 ;
71 mov ax,cx
72 mul WORD PTR es:[bx+6] ; w* *a
73 add ax,WORD PTR ds:[di+6] ; + *r
74 adc dx,0
75 adc ax,si
76 adc dx,0
77 mov WORD PTR ds:[di+6],ax
78 mov si,dx
79 ;
80 add bx,8
81 add di,8
82 ;
83 dec bp
84 je $L555
85 jmp $L546
86;
87;
88$L555:
89 mov bp,sp
90 mov bp,WORD PTR [bp+24] ; load num
91 and bp,3
92 dec bp
93 js $L547
94
95 mov ax,cx
96 mul WORD PTR es:[bx] ; w* *a
97 add ax,WORD PTR ds:[di] ; + *r
98 adc dx,0
99 adc ax,si
100 adc dx,0
101 mov WORD PTR ds:[di],ax
102 mov si,dx
103 dec bp
104 js $L547 ; Note that we are now testing for -1
105 ;
106 mov ax,cx
107 mul WORD PTR es:[bx+2] ; w* *a
108 add ax,WORD PTR ds:[di+2] ; + *r
109 adc dx,0
110 adc ax,si
111 adc dx,0
112 mov WORD PTR ds:[di+2],ax
113 mov si,dx
114 dec bp
115 js $L547
116 ;
117 mov ax,cx
118 mul WORD PTR es:[bx+4] ; w* *a
119 add ax,WORD PTR ds:[di+4] ; + *r
120 adc dx,0
121 adc ax,si
122 adc dx,0
123 mov WORD PTR ds:[di+4],ax
124 mov si,dx
125$L547:
126 mov ax,si
127 pop es
128 pop ds
129 pop di
130 pop si
131 pop bx
132 pop bp
133 ret
134 nop
135
136_bn_mul_add_words ENDP
137 PUBLIC _bn_mul_words
138_bn_mul_words PROC FAR
139; Line 76
140 push bp
141 push bx
142 push si
143 push di
144 push ds
145 push es
146 xor si,si
147 mov bp,sp
148 mov di,WORD PTR [bp+16] ; r
149 mov ds,WORD PTR [bp+18]
150 mov bx,WORD PTR [bp+20] ; a
151 mov es,WORD PTR [bp+22]
152 mov cx,WORD PTR [bp+26] ; w
153 mov bp,WORD PTR [bp+24] ; num
154$FC743:
155 mov ax,cx
156 mul WORD PTR es:[bx]
157 add ax,si
158 adc dx,0
159 mov WORD PTR ds:[di],ax
160 mov si,dx
161 dec bp
162 je $L764
163 ;
164 mov ax,cx
165 mul WORD PTR es:[bx+2]
166 add ax,si
167 adc dx,0
168 mov WORD PTR ds:[di+2],ax
169 mov si,dx
170 dec bp
171 je $L764
172 ;
173 mov ax,cx
174 mul WORD PTR es:[bx+4]
175 add ax,si
176 adc dx,0
177 mov WORD PTR ds:[di+4],ax
178 mov si,dx
179 dec bp
180 je $L764
181 ;
182 mov ax,cx
183 mul WORD PTR es:[bx+6]
184 add ax,si
185 adc dx,0
186 mov WORD PTR ds:[di+6],ax
187 mov si,dx
188 dec bp
189 je $L764
190 ;
191 add bx,8
192 add di,8
193 jmp $FC743
194 nop
195$L764:
196 mov ax,si
197 pop es
198 pop ds
199 pop di
200 pop si
201 pop bx
202 pop bp
203 ret
204 nop
205_bn_mul_words ENDP
206 PUBLIC _bn_sqr_words
207_bn_sqr_words PROC FAR
208; Line 92
209 push bp
210 push bx
211 push si
212 push di
213 push ds
214 push es
215 mov bp,sp
216 mov si,WORD PTR [bp+16]
217 mov ds,WORD PTR [bp+18]
218 mov di,WORD PTR [bp+20]
219 mov es,WORD PTR [bp+22]
220 mov bx,WORD PTR [bp+24]
221
222 mov bp,bx ; save a memory lookup later
223 shr bx,1 ; div count by 4 and do groups of 4
224 shr bx,1
225 je $L666
226
227$L765:
228 mov ax,WORD PTR es:[di]
229 mul ax
230 mov WORD PTR ds:[si],ax
231 mov WORD PTR ds:[si+2],dx
232 ;
233 mov ax,WORD PTR es:[di+2]
234 mul ax
235 mov WORD PTR ds:[si+4],ax
236 mov WORD PTR ds:[si+6],dx
237 ;
238 mov ax,WORD PTR es:[di+4]
239 mul ax
240 mov WORD PTR ds:[si+8],ax
241 mov WORD PTR ds:[si+10],dx
242 ;
243 mov ax,WORD PTR es:[di+6]
244 mul ax
245 mov WORD PTR ds:[si+12],ax
246 mov WORD PTR ds:[si+14],dx
247 ;
248 add di,8
249 add si,16
250 dec bx
251 je $L666
252 jmp $L765
253$L666:
254 and bp,3
255 dec bp ; The copied value of bx (num)
256 js $L645
257 ;
258 mov ax,WORD PTR es:[di]
259 mul ax
260 mov WORD PTR ds:[si],ax
261 mov WORD PTR ds:[si+2],dx
262 dec bp
263 js $L645
264 ;
265 mov ax,WORD PTR es:[di+2]
266 mul ax
267 mov WORD PTR ds:[si+4],ax
268 mov WORD PTR ds:[si+6],dx
269 dec bp
270 js $L645
271 ;
272 mov ax,WORD PTR es:[di+4]
273 mul ax
274 mov WORD PTR ds:[si+8],ax
275 mov WORD PTR ds:[si+10],dx
276$L645:
277 pop es
278 pop ds
279 pop di
280 pop si
281 pop bx
282 pop bp
283 ret
284
285_bn_sqr_words ENDP
286 PUBLIC _bn_div64
287_bn_div64 PROC FAR
288 push bp
289 mov bp,sp
290 mov dx, WORD PTR [bp+6]
291 mov ax, WORD PTR [bp+8]
292 div WORD PTR [bp+10]
293 pop bp
294 ret
295_bn_div64 ENDP
296F_TEXT ENDS
297END
diff --git a/src/lib/libcrypto/bn/asm/x86w32.asm b/src/lib/libcrypto/bn/asm/x86w32.asm
index 957d71e3b1..e69de29bb2 100644
--- a/src/lib/libcrypto/bn/asm/x86w32.asm
+++ b/src/lib/libcrypto/bn/asm/x86w32.asm
@@ -1,360 +0,0 @@
1; Static Name Aliases
2;
3 TITLE bn_mulw.c
4 .386
5F_TEXT SEGMENT WORD USE16 PUBLIC 'CODE'
6F_TEXT ENDS
7_DATA SEGMENT WORD USE16 PUBLIC 'DATA'
8_DATA ENDS
9_CONST SEGMENT WORD USE16 PUBLIC 'CONST'
10_CONST ENDS
11_BSS SEGMENT WORD USE16 PUBLIC 'BSS'
12_BSS ENDS
13DGROUP GROUP _CONST, _BSS, _DATA
14 ASSUME DS: DGROUP, SS: DGROUP
15F_TEXT SEGMENT
16 ASSUME CS: F_TEXT
17 PUBLIC _bn_mul_add_words
18_bn_mul_add_words PROC FAR
19; Line 58
20 push bp
21 push bx
22 push esi
23 push di
24 push ds
25 push es
26 mov bp,sp
27; w = 28
28; num = 26
29; ap = 22
30; rp = 18
31 xor esi,esi ;c=0;
32 mov di,WORD PTR [bp+18] ; load r
33 mov ds,WORD PTR [bp+20] ; load r
34 mov bx,WORD PTR [bp+22] ; load a
35 mov es,WORD PTR [bp+24] ; load a
36 mov ecx,DWORD PTR [bp+28] ; load w
37 mov bp,WORD PTR [bp+26] ; load num
38 shr bp,1 ; div count by 4 and do groups of 4
39 shr bp,1
40 je $L555
41
42$L546:
43 mov eax,ecx
44 mul DWORD PTR es:[bx] ; w* *a
45 add eax,DWORD PTR ds:[di] ; + *r
46 adc edx,0
47 adc eax,esi
48 adc edx,0
49 mov DWORD PTR ds:[di],eax
50 mov esi,edx
51 ;
52 mov eax,ecx
53 mul DWORD PTR es:[bx+4] ; w* *a
54 add eax,DWORD PTR ds:[di+4] ; + *r
55 adc edx,0
56 adc eax,esi
57 adc edx,0
58 mov DWORD PTR ds:[di+4],eax
59 mov esi,edx
60 ;
61 mov eax,ecx
62 mul DWORD PTR es:[bx+8] ; w* *a
63 add eax,DWORD PTR ds:[di+8] ; + *r
64 adc edx,0
65 adc eax,esi
66 adc edx,0
67 mov DWORD PTR ds:[di+8],eax
68 mov esi,edx
69 ;
70 mov eax,ecx
71 mul DWORD PTR es:[bx+12] ; w* *a
72 add eax,DWORD PTR ds:[di+12] ; + *r
73 adc edx,0
74 adc eax,esi
75 adc edx,0
76 mov DWORD PTR ds:[di+12],eax
77 mov esi,edx
78 ;
79 add bx,16
80 add di,16
81 ;
82 dec bp
83 je $L555
84 jmp $L546
85;
86;
87$L555:
88 mov bp,sp
89 mov bp,WORD PTR [bp+26] ; load num
90 and bp,3
91 dec bp
92 js $L547m
93
94 mov eax,ecx
95 mul DWORD PTR es:[bx] ; w* *a
96 add eax,DWORD PTR ds:[di] ; + *r
97 adc edx,0
98 adc eax,esi
99 adc edx,0
100 mov DWORD PTR ds:[di],eax
101 mov esi,edx
102 dec bp
103 js $L547m ; Note that we are now testing for -1
104 ;
105 mov eax,ecx
106 mul DWORD PTR es:[bx+4] ; w* *a
107 add eax,DWORD PTR ds:[di+4] ; + *r
108 adc edx,0
109 adc eax,esi
110 adc edx,0
111 mov DWORD PTR ds:[di+4],eax
112 mov esi,edx
113 dec bp
114 js $L547m
115 ;
116 mov eax,ecx
117 mul DWORD PTR es:[bx+8] ; w* *a
118 add eax,DWORD PTR ds:[di+8] ; + *r
119 adc edx,0
120 adc eax,esi
121 adc edx,0
122 mov DWORD PTR ds:[di+8],eax
123 mov esi,edx
124$L547m:
125 mov eax,esi
126 mov edx,esi
127 shr edx,16
128 pop es
129 pop ds
130 pop di
131 pop esi
132 pop bx
133 pop bp
134 ret
135 nop
136_bn_mul_add_words ENDP
137
138 PUBLIC _bn_mul_words
139_bn_mul_words PROC FAR
140; Line 76
141 push bp
142 push bx
143 push esi
144 push di
145 push ds
146 push es
147 xor esi,esi
148 mov bp,sp
149 mov di,WORD PTR [bp+18] ; r
150 mov ds,WORD PTR [bp+20]
151 mov bx,WORD PTR [bp+22] ; a
152 mov es,WORD PTR [bp+24]
153 mov ecx,DWORD PTR [bp+28] ; w
154 mov bp,WORD PTR [bp+26] ; num
155
156$FC743:
157 mov eax,ecx
158 mul DWORD PTR es:[bx]
159 add eax,esi
160 adc edx,0
161 mov DWORD PTR ds:[di],eax
162 mov esi,edx
163 dec bp
164 je $L764
165 ;
166 mov eax,ecx
167 mul DWORD PTR es:[bx+4]
168 add eax,esi
169 adc edx,0
170 mov DWORD PTR ds:[di+4],eax
171 mov esi,edx
172 dec bp
173 je $L764
174 ;
175 mov eax,ecx
176 mul DWORD PTR es:[bx+8]
177 add eax,esi
178 adc edx,0
179 mov DWORD PTR ds:[di+8],eax
180 mov esi,edx
181 dec bp
182 je $L764
183 ;
184 mov eax,ecx
185 mul DWORD PTR es:[bx+12]
186 add eax,esi
187 adc edx,0
188 mov DWORD PTR ds:[di+12],eax
189 mov esi,edx
190 dec bp
191 je $L764
192 ;
193 add bx,16
194 add di,16
195 jmp $FC743
196 nop
197$L764:
198 mov eax,esi
199 mov edx,esi
200 shr edx,16
201 pop es
202 pop ds
203 pop di
204 pop esi
205 pop bx
206 pop bp
207 ret
208 nop
209_bn_mul_words ENDP
210 PUBLIC _bn_sqr_words
211_bn_sqr_words PROC FAR
212; Line 92
213 push bp
214 push bx
215 push si
216 push di
217 push ds
218 push es
219 mov bp,sp
220 mov si,WORD PTR [bp+16]
221 mov ds,WORD PTR [bp+18]
222 mov di,WORD PTR [bp+20]
223 mov es,WORD PTR [bp+22]
224 mov bx,WORD PTR [bp+24]
225
226 mov bp,bx ; save a memory lookup later
227 shr bx,1 ; div count by 4 and do groups of 4
228 shr bx,1
229 je $L666
230
231$L765:
232 mov eax,DWORD PTR es:[di]
233 mul eax
234 mov DWORD PTR ds:[si],eax
235 mov DWORD PTR ds:[si+4],edx
236 ;
237 mov eax,DWORD PTR es:[di+4]
238 mul eax
239 mov DWORD PTR ds:[si+8],eax
240 mov DWORD PTR ds:[si+12],edx
241 ;
242 mov eax,DWORD PTR es:[di+8]
243 mul eax
244 mov DWORD PTR ds:[si+16],eax
245 mov DWORD PTR ds:[si+20],edx
246 ;
247 mov eax,DWORD PTR es:[di+12]
248 mul eax
249 mov DWORD PTR ds:[si+24],eax
250 mov DWORD PTR ds:[si+28],edx
251 ;
252 add di,16
253 add si,32
254 dec bx
255 je $L666
256 jmp $L765
257$L666:
258 and bp,3
259 dec bp ; The copied value of bx (num)
260 js $L645
261 ;
262 mov eax,DWORD PTR es:[di]
263 mul eax
264 mov DWORD PTR ds:[si],eax
265 mov DWORD PTR ds:[si+4],edx
266 dec bp
267 js $L645
268 ;
269 mov eax,DWORD PTR es:[di+4]
270 mul eax
271 mov DWORD PTR ds:[si+8],eax
272 mov DWORD PTR ds:[si+12],edx
273 dec bp
274 js $L645
275 ;
276 mov eax,DWORD PTR es:[di+8]
277 mul eax
278 mov DWORD PTR ds:[si+16],eax
279 mov DWORD PTR ds:[si+20],edx
280$L645:
281 pop es
282 pop ds
283 pop di
284 pop si
285 pop bx
286 pop bp
287 ret
288_bn_sqr_words ENDP
289
290 PUBLIC _bn_div64
291_bn_div64 PROC FAR
292 push bp
293 mov bp,sp
294 mov edx, DWORD PTR [bp+6]
295 mov eax, DWORD PTR [bp+10]
296 div DWORD PTR [bp+14]
297 mov edx,eax
298 shr edx,16
299 pop bp
300 ret
301_bn_div64 ENDP
302
303 PUBLIC _bn_add_words
304_bn_add_words PROC FAR
305; Line 58
306 push bp
307 push bx
308 push esi
309 push di
310 push ds
311 push es
312 mov bp,sp
313; w = 28
314; num = 26
315; ap = 22
316; rp = 18
317 xor esi,esi ;c=0;
318 mov bx,WORD PTR [bp+18] ; load low r
319 mov si,WORD PTR [bp+22] ; load a
320 mov es,WORD PTR [bp+24] ; load a
321 mov di,WORD PTR [bp+26] ; load b
322 mov ds,WORD PTR [bp+28] ; load b
323
324 mov dx,WORD PTR [bp+30] ; load num
325 xor ecx,ecx
326 dec dx
327 js $L547a
328
329$L5477:
330 mov eax,DWORD PTR es:[si] ; *a
331 add eax,ecx
332 mov ecx,0
333 adc ecx,0
334 add si,4 ; a++
335 add eax,DWORD PTR ds:[di] ; + *b
336 adc ecx,0
337 mov ds,WORD PTR [bp+20]
338 add di,4
339 mov DWORD PTR ds:[bx],eax
340 mov ds,WORD PTR [bp+28]
341 add bx,4
342 dec dx
343 js $L547a ; Note that we are now testing for -1
344 jmp $L5477
345 ;
346$L547a:
347 mov eax,ecx
348 mov edx,ecx
349 shr edx,16
350 pop es
351 pop ds
352 pop di
353 pop esi
354 pop bx
355 pop bp
356 ret
357 nop
358_bn_add_words ENDP
359F_TEXT ENDS
360END
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h
index d8822610df..009b0eb685 100644
--- a/src/lib/libcrypto/bn/bn.h
+++ b/src/lib/libcrypto/bn/bn.h
@@ -89,7 +89,7 @@ extern "C" {
89 * For machines with only one compiler (or shared libraries), this should 89 * For machines with only one compiler (or shared libraries), this should
90 * be on. Again this in only really a problem on machines 90 * be on. Again this in only really a problem on machines
91 * using "long long's", are 32bit, and are not using my assembler code. */ 91 * using "long long's", are 32bit, and are not using my assembler code. */
92#if defined(MSDOS) || defined(WINDOWS) || defined(linux) 92#if defined(MSDOS) || defined(WINDOWS) || defined(WIN32) || defined(linux)
93#define BN_DIV2W 93#define BN_DIV2W
94#endif 94#endif
95 95
diff --git a/src/lib/libcrypto/bn/bn_err.c b/src/lib/libcrypto/bn/bn_err.c
index f3b9497dca..988270bcf4 100644
--- a/src/lib/libcrypto/bn/bn_err.c
+++ b/src/lib/libcrypto/bn/bn_err.c
@@ -54,7 +54,8 @@
54 */ 54 */
55 55
56/* NOTE: this file was auto generated by the mkerr.pl script: any changes 56/* NOTE: this file was auto generated by the mkerr.pl script: any changes
57 * made to it will be overwritten when the script next updates this file. 57 * made to it will be overwritten when the script next updates this file,
58 * only reason strings will be preserved.
58 */ 59 */
59 60
60#include <stdio.h> 61#include <stdio.h>
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c
index 7bb0b91223..598fecbf0c 100644
--- a/src/lib/libcrypto/bn/bn_mont.c
+++ b/src/lib/libcrypto/bn/bn_mont.c
@@ -73,6 +73,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b,
73 BN_MONT_CTX *mont, BN_CTX *ctx) 73 BN_MONT_CTX *mont, BN_CTX *ctx)
74 { 74 {
75 BIGNUM *tmp,*tmp2; 75 BIGNUM *tmp,*tmp2;
76 int ret=0;
76 77
77 BN_CTX_start(ctx); 78 BN_CTX_start(ctx);
78 tmp = BN_CTX_get(ctx); 79 tmp = BN_CTX_get(ctx);
@@ -101,10 +102,10 @@ int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b,
101 } 102 }
102 /* reduce from aRR to aR */ 103 /* reduce from aRR to aR */
103 if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err; 104 if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err;
104 BN_CTX_end(ctx); 105 ret=1;
105 return(1);
106err: 106err:
107 return(0); 107 BN_CTX_end(ctx);
108 return(ret);
108 } 109 }
109 110
110int BN_from_montgomery(BIGNUM *ret, BIGNUM *a, BN_MONT_CTX *mont, 111int BN_from_montgomery(BIGNUM *ret, BIGNUM *a, BN_MONT_CTX *mont,
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c
index eb007e19e9..3e8baaad9a 100644
--- a/src/lib/libcrypto/bn/bn_mul.c
+++ b/src/lib/libcrypto/bn/bn_mul.c
@@ -61,6 +61,9 @@
61#include "bn_lcl.h" 61#include "bn_lcl.h"
62 62
63#ifdef BN_RECURSION 63#ifdef BN_RECURSION
64/* Karatsuba recursive multiplication algorithm
65 * (cf. Knuth, The Art of Computer Programming, Vol. 2) */
66
64/* r is 2*n2 words in size, 67/* r is 2*n2 words in size,
65 * a and b are both n2 words in size. 68 * a and b are both n2 words in size.
66 * n2 must be a power of 2. 69 * n2 must be a power of 2.
diff --git a/src/lib/libcrypto/bn/bntest.c b/src/lib/libcrypto/bn/bntest.c
index 41c22f5954..0a97af69c5 100644
--- a/src/lib/libcrypto/bn/bntest.c
+++ b/src/lib/libcrypto/bn/bntest.c
@@ -234,7 +234,8 @@ int main(int argc, char *argv[])
234/**/ 234/**/
235 exit(0); 235 exit(0);
236err: 236err:
237 BIO_puts(out,"1\n"); /* make sure bc fails if we are piping to it */ 237 BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices
238 * the failure, see test_bn in test/Makefile.ssl*/
238 BIO_flush(out); 239 BIO_flush(out);
239 ERR_load_crypto_strings(); 240 ERR_load_crypto_strings();
240 ERR_print_errors_fp(stderr); 241 ERR_print_errors_fp(stderr);