summaryrefslogtreecommitdiff
path: root/lib/libcrypto/bn
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2000-04-15 06:18:52 +0000
committerBob Beck <beck@cvs.openbsd.org>2000-04-15 06:18:52 +0000
commit8023a8fe50e4963b4fba8c86d9623b97c27ce784 (patch)
tree970860d25d50d5f71198db33bd8bcfb6cf5a9864 /lib/libcrypto/bn
parentd6d4194cda8ed05473dc616aad0ba6818e9fa3a5 (diff)
OpenSSL 0.9.5a merge
Diffstat (limited to 'lib/libcrypto/bn')
-rw-r--r--lib/libcrypto/bn/Makefile.ssl9
-rw-r--r--lib/libcrypto/bn/asm/bn-win32.asm2122
-rw-r--r--lib/libcrypto/bn/asm/x86w16.asm297
-rw-r--r--lib/libcrypto/bn/asm/x86w32.asm360
-rw-r--r--lib/libcrypto/bn/bn.h2
-rw-r--r--lib/libcrypto/bn/bn_err.c3
-rw-r--r--lib/libcrypto/bn/bn_mont.c7
-rw-r--r--lib/libcrypto/bn/bn_mul.c3
-rw-r--r--lib/libcrypto/bn/bntest.c3
9 files changed, 17 insertions, 2789 deletions
diff --git a/lib/libcrypto/bn/Makefile.ssl b/lib/libcrypto/bn/Makefile.ssl
index fa23a43fa0c..beb9c1b5231 100644
--- a/lib/libcrypto/bn/Makefile.ssl
+++ b/lib/libcrypto/bn/Makefile.ssl
@@ -5,6 +5,7 @@
DIR= bn
TOP= ../..
CC= cc
+CPP= $(CC) -E
INCLUDES= -I.. -I../../include
CFLAG=-g
INSTALL_PREFIX=
@@ -72,10 +73,10 @@ lib: $(LIBOBJ)
# elf
asm/bn86-elf.o: asm/bn86unix.cpp
- $(CPP) -DELF asm/bn86unix.cpp | as -o asm/bn86-elf.o
+ $(CPP) -DELF -x c asm/bn86unix.cpp | as -o asm/bn86-elf.o
asm/co86-elf.o: asm/co86unix.cpp
- $(CPP) -DELF asm/co86unix.cpp | as -o asm/co86-elf.o
+ $(CPP) -DELF -x c asm/co86unix.cpp | as -o asm/co86-elf.o
# solaris
asm/bn86-sol.o: asm/bn86unix.cpp
@@ -102,10 +103,10 @@ asm/bn86bsdi.o: asm/bn86unix.cpp
asm/co86bsdi.o: asm/co86unix.cpp
$(CPP) -DBSDI asm/co86unix.cpp | sed 's/ :/:/' | as -o asm/co86bsdi.o
-asm/bn86unix.cpp: asm/bn-586.pl
+asm/bn86unix.cpp: asm/bn-586.pl ../perlasm/x86asm.pl
(cd asm; $(PERL) bn-586.pl cpp >bn86unix.cpp )
-asm/co86unix.cpp: asm/co-586.pl
+asm/co86unix.cpp: asm/co-586.pl ../perlasm/x86asm.pl
(cd asm; $(PERL) co-586.pl cpp >co86unix.cpp )
asm/sparcv8.o: asm/sparcv8.S
diff --git a/lib/libcrypto/bn/asm/bn-win32.asm b/lib/libcrypto/bn/asm/bn-win32.asm
index 871bd88d77f..e69de29bb2d 100644
--- a/lib/libcrypto/bn/asm/bn-win32.asm
+++ b/lib/libcrypto/bn/asm/bn-win32.asm
@@ -1,2122 +0,0 @@
- ; Don't even think of reading this code
- ; It was automatically generated by bn-586.pl
- ; Which is a perl program used to generate the x86 assember for
- ; any of elf, a.out, BSDI,Win32, or Solaris
- ; eric <eay@cryptsoft.com>
- ;
- TITLE bn-586.asm
- .386
-.model FLAT
-_TEXT SEGMENT
-PUBLIC _bn_mul_add_words
-
-_bn_mul_add_words PROC NEAR
- push ebp
- push ebx
- push esi
- push edi
- ;
- xor esi, esi
- mov edi, DWORD PTR 20[esp]
- mov ecx, DWORD PTR 28[esp]
- mov ebx, DWORD PTR 24[esp]
- and ecx, 4294967288
- mov ebp, DWORD PTR 32[esp]
- push ecx
- jz $L000maw_finish
-L001maw_loop:
- mov DWORD PTR [esp],ecx
- ; Round 0
- mov eax, DWORD PTR [ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR [edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- mov DWORD PTR [edi],eax
- mov esi, edx
- ; Round 4
- mov eax, DWORD PTR 4[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 4[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- mov DWORD PTR 4[edi],eax
- mov esi, edx
- ; Round 8
- mov eax, DWORD PTR 8[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 8[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- mov DWORD PTR 8[edi],eax
- mov esi, edx
- ; Round 12
- mov eax, DWORD PTR 12[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 12[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- mov DWORD PTR 12[edi],eax
- mov esi, edx
- ; Round 16
- mov eax, DWORD PTR 16[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 16[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- mov DWORD PTR 16[edi],eax
- mov esi, edx
- ; Round 20
- mov eax, DWORD PTR 20[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 20[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- mov DWORD PTR 20[edi],eax
- mov esi, edx
- ; Round 24
- mov eax, DWORD PTR 24[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 24[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- mov DWORD PTR 24[edi],eax
- mov esi, edx
- ; Round 28
- mov eax, DWORD PTR 28[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 28[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- mov DWORD PTR 28[edi],eax
- mov esi, edx
- ;
- mov ecx, DWORD PTR [esp]
- add ebx, 32
- add edi, 32
- sub ecx, 8
- jnz L001maw_loop
-$L000maw_finish:
- mov ecx, DWORD PTR 32[esp]
- and ecx, 7
- jnz $L002maw_finish2
- jmp $L003maw_end
-$L002maw_finish2:
- ; Tail Round 0
- mov eax, DWORD PTR [ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR [edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- dec ecx
- mov DWORD PTR [edi],eax
- mov esi, edx
- jz $L003maw_end
- ; Tail Round 1
- mov eax, DWORD PTR 4[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 4[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- dec ecx
- mov DWORD PTR 4[edi],eax
- mov esi, edx
- jz $L003maw_end
- ; Tail Round 2
- mov eax, DWORD PTR 8[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 8[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- dec ecx
- mov DWORD PTR 8[edi],eax
- mov esi, edx
- jz $L003maw_end
- ; Tail Round 3
- mov eax, DWORD PTR 12[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 12[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- dec ecx
- mov DWORD PTR 12[edi],eax
- mov esi, edx
- jz $L003maw_end
- ; Tail Round 4
- mov eax, DWORD PTR 16[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 16[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- dec ecx
- mov DWORD PTR 16[edi],eax
- mov esi, edx
- jz $L003maw_end
- ; Tail Round 5
- mov eax, DWORD PTR 20[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 20[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- dec ecx
- mov DWORD PTR 20[edi],eax
- mov esi, edx
- jz $L003maw_end
- ; Tail Round 6
- mov eax, DWORD PTR 24[ebx]
- mul ebp
- add eax, esi
- mov esi, DWORD PTR 24[edi]
- adc edx, 0
- add eax, esi
- adc edx, 0
- mov DWORD PTR 24[edi],eax
- mov esi, edx
-$L003maw_end:
- mov eax, esi
- pop ecx
- pop edi
- pop esi
- pop ebx
- pop ebp
- ret
-_bn_mul_add_words ENDP
-_TEXT ENDS
-_TEXT SEGMENT
-PUBLIC _bn_mul_words
-
-_bn_mul_words PROC NEAR
- push ebp
- push ebx
- push esi
- push edi
- ;
- xor esi, esi
- mov edi, DWORD PTR 20[esp]
- mov ebx, DWORD PTR 24[esp]
- mov ebp, DWORD PTR 28[esp]
- mov ecx, DWORD PTR 32[esp]
- and ebp, 4294967288
- jz $L004mw_finish
-L005mw_loop:
- ; Round 0
- mov eax, DWORD PTR [ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR [edi],eax
- mov esi, edx
- ; Round 4
- mov eax, DWORD PTR 4[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 4[edi],eax
- mov esi, edx
- ; Round 8
- mov eax, DWORD PTR 8[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 8[edi],eax
- mov esi, edx
- ; Round 12
- mov eax, DWORD PTR 12[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 12[edi],eax
- mov esi, edx
- ; Round 16
- mov eax, DWORD PTR 16[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 16[edi],eax
- mov esi, edx
- ; Round 20
- mov eax, DWORD PTR 20[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 20[edi],eax
- mov esi, edx
- ; Round 24
- mov eax, DWORD PTR 24[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 24[edi],eax
- mov esi, edx
- ; Round 28
- mov eax, DWORD PTR 28[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 28[edi],eax
- mov esi, edx
- ;
- add ebx, 32
- add edi, 32
- sub ebp, 8
- jz $L004mw_finish
- jmp L005mw_loop
-$L004mw_finish:
- mov ebp, DWORD PTR 28[esp]
- and ebp, 7
- jnz $L006mw_finish2
- jmp $L007mw_end
-$L006mw_finish2:
- ; Tail Round 0
- mov eax, DWORD PTR [ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR [edi],eax
- mov esi, edx
- dec ebp
- jz $L007mw_end
- ; Tail Round 1
- mov eax, DWORD PTR 4[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 4[edi],eax
- mov esi, edx
- dec ebp
- jz $L007mw_end
- ; Tail Round 2
- mov eax, DWORD PTR 8[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 8[edi],eax
- mov esi, edx
- dec ebp
- jz $L007mw_end
- ; Tail Round 3
- mov eax, DWORD PTR 12[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 12[edi],eax
- mov esi, edx
- dec ebp
- jz $L007mw_end
- ; Tail Round 4
- mov eax, DWORD PTR 16[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 16[edi],eax
- mov esi, edx
- dec ebp
- jz $L007mw_end
- ; Tail Round 5
- mov eax, DWORD PTR 20[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 20[edi],eax
- mov esi, edx
- dec ebp
- jz $L007mw_end
- ; Tail Round 6
- mov eax, DWORD PTR 24[ebx]
- mul ecx
- add eax, esi
- adc edx, 0
- mov DWORD PTR 24[edi],eax
- mov esi, edx
-$L007mw_end:
- mov eax, esi
- pop edi
- pop esi
- pop ebx
- pop ebp
- ret
-_bn_mul_words ENDP
-_TEXT ENDS
-_TEXT SEGMENT
-PUBLIC _bn_sqr_words
-
-_bn_sqr_words PROC NEAR
- push ebp
- push ebx
- push esi
- push edi
- ;
- mov esi, DWORD PTR 20[esp]
- mov edi, DWORD PTR 24[esp]
- mov ebx, DWORD PTR 28[esp]
- and ebx, 4294967288
- jz $L008sw_finish
-L009sw_loop:
- ; Round 0
- mov eax, DWORD PTR [edi]
- mul eax
- mov DWORD PTR [esi],eax
- mov DWORD PTR 4[esi],edx
- ; Round 4
- mov eax, DWORD PTR 4[edi]
- mul eax
- mov DWORD PTR 8[esi],eax
- mov DWORD PTR 12[esi],edx
- ; Round 8
- mov eax, DWORD PTR 8[edi]
- mul eax
- mov DWORD PTR 16[esi],eax
- mov DWORD PTR 20[esi],edx
- ; Round 12
- mov eax, DWORD PTR 12[edi]
- mul eax
- mov DWORD PTR 24[esi],eax
- mov DWORD PTR 28[esi],edx
- ; Round 16
- mov eax, DWORD PTR 16[edi]
- mul eax
- mov DWORD PTR 32[esi],eax
- mov DWORD PTR 36[esi],edx
- ; Round 20
- mov eax, DWORD PTR 20[edi]
- mul eax
- mov DWORD PTR 40[esi],eax
- mov DWORD PTR 44[esi],edx
- ; Round 24
- mov eax, DWORD PTR 24[edi]
- mul eax
- mov DWORD PTR 48[esi],eax
- mov DWORD PTR 52[esi],edx
- ; Round 28
- mov eax, DWORD PTR 28[edi]
- mul eax
- mov DWORD PTR 56[esi],eax
- mov DWORD PTR 60[esi],edx
- ;
- add edi, 32
- add esi, 64
- sub ebx, 8
- jnz L009sw_loop
-$L008sw_finish:
- mov ebx, DWORD PTR 28[esp]
- and ebx, 7
- jz $L010sw_end
- ; Tail Round 0
- mov eax, DWORD PTR [edi]
- mul eax
- mov DWORD PTR [esi],eax
- dec ebx
- mov DWORD PTR 4[esi],edx
- jz $L010sw_end
- ; Tail Round 1
- mov eax, DWORD PTR 4[edi]
- mul eax
- mov DWORD PTR 8[esi],eax
- dec ebx
- mov DWORD PTR 12[esi],edx
- jz $L010sw_end
- ; Tail Round 2
- mov eax, DWORD PTR 8[edi]
- mul eax
- mov DWORD PTR 16[esi],eax
- dec ebx
- mov DWORD PTR 20[esi],edx
- jz $L010sw_end
- ; Tail Round 3
- mov eax, DWORD PTR 12[edi]
- mul eax
- mov DWORD PTR 24[esi],eax
- dec ebx
- mov DWORD PTR 28[esi],edx
- jz $L010sw_end
- ; Tail Round 4
- mov eax, DWORD PTR 16[edi]
- mul eax
- mov DWORD PTR 32[esi],eax
- dec ebx
- mov DWORD PTR 36[esi],edx
- jz $L010sw_end
- ; Tail Round 5
- mov eax, DWORD PTR 20[edi]
- mul eax
- mov DWORD PTR 40[esi],eax
- dec ebx
- mov DWORD PTR 44[esi],edx
- jz $L010sw_end
- ; Tail Round 6
- mov eax, DWORD PTR 24[edi]
- mul eax
- mov DWORD PTR 48[esi],eax
- mov DWORD PTR 52[esi],edx
-$L010sw_end:
- pop edi
- pop esi
- pop ebx
- pop ebp
- ret
-_bn_sqr_words ENDP
-_TEXT ENDS
-_TEXT SEGMENT
-PUBLIC _bn_div_words
-
-_bn_div_words PROC NEAR
- push ebp
- push ebx
- push esi
- push edi
- mov edx, DWORD PTR 20[esp]
- mov eax, DWORD PTR 24[esp]
- mov ebx, DWORD PTR 28[esp]
- div ebx
- pop edi
- pop esi
- pop ebx
- pop ebp
- ret
-_bn_div_words ENDP
-_TEXT ENDS
-_TEXT SEGMENT
-PUBLIC _bn_add_words
-
-_bn_add_words PROC NEAR
- push ebp
- push ebx
- push esi
- push edi
- ;
- mov ebx, DWORD PTR 20[esp]
- mov esi, DWORD PTR 24[esp]
- mov edi, DWORD PTR 28[esp]
- mov ebp, DWORD PTR 32[esp]
- xor eax, eax
- and ebp, 4294967288
- jz $L011aw_finish
-L012aw_loop:
- ; Round 0
- mov ecx, DWORD PTR [esi]
- mov edx, DWORD PTR [edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- mov DWORD PTR [ebx],ecx
- ; Round 1
- mov ecx, DWORD PTR 4[esi]
- mov edx, DWORD PTR 4[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- mov DWORD PTR 4[ebx],ecx
- ; Round 2
- mov ecx, DWORD PTR 8[esi]
- mov edx, DWORD PTR 8[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- mov DWORD PTR 8[ebx],ecx
- ; Round 3
- mov ecx, DWORD PTR 12[esi]
- mov edx, DWORD PTR 12[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- mov DWORD PTR 12[ebx],ecx
- ; Round 4
- mov ecx, DWORD PTR 16[esi]
- mov edx, DWORD PTR 16[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- mov DWORD PTR 16[ebx],ecx
- ; Round 5
- mov ecx, DWORD PTR 20[esi]
- mov edx, DWORD PTR 20[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- mov DWORD PTR 20[ebx],ecx
- ; Round 6
- mov ecx, DWORD PTR 24[esi]
- mov edx, DWORD PTR 24[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- mov DWORD PTR 24[ebx],ecx
- ; Round 7
- mov ecx, DWORD PTR 28[esi]
- mov edx, DWORD PTR 28[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- mov DWORD PTR 28[ebx],ecx
- ;
- add esi, 32
- add edi, 32
- add ebx, 32
- sub ebp, 8
- jnz L012aw_loop
-$L011aw_finish:
- mov ebp, DWORD PTR 32[esp]
- and ebp, 7
- jz $L013aw_end
- ; Tail Round 0
- mov ecx, DWORD PTR [esi]
- mov edx, DWORD PTR [edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR [ebx],ecx
- jz $L013aw_end
- ; Tail Round 1
- mov ecx, DWORD PTR 4[esi]
- mov edx, DWORD PTR 4[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR 4[ebx],ecx
- jz $L013aw_end
- ; Tail Round 2
- mov ecx, DWORD PTR 8[esi]
- mov edx, DWORD PTR 8[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR 8[ebx],ecx
- jz $L013aw_end
- ; Tail Round 3
- mov ecx, DWORD PTR 12[esi]
- mov edx, DWORD PTR 12[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR 12[ebx],ecx
- jz $L013aw_end
- ; Tail Round 4
- mov ecx, DWORD PTR 16[esi]
- mov edx, DWORD PTR 16[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR 16[ebx],ecx
- jz $L013aw_end
- ; Tail Round 5
- mov ecx, DWORD PTR 20[esi]
- mov edx, DWORD PTR 20[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR 20[ebx],ecx
- jz $L013aw_end
- ; Tail Round 6
- mov ecx, DWORD PTR 24[esi]
- mov edx, DWORD PTR 24[edi]
- add ecx, eax
- mov eax, 0
- adc eax, eax
- add ecx, edx
- adc eax, 0
- mov DWORD PTR 24[ebx],ecx
-$L013aw_end:
- pop edi
- pop esi
- pop ebx
- pop ebp
- ret
-_bn_add_words ENDP
-_TEXT ENDS
-_TEXT SEGMENT
-PUBLIC _bn_sub_words
-
-_bn_sub_words PROC NEAR
- push ebp
- push ebx
- push esi
- push edi
- ;
- mov ebx, DWORD PTR 20[esp]
- mov esi, DWORD PTR 24[esp]
- mov edi, DWORD PTR 28[esp]
- mov ebp, DWORD PTR 32[esp]
- xor eax, eax
- and ebp, 4294967288
- jz $L014aw_finish
-L015aw_loop:
- ; Round 0
- mov ecx, DWORD PTR [esi]
- mov edx, DWORD PTR [edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- mov DWORD PTR [ebx],ecx
- ; Round 1
- mov ecx, DWORD PTR 4[esi]
- mov edx, DWORD PTR 4[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- mov DWORD PTR 4[ebx],ecx
- ; Round 2
- mov ecx, DWORD PTR 8[esi]
- mov edx, DWORD PTR 8[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- mov DWORD PTR 8[ebx],ecx
- ; Round 3
- mov ecx, DWORD PTR 12[esi]
- mov edx, DWORD PTR 12[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- mov DWORD PTR 12[ebx],ecx
- ; Round 4
- mov ecx, DWORD PTR 16[esi]
- mov edx, DWORD PTR 16[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- mov DWORD PTR 16[ebx],ecx
- ; Round 5
- mov ecx, DWORD PTR 20[esi]
- mov edx, DWORD PTR 20[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- mov DWORD PTR 20[ebx],ecx
- ; Round 6
- mov ecx, DWORD PTR 24[esi]
- mov edx, DWORD PTR 24[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- mov DWORD PTR 24[ebx],ecx
- ; Round 7
- mov ecx, DWORD PTR 28[esi]
- mov edx, DWORD PTR 28[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- mov DWORD PTR 28[ebx],ecx
- ;
- add esi, 32
- add edi, 32
- add ebx, 32
- sub ebp, 8
- jnz L015aw_loop
-$L014aw_finish:
- mov ebp, DWORD PTR 32[esp]
- and ebp, 7
- jz $L016aw_end
- ; Tail Round 0
- mov ecx, DWORD PTR [esi]
- mov edx, DWORD PTR [edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR [ebx],ecx
- jz $L016aw_end
- ; Tail Round 1
- mov ecx, DWORD PTR 4[esi]
- mov edx, DWORD PTR 4[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR 4[ebx],ecx
- jz $L016aw_end
- ; Tail Round 2
- mov ecx, DWORD PTR 8[esi]
- mov edx, DWORD PTR 8[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR 8[ebx],ecx
- jz $L016aw_end
- ; Tail Round 3
- mov ecx, DWORD PTR 12[esi]
- mov edx, DWORD PTR 12[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR 12[ebx],ecx
- jz $L016aw_end
- ; Tail Round 4
- mov ecx, DWORD PTR 16[esi]
- mov edx, DWORD PTR 16[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR 16[ebx],ecx
- jz $L016aw_end
- ; Tail Round 5
- mov ecx, DWORD PTR 20[esi]
- mov edx, DWORD PTR 20[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- dec ebp
- mov DWORD PTR 20[ebx],ecx
- jz $L016aw_end
- ; Tail Round 6
- mov ecx, DWORD PTR 24[esi]
- mov edx, DWORD PTR 24[edi]
- sub ecx, eax
- mov eax, 0
- adc eax, eax
- sub ecx, edx
- adc eax, 0
- mov DWORD PTR 24[ebx],ecx
-$L016aw_end:
- pop edi
- pop esi
- pop ebx
- pop ebp
- ret
-_bn_sub_words ENDP
-_TEXT ENDS
-_TEXT SEGMENT
-PUBLIC _bn_mul_comba8
-
-_bn_mul_comba8 PROC NEAR
- push esi
- mov esi, DWORD PTR 12[esp]
- push edi
- mov edi, DWORD PTR 20[esp]
- push ebp
- push ebx
- xor ebx, ebx
- mov eax, DWORD PTR [esi]
- xor ecx, ecx
- mov edx, DWORD PTR [edi]
- ; ################## Calculate word 0
- xor ebp, ebp
- ; mul a[0]*b[0]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 20[esp]
- adc ecx, edx
- mov edx, DWORD PTR [edi]
- adc ebp, 0
- mov DWORD PTR [eax],ebx
- mov eax, DWORD PTR 4[esi]
- ; saved r[0]
- ; ################## Calculate word 1
- xor ebx, ebx
- ; mul a[1]*b[0]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR [esi]
- adc ebp, edx
- mov edx, DWORD PTR 4[edi]
- adc ebx, 0
- ; mul a[0]*b[1]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 20[esp]
- adc ebp, edx
- mov edx, DWORD PTR [edi]
- adc ebx, 0
- mov DWORD PTR 4[eax],ecx
- mov eax, DWORD PTR 8[esi]
- ; saved r[1]
- ; ################## Calculate word 2
- xor ecx, ecx
- ; mul a[2]*b[0]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 4[esi]
- adc ebx, edx
- mov edx, DWORD PTR 4[edi]
- adc ecx, 0
- ; mul a[1]*b[1]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR [esi]
- adc ebx, edx
- mov edx, DWORD PTR 8[edi]
- adc ecx, 0
- ; mul a[0]*b[2]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 20[esp]
- adc ebx, edx
- mov edx, DWORD PTR [edi]
- adc ecx, 0
- mov DWORD PTR 8[eax],ebp
- mov eax, DWORD PTR 12[esi]
- ; saved r[2]
- ; ################## Calculate word 3
- xor ebp, ebp
- ; mul a[3]*b[0]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 8[esi]
- adc ecx, edx
- mov edx, DWORD PTR 4[edi]
- adc ebp, 0
- ; mul a[2]*b[1]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 4[esi]
- adc ecx, edx
- mov edx, DWORD PTR 8[edi]
- adc ebp, 0
- ; mul a[1]*b[2]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR [esi]
- adc ecx, edx
- mov edx, DWORD PTR 12[edi]
- adc ebp, 0
- ; mul a[0]*b[3]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 20[esp]
- adc ecx, edx
- mov edx, DWORD PTR [edi]
- adc ebp, 0
- mov DWORD PTR 12[eax],ebx
- mov eax, DWORD PTR 16[esi]
- ; saved r[3]
- ; ################## Calculate word 4
- xor ebx, ebx
- ; mul a[4]*b[0]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 12[esi]
- adc ebp, edx
- mov edx, DWORD PTR 4[edi]
- adc ebx, 0
- ; mul a[3]*b[1]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 8[esi]
- adc ebp, edx
- mov edx, DWORD PTR 8[edi]
- adc ebx, 0
- ; mul a[2]*b[2]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 4[esi]
- adc ebp, edx
- mov edx, DWORD PTR 12[edi]
- adc ebx, 0
- ; mul a[1]*b[3]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR [esi]
- adc ebp, edx
- mov edx, DWORD PTR 16[edi]
- adc ebx, 0
- ; mul a[0]*b[4]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 20[esp]
- adc ebp, edx
- mov edx, DWORD PTR [edi]
- adc ebx, 0
- mov DWORD PTR 16[eax],ecx
- mov eax, DWORD PTR 20[esi]
- ; saved r[4]
- ; ################## Calculate word 5
- xor ecx, ecx
- ; mul a[5]*b[0]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 16[esi]
- adc ebx, edx
- mov edx, DWORD PTR 4[edi]
- adc ecx, 0
- ; mul a[4]*b[1]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 12[esi]
- adc ebx, edx
- mov edx, DWORD PTR 8[edi]
- adc ecx, 0
- ; mul a[3]*b[2]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 8[esi]
- adc ebx, edx
- mov edx, DWORD PTR 12[edi]
- adc ecx, 0
- ; mul a[2]*b[3]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 4[esi]
- adc ebx, edx
- mov edx, DWORD PTR 16[edi]
- adc ecx, 0
- ; mul a[1]*b[4]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR [esi]
- adc ebx, edx
- mov edx, DWORD PTR 20[edi]
- adc ecx, 0
- ; mul a[0]*b[5]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 20[esp]
- adc ebx, edx
- mov edx, DWORD PTR [edi]
- adc ecx, 0
- mov DWORD PTR 20[eax],ebp
- mov eax, DWORD PTR 24[esi]
- ; saved r[5]
- ; ################## Calculate word 6
- xor ebp, ebp
- ; mul a[6]*b[0]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 20[esi]
- adc ecx, edx
- mov edx, DWORD PTR 4[edi]
- adc ebp, 0
- ; mul a[5]*b[1]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 16[esi]
- adc ecx, edx
- mov edx, DWORD PTR 8[edi]
- adc ebp, 0
- ; mul a[4]*b[2]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 12[esi]
- adc ecx, edx
- mov edx, DWORD PTR 12[edi]
- adc ebp, 0
- ; mul a[3]*b[3]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 8[esi]
- adc ecx, edx
- mov edx, DWORD PTR 16[edi]
- adc ebp, 0
- ; mul a[2]*b[4]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 4[esi]
- adc ecx, edx
- mov edx, DWORD PTR 20[edi]
- adc ebp, 0
- ; mul a[1]*b[5]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR [esi]
- adc ecx, edx
- mov edx, DWORD PTR 24[edi]
- adc ebp, 0
- ; mul a[0]*b[6]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 20[esp]
- adc ecx, edx
- mov edx, DWORD PTR [edi]
- adc ebp, 0
- mov DWORD PTR 24[eax],ebx
- mov eax, DWORD PTR 28[esi]
- ; saved r[6]
- ; ################## Calculate word 7
- xor ebx, ebx
- ; mul a[7]*b[0]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 24[esi]
- adc ebp, edx
- mov edx, DWORD PTR 4[edi]
- adc ebx, 0
- ; mul a[6]*b[1]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 20[esi]
- adc ebp, edx
- mov edx, DWORD PTR 8[edi]
- adc ebx, 0
- ; mul a[5]*b[2]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 16[esi]
- adc ebp, edx
- mov edx, DWORD PTR 12[edi]
- adc ebx, 0
- ; mul a[4]*b[3]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 12[esi]
- adc ebp, edx
- mov edx, DWORD PTR 16[edi]
- adc ebx, 0
- ; mul a[3]*b[4]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 8[esi]
- adc ebp, edx
- mov edx, DWORD PTR 20[edi]
- adc ebx, 0
- ; mul a[2]*b[5]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 4[esi]
- adc ebp, edx
- mov edx, DWORD PTR 24[edi]
- adc ebx, 0
- ; mul a[1]*b[6]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR [esi]
- adc ebp, edx
- mov edx, DWORD PTR 28[edi]
- adc ebx, 0
- ; mul a[0]*b[7]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 20[esp]
- adc ebp, edx
- mov edx, DWORD PTR 4[edi]
- adc ebx, 0
- mov DWORD PTR 28[eax],ecx
- mov eax, DWORD PTR 28[esi]
- ; saved r[7]
- ; ################## Calculate word 8
- xor ecx, ecx
- ; mul a[7]*b[1]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 24[esi]
- adc ebx, edx
- mov edx, DWORD PTR 8[edi]
- adc ecx, 0
- ; mul a[6]*b[2]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 20[esi]
- adc ebx, edx
- mov edx, DWORD PTR 12[edi]
- adc ecx, 0
- ; mul a[5]*b[3]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 16[esi]
- adc ebx, edx
- mov edx, DWORD PTR 16[edi]
- adc ecx, 0
- ; mul a[4]*b[4]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 12[esi]
- adc ebx, edx
- mov edx, DWORD PTR 20[edi]
- adc ecx, 0
- ; mul a[3]*b[5]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 8[esi]
- adc ebx, edx
- mov edx, DWORD PTR 24[edi]
- adc ecx, 0
- ; mul a[2]*b[6]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 4[esi]
- adc ebx, edx
- mov edx, DWORD PTR 28[edi]
- adc ecx, 0
- ; mul a[1]*b[7]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 20[esp]
- adc ebx, edx
- mov edx, DWORD PTR 8[edi]
- adc ecx, 0
- mov DWORD PTR 32[eax],ebp
- mov eax, DWORD PTR 28[esi]
- ; saved r[8]
- ; ################## Calculate word 9
- xor ebp, ebp
- ; mul a[7]*b[2]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 24[esi]
- adc ecx, edx
- mov edx, DWORD PTR 12[edi]
- adc ebp, 0
- ; mul a[6]*b[3]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 20[esi]
- adc ecx, edx
- mov edx, DWORD PTR 16[edi]
- adc ebp, 0
- ; mul a[5]*b[4]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 16[esi]
- adc ecx, edx
- mov edx, DWORD PTR 20[edi]
- adc ebp, 0
- ; mul a[4]*b[5]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 12[esi]
- adc ecx, edx
- mov edx, DWORD PTR 24[edi]
- adc ebp, 0
- ; mul a[3]*b[6]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 8[esi]
- adc ecx, edx
- mov edx, DWORD PTR 28[edi]
- adc ebp, 0
- ; mul a[2]*b[7]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 20[esp]
- adc ecx, edx
- mov edx, DWORD PTR 12[edi]
- adc ebp, 0
- mov DWORD PTR 36[eax],ebx
- mov eax, DWORD PTR 28[esi]
- ; saved r[9]
- ; ################## Calculate word 10
- xor ebx, ebx
- ; mul a[7]*b[3]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 24[esi]
- adc ebp, edx
- mov edx, DWORD PTR 16[edi]
- adc ebx, 0
- ; mul a[6]*b[4]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 20[esi]
- adc ebp, edx
- mov edx, DWORD PTR 20[edi]
- adc ebx, 0
- ; mul a[5]*b[5]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 16[esi]
- adc ebp, edx
- mov edx, DWORD PTR 24[edi]
- adc ebx, 0
- ; mul a[4]*b[6]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 12[esi]
- adc ebp, edx
- mov edx, DWORD PTR 28[edi]
- adc ebx, 0
- ; mul a[3]*b[7]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 20[esp]
- adc ebp, edx
- mov edx, DWORD PTR 16[edi]
- adc ebx, 0
- mov DWORD PTR 40[eax],ecx
- mov eax, DWORD PTR 28[esi]
- ; saved r[10]
- ; ################## Calculate word 11
- xor ecx, ecx
- ; mul a[7]*b[4]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 24[esi]
- adc ebx, edx
- mov edx, DWORD PTR 20[edi]
- adc ecx, 0
- ; mul a[6]*b[5]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 20[esi]
- adc ebx, edx
- mov edx, DWORD PTR 24[edi]
- adc ecx, 0
- ; mul a[5]*b[6]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 16[esi]
- adc ebx, edx
- mov edx, DWORD PTR 28[edi]
- adc ecx, 0
- ; mul a[4]*b[7]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 20[esp]
- adc ebx, edx
- mov edx, DWORD PTR 20[edi]
- adc ecx, 0
- mov DWORD PTR 44[eax],ebp
- mov eax, DWORD PTR 28[esi]
- ; saved r[11]
- ; ################## Calculate word 12
- xor ebp, ebp
- ; mul a[7]*b[5]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 24[esi]
- adc ecx, edx
- mov edx, DWORD PTR 24[edi]
- adc ebp, 0
- ; mul a[6]*b[6]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 20[esi]
- adc ecx, edx
- mov edx, DWORD PTR 28[edi]
- adc ebp, 0
- ; mul a[5]*b[7]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 20[esp]
- adc ecx, edx
- mov edx, DWORD PTR 24[edi]
- adc ebp, 0
- mov DWORD PTR 48[eax],ebx
- mov eax, DWORD PTR 28[esi]
- ; saved r[12]
- ; ################## Calculate word 13
- xor ebx, ebx
- ; mul a[7]*b[6]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 24[esi]
- adc ebp, edx
- mov edx, DWORD PTR 28[edi]
- adc ebx, 0
- ; mul a[6]*b[7]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 20[esp]
- adc ebp, edx
- mov edx, DWORD PTR 28[edi]
- adc ebx, 0
- mov DWORD PTR 52[eax],ecx
- mov eax, DWORD PTR 28[esi]
- ; saved r[13]
- ; ################## Calculate word 14
- xor ecx, ecx
- ; mul a[7]*b[7]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 20[esp]
- adc ebx, edx
- adc ecx, 0
- mov DWORD PTR 56[eax],ebp
- ; saved r[14]
- ; save r[15]
- mov DWORD PTR 60[eax],ebx
- pop ebx
- pop ebp
- pop edi
- pop esi
- ret
-_bn_mul_comba8 ENDP
-_TEXT ENDS
-_TEXT SEGMENT
-PUBLIC _bn_mul_comba4
-
-_bn_mul_comba4 PROC NEAR
- push esi
- mov esi, DWORD PTR 12[esp]
- push edi
- mov edi, DWORD PTR 20[esp]
- push ebp
- push ebx
- xor ebx, ebx
- mov eax, DWORD PTR [esi]
- xor ecx, ecx
- mov edx, DWORD PTR [edi]
- ; ################## Calculate word 0
- xor ebp, ebp
- ; mul a[0]*b[0]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 20[esp]
- adc ecx, edx
- mov edx, DWORD PTR [edi]
- adc ebp, 0
- mov DWORD PTR [eax],ebx
- mov eax, DWORD PTR 4[esi]
- ; saved r[0]
- ; ################## Calculate word 1
- xor ebx, ebx
- ; mul a[1]*b[0]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR [esi]
- adc ebp, edx
- mov edx, DWORD PTR 4[edi]
- adc ebx, 0
- ; mul a[0]*b[1]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 20[esp]
- adc ebp, edx
- mov edx, DWORD PTR [edi]
- adc ebx, 0
- mov DWORD PTR 4[eax],ecx
- mov eax, DWORD PTR 8[esi]
- ; saved r[1]
- ; ################## Calculate word 2
- xor ecx, ecx
- ; mul a[2]*b[0]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 4[esi]
- adc ebx, edx
- mov edx, DWORD PTR 4[edi]
- adc ecx, 0
- ; mul a[1]*b[1]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR [esi]
- adc ebx, edx
- mov edx, DWORD PTR 8[edi]
- adc ecx, 0
- ; mul a[0]*b[2]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 20[esp]
- adc ebx, edx
- mov edx, DWORD PTR [edi]
- adc ecx, 0
- mov DWORD PTR 8[eax],ebp
- mov eax, DWORD PTR 12[esi]
- ; saved r[2]
- ; ################## Calculate word 3
- xor ebp, ebp
- ; mul a[3]*b[0]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 8[esi]
- adc ecx, edx
- mov edx, DWORD PTR 4[edi]
- adc ebp, 0
- ; mul a[2]*b[1]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 4[esi]
- adc ecx, edx
- mov edx, DWORD PTR 8[edi]
- adc ebp, 0
- ; mul a[1]*b[2]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR [esi]
- adc ecx, edx
- mov edx, DWORD PTR 12[edi]
- adc ebp, 0
- ; mul a[0]*b[3]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 20[esp]
- adc ecx, edx
- mov edx, DWORD PTR 4[edi]
- adc ebp, 0
- mov DWORD PTR 12[eax],ebx
- mov eax, DWORD PTR 12[esi]
- ; saved r[3]
- ; ################## Calculate word 4
- xor ebx, ebx
- ; mul a[3]*b[1]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 8[esi]
- adc ebp, edx
- mov edx, DWORD PTR 8[edi]
- adc ebx, 0
- ; mul a[2]*b[2]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 4[esi]
- adc ebp, edx
- mov edx, DWORD PTR 12[edi]
- adc ebx, 0
- ; mul a[1]*b[3]
- mul edx
- add ecx, eax
- mov eax, DWORD PTR 20[esp]
- adc ebp, edx
- mov edx, DWORD PTR 8[edi]
- adc ebx, 0
- mov DWORD PTR 16[eax],ecx
- mov eax, DWORD PTR 12[esi]
- ; saved r[4]
- ; ################## Calculate word 5
- xor ecx, ecx
- ; mul a[3]*b[2]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 8[esi]
- adc ebx, edx
- mov edx, DWORD PTR 12[edi]
- adc ecx, 0
- ; mul a[2]*b[3]
- mul edx
- add ebp, eax
- mov eax, DWORD PTR 20[esp]
- adc ebx, edx
- mov edx, DWORD PTR 12[edi]
- adc ecx, 0
- mov DWORD PTR 20[eax],ebp
- mov eax, DWORD PTR 12[esi]
- ; saved r[5]
- ; ################## Calculate word 6
- xor ebp, ebp
- ; mul a[3]*b[3]
- mul edx
- add ebx, eax
- mov eax, DWORD PTR 20[esp]
- adc ecx, edx
- adc ebp, 0
- mov DWORD PTR 24[eax],ebx
- ; saved r[6]
- ; save r[7]
- mov DWORD PTR 28[eax],ecx
- pop ebx
- pop ebp
- pop edi
- pop esi
- ret
-_bn_mul_comba4 ENDP
-_TEXT ENDS
-_TEXT SEGMENT
-PUBLIC _bn_sqr_comba8
-
-_bn_sqr_comba8 PROC NEAR
- push esi
- push edi
- push ebp
- push ebx
- mov edi, DWORD PTR 20[esp]
- mov esi, DWORD PTR 24[esp]
- xor ebx, ebx
- xor ecx, ecx
- mov eax, DWORD PTR [esi]
- ; ############### Calculate word 0
- xor ebp, ebp
- ; sqr a[0]*a[0]
- mul eax
- add ebx, eax
- adc ecx, edx
- mov edx, DWORD PTR [esi]
- adc ebp, 0
- mov DWORD PTR [edi],ebx
- mov eax, DWORD PTR 4[esi]
- ; saved r[0]
- ; ############### Calculate word 1
- xor ebx, ebx
- ; sqr a[1]*a[0]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 8[esi]
- adc ebx, 0
- mov DWORD PTR 4[edi],ecx
- mov edx, DWORD PTR [esi]
- ; saved r[1]
- ; ############### Calculate word 2
- xor ecx, ecx
- ; sqr a[2]*a[0]
- mul edx
- add eax, eax
- adc edx, edx
- adc ecx, 0
- add ebp, eax
- adc ebx, edx
- mov eax, DWORD PTR 4[esi]
- adc ecx, 0
- ; sqr a[1]*a[1]
- mul eax
- add ebp, eax
- adc ebx, edx
- mov edx, DWORD PTR [esi]
- adc ecx, 0
- mov DWORD PTR 8[edi],ebp
- mov eax, DWORD PTR 12[esi]
- ; saved r[2]
- ; ############### Calculate word 3
- xor ebp, ebp
- ; sqr a[3]*a[0]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebp, 0
- add ebx, eax
- adc ecx, edx
- mov eax, DWORD PTR 8[esi]
- adc ebp, 0
- mov edx, DWORD PTR 4[esi]
- ; sqr a[2]*a[1]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebp, 0
- add ebx, eax
- adc ecx, edx
- mov eax, DWORD PTR 16[esi]
- adc ebp, 0
- mov DWORD PTR 12[edi],ebx
- mov edx, DWORD PTR [esi]
- ; saved r[3]
- ; ############### Calculate word 4
- xor ebx, ebx
- ; sqr a[4]*a[0]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 12[esi]
- adc ebx, 0
- mov edx, DWORD PTR 4[esi]
- ; sqr a[3]*a[1]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 8[esi]
- adc ebx, 0
- ; sqr a[2]*a[2]
- mul eax
- add ecx, eax
- adc ebp, edx
- mov edx, DWORD PTR [esi]
- adc ebx, 0
- mov DWORD PTR 16[edi],ecx
- mov eax, DWORD PTR 20[esi]
- ; saved r[4]
- ; ############### Calculate word 5
- xor ecx, ecx
- ; sqr a[5]*a[0]
- mul edx
- add eax, eax
- adc edx, edx
- adc ecx, 0
- add ebp, eax
- adc ebx, edx
- mov eax, DWORD PTR 16[esi]
- adc ecx, 0
- mov edx, DWORD PTR 4[esi]
- ; sqr a[4]*a[1]
- mul edx
- add eax, eax
- adc edx, edx
- adc ecx, 0
- add ebp, eax
- adc ebx, edx
- mov eax, DWORD PTR 12[esi]
- adc ecx, 0
- mov edx, DWORD PTR 8[esi]
- ; sqr a[3]*a[2]
- mul edx
- add eax, eax
- adc edx, edx
- adc ecx, 0
- add ebp, eax
- adc ebx, edx
- mov eax, DWORD PTR 24[esi]
- adc ecx, 0
- mov DWORD PTR 20[edi],ebp
- mov edx, DWORD PTR [esi]
- ; saved r[5]
- ; ############### Calculate word 6
- xor ebp, ebp
- ; sqr a[6]*a[0]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebp, 0
- add ebx, eax
- adc ecx, edx
- mov eax, DWORD PTR 20[esi]
- adc ebp, 0
- mov edx, DWORD PTR 4[esi]
- ; sqr a[5]*a[1]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebp, 0
- add ebx, eax
- adc ecx, edx
- mov eax, DWORD PTR 16[esi]
- adc ebp, 0
- mov edx, DWORD PTR 8[esi]
- ; sqr a[4]*a[2]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebp, 0
- add ebx, eax
- adc ecx, edx
- mov eax, DWORD PTR 12[esi]
- adc ebp, 0
- ; sqr a[3]*a[3]
- mul eax
- add ebx, eax
- adc ecx, edx
- mov edx, DWORD PTR [esi]
- adc ebp, 0
- mov DWORD PTR 24[edi],ebx
- mov eax, DWORD PTR 28[esi]
- ; saved r[6]
- ; ############### Calculate word 7
- xor ebx, ebx
- ; sqr a[7]*a[0]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 24[esi]
- adc ebx, 0
- mov edx, DWORD PTR 4[esi]
- ; sqr a[6]*a[1]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 20[esi]
- adc ebx, 0
- mov edx, DWORD PTR 8[esi]
- ; sqr a[5]*a[2]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 16[esi]
- adc ebx, 0
- mov edx, DWORD PTR 12[esi]
- ; sqr a[4]*a[3]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 28[esi]
- adc ebx, 0
- mov DWORD PTR 28[edi],ecx
- mov edx, DWORD PTR 4[esi]
- ; saved r[7]
- ; ############### Calculate word 8
- xor ecx, ecx
- ; sqr a[7]*a[1]
- mul edx
- add eax, eax
- adc edx, edx
- adc ecx, 0
- add ebp, eax
- adc ebx, edx
- mov eax, DWORD PTR 24[esi]
- adc ecx, 0
- mov edx, DWORD PTR 8[esi]
- ; sqr a[6]*a[2]
- mul edx
- add eax, eax
- adc edx, edx
- adc ecx, 0
- add ebp, eax
- adc ebx, edx
- mov eax, DWORD PTR 20[esi]
- adc ecx, 0
- mov edx, DWORD PTR 12[esi]
- ; sqr a[5]*a[3]
- mul edx
- add eax, eax
- adc edx, edx
- adc ecx, 0
- add ebp, eax
- adc ebx, edx
- mov eax, DWORD PTR 16[esi]
- adc ecx, 0
- ; sqr a[4]*a[4]
- mul eax
- add ebp, eax
- adc ebx, edx
- mov edx, DWORD PTR 8[esi]
- adc ecx, 0
- mov DWORD PTR 32[edi],ebp
- mov eax, DWORD PTR 28[esi]
- ; saved r[8]
- ; ############### Calculate word 9
- xor ebp, ebp
- ; sqr a[7]*a[2]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebp, 0
- add ebx, eax
- adc ecx, edx
- mov eax, DWORD PTR 24[esi]
- adc ebp, 0
- mov edx, DWORD PTR 12[esi]
- ; sqr a[6]*a[3]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebp, 0
- add ebx, eax
- adc ecx, edx
- mov eax, DWORD PTR 20[esi]
- adc ebp, 0
- mov edx, DWORD PTR 16[esi]
- ; sqr a[5]*a[4]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebp, 0
- add ebx, eax
- adc ecx, edx
- mov eax, DWORD PTR 28[esi]
- adc ebp, 0
- mov DWORD PTR 36[edi],ebx
- mov edx, DWORD PTR 12[esi]
- ; saved r[9]
- ; ############### Calculate word 10
- xor ebx, ebx
- ; sqr a[7]*a[3]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 24[esi]
- adc ebx, 0
- mov edx, DWORD PTR 16[esi]
- ; sqr a[6]*a[4]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 20[esi]
- adc ebx, 0
- ; sqr a[5]*a[5]
- mul eax
- add ecx, eax
- adc ebp, edx
- mov edx, DWORD PTR 16[esi]
- adc ebx, 0
- mov DWORD PTR 40[edi],ecx
- mov eax, DWORD PTR 28[esi]
- ; saved r[10]
- ; ############### Calculate word 11
- xor ecx, ecx
- ; sqr a[7]*a[4]
- mul edx
- add eax, eax
- adc edx, edx
- adc ecx, 0
- add ebp, eax
- adc ebx, edx
- mov eax, DWORD PTR 24[esi]
- adc ecx, 0
- mov edx, DWORD PTR 20[esi]
- ; sqr a[6]*a[5]
- mul edx
- add eax, eax
- adc edx, edx
- adc ecx, 0
- add ebp, eax
- adc ebx, edx
- mov eax, DWORD PTR 28[esi]
- adc ecx, 0
- mov DWORD PTR 44[edi],ebp
- mov edx, DWORD PTR 20[esi]
- ; saved r[11]
- ; ############### Calculate word 12
- xor ebp, ebp
- ; sqr a[7]*a[5]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebp, 0
- add ebx, eax
- adc ecx, edx
- mov eax, DWORD PTR 24[esi]
- adc ebp, 0
- ; sqr a[6]*a[6]
- mul eax
- add ebx, eax
- adc ecx, edx
- mov edx, DWORD PTR 24[esi]
- adc ebp, 0
- mov DWORD PTR 48[edi],ebx
- mov eax, DWORD PTR 28[esi]
- ; saved r[12]
- ; ############### Calculate word 13
- xor ebx, ebx
- ; sqr a[7]*a[6]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 28[esi]
- adc ebx, 0
- mov DWORD PTR 52[edi],ecx
- ; saved r[13]
- ; ############### Calculate word 14
- xor ecx, ecx
- ; sqr a[7]*a[7]
- mul eax
- add ebp, eax
- adc ebx, edx
- adc ecx, 0
- mov DWORD PTR 56[edi],ebp
- ; saved r[14]
- mov DWORD PTR 60[edi],ebx
- pop ebx
- pop ebp
- pop edi
- pop esi
- ret
-_bn_sqr_comba8 ENDP
-_TEXT ENDS
-_TEXT SEGMENT
-PUBLIC _bn_sqr_comba4
-
-_bn_sqr_comba4 PROC NEAR
- push esi
- push edi
- push ebp
- push ebx
- mov edi, DWORD PTR 20[esp]
- mov esi, DWORD PTR 24[esp]
- xor ebx, ebx
- xor ecx, ecx
- mov eax, DWORD PTR [esi]
- ; ############### Calculate word 0
- xor ebp, ebp
- ; sqr a[0]*a[0]
- mul eax
- add ebx, eax
- adc ecx, edx
- mov edx, DWORD PTR [esi]
- adc ebp, 0
- mov DWORD PTR [edi],ebx
- mov eax, DWORD PTR 4[esi]
- ; saved r[0]
- ; ############### Calculate word 1
- xor ebx, ebx
- ; sqr a[1]*a[0]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 8[esi]
- adc ebx, 0
- mov DWORD PTR 4[edi],ecx
- mov edx, DWORD PTR [esi]
- ; saved r[1]
- ; ############### Calculate word 2
- xor ecx, ecx
- ; sqr a[2]*a[0]
- mul edx
- add eax, eax
- adc edx, edx
- adc ecx, 0
- add ebp, eax
- adc ebx, edx
- mov eax, DWORD PTR 4[esi]
- adc ecx, 0
- ; sqr a[1]*a[1]
- mul eax
- add ebp, eax
- adc ebx, edx
- mov edx, DWORD PTR [esi]
- adc ecx, 0
- mov DWORD PTR 8[edi],ebp
- mov eax, DWORD PTR 12[esi]
- ; saved r[2]
- ; ############### Calculate word 3
- xor ebp, ebp
- ; sqr a[3]*a[0]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebp, 0
- add ebx, eax
- adc ecx, edx
- mov eax, DWORD PTR 8[esi]
- adc ebp, 0
- mov edx, DWORD PTR 4[esi]
- ; sqr a[2]*a[1]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebp, 0
- add ebx, eax
- adc ecx, edx
- mov eax, DWORD PTR 12[esi]
- adc ebp, 0
- mov DWORD PTR 12[edi],ebx
- mov edx, DWORD PTR 4[esi]
- ; saved r[3]
- ; ############### Calculate word 4
- xor ebx, ebx
- ; sqr a[3]*a[1]
- mul edx
- add eax, eax
- adc edx, edx
- adc ebx, 0
- add ecx, eax
- adc ebp, edx
- mov eax, DWORD PTR 8[esi]
- adc ebx, 0
- ; sqr a[2]*a[2]
- mul eax
- add ecx, eax
- adc ebp, edx
- mov edx, DWORD PTR 8[esi]
- adc ebx, 0
- mov DWORD PTR 16[edi],ecx
- mov eax, DWORD PTR 12[esi]
- ; saved r[4]
- ; ############### Calculate word 5
- xor ecx, ecx
- ; sqr a[3]*a[2]
- mul edx
- add eax, eax
- adc edx, edx
- adc ecx, 0
- add ebp, eax
- adc ebx, edx
- mov eax, DWORD PTR 12[esi]
- adc ecx, 0
- mov DWORD PTR 20[edi],ebp
- ; saved r[5]
- ; ############### Calculate word 6
- xor ebp, ebp
- ; sqr a[3]*a[3]
- mul eax
- add ebx, eax
- adc ecx, edx
- adc ebp, 0
- mov DWORD PTR 24[edi],ebx
- ; saved r[6]
- mov DWORD PTR 28[edi],ecx
- pop ebx
- pop ebp
- pop edi
- pop esi
- ret
-_bn_sqr_comba4 ENDP
-_TEXT ENDS
-END
diff --git a/lib/libcrypto/bn/asm/x86w16.asm b/lib/libcrypto/bn/asm/x86w16.asm
index 80a9ed6eef1..e69de29bb2d 100644
--- a/lib/libcrypto/bn/asm/x86w16.asm
+++ b/lib/libcrypto/bn/asm/x86w16.asm
@@ -1,297 +0,0 @@
-; Static Name Aliases
-;
- TITLE bn_mulw.c
- .8087
-F_TEXT SEGMENT WORD PUBLIC 'CODE'
-F_TEXT ENDS
-_DATA SEGMENT WORD PUBLIC 'DATA'
-_DATA ENDS
-_CONST SEGMENT WORD PUBLIC 'CONST'
-_CONST ENDS
-_BSS SEGMENT WORD PUBLIC 'BSS'
-_BSS ENDS
-DGROUP GROUP _CONST, _BSS, _DATA
- ASSUME DS: DGROUP, SS: DGROUP
-F_TEXT SEGMENT
- ASSUME CS: F_TEXT
- PUBLIC _bn_mul_add_words
-_bn_mul_add_words PROC FAR
-; Line 58
- push bp
- push bx
- push si
- push di
- push ds
- push es
- mov bp,sp
-; w = 26
-; num = 24
-; ap = 20
-; rp = 16
- xor si,si ;c=0;
- mov di,WORD PTR [bp+16] ; load r
- mov ds,WORD PTR [bp+18] ; load r
- mov bx,WORD PTR [bp+20] ; load a
- mov es,WORD PTR [bp+22] ; load a
- mov cx,WORD PTR [bp+26] ; load w
- mov bp,WORD PTR [bp+24] ; load num
-
- shr bp,1 ; div count by 4 and do groups of 4
- shr bp,1
- je $L555
-
-$L546:
- mov ax,cx
- mul WORD PTR es:[bx] ; w* *a
- add ax,WORD PTR ds:[di] ; + *r
- adc dx,0
- adc ax,si
- adc dx,0
- mov WORD PTR ds:[di],ax
- mov si,dx
- ;
- mov ax,cx
- mul WORD PTR es:[bx+2] ; w* *a
- add ax,WORD PTR ds:[di+2] ; + *r
- adc dx,0
- adc ax,si
- adc dx,0
- mov WORD PTR ds:[di+2],ax
- mov si,dx
- ;
- mov ax,cx
- mul WORD PTR es:[bx+4] ; w* *a
- add ax,WORD PTR ds:[di+4] ; + *r
- adc dx,0
- adc ax,si
- adc dx,0
- mov WORD PTR ds:[di+4],ax
- mov si,dx
- ;
- mov ax,cx
- mul WORD PTR es:[bx+6] ; w* *a
- add ax,WORD PTR ds:[di+6] ; + *r
- adc dx,0
- adc ax,si
- adc dx,0
- mov WORD PTR ds:[di+6],ax
- mov si,dx
- ;
- add bx,8
- add di,8
- ;
- dec bp
- je $L555
- jmp $L546
-;
-;
-$L555:
- mov bp,sp
- mov bp,WORD PTR [bp+24] ; load num
- and bp,3
- dec bp
- js $L547
-
- mov ax,cx
- mul WORD PTR es:[bx] ; w* *a
- add ax,WORD PTR ds:[di] ; + *r
- adc dx,0
- adc ax,si
- adc dx,0
- mov WORD PTR ds:[di],ax
- mov si,dx
- dec bp
- js $L547 ; Note that we are now testing for -1
- ;
- mov ax,cx
- mul WORD PTR es:[bx+2] ; w* *a
- add ax,WORD PTR ds:[di+2] ; + *r
- adc dx,0
- adc ax,si
- adc dx,0
- mov WORD PTR ds:[di+2],ax
- mov si,dx
- dec bp
- js $L547
- ;
- mov ax,cx
- mul WORD PTR es:[bx+4] ; w* *a
- add ax,WORD PTR ds:[di+4] ; + *r
- adc dx,0
- adc ax,si
- adc dx,0
- mov WORD PTR ds:[di+4],ax
- mov si,dx
-$L547:
- mov ax,si
- pop es
- pop ds
- pop di
- pop si
- pop bx
- pop bp
- ret
- nop
-
-_bn_mul_add_words ENDP
- PUBLIC _bn_mul_words
-_bn_mul_words PROC FAR
-; Line 76
- push bp
- push bx
- push si
- push di
- push ds
- push es
- xor si,si
- mov bp,sp
- mov di,WORD PTR [bp+16] ; r
- mov ds,WORD PTR [bp+18]
- mov bx,WORD PTR [bp+20] ; a
- mov es,WORD PTR [bp+22]
- mov cx,WORD PTR [bp+26] ; w
- mov bp,WORD PTR [bp+24] ; num
-$FC743:
- mov ax,cx
- mul WORD PTR es:[bx]
- add ax,si
- adc dx,0
- mov WORD PTR ds:[di],ax
- mov si,dx
- dec bp
- je $L764
- ;
- mov ax,cx
- mul WORD PTR es:[bx+2]
- add ax,si
- adc dx,0
- mov WORD PTR ds:[di+2],ax
- mov si,dx
- dec bp
- je $L764
- ;
- mov ax,cx
- mul WORD PTR es:[bx+4]
- add ax,si
- adc dx,0
- mov WORD PTR ds:[di+4],ax
- mov si,dx
- dec bp
- je $L764
- ;
- mov ax,cx
- mul WORD PTR es:[bx+6]
- add ax,si
- adc dx,0
- mov WORD PTR ds:[di+6],ax
- mov si,dx
- dec bp
- je $L764
- ;
- add bx,8
- add di,8
- jmp $FC743
- nop
-$L764:
- mov ax,si
- pop es
- pop ds
- pop di
- pop si
- pop bx
- pop bp
- ret
- nop
-_bn_mul_words ENDP
- PUBLIC _bn_sqr_words
-_bn_sqr_words PROC FAR
-; Line 92
- push bp
- push bx
- push si
- push di
- push ds
- push es
- mov bp,sp
- mov si,WORD PTR [bp+16]
- mov ds,WORD PTR [bp+18]
- mov di,WORD PTR [bp+20]
- mov es,WORD PTR [bp+22]
- mov bx,WORD PTR [bp+24]
-
- mov bp,bx ; save a memory lookup later
- shr bx,1 ; div count by 4 and do groups of 4
- shr bx,1
- je $L666
-
-$L765:
- mov ax,WORD PTR es:[di]
- mul ax
- mov WORD PTR ds:[si],ax
- mov WORD PTR ds:[si+2],dx
- ;
- mov ax,WORD PTR es:[di+2]
- mul ax
- mov WORD PTR ds:[si+4],ax
- mov WORD PTR ds:[si+6],dx
- ;
- mov ax,WORD PTR es:[di+4]
- mul ax
- mov WORD PTR ds:[si+8],ax
- mov WORD PTR ds:[si+10],dx
- ;
- mov ax,WORD PTR es:[di+6]
- mul ax
- mov WORD PTR ds:[si+12],ax
- mov WORD PTR ds:[si+14],dx
- ;
- add di,8
- add si,16
- dec bx
- je $L666
- jmp $L765
-$L666:
- and bp,3
- dec bp ; The copied value of bx (num)
- js $L645
- ;
- mov ax,WORD PTR es:[di]
- mul ax
- mov WORD PTR ds:[si],ax
- mov WORD PTR ds:[si+2],dx
- dec bp
- js $L645
- ;
- mov ax,WORD PTR es:[di+2]
- mul ax
- mov WORD PTR ds:[si+4],ax
- mov WORD PTR ds:[si+6],dx
- dec bp
- js $L645
- ;
- mov ax,WORD PTR es:[di+4]
- mul ax
- mov WORD PTR ds:[si+8],ax
- mov WORD PTR ds:[si+10],dx
-$L645:
- pop es
- pop ds
- pop di
- pop si
- pop bx
- pop bp
- ret
-
-_bn_sqr_words ENDP
- PUBLIC _bn_div64
-_bn_div64 PROC FAR
- push bp
- mov bp,sp
- mov dx, WORD PTR [bp+6]
- mov ax, WORD PTR [bp+8]
- div WORD PTR [bp+10]
- pop bp
- ret
-_bn_div64 ENDP
-F_TEXT ENDS
-END
diff --git a/lib/libcrypto/bn/asm/x86w32.asm b/lib/libcrypto/bn/asm/x86w32.asm
index 957d71e3b18..e69de29bb2d 100644
--- a/lib/libcrypto/bn/asm/x86w32.asm
+++ b/lib/libcrypto/bn/asm/x86w32.asm
@@ -1,360 +0,0 @@
-; Static Name Aliases
-;
- TITLE bn_mulw.c
- .386
-F_TEXT SEGMENT WORD USE16 PUBLIC 'CODE'
-F_TEXT ENDS
-_DATA SEGMENT WORD USE16 PUBLIC 'DATA'
-_DATA ENDS
-_CONST SEGMENT WORD USE16 PUBLIC 'CONST'
-_CONST ENDS
-_BSS SEGMENT WORD USE16 PUBLIC 'BSS'
-_BSS ENDS
-DGROUP GROUP _CONST, _BSS, _DATA
- ASSUME DS: DGROUP, SS: DGROUP
-F_TEXT SEGMENT
- ASSUME CS: F_TEXT
- PUBLIC _bn_mul_add_words
-_bn_mul_add_words PROC FAR
-; Line 58
- push bp
- push bx
- push esi
- push di
- push ds
- push es
- mov bp,sp
-; w = 28
-; num = 26
-; ap = 22
-; rp = 18
- xor esi,esi ;c=0;
- mov di,WORD PTR [bp+18] ; load r
- mov ds,WORD PTR [bp+20] ; load r
- mov bx,WORD PTR [bp+22] ; load a
- mov es,WORD PTR [bp+24] ; load a
- mov ecx,DWORD PTR [bp+28] ; load w
- mov bp,WORD PTR [bp+26] ; load num
- shr bp,1 ; div count by 4 and do groups of 4
- shr bp,1
- je $L555
-
-$L546:
- mov eax,ecx
- mul DWORD PTR es:[bx] ; w* *a
- add eax,DWORD PTR ds:[di] ; + *r
- adc edx,0
- adc eax,esi
- adc edx,0
- mov DWORD PTR ds:[di],eax
- mov esi,edx
- ;
- mov eax,ecx
- mul DWORD PTR es:[bx+4] ; w* *a
- add eax,DWORD PTR ds:[di+4] ; + *r
- adc edx,0
- adc eax,esi
- adc edx,0
- mov DWORD PTR ds:[di+4],eax
- mov esi,edx
- ;
- mov eax,ecx
- mul DWORD PTR es:[bx+8] ; w* *a
- add eax,DWORD PTR ds:[di+8] ; + *r
- adc edx,0
- adc eax,esi
- adc edx,0
- mov DWORD PTR ds:[di+8],eax
- mov esi,edx
- ;
- mov eax,ecx
- mul DWORD PTR es:[bx+12] ; w* *a
- add eax,DWORD PTR ds:[di+12] ; + *r
- adc edx,0
- adc eax,esi
- adc edx,0
- mov DWORD PTR ds:[di+12],eax
- mov esi,edx
- ;
- add bx,16
- add di,16
- ;
- dec bp
- je $L555
- jmp $L546
-;
-;
-$L555:
- mov bp,sp
- mov bp,WORD PTR [bp+26] ; load num
- and bp,3
- dec bp
- js $L547m
-
- mov eax,ecx
- mul DWORD PTR es:[bx] ; w* *a
- add eax,DWORD PTR ds:[di] ; + *r
- adc edx,0
- adc eax,esi
- adc edx,0
- mov DWORD PTR ds:[di],eax
- mov esi,edx
- dec bp
- js $L547m ; Note that we are now testing for -1
- ;
- mov eax,ecx
- mul DWORD PTR es:[bx+4] ; w* *a
- add eax,DWORD PTR ds:[di+4] ; + *r
- adc edx,0
- adc eax,esi
- adc edx,0
- mov DWORD PTR ds:[di+4],eax
- mov esi,edx
- dec bp
- js $L547m
- ;
- mov eax,ecx
- mul DWORD PTR es:[bx+8] ; w* *a
- add eax,DWORD PTR ds:[di+8] ; + *r
- adc edx,0
- adc eax,esi
- adc edx,0
- mov DWORD PTR ds:[di+8],eax
- mov esi,edx
-$L547m:
- mov eax,esi
- mov edx,esi
- shr edx,16
- pop es
- pop ds
- pop di
- pop esi
- pop bx
- pop bp
- ret
- nop
-_bn_mul_add_words ENDP
-
- PUBLIC _bn_mul_words
-_bn_mul_words PROC FAR
-; Line 76
- push bp
- push bx
- push esi
- push di
- push ds
- push es
- xor esi,esi
- mov bp,sp
- mov di,WORD PTR [bp+18] ; r
- mov ds,WORD PTR [bp+20]
- mov bx,WORD PTR [bp+22] ; a
- mov es,WORD PTR [bp+24]
- mov ecx,DWORD PTR [bp+28] ; w
- mov bp,WORD PTR [bp+26] ; num
-
-$FC743:
- mov eax,ecx
- mul DWORD PTR es:[bx]
- add eax,esi
- adc edx,0
- mov DWORD PTR ds:[di],eax
- mov esi,edx
- dec bp
- je $L764
- ;
- mov eax,ecx
- mul DWORD PTR es:[bx+4]
- add eax,esi
- adc edx,0
- mov DWORD PTR ds:[di+4],eax
- mov esi,edx
- dec bp
- je $L764
- ;
- mov eax,ecx
- mul DWORD PTR es:[bx+8]
- add eax,esi
- adc edx,0
- mov DWORD PTR ds:[di+8],eax
- mov esi,edx
- dec bp
- je $L764
- ;
- mov eax,ecx
- mul DWORD PTR es:[bx+12]
- add eax,esi
- adc edx,0
- mov DWORD PTR ds:[di+12],eax
- mov esi,edx
- dec bp
- je $L764
- ;
- add bx,16
- add di,16
- jmp $FC743
- nop
-$L764:
- mov eax,esi
- mov edx,esi
- shr edx,16
- pop es
- pop ds
- pop di
- pop esi
- pop bx
- pop bp
- ret
- nop
-_bn_mul_words ENDP
- PUBLIC _bn_sqr_words
-_bn_sqr_words PROC FAR
-; Line 92
- push bp
- push bx
- push si
- push di
- push ds
- push es
- mov bp,sp
- mov si,WORD PTR [bp+16]
- mov ds,WORD PTR [bp+18]
- mov di,WORD PTR [bp+20]
- mov es,WORD PTR [bp+22]
- mov bx,WORD PTR [bp+24]
-
- mov bp,bx ; save a memory lookup later
- shr bx,1 ; div count by 4 and do groups of 4
- shr bx,1
- je $L666
-
-$L765:
- mov eax,DWORD PTR es:[di]
- mul eax
- mov DWORD PTR ds:[si],eax
- mov DWORD PTR ds:[si+4],edx
- ;
- mov eax,DWORD PTR es:[di+4]
- mul eax
- mov DWORD PTR ds:[si+8],eax
- mov DWORD PTR ds:[si+12],edx
- ;
- mov eax,DWORD PTR es:[di+8]
- mul eax
- mov DWORD PTR ds:[si+16],eax
- mov DWORD PTR ds:[si+20],edx
- ;
- mov eax,DWORD PTR es:[di+12]
- mul eax
- mov DWORD PTR ds:[si+24],eax
- mov DWORD PTR ds:[si+28],edx
- ;
- add di,16
- add si,32
- dec bx
- je $L666
- jmp $L765
-$L666:
- and bp,3
- dec bp ; The copied value of bx (num)
- js $L645
- ;
- mov eax,DWORD PTR es:[di]
- mul eax
- mov DWORD PTR ds:[si],eax
- mov DWORD PTR ds:[si+4],edx
- dec bp
- js $L645
- ;
- mov eax,DWORD PTR es:[di+4]
- mul eax
- mov DWORD PTR ds:[si+8],eax
- mov DWORD PTR ds:[si+12],edx
- dec bp
- js $L645
- ;
- mov eax,DWORD PTR es:[di+8]
- mul eax
- mov DWORD PTR ds:[si+16],eax
- mov DWORD PTR ds:[si+20],edx
-$L645:
- pop es
- pop ds
- pop di
- pop si
- pop bx
- pop bp
- ret
-_bn_sqr_words ENDP
-
- PUBLIC _bn_div64
-_bn_div64 PROC FAR
- push bp
- mov bp,sp
- mov edx, DWORD PTR [bp+6]
- mov eax, DWORD PTR [bp+10]
- div DWORD PTR [bp+14]
- mov edx,eax
- shr edx,16
- pop bp
- ret
-_bn_div64 ENDP
-
- PUBLIC _bn_add_words
-_bn_add_words PROC FAR
-; Line 58
- push bp
- push bx
- push esi
- push di
- push ds
- push es
- mov bp,sp
-; w = 28
-; num = 26
-; ap = 22
-; rp = 18
- xor esi,esi ;c=0;
- mov bx,WORD PTR [bp+18] ; load low r
- mov si,WORD PTR [bp+22] ; load a
- mov es,WORD PTR [bp+24] ; load a
- mov di,WORD PTR [bp+26] ; load b
- mov ds,WORD PTR [bp+28] ; load b
-
- mov dx,WORD PTR [bp+30] ; load num
- xor ecx,ecx
- dec dx
- js $L547a
-
-$L5477:
- mov eax,DWORD PTR es:[si] ; *a
- add eax,ecx
- mov ecx,0
- adc ecx,0
- add si,4 ; a++
- add eax,DWORD PTR ds:[di] ; + *b
- adc ecx,0
- mov ds,WORD PTR [bp+20]
- add di,4
- mov DWORD PTR ds:[bx],eax
- mov ds,WORD PTR [bp+28]
- add bx,4
- dec dx
- js $L547a ; Note that we are now testing for -1
- jmp $L5477
- ;
-$L547a:
- mov eax,ecx
- mov edx,ecx
- shr edx,16
- pop es
- pop ds
- pop di
- pop esi
- pop bx
- pop bp
- ret
- nop
-_bn_add_words ENDP
-F_TEXT ENDS
-END
diff --git a/lib/libcrypto/bn/bn.h b/lib/libcrypto/bn/bn.h
index d8822610dfa..009b0eb6856 100644
--- a/lib/libcrypto/bn/bn.h
+++ b/lib/libcrypto/bn/bn.h
@@ -89,7 +89,7 @@ extern "C" {
* For machines with only one compiler (or shared libraries), this should
* be on. Again this in only really a problem on machines
* using "long long's", are 32bit, and are not using my assembler code. */
-#if defined(MSDOS) || defined(WINDOWS) || defined(linux)
+#if defined(MSDOS) || defined(WINDOWS) || defined(WIN32) || defined(linux)
#define BN_DIV2W
#endif
diff --git a/lib/libcrypto/bn/bn_err.c b/lib/libcrypto/bn/bn_err.c
index f3b9497dca0..988270bcf4f 100644
--- a/lib/libcrypto/bn/bn_err.c
+++ b/lib/libcrypto/bn/bn_err.c
@@ -54,7 +54,8 @@
*/
/* NOTE: this file was auto generated by the mkerr.pl script: any changes
- * made to it will be overwritten when the script next updates this file.
+ * made to it will be overwritten when the script next updates this file,
+ * only reason strings will be preserved.
*/
#include <stdio.h>
diff --git a/lib/libcrypto/bn/bn_mont.c b/lib/libcrypto/bn/bn_mont.c
index 7bb0b91223c..598fecbf0c8 100644
--- a/lib/libcrypto/bn/bn_mont.c
+++ b/lib/libcrypto/bn/bn_mont.c
@@ -73,6 +73,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b,
BN_MONT_CTX *mont, BN_CTX *ctx)
{
BIGNUM *tmp,*tmp2;
+ int ret=0;
BN_CTX_start(ctx);
tmp = BN_CTX_get(ctx);
@@ -101,10 +102,10 @@ int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b,
}
/* reduce from aRR to aR */
if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err;
- BN_CTX_end(ctx);
- return(1);
+ ret=1;
err:
- return(0);
+ BN_CTX_end(ctx);
+ return(ret);
}
int BN_from_montgomery(BIGNUM *ret, BIGNUM *a, BN_MONT_CTX *mont,
diff --git a/lib/libcrypto/bn/bn_mul.c b/lib/libcrypto/bn/bn_mul.c
index eb007e19e9a..3e8baaad9a0 100644
--- a/lib/libcrypto/bn/bn_mul.c
+++ b/lib/libcrypto/bn/bn_mul.c
@@ -61,6 +61,9 @@
#include "bn_lcl.h"
#ifdef BN_RECURSION
+/* Karatsuba recursive multiplication algorithm
+ * (cf. Knuth, The Art of Computer Programming, Vol. 2) */
+
/* r is 2*n2 words in size,
* a and b are both n2 words in size.
* n2 must be a power of 2.
diff --git a/lib/libcrypto/bn/bntest.c b/lib/libcrypto/bn/bntest.c
index 41c22f5954d..0a97af69c58 100644
--- a/lib/libcrypto/bn/bntest.c
+++ b/lib/libcrypto/bn/bntest.c
@@ -234,7 +234,8 @@ int main(int argc, char *argv[])
/**/
exit(0);
err:
- BIO_puts(out,"1\n"); /* make sure bc fails if we are piping to it */
+ BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices
+ * the failure, see test_bn in test/Makefile.ssl*/
BIO_flush(out);
ERR_load_crypto_strings();
ERR_print_errors_fp(stderr);