diff options
Diffstat (limited to 'src/lib/libcrypto/bn')
52 files changed, 732 insertions, 11151 deletions
diff --git a/src/lib/libcrypto/bn/Makefile b/src/lib/libcrypto/bn/Makefile index f5e8f65a46..aabc4f56b8 100644 --- a/src/lib/libcrypto/bn/Makefile +++ b/src/lib/libcrypto/bn/Makefile | |||
| @@ -12,8 +12,6 @@ MAKEFILE= Makefile | |||
| 12 | AR= ar r | 12 | AR= ar r |
| 13 | 13 | ||
| 14 | BN_ASM= bn_asm.o | 14 | BN_ASM= bn_asm.o |
| 15 | # or use | ||
| 16 | #BN_ASM= bn86-elf.o | ||
| 17 | 15 | ||
| 18 | CFLAGS= $(INCLUDES) $(CFLAG) | 16 | CFLAGS= $(INCLUDES) $(CFLAG) |
| 19 | ASFLAGS= $(INCLUDES) $(ASFLAG) | 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) |
| @@ -28,13 +26,13 @@ LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \ | |||
| 28 | bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \ | 26 | bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \ |
| 29 | bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \ | 27 | bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \ |
| 30 | bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \ | 28 | bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \ |
| 31 | bn_depr.c bn_x931p.c bn_const.c bn_opt.c | 29 | bn_depr.c bn_const.c |
| 32 | 30 | ||
| 33 | LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \ | 31 | LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \ |
| 34 | bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \ | 32 | bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \ |
| 35 | bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \ | 33 | bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \ |
| 36 | bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o bn_gf2m.o bn_nist.o \ | 34 | bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o bn_gf2m.o bn_nist.o \ |
| 37 | bn_depr.o bn_x931p.o bn_const.o bn_opt.o | 35 | bn_depr.o bn_const.o |
| 38 | 36 | ||
| 39 | SRC= $(LIBSRC) | 37 | SRC= $(LIBSRC) |
| 40 | 38 | ||
| @@ -58,36 +56,25 @@ bnbug: bnbug.c ../../libcrypto.a top | |||
| 58 | cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a | 56 | cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a |
| 59 | 57 | ||
| 60 | lib: $(LIBOBJ) | 58 | lib: $(LIBOBJ) |
| 61 | $(ARX) $(LIB) $(LIBOBJ) | 59 | $(AR) $(LIB) $(LIBOBJ) |
| 62 | $(RANLIB) $(LIB) || echo Never mind. | 60 | $(RANLIB) $(LIB) || echo Never mind. |
| 63 | @touch lib | 61 | @touch lib |
| 64 | 62 | ||
| 65 | # ELF | 63 | bn-586.s: asm/bn-586.pl ../perlasm/x86asm.pl |
| 66 | bn86-elf.s: asm/bn-586.pl ../perlasm/x86asm.pl | 64 | $(PERL) asm/bn-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ |
| 67 | (cd asm; $(PERL) bn-586.pl elf $(CFLAGS) > ../$@) | 65 | co-586.s: asm/co-586.pl ../perlasm/x86asm.pl |
| 68 | co86-elf.s: asm/co-586.pl ../perlasm/x86asm.pl | 66 | $(PERL) asm/co-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ |
| 69 | (cd asm; $(PERL) co-586.pl elf $(CFLAGS) > ../$@) | 67 | x86-mont.s: asm/x86-mont.pl ../perlasm/x86asm.pl |
| 70 | mo86-elf.s: asm/mo-586.pl ../perlasm/x86asm.pl | 68 | $(PERL) asm/x86-mont.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ |
| 71 | (cd asm; $(PERL) mo-586.pl elf $(CFLAGS) > ../$@) | ||
| 72 | # COFF | ||
| 73 | bn86-cof.s: asm/bn-586.pl ../perlasm/x86asm.pl | ||
| 74 | (cd asm; $(PERL) bn-586.pl coff $(CFLAGS) > ../$@) | ||
| 75 | co86-cof.s: asm/co-586.pl ../perlasm/x86asm.pl | ||
| 76 | (cd asm; $(PERL) co-586.pl coff $(CFLAGS) > ../$@) | ||
| 77 | mo86-cof.s: asm/mo-586.pl ../perlasm/x86asm.pl | ||
| 78 | (cd asm; $(PERL) mo-586.pl coff $(CFLAGS) > ../$@) | ||
| 79 | # a.out | ||
| 80 | bn86-out.s: asm/bn-586.pl ../perlasm/x86asm.pl | ||
| 81 | (cd asm; $(PERL) bn-586.pl a.out $(CFLAGS) > ../$@) | ||
| 82 | co86-out.s: asm/co-586.pl ../perlasm/x86asm.pl | ||
| 83 | (cd asm; $(PERL) co-586.pl a.out $(CFLAGS) > ../$@) | ||
| 84 | mo86-out.s: asm/mo-586.pl ../perlasm/x86asm.pl | ||
| 85 | (cd asm; $(PERL) mo-586.pl a.out $(CFLAGS) > ../$@) | ||
| 86 | 69 | ||
| 87 | sparcv8.o: asm/sparcv8.S | 70 | sparcv8.o: asm/sparcv8.S |
| 88 | $(CC) $(CFLAGS) -c asm/sparcv8.S | 71 | $(CC) $(CFLAGS) -c asm/sparcv8.S |
| 89 | sparcv8plus.o: asm/sparcv8plus.S | 72 | bn-sparcv9.o: asm/sparcv8plus.S |
| 90 | $(CC) $(CFLAGS) -c asm/sparcv8plus.S | 73 | $(CC) $(CFLAGS) -c -o $@ asm/sparcv8plus.S |
| 74 | sparcv9a-mont.s: asm/sparcv9a-mont.pl | ||
| 75 | $(PERL) asm/sparcv9a-mont.pl $(CFLAGS) > $@ | ||
| 76 | sparcv9-mont.s: asm/sparcv9-mont.pl | ||
| 77 | $(PERL) asm/sparcv9-mont.pl $(CFLAGS) > $@ | ||
| 91 | 78 | ||
| 92 | bn-mips3.o: asm/mips3.s | 79 | bn-mips3.o: asm/mips3.s |
| 93 | @if [ "$(CC)" = "gcc" ]; then \ | 80 | @if [ "$(CC)" = "gcc" ]; then \ |
| @@ -95,10 +82,13 @@ bn-mips3.o: asm/mips3.s | |||
| 95 | as -$$ABI -O -o $@ asm/mips3.s; \ | 82 | as -$$ABI -O -o $@ asm/mips3.s; \ |
| 96 | else $(CC) -c $(CFLAGS) -o $@ asm/mips3.s; fi | 83 | else $(CC) -c $(CFLAGS) -o $@ asm/mips3.s; fi |
| 97 | 84 | ||
| 85 | bn-s390x.o: asm/s390x.S | ||
| 86 | $(CC) $(CFLAGS) -c -o $@ asm/s390x.S | ||
| 87 | |||
| 98 | x86_64-gcc.o: asm/x86_64-gcc.c | 88 | x86_64-gcc.o: asm/x86_64-gcc.c |
| 99 | $(CC) $(CFLAGS) -c -o $@ asm/x86_64-gcc.c | 89 | $(CC) $(CFLAGS) -c -o $@ asm/x86_64-gcc.c |
| 100 | x86_64-mont.s: asm/x86_64-mont.pl | 90 | x86_64-mont.s: asm/x86_64-mont.pl |
| 101 | $(PERL) asm/x86_64-mont.pl $@ | 91 | $(PERL) asm/x86_64-mont.pl $(PERLASM_SCHEME) > $@ |
| 102 | 92 | ||
| 103 | bn-ia64.s: asm/ia64.S | 93 | bn-ia64.s: asm/ia64.S |
| 104 | $(CC) $(CFLAGS) -E asm/ia64.S > $@ | 94 | $(CC) $(CFLAGS) -E asm/ia64.S > $@ |
| @@ -111,12 +101,14 @@ pa-risc2.o: asm/pa-risc2.s | |||
| 111 | /usr/ccs/bin/as -o pa-risc2.o asm/pa-risc2.s | 101 | /usr/ccs/bin/as -o pa-risc2.o asm/pa-risc2.s |
| 112 | 102 | ||
| 113 | # ppc - AIX, Linux, MacOS X... | 103 | # ppc - AIX, Linux, MacOS X... |
| 114 | linux_ppc32.s: asm/ppc.pl; $(PERL) $< $@ | 104 | bn-ppc.s: asm/ppc.pl; $(PERL) asm/ppc.pl $(PERLASM_SCHEME) $@ |
| 115 | linux_ppc64.s: asm/ppc.pl; $(PERL) $< $@ | 105 | ppc-mont.s: asm/ppc-mont.pl;$(PERL) asm/ppc-mont.pl $(PERLASM_SCHEME) $@ |
| 116 | aix_ppc32.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@ | 106 | |
| 117 | aix_ppc64.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@ | 107 | alpha-mont.s: asm/alpha-mont.pl |
| 118 | osx_ppc32.s: asm/ppc.pl; $(PERL) $< $@ | 108 | $(PERL) $< | $(CC) -E - | tee $@ > /dev/null |
| 119 | osx_ppc64.s: asm/ppc.pl; $(PERL) $< $@ | 109 | |
| 110 | # GNU make "catch all" | ||
| 111 | %-mont.s: asm/%-mont.pl; $(PERL) $< $(CFLAGS) > $@ | ||
| 120 | 112 | ||
| 121 | files: | 113 | files: |
| 122 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | 114 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO |
| @@ -184,8 +176,11 @@ bn_blind.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | |||
| 184 | bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 176 | bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 185 | bn_blind.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 177 | bn_blind.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 186 | bn_blind.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_blind.c bn_lcl.h | 178 | bn_blind.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_blind.c bn_lcl.h |
| 187 | bn_const.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | 179 | bn_const.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 188 | bn_const.o: ../../include/openssl/ossl_typ.h bn.h bn_const.c | 180 | bn_const.o: ../../include/openssl/opensslconf.h |
| 181 | bn_const.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 182 | bn_const.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 183 | bn_const.o: ../../include/openssl/symhacks.h bn.h bn_const.c | ||
| 189 | bn_ctx.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | 184 | bn_ctx.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 190 | bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 185 | bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 191 | bn_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 186 | bn_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| @@ -292,13 +287,6 @@ bn_nist.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | |||
| 292 | bn_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 287 | bn_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 293 | bn_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 288 | bn_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 294 | bn_nist.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_nist.c | 289 | bn_nist.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_nist.c |
| 295 | bn_opt.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 296 | bn_opt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 297 | bn_opt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 298 | bn_opt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 299 | bn_opt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 300 | bn_opt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 301 | bn_opt.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_opt.c | ||
| 302 | bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | 290 | bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 303 | bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 291 | bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 304 | bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 292 | bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| @@ -357,6 +345,3 @@ bn_word.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | |||
| 357 | bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 345 | bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 358 | bn_word.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 346 | bn_word.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 359 | bn_word.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_word.c | 347 | bn_word.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_word.c |
| 360 | bn_x931p.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h | ||
| 361 | bn_x931p.o: ../../include/openssl/opensslconf.h | ||
| 362 | bn_x931p.o: ../../include/openssl/ossl_typ.h bn_x931p.c | ||
diff --git a/src/lib/libcrypto/bn/Makefile.ssl b/src/lib/libcrypto/bn/Makefile.ssl deleted file mode 100644 index 50892ef44c..0000000000 --- a/src/lib/libcrypto/bn/Makefile.ssl +++ /dev/null | |||
| @@ -1,326 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/bn/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= bn | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 10 | CFLAG=-g | ||
| 11 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP=/usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | |||
| 20 | BN_ASM= bn_asm.o | ||
| 21 | # or use | ||
| 22 | #BN_ASM= bn86-elf.o | ||
| 23 | |||
| 24 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 25 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 26 | |||
| 27 | GENERAL=Makefile | ||
| 28 | TEST=bntest.c exptest.c | ||
| 29 | APPS= | ||
| 30 | |||
| 31 | LIB=$(TOP)/libcrypto.a | ||
| 32 | LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \ | ||
| 33 | bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \ | ||
| 34 | bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \ | ||
| 35 | bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c | ||
| 36 | |||
| 37 | LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \ | ||
| 38 | bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \ | ||
| 39 | bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \ | ||
| 40 | bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o | ||
| 41 | |||
| 42 | SRC= $(LIBSRC) | ||
| 43 | |||
| 44 | EXHEADER= bn.h | ||
| 45 | HEADER= bn_lcl.h bn_prime.h $(EXHEADER) | ||
| 46 | |||
| 47 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 48 | |||
| 49 | top: | ||
| 50 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 51 | |||
| 52 | all: lib | ||
| 53 | |||
| 54 | bn_prime.h: bn_prime.pl | ||
| 55 | $(PERL) bn_prime.pl >bn_prime.h | ||
| 56 | |||
| 57 | divtest: divtest.c ../../libcrypto.a | ||
| 58 | cc -I../../include divtest.c -o divtest ../../libcrypto.a | ||
| 59 | |||
| 60 | bnbug: bnbug.c ../../libcrypto.a top | ||
| 61 | cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a | ||
| 62 | |||
| 63 | lib: $(LIBOBJ) | ||
| 64 | $(AR) $(LIB) $(LIBOBJ) | ||
| 65 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 66 | @touch lib | ||
| 67 | |||
| 68 | # elf | ||
| 69 | asm/bn86-elf.s: asm/bn-586.pl ../perlasm/x86asm.pl | ||
| 70 | (cd asm; $(PERL) bn-586.pl elf $(CFLAGS) > bn86-elf.s) | ||
| 71 | |||
| 72 | asm/co86-elf.s: asm/co-586.pl ../perlasm/x86asm.pl | ||
| 73 | (cd asm; $(PERL) co-586.pl elf $(CFLAGS) > co86-elf.s) | ||
| 74 | |||
| 75 | # a.out | ||
| 76 | asm/bn86-out.o: asm/bn86unix.cpp | ||
| 77 | $(CPP) -DOUT asm/bn86unix.cpp | as -o asm/bn86-out.o | ||
| 78 | |||
| 79 | asm/co86-out.o: asm/co86unix.cpp | ||
| 80 | $(CPP) -DOUT asm/co86unix.cpp | as -o asm/co86-out.o | ||
| 81 | |||
| 82 | # bsdi | ||
| 83 | asm/bn86bsdi.o: asm/bn86unix.cpp | ||
| 84 | $(CPP) -DBSDI asm/bn86unix.cpp | sed 's/ :/:/' | as -o asm/bn86bsdi.o | ||
| 85 | |||
| 86 | asm/co86bsdi.o: asm/co86unix.cpp | ||
| 87 | $(CPP) -DBSDI asm/co86unix.cpp | sed 's/ :/:/' | as -o asm/co86bsdi.o | ||
| 88 | |||
| 89 | asm/bn86unix.cpp: asm/bn-586.pl ../perlasm/x86asm.pl | ||
| 90 | (cd asm; $(PERL) bn-586.pl cpp >bn86unix.cpp ) | ||
| 91 | |||
| 92 | asm/co86unix.cpp: asm/co-586.pl ../perlasm/x86asm.pl | ||
| 93 | (cd asm; $(PERL) co-586.pl cpp >co86unix.cpp ) | ||
| 94 | |||
| 95 | asm/sparcv8.o: asm/sparcv8.S | ||
| 96 | |||
| 97 | asm/sparcv8plus.o: asm/sparcv8plus.S | ||
| 98 | |||
| 99 | # Old GNU assembler doesn't understand V9 instructions, so we | ||
| 100 | # hire /usr/ccs/bin/as to do the job. Note that option is called | ||
| 101 | # *-gcc27, but even gcc 2>=8 users may experience similar problem | ||
| 102 | # if they didn't bother to upgrade GNU assembler. Such users should | ||
| 103 | # not choose this option, but be adviced to *remove* GNU assembler | ||
| 104 | # or upgrade it. | ||
| 105 | asm/sparcv8plus-gcc27.o: asm/sparcv8plus.S | ||
| 106 | $(CC) $(ASFLAGS) -E asm/sparcv8plus.S | \ | ||
| 107 | /usr/ccs/bin/as -xarch=v8plus - -o asm/sparcv8plus-gcc27.o | ||
| 108 | |||
| 109 | |||
| 110 | asm/ia64.o: asm/ia64.S | ||
| 111 | |||
| 112 | # Some compiler drivers (most notably HP-UX and Intel C++) don't | ||
| 113 | # understand .S extension:-( I wish I could pipe output from cc -E, | ||
| 114 | # but it's too compiler driver/ABI dependent to cover with a single | ||
| 115 | # rule... <appro@fy.chalmers.se> | ||
| 116 | asm/ia64-cpp.o: asm/ia64.S | ||
| 117 | $(CC) $(ASFLAGS) -E asm/ia64.S > /tmp/ia64.$$$$.s && \ | ||
| 118 | $(CC) $(ASFLAGS) -c -o asm/ia64-cpp.o /tmp/ia64.$$$$.s; \ | ||
| 119 | rm -f /tmp/ia64.$$$$.s | ||
| 120 | |||
| 121 | asm/x86_64-gcc.o: asm/x86_64-gcc.c | ||
| 122 | |||
| 123 | asm/pa-risc2W.o: asm/pa-risc2W.s | ||
| 124 | /usr/ccs/bin/as -o asm/pa-rics2W.o asm/pa-risc2W.s | ||
| 125 | |||
| 126 | files: | ||
| 127 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 128 | |||
| 129 | links: | ||
| 130 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 131 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 132 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 133 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 134 | |||
| 135 | install: | ||
| 136 | @for i in $(EXHEADER) ; \ | ||
| 137 | do \ | ||
| 138 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 139 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 140 | done; | ||
| 141 | |||
| 142 | exptest: | ||
| 143 | rm -f exptest | ||
| 144 | gcc -I../../include -g2 -ggdb -o exptest exptest.c ../../libcrypto.a | ||
| 145 | |||
| 146 | div: | ||
| 147 | rm -f a.out | ||
| 148 | gcc -I.. -g div.c ../../libcrypto.a | ||
| 149 | |||
| 150 | tags: | ||
| 151 | ctags $(SRC) | ||
| 152 | |||
| 153 | tests: | ||
| 154 | |||
| 155 | lint: | ||
| 156 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 157 | |||
| 158 | depend: | ||
| 159 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 160 | |||
| 161 | dclean: | ||
| 162 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 163 | mv -f Makefile.new $(MAKEFILE) | ||
| 164 | |||
| 165 | clean: | ||
| 166 | rm -f asm/co86unix.cpp asm/bn86unix.cpp asm/*-elf.* *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff bn_asm.s | ||
| 167 | |||
| 168 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 169 | |||
| 170 | bn_add.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 171 | bn_add.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 172 | bn_add.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 173 | bn_add.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 174 | bn_add.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 175 | bn_add.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 176 | bn_add.o: ../cryptlib.h bn_add.c bn_lcl.h | ||
| 177 | bn_asm.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 178 | bn_asm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 179 | bn_asm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 180 | bn_asm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 181 | bn_asm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 182 | bn_asm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 183 | bn_asm.o: ../cryptlib.h bn_asm.c bn_lcl.h | ||
| 184 | bn_blind.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 185 | bn_blind.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 186 | bn_blind.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 187 | bn_blind.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 188 | bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 189 | bn_blind.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 190 | bn_blind.o: ../cryptlib.h bn_blind.c bn_lcl.h | ||
| 191 | bn_ctx.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 192 | bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 193 | bn_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 194 | bn_ctx.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 195 | bn_ctx.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 196 | bn_ctx.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 197 | bn_ctx.o: ../cryptlib.h bn_ctx.c bn_lcl.h | ||
| 198 | bn_div.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 199 | bn_div.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 200 | bn_div.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 201 | bn_div.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 202 | bn_div.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 203 | bn_div.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 204 | bn_div.o: ../cryptlib.h bn_div.c bn_lcl.h | ||
| 205 | bn_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 206 | bn_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 207 | bn_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 208 | bn_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 209 | bn_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 210 | bn_err.o: ../../include/openssl/symhacks.h bn_err.c | ||
| 211 | bn_exp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 212 | bn_exp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 213 | bn_exp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 214 | bn_exp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 215 | bn_exp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 216 | bn_exp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 217 | bn_exp.o: ../cryptlib.h bn_exp.c bn_lcl.h | ||
| 218 | bn_exp2.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 219 | bn_exp2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 220 | bn_exp2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 221 | bn_exp2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 222 | bn_exp2.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 223 | bn_exp2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 224 | bn_exp2.o: ../cryptlib.h bn_exp2.c bn_lcl.h | ||
| 225 | bn_gcd.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 226 | bn_gcd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 227 | bn_gcd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 228 | bn_gcd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 229 | bn_gcd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 230 | bn_gcd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 231 | bn_gcd.o: ../cryptlib.h bn_gcd.c bn_lcl.h | ||
| 232 | bn_kron.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h | ||
| 233 | bn_kron.o: ../../include/openssl/opensslconf.h bn_kron.c bn_lcl.h | ||
| 234 | bn_lib.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 235 | bn_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 236 | bn_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 237 | bn_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 238 | bn_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 239 | bn_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 240 | bn_lib.o: ../cryptlib.h bn_lcl.h bn_lib.c | ||
| 241 | bn_mod.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 242 | bn_mod.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 243 | bn_mod.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 244 | bn_mod.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 245 | bn_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 246 | bn_mod.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 247 | bn_mod.o: ../cryptlib.h bn_lcl.h bn_mod.c | ||
| 248 | bn_mont.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 249 | bn_mont.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 250 | bn_mont.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 251 | bn_mont.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 252 | bn_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 253 | bn_mont.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 254 | bn_mont.o: ../cryptlib.h bn_lcl.h bn_mont.c | ||
| 255 | bn_mpi.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 256 | bn_mpi.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 257 | bn_mpi.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 258 | bn_mpi.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 259 | bn_mpi.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 260 | bn_mpi.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 261 | bn_mpi.o: ../cryptlib.h bn_lcl.h bn_mpi.c | ||
| 262 | bn_mul.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 263 | bn_mul.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 264 | bn_mul.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 265 | bn_mul.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 266 | bn_mul.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 267 | bn_mul.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 268 | bn_mul.o: ../cryptlib.h bn_lcl.h bn_mul.c | ||
| 269 | bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 270 | bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 271 | bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 272 | bn_prime.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 273 | bn_prime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 274 | bn_prime.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 275 | bn_prime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 276 | bn_prime.o: ../cryptlib.h bn_lcl.h bn_prime.c bn_prime.h | ||
| 277 | bn_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 278 | bn_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 279 | bn_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 280 | bn_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 281 | bn_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 282 | bn_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 283 | bn_print.o: ../cryptlib.h bn_lcl.h bn_print.c | ||
| 284 | bn_rand.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 285 | bn_rand.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 286 | bn_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 287 | bn_rand.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 288 | bn_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 289 | bn_rand.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 290 | bn_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 291 | bn_rand.o: ../cryptlib.h bn_lcl.h bn_rand.c | ||
| 292 | bn_recp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 293 | bn_recp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 294 | bn_recp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 295 | bn_recp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 296 | bn_recp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 297 | bn_recp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 298 | bn_recp.o: ../cryptlib.h bn_lcl.h bn_recp.c | ||
| 299 | bn_shift.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 300 | bn_shift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 301 | bn_shift.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 302 | bn_shift.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 303 | bn_shift.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 304 | bn_shift.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 305 | bn_shift.o: ../cryptlib.h bn_lcl.h bn_shift.c | ||
| 306 | bn_sqr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 307 | bn_sqr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 308 | bn_sqr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 309 | bn_sqr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 310 | bn_sqr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 311 | bn_sqr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 312 | bn_sqr.o: ../cryptlib.h bn_lcl.h bn_sqr.c | ||
| 313 | bn_sqrt.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 314 | bn_sqrt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 315 | bn_sqrt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 316 | bn_sqrt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 317 | bn_sqrt.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 318 | bn_sqrt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 319 | bn_sqrt.o: ../cryptlib.h bn_lcl.h bn_sqrt.c | ||
| 320 | bn_word.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 321 | bn_word.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 322 | bn_word.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 323 | bn_word.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 324 | bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 325 | bn_word.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 326 | bn_word.o: ../cryptlib.h bn_lcl.h bn_word.c | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.s b/src/lib/libcrypto/bn/asm/alpha.s deleted file mode 100644 index 555ff0b92d..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.s +++ /dev/null | |||
| @@ -1,3199 +0,0 @@ | |||
| 1 | # DEC Alpha assember | ||
| 2 | # The bn_div_words is actually gcc output but the other parts are hand done. | ||
| 3 | # Thanks to tzeruch@ceddec.com for sending me the gcc output for | ||
| 4 | # bn_div_words. | ||
| 5 | # I've gone back and re-done most of routines. | ||
| 6 | # The key thing to remeber for the 164 CPU is that while a | ||
| 7 | # multiply operation takes 8 cycles, another one can only be issued | ||
| 8 | # after 4 cycles have elapsed. I've done modification to help | ||
| 9 | # improve this. Also, normally, a ld instruction will not be available | ||
| 10 | # for about 3 cycles. | ||
| 11 | .file 1 "bn_asm.c" | ||
| 12 | .set noat | ||
| 13 | gcc2_compiled.: | ||
| 14 | __gnu_compiled_c: | ||
| 15 | .text | ||
| 16 | .align 3 | ||
| 17 | .globl bn_mul_add_words | ||
| 18 | .ent bn_mul_add_words | ||
| 19 | bn_mul_add_words: | ||
| 20 | bn_mul_add_words..ng: | ||
| 21 | .frame $30,0,$26,0 | ||
| 22 | .prologue 0 | ||
| 23 | .align 5 | ||
| 24 | subq $18,4,$18 | ||
| 25 | bis $31,$31,$0 | ||
| 26 | blt $18,$43 # if we are -1, -2, -3 or -4 goto tail code | ||
| 27 | ldq $20,0($17) # 1 1 | ||
| 28 | ldq $1,0($16) # 1 1 | ||
| 29 | .align 3 | ||
| 30 | $42: | ||
| 31 | mulq $20,$19,$5 # 1 2 1 ###### | ||
| 32 | ldq $21,8($17) # 2 1 | ||
| 33 | ldq $2,8($16) # 2 1 | ||
| 34 | umulh $20,$19,$20 # 1 2 ###### | ||
| 35 | ldq $27,16($17) # 3 1 | ||
| 36 | ldq $3,16($16) # 3 1 | ||
| 37 | mulq $21,$19,$6 # 2 2 1 ###### | ||
| 38 | ldq $28,24($17) # 4 1 | ||
| 39 | addq $1,$5,$1 # 1 2 2 | ||
| 40 | ldq $4,24($16) # 4 1 | ||
| 41 | umulh $21,$19,$21 # 2 2 ###### | ||
| 42 | cmpult $1,$5,$22 # 1 2 3 1 | ||
| 43 | addq $20,$22,$20 # 1 3 1 | ||
| 44 | addq $1,$0,$1 # 1 2 3 1 | ||
| 45 | mulq $27,$19,$7 # 3 2 1 ###### | ||
| 46 | cmpult $1,$0,$0 # 1 2 3 2 | ||
| 47 | addq $2,$6,$2 # 2 2 2 | ||
| 48 | addq $20,$0,$0 # 1 3 2 | ||
| 49 | cmpult $2,$6,$23 # 2 2 3 1 | ||
| 50 | addq $21,$23,$21 # 2 3 1 | ||
| 51 | umulh $27,$19,$27 # 3 2 ###### | ||
| 52 | addq $2,$0,$2 # 2 2 3 1 | ||
| 53 | cmpult $2,$0,$0 # 2 2 3 2 | ||
| 54 | subq $18,4,$18 | ||
| 55 | mulq $28,$19,$8 # 4 2 1 ###### | ||
| 56 | addq $21,$0,$0 # 2 3 2 | ||
| 57 | addq $3,$7,$3 # 3 2 2 | ||
| 58 | addq $16,32,$16 | ||
| 59 | cmpult $3,$7,$24 # 3 2 3 1 | ||
| 60 | stq $1,-32($16) # 1 2 4 | ||
| 61 | umulh $28,$19,$28 # 4 2 ###### | ||
| 62 | addq $27,$24,$27 # 3 3 1 | ||
| 63 | addq $3,$0,$3 # 3 2 3 1 | ||
| 64 | stq $2,-24($16) # 2 2 4 | ||
| 65 | cmpult $3,$0,$0 # 3 2 3 2 | ||
| 66 | stq $3,-16($16) # 3 2 4 | ||
| 67 | addq $4,$8,$4 # 4 2 2 | ||
| 68 | addq $27,$0,$0 # 3 3 2 | ||
| 69 | cmpult $4,$8,$25 # 4 2 3 1 | ||
| 70 | addq $17,32,$17 | ||
| 71 | addq $28,$25,$28 # 4 3 1 | ||
| 72 | addq $4,$0,$4 # 4 2 3 1 | ||
| 73 | cmpult $4,$0,$0 # 4 2 3 2 | ||
| 74 | stq $4,-8($16) # 4 2 4 | ||
| 75 | addq $28,$0,$0 # 4 3 2 | ||
| 76 | blt $18,$43 | ||
| 77 | |||
| 78 | ldq $20,0($17) # 1 1 | ||
| 79 | ldq $1,0($16) # 1 1 | ||
| 80 | |||
| 81 | br $42 | ||
| 82 | |||
| 83 | .align 4 | ||
| 84 | $45: | ||
| 85 | ldq $20,0($17) # 4 1 | ||
| 86 | ldq $1,0($16) # 4 1 | ||
| 87 | mulq $20,$19,$5 # 4 2 1 | ||
| 88 | subq $18,1,$18 | ||
| 89 | addq $16,8,$16 | ||
| 90 | addq $17,8,$17 | ||
| 91 | umulh $20,$19,$20 # 4 2 | ||
| 92 | addq $1,$5,$1 # 4 2 2 | ||
| 93 | cmpult $1,$5,$22 # 4 2 3 1 | ||
| 94 | addq $20,$22,$20 # 4 3 1 | ||
| 95 | addq $1,$0,$1 # 4 2 3 1 | ||
| 96 | cmpult $1,$0,$0 # 4 2 3 2 | ||
| 97 | addq $20,$0,$0 # 4 3 2 | ||
| 98 | stq $1,-8($16) # 4 2 4 | ||
| 99 | bgt $18,$45 | ||
| 100 | ret $31,($26),1 # else exit | ||
| 101 | |||
| 102 | .align 4 | ||
| 103 | $43: | ||
| 104 | addq $18,4,$18 | ||
| 105 | bgt $18,$45 # goto tail code | ||
| 106 | ret $31,($26),1 # else exit | ||
| 107 | |||
| 108 | .end bn_mul_add_words | ||
| 109 | .align 3 | ||
| 110 | .globl bn_mul_words | ||
| 111 | .ent bn_mul_words | ||
| 112 | bn_mul_words: | ||
| 113 | bn_mul_words..ng: | ||
| 114 | .frame $30,0,$26,0 | ||
| 115 | .prologue 0 | ||
| 116 | .align 5 | ||
| 117 | subq $18,4,$18 | ||
| 118 | bis $31,$31,$0 | ||
| 119 | blt $18,$143 # if we are -1, -2, -3 or -4 goto tail code | ||
| 120 | ldq $20,0($17) # 1 1 | ||
| 121 | .align 3 | ||
| 122 | $142: | ||
| 123 | |||
| 124 | mulq $20,$19,$5 # 1 2 1 ##### | ||
| 125 | ldq $21,8($17) # 2 1 | ||
| 126 | ldq $27,16($17) # 3 1 | ||
| 127 | umulh $20,$19,$20 # 1 2 ##### | ||
| 128 | ldq $28,24($17) # 4 1 | ||
| 129 | mulq $21,$19,$6 # 2 2 1 ##### | ||
| 130 | addq $5,$0,$5 # 1 2 3 1 | ||
| 131 | subq $18,4,$18 | ||
| 132 | cmpult $5,$0,$0 # 1 2 3 2 | ||
| 133 | umulh $21,$19,$21 # 2 2 ##### | ||
| 134 | addq $20,$0,$0 # 1 3 2 | ||
| 135 | addq $17,32,$17 | ||
| 136 | addq $6,$0,$6 # 2 2 3 1 | ||
| 137 | mulq $27,$19,$7 # 3 2 1 ##### | ||
| 138 | cmpult $6,$0,$0 # 2 2 3 2 | ||
| 139 | addq $21,$0,$0 # 2 3 2 | ||
| 140 | addq $16,32,$16 | ||
| 141 | umulh $27,$19,$27 # 3 2 ##### | ||
| 142 | stq $5,-32($16) # 1 2 4 | ||
| 143 | mulq $28,$19,$8 # 4 2 1 ##### | ||
| 144 | addq $7,$0,$7 # 3 2 3 1 | ||
| 145 | stq $6,-24($16) # 2 2 4 | ||
| 146 | cmpult $7,$0,$0 # 3 2 3 2 | ||
| 147 | umulh $28,$19,$28 # 4 2 ##### | ||
| 148 | addq $27,$0,$0 # 3 3 2 | ||
| 149 | stq $7,-16($16) # 3 2 4 | ||
| 150 | addq $8,$0,$8 # 4 2 3 1 | ||
| 151 | cmpult $8,$0,$0 # 4 2 3 2 | ||
| 152 | |||
| 153 | addq $28,$0,$0 # 4 3 2 | ||
| 154 | |||
| 155 | stq $8,-8($16) # 4 2 4 | ||
| 156 | |||
| 157 | blt $18,$143 | ||
| 158 | |||
| 159 | ldq $20,0($17) # 1 1 | ||
| 160 | |||
| 161 | br $142 | ||
| 162 | |||
| 163 | .align 4 | ||
| 164 | $145: | ||
| 165 | ldq $20,0($17) # 4 1 | ||
| 166 | mulq $20,$19,$5 # 4 2 1 | ||
| 167 | subq $18,1,$18 | ||
| 168 | umulh $20,$19,$20 # 4 2 | ||
| 169 | addq $5,$0,$5 # 4 2 3 1 | ||
| 170 | addq $16,8,$16 | ||
| 171 | cmpult $5,$0,$0 # 4 2 3 2 | ||
| 172 | addq $17,8,$17 | ||
| 173 | addq $20,$0,$0 # 4 3 2 | ||
| 174 | stq $5,-8($16) # 4 2 4 | ||
| 175 | |||
| 176 | bgt $18,$145 | ||
| 177 | ret $31,($26),1 # else exit | ||
| 178 | |||
| 179 | .align 4 | ||
| 180 | $143: | ||
| 181 | addq $18,4,$18 | ||
| 182 | bgt $18,$145 # goto tail code | ||
| 183 | ret $31,($26),1 # else exit | ||
| 184 | |||
| 185 | .end bn_mul_words | ||
| 186 | .align 3 | ||
| 187 | .globl bn_sqr_words | ||
| 188 | .ent bn_sqr_words | ||
| 189 | bn_sqr_words: | ||
| 190 | bn_sqr_words..ng: | ||
| 191 | .frame $30,0,$26,0 | ||
| 192 | .prologue 0 | ||
| 193 | |||
| 194 | subq $18,4,$18 | ||
| 195 | blt $18,$543 # if we are -1, -2, -3 or -4 goto tail code | ||
| 196 | ldq $20,0($17) # 1 1 | ||
| 197 | .align 3 | ||
| 198 | $542: | ||
| 199 | mulq $20,$20,$5 ###### | ||
| 200 | ldq $21,8($17) # 1 1 | ||
| 201 | subq $18,4 | ||
| 202 | umulh $20,$20,$1 ###### | ||
| 203 | ldq $27,16($17) # 1 1 | ||
| 204 | mulq $21,$21,$6 ###### | ||
| 205 | ldq $28,24($17) # 1 1 | ||
| 206 | stq $5,0($16) # r[0] | ||
| 207 | umulh $21,$21,$2 ###### | ||
| 208 | stq $1,8($16) # r[1] | ||
| 209 | mulq $27,$27,$7 ###### | ||
| 210 | stq $6,16($16) # r[0] | ||
| 211 | umulh $27,$27,$3 ###### | ||
| 212 | stq $2,24($16) # r[1] | ||
| 213 | mulq $28,$28,$8 ###### | ||
| 214 | stq $7,32($16) # r[0] | ||
| 215 | umulh $28,$28,$4 ###### | ||
| 216 | stq $3,40($16) # r[1] | ||
| 217 | |||
| 218 | addq $16,64,$16 | ||
| 219 | addq $17,32,$17 | ||
| 220 | stq $8,-16($16) # r[0] | ||
| 221 | stq $4,-8($16) # r[1] | ||
| 222 | |||
| 223 | blt $18,$543 | ||
| 224 | ldq $20,0($17) # 1 1 | ||
| 225 | br $542 | ||
| 226 | |||
| 227 | $442: | ||
| 228 | ldq $20,0($17) # a[0] | ||
| 229 | mulq $20,$20,$5 # a[0]*w low part r2 | ||
| 230 | addq $16,16,$16 | ||
| 231 | addq $17,8,$17 | ||
| 232 | subq $18,1,$18 | ||
| 233 | umulh $20,$20,$1 # a[0]*w high part r3 | ||
| 234 | stq $5,-16($16) # r[0] | ||
| 235 | stq $1,-8($16) # r[1] | ||
| 236 | |||
| 237 | bgt $18,$442 | ||
| 238 | ret $31,($26),1 # else exit | ||
| 239 | |||
| 240 | .align 4 | ||
| 241 | $543: | ||
| 242 | addq $18,4,$18 | ||
| 243 | bgt $18,$442 # goto tail code | ||
| 244 | ret $31,($26),1 # else exit | ||
| 245 | .end bn_sqr_words | ||
| 246 | |||
| 247 | .align 3 | ||
| 248 | .globl bn_add_words | ||
| 249 | .ent bn_add_words | ||
| 250 | bn_add_words: | ||
| 251 | bn_add_words..ng: | ||
| 252 | .frame $30,0,$26,0 | ||
| 253 | .prologue 0 | ||
| 254 | |||
| 255 | subq $19,4,$19 | ||
| 256 | bis $31,$31,$0 # carry = 0 | ||
| 257 | blt $19,$900 | ||
| 258 | ldq $5,0($17) # a[0] | ||
| 259 | ldq $1,0($18) # b[1] | ||
| 260 | .align 3 | ||
| 261 | $901: | ||
| 262 | addq $1,$5,$1 # r=a+b; | ||
| 263 | ldq $6,8($17) # a[1] | ||
| 264 | cmpult $1,$5,$22 # did we overflow? | ||
| 265 | ldq $2,8($18) # b[1] | ||
| 266 | addq $1,$0,$1 # c+= overflow | ||
| 267 | ldq $7,16($17) # a[2] | ||
| 268 | cmpult $1,$0,$0 # overflow? | ||
| 269 | ldq $3,16($18) # b[2] | ||
| 270 | addq $0,$22,$0 | ||
| 271 | ldq $8,24($17) # a[3] | ||
| 272 | addq $2,$6,$2 # r=a+b; | ||
| 273 | ldq $4,24($18) # b[3] | ||
| 274 | cmpult $2,$6,$23 # did we overflow? | ||
| 275 | addq $3,$7,$3 # r=a+b; | ||
| 276 | addq $2,$0,$2 # c+= overflow | ||
| 277 | cmpult $3,$7,$24 # did we overflow? | ||
| 278 | cmpult $2,$0,$0 # overflow? | ||
| 279 | addq $4,$8,$4 # r=a+b; | ||
| 280 | addq $0,$23,$0 | ||
| 281 | cmpult $4,$8,$25 # did we overflow? | ||
| 282 | addq $3,$0,$3 # c+= overflow | ||
| 283 | stq $1,0($16) # r[0]=c | ||
| 284 | cmpult $3,$0,$0 # overflow? | ||
| 285 | stq $2,8($16) # r[1]=c | ||
| 286 | addq $0,$24,$0 | ||
| 287 | stq $3,16($16) # r[2]=c | ||
| 288 | addq $4,$0,$4 # c+= overflow | ||
| 289 | subq $19,4,$19 # loop-- | ||
| 290 | cmpult $4,$0,$0 # overflow? | ||
| 291 | addq $17,32,$17 # a++ | ||
| 292 | addq $0,$25,$0 | ||
| 293 | stq $4,24($16) # r[3]=c | ||
| 294 | addq $18,32,$18 # b++ | ||
| 295 | addq $16,32,$16 # r++ | ||
| 296 | |||
| 297 | blt $19,$900 | ||
| 298 | ldq $5,0($17) # a[0] | ||
| 299 | ldq $1,0($18) # b[1] | ||
| 300 | br $901 | ||
| 301 | .align 4 | ||
| 302 | $945: | ||
| 303 | ldq $5,0($17) # a[0] | ||
| 304 | ldq $1,0($18) # b[1] | ||
| 305 | addq $1,$5,$1 # r=a+b; | ||
| 306 | subq $19,1,$19 # loop-- | ||
| 307 | addq $1,$0,$1 # c+= overflow | ||
| 308 | addq $17,8,$17 # a++ | ||
| 309 | cmpult $1,$5,$22 # did we overflow? | ||
| 310 | cmpult $1,$0,$0 # overflow? | ||
| 311 | addq $18,8,$18 # b++ | ||
| 312 | stq $1,0($16) # r[0]=c | ||
| 313 | addq $0,$22,$0 | ||
| 314 | addq $16,8,$16 # r++ | ||
| 315 | |||
| 316 | bgt $19,$945 | ||
| 317 | ret $31,($26),1 # else exit | ||
| 318 | |||
| 319 | $900: | ||
| 320 | addq $19,4,$19 | ||
| 321 | bgt $19,$945 # goto tail code | ||
| 322 | ret $31,($26),1 # else exit | ||
| 323 | .end bn_add_words | ||
| 324 | |||
| 325 | # | ||
| 326 | # What follows was taken directly from the C compiler with a few | ||
| 327 | # hacks to redo the lables. | ||
| 328 | # | ||
| 329 | .text | ||
| 330 | .align 3 | ||
| 331 | .globl bn_div_words | ||
| 332 | .ent bn_div_words | ||
| 333 | bn_div_words: | ||
| 334 | ldgp $29,0($27) | ||
| 335 | bn_div_words..ng: | ||
| 336 | lda $30,-48($30) | ||
| 337 | .frame $30,48,$26,0 | ||
| 338 | stq $26,0($30) | ||
| 339 | stq $9,8($30) | ||
| 340 | stq $10,16($30) | ||
| 341 | stq $11,24($30) | ||
| 342 | stq $12,32($30) | ||
| 343 | stq $13,40($30) | ||
| 344 | .mask 0x4003e00,-48 | ||
| 345 | .prologue 1 | ||
| 346 | bis $16,$16,$9 | ||
| 347 | bis $17,$17,$10 | ||
| 348 | bis $18,$18,$11 | ||
| 349 | bis $31,$31,$13 | ||
| 350 | bis $31,2,$12 | ||
| 351 | bne $11,$119 | ||
| 352 | lda $0,-1 | ||
| 353 | br $31,$136 | ||
| 354 | .align 4 | ||
| 355 | $119: | ||
| 356 | bis $11,$11,$16 | ||
| 357 | jsr $26,BN_num_bits_word | ||
| 358 | ldgp $29,0($26) | ||
| 359 | subq $0,64,$1 | ||
| 360 | beq $1,$120 | ||
| 361 | bis $31,1,$1 | ||
| 362 | sll $1,$0,$1 | ||
| 363 | cmpule $9,$1,$1 | ||
| 364 | bne $1,$120 | ||
| 365 | # lda $16,_IO_stderr_ | ||
| 366 | # lda $17,$C32 | ||
| 367 | # bis $0,$0,$18 | ||
| 368 | # jsr $26,fprintf | ||
| 369 | # ldgp $29,0($26) | ||
| 370 | jsr $26,abort | ||
| 371 | ldgp $29,0($26) | ||
| 372 | .align 4 | ||
| 373 | $120: | ||
| 374 | bis $31,64,$3 | ||
| 375 | cmpult $9,$11,$2 | ||
| 376 | subq $3,$0,$1 | ||
| 377 | addl $1,$31,$0 | ||
| 378 | subq $9,$11,$1 | ||
| 379 | cmoveq $2,$1,$9 | ||
| 380 | beq $0,$122 | ||
| 381 | zapnot $0,15,$2 | ||
| 382 | subq $3,$0,$1 | ||
| 383 | sll $11,$2,$11 | ||
| 384 | sll $9,$2,$3 | ||
| 385 | srl $10,$1,$1 | ||
| 386 | sll $10,$2,$10 | ||
| 387 | bis $3,$1,$9 | ||
| 388 | $122: | ||
| 389 | srl $11,32,$5 | ||
| 390 | zapnot $11,15,$6 | ||
| 391 | lda $7,-1 | ||
| 392 | .align 5 | ||
| 393 | $123: | ||
| 394 | srl $9,32,$1 | ||
| 395 | subq $1,$5,$1 | ||
| 396 | bne $1,$126 | ||
| 397 | zapnot $7,15,$27 | ||
| 398 | br $31,$127 | ||
| 399 | .align 4 | ||
| 400 | $126: | ||
| 401 | bis $9,$9,$24 | ||
| 402 | bis $5,$5,$25 | ||
| 403 | divqu $24,$25,$27 | ||
| 404 | $127: | ||
| 405 | srl $10,32,$4 | ||
| 406 | .align 5 | ||
| 407 | $128: | ||
| 408 | mulq $27,$5,$1 | ||
| 409 | subq $9,$1,$3 | ||
| 410 | zapnot $3,240,$1 | ||
| 411 | bne $1,$129 | ||
| 412 | mulq $6,$27,$2 | ||
| 413 | sll $3,32,$1 | ||
| 414 | addq $1,$4,$1 | ||
| 415 | cmpule $2,$1,$2 | ||
| 416 | bne $2,$129 | ||
| 417 | subq $27,1,$27 | ||
| 418 | br $31,$128 | ||
| 419 | .align 4 | ||
| 420 | $129: | ||
| 421 | mulq $27,$6,$1 | ||
| 422 | mulq $27,$5,$4 | ||
| 423 | srl $1,32,$3 | ||
| 424 | sll $1,32,$1 | ||
| 425 | addq $4,$3,$4 | ||
| 426 | cmpult $10,$1,$2 | ||
| 427 | subq $10,$1,$10 | ||
| 428 | addq $2,$4,$2 | ||
| 429 | cmpult $9,$2,$1 | ||
| 430 | bis $2,$2,$4 | ||
| 431 | beq $1,$134 | ||
| 432 | addq $9,$11,$9 | ||
| 433 | subq $27,1,$27 | ||
| 434 | $134: | ||
| 435 | subl $12,1,$12 | ||
| 436 | subq $9,$4,$9 | ||
| 437 | beq $12,$124 | ||
| 438 | sll $27,32,$13 | ||
| 439 | sll $9,32,$2 | ||
| 440 | srl $10,32,$1 | ||
| 441 | sll $10,32,$10 | ||
| 442 | bis $2,$1,$9 | ||
| 443 | br $31,$123 | ||
| 444 | .align 4 | ||
| 445 | $124: | ||
| 446 | bis $13,$27,$0 | ||
| 447 | $136: | ||
| 448 | ldq $26,0($30) | ||
| 449 | ldq $9,8($30) | ||
| 450 | ldq $10,16($30) | ||
| 451 | ldq $11,24($30) | ||
| 452 | ldq $12,32($30) | ||
| 453 | ldq $13,40($30) | ||
| 454 | addq $30,48,$30 | ||
| 455 | ret $31,($26),1 | ||
| 456 | .end bn_div_words | ||
| 457 | |||
| 458 | .set noat | ||
| 459 | .text | ||
| 460 | .align 3 | ||
| 461 | .globl bn_sub_words | ||
| 462 | .ent bn_sub_words | ||
| 463 | bn_sub_words: | ||
| 464 | bn_sub_words..ng: | ||
| 465 | .frame $30,0,$26,0 | ||
| 466 | .prologue 0 | ||
| 467 | |||
| 468 | subq $19, 4, $19 | ||
| 469 | bis $31, $31, $0 | ||
| 470 | blt $19, $100 | ||
| 471 | ldq $1, 0($17) | ||
| 472 | ldq $2, 0($18) | ||
| 473 | $101: | ||
| 474 | ldq $3, 8($17) | ||
| 475 | cmpult $1, $2, $4 | ||
| 476 | ldq $5, 8($18) | ||
| 477 | subq $1, $2, $1 | ||
| 478 | ldq $6, 16($17) | ||
| 479 | cmpult $1, $0, $2 | ||
| 480 | ldq $7, 16($18) | ||
| 481 | subq $1, $0, $23 | ||
| 482 | ldq $8, 24($17) | ||
| 483 | addq $2, $4, $0 | ||
| 484 | cmpult $3, $5, $24 | ||
| 485 | subq $3, $5, $3 | ||
| 486 | ldq $22, 24($18) | ||
| 487 | cmpult $3, $0, $5 | ||
| 488 | subq $3, $0, $25 | ||
| 489 | addq $5, $24, $0 | ||
| 490 | cmpult $6, $7, $27 | ||
| 491 | subq $6, $7, $6 | ||
| 492 | stq $23, 0($16) | ||
| 493 | cmpult $6, $0, $7 | ||
| 494 | subq $6, $0, $28 | ||
| 495 | addq $7, $27, $0 | ||
| 496 | cmpult $8, $22, $21 | ||
| 497 | subq $8, $22, $8 | ||
| 498 | stq $25, 8($16) | ||
| 499 | cmpult $8, $0, $22 | ||
| 500 | subq $8, $0, $20 | ||
| 501 | addq $22, $21, $0 | ||
| 502 | stq $28, 16($16) | ||
| 503 | subq $19, 4, $19 | ||
| 504 | stq $20, 24($16) | ||
| 505 | addq $17, 32, $17 | ||
| 506 | addq $18, 32, $18 | ||
| 507 | addq $16, 32, $16 | ||
| 508 | blt $19, $100 | ||
| 509 | ldq $1, 0($17) | ||
| 510 | ldq $2, 0($18) | ||
| 511 | br $101 | ||
| 512 | $102: | ||
| 513 | ldq $1, 0($17) | ||
| 514 | ldq $2, 0($18) | ||
| 515 | cmpult $1, $2, $27 | ||
| 516 | subq $1, $2, $1 | ||
| 517 | cmpult $1, $0, $2 | ||
| 518 | subq $1, $0, $1 | ||
| 519 | stq $1, 0($16) | ||
| 520 | addq $2, $27, $0 | ||
| 521 | addq $17, 8, $17 | ||
| 522 | addq $18, 8, $18 | ||
| 523 | addq $16, 8, $16 | ||
| 524 | subq $19, 1, $19 | ||
| 525 | bgt $19, $102 | ||
| 526 | ret $31,($26),1 | ||
| 527 | $100: | ||
| 528 | addq $19, 4, $19 | ||
| 529 | bgt $19, $102 | ||
| 530 | $103: | ||
| 531 | ret $31,($26),1 | ||
| 532 | .end bn_sub_words | ||
| 533 | .text | ||
| 534 | .align 3 | ||
| 535 | .globl bn_mul_comba4 | ||
| 536 | .ent bn_mul_comba4 | ||
| 537 | bn_mul_comba4: | ||
| 538 | bn_mul_comba4..ng: | ||
| 539 | .frame $30,0,$26,0 | ||
| 540 | .prologue 0 | ||
| 541 | |||
| 542 | ldq $0, 0($17) | ||
| 543 | ldq $1, 0($18) | ||
| 544 | ldq $2, 8($17) | ||
| 545 | ldq $3, 8($18) | ||
| 546 | ldq $4, 16($17) | ||
| 547 | ldq $5, 16($18) | ||
| 548 | ldq $6, 24($17) | ||
| 549 | ldq $7, 24($18) | ||
| 550 | bis $31, $31, $23 | ||
| 551 | mulq $0, $1, $8 | ||
| 552 | umulh $0, $1, $22 | ||
| 553 | stq $8, 0($16) | ||
| 554 | bis $31, $31, $8 | ||
| 555 | mulq $0, $3, $24 | ||
| 556 | umulh $0, $3, $25 | ||
| 557 | addq $22, $24, $22 | ||
| 558 | cmpult $22, $24, $27 | ||
| 559 | addq $27, $25, $25 | ||
| 560 | addq $23, $25, $23 | ||
| 561 | cmpult $23, $25, $28 | ||
| 562 | addq $8, $28, $8 | ||
| 563 | mulq $2, $1, $21 | ||
| 564 | umulh $2, $1, $20 | ||
| 565 | addq $22, $21, $22 | ||
| 566 | cmpult $22, $21, $19 | ||
| 567 | addq $19, $20, $20 | ||
| 568 | addq $23, $20, $23 | ||
| 569 | cmpult $23, $20, $17 | ||
| 570 | addq $8, $17, $8 | ||
| 571 | stq $22, 8($16) | ||
| 572 | bis $31, $31, $22 | ||
| 573 | mulq $2, $3, $18 | ||
| 574 | umulh $2, $3, $24 | ||
| 575 | addq $23, $18, $23 | ||
| 576 | cmpult $23, $18, $27 | ||
| 577 | addq $27, $24, $24 | ||
| 578 | addq $8, $24, $8 | ||
| 579 | cmpult $8, $24, $25 | ||
| 580 | addq $22, $25, $22 | ||
| 581 | mulq $0, $5, $28 | ||
| 582 | umulh $0, $5, $21 | ||
| 583 | addq $23, $28, $23 | ||
| 584 | cmpult $23, $28, $19 | ||
| 585 | addq $19, $21, $21 | ||
| 586 | addq $8, $21, $8 | ||
| 587 | cmpult $8, $21, $20 | ||
| 588 | addq $22, $20, $22 | ||
| 589 | mulq $4, $1, $17 | ||
| 590 | umulh $4, $1, $18 | ||
| 591 | addq $23, $17, $23 | ||
| 592 | cmpult $23, $17, $27 | ||
| 593 | addq $27, $18, $18 | ||
| 594 | addq $8, $18, $8 | ||
| 595 | cmpult $8, $18, $24 | ||
| 596 | addq $22, $24, $22 | ||
| 597 | stq $23, 16($16) | ||
| 598 | bis $31, $31, $23 | ||
| 599 | mulq $0, $7, $25 | ||
| 600 | umulh $0, $7, $28 | ||
| 601 | addq $8, $25, $8 | ||
| 602 | cmpult $8, $25, $19 | ||
| 603 | addq $19, $28, $28 | ||
| 604 | addq $22, $28, $22 | ||
| 605 | cmpult $22, $28, $21 | ||
| 606 | addq $23, $21, $23 | ||
| 607 | mulq $2, $5, $20 | ||
| 608 | umulh $2, $5, $17 | ||
| 609 | addq $8, $20, $8 | ||
| 610 | cmpult $8, $20, $27 | ||
| 611 | addq $27, $17, $17 | ||
| 612 | addq $22, $17, $22 | ||
| 613 | cmpult $22, $17, $18 | ||
| 614 | addq $23, $18, $23 | ||
| 615 | mulq $4, $3, $24 | ||
| 616 | umulh $4, $3, $25 | ||
| 617 | addq $8, $24, $8 | ||
| 618 | cmpult $8, $24, $19 | ||
| 619 | addq $19, $25, $25 | ||
| 620 | addq $22, $25, $22 | ||
| 621 | cmpult $22, $25, $28 | ||
| 622 | addq $23, $28, $23 | ||
| 623 | mulq $6, $1, $21 | ||
| 624 | umulh $6, $1, $0 | ||
| 625 | addq $8, $21, $8 | ||
| 626 | cmpult $8, $21, $20 | ||
| 627 | addq $20, $0, $0 | ||
| 628 | addq $22, $0, $22 | ||
| 629 | cmpult $22, $0, $27 | ||
| 630 | addq $23, $27, $23 | ||
| 631 | stq $8, 24($16) | ||
| 632 | bis $31, $31, $8 | ||
| 633 | mulq $2, $7, $17 | ||
| 634 | umulh $2, $7, $18 | ||
| 635 | addq $22, $17, $22 | ||
| 636 | cmpult $22, $17, $24 | ||
| 637 | addq $24, $18, $18 | ||
| 638 | addq $23, $18, $23 | ||
| 639 | cmpult $23, $18, $19 | ||
| 640 | addq $8, $19, $8 | ||
| 641 | mulq $4, $5, $25 | ||
| 642 | umulh $4, $5, $28 | ||
| 643 | addq $22, $25, $22 | ||
| 644 | cmpult $22, $25, $21 | ||
| 645 | addq $21, $28, $28 | ||
| 646 | addq $23, $28, $23 | ||
| 647 | cmpult $23, $28, $20 | ||
| 648 | addq $8, $20, $8 | ||
| 649 | mulq $6, $3, $0 | ||
| 650 | umulh $6, $3, $27 | ||
| 651 | addq $22, $0, $22 | ||
| 652 | cmpult $22, $0, $1 | ||
| 653 | addq $1, $27, $27 | ||
| 654 | addq $23, $27, $23 | ||
| 655 | cmpult $23, $27, $17 | ||
| 656 | addq $8, $17, $8 | ||
| 657 | stq $22, 32($16) | ||
| 658 | bis $31, $31, $22 | ||
| 659 | mulq $4, $7, $24 | ||
| 660 | umulh $4, $7, $18 | ||
| 661 | addq $23, $24, $23 | ||
| 662 | cmpult $23, $24, $19 | ||
| 663 | addq $19, $18, $18 | ||
| 664 | addq $8, $18, $8 | ||
| 665 | cmpult $8, $18, $2 | ||
| 666 | addq $22, $2, $22 | ||
| 667 | mulq $6, $5, $25 | ||
| 668 | umulh $6, $5, $21 | ||
| 669 | addq $23, $25, $23 | ||
| 670 | cmpult $23, $25, $28 | ||
| 671 | addq $28, $21, $21 | ||
| 672 | addq $8, $21, $8 | ||
| 673 | cmpult $8, $21, $20 | ||
| 674 | addq $22, $20, $22 | ||
| 675 | stq $23, 40($16) | ||
| 676 | bis $31, $31, $23 | ||
| 677 | mulq $6, $7, $0 | ||
| 678 | umulh $6, $7, $1 | ||
| 679 | addq $8, $0, $8 | ||
| 680 | cmpult $8, $0, $27 | ||
| 681 | addq $27, $1, $1 | ||
| 682 | addq $22, $1, $22 | ||
| 683 | cmpult $22, $1, $17 | ||
| 684 | addq $23, $17, $23 | ||
| 685 | stq $8, 48($16) | ||
| 686 | stq $22, 56($16) | ||
| 687 | ret $31,($26),1 | ||
| 688 | .end bn_mul_comba4 | ||
| 689 | .text | ||
| 690 | .align 3 | ||
| 691 | .globl bn_mul_comba8 | ||
| 692 | .ent bn_mul_comba8 | ||
| 693 | bn_mul_comba8: | ||
| 694 | bn_mul_comba8..ng: | ||
| 695 | .frame $30,0,$26,0 | ||
| 696 | .prologue 0 | ||
| 697 | ldq $1, 0($17) | ||
| 698 | ldq $2, 0($18) | ||
| 699 | zapnot $1, 15, $7 | ||
| 700 | srl $2, 32, $8 | ||
| 701 | mulq $8, $7, $22 | ||
| 702 | srl $1, 32, $6 | ||
| 703 | zapnot $2, 15, $5 | ||
| 704 | mulq $5, $6, $4 | ||
| 705 | mulq $7, $5, $24 | ||
| 706 | addq $22, $4, $22 | ||
| 707 | cmpult $22, $4, $1 | ||
| 708 | mulq $6, $8, $3 | ||
| 709 | beq $1, $173 | ||
| 710 | bis $31, 1, $1 | ||
| 711 | sll $1, 32, $1 | ||
| 712 | addq $3, $1, $3 | ||
| 713 | $173: | ||
| 714 | sll $22, 32, $4 | ||
| 715 | addq $24, $4, $24 | ||
| 716 | stq $24, 0($16) | ||
| 717 | ldq $2, 0($17) | ||
| 718 | ldq $1, 8($18) | ||
| 719 | zapnot $2, 15, $7 | ||
| 720 | srl $1, 32, $8 | ||
| 721 | mulq $8, $7, $25 | ||
| 722 | zapnot $1, 15, $5 | ||
| 723 | mulq $7, $5, $0 | ||
| 724 | srl $2, 32, $6 | ||
| 725 | mulq $5, $6, $23 | ||
| 726 | mulq $6, $8, $6 | ||
| 727 | srl $22, 32, $1 | ||
| 728 | cmpult $24, $4, $2 | ||
| 729 | addq $3, $1, $3 | ||
| 730 | addq $2, $3, $22 | ||
| 731 | addq $25, $23, $25 | ||
| 732 | cmpult $25, $23, $1 | ||
| 733 | bis $31, 1, $2 | ||
| 734 | beq $1, $177 | ||
| 735 | sll $2, 32, $1 | ||
| 736 | addq $6, $1, $6 | ||
| 737 | $177: | ||
| 738 | sll $25, 32, $23 | ||
| 739 | ldq $1, 0($18) | ||
| 740 | addq $0, $23, $0 | ||
| 741 | bis $0, $0, $7 | ||
| 742 | ldq $3, 8($17) | ||
| 743 | addq $22, $7, $22 | ||
| 744 | srl $1, 32, $8 | ||
| 745 | cmpult $22, $7, $4 | ||
| 746 | zapnot $3, 15, $7 | ||
| 747 | mulq $8, $7, $28 | ||
| 748 | zapnot $1, 15, $5 | ||
| 749 | mulq $7, $5, $21 | ||
| 750 | srl $25, 32, $1 | ||
| 751 | cmpult $0, $23, $2 | ||
| 752 | addq $6, $1, $6 | ||
| 753 | addq $2, $6, $6 | ||
| 754 | addq $4, $6, $24 | ||
| 755 | srl $3, 32, $6 | ||
| 756 | mulq $5, $6, $2 | ||
| 757 | mulq $6, $8, $6 | ||
| 758 | addq $28, $2, $28 | ||
| 759 | cmpult $28, $2, $1 | ||
| 760 | bis $31, 1, $2 | ||
| 761 | beq $1, $181 | ||
| 762 | sll $2, 32, $1 | ||
| 763 | addq $6, $1, $6 | ||
| 764 | $181: | ||
| 765 | sll $28, 32, $2 | ||
| 766 | addq $21, $2, $21 | ||
| 767 | bis $21, $21, $7 | ||
| 768 | addq $22, $7, $22 | ||
| 769 | stq $22, 8($16) | ||
| 770 | ldq $3, 16($17) | ||
| 771 | ldq $1, 0($18) | ||
| 772 | cmpult $22, $7, $4 | ||
| 773 | zapnot $3, 15, $7 | ||
| 774 | srl $1, 32, $8 | ||
| 775 | mulq $8, $7, $22 | ||
| 776 | zapnot $1, 15, $5 | ||
| 777 | mulq $7, $5, $20 | ||
| 778 | srl $28, 32, $1 | ||
| 779 | cmpult $21, $2, $2 | ||
| 780 | addq $6, $1, $6 | ||
| 781 | addq $2, $6, $6 | ||
| 782 | addq $4, $6, $6 | ||
| 783 | addq $24, $6, $24 | ||
| 784 | cmpult $24, $6, $23 | ||
| 785 | srl $3, 32, $6 | ||
| 786 | mulq $5, $6, $2 | ||
| 787 | mulq $6, $8, $6 | ||
| 788 | addq $22, $2, $22 | ||
| 789 | cmpult $22, $2, $1 | ||
| 790 | bis $31, 1, $2 | ||
| 791 | beq $1, $185 | ||
| 792 | sll $2, 32, $1 | ||
| 793 | addq $6, $1, $6 | ||
| 794 | $185: | ||
| 795 | sll $22, 32, $2 | ||
| 796 | ldq $1, 8($18) | ||
| 797 | addq $20, $2, $20 | ||
| 798 | bis $20, $20, $7 | ||
| 799 | ldq $4, 8($17) | ||
| 800 | addq $24, $7, $24 | ||
| 801 | srl $1, 32, $8 | ||
| 802 | cmpult $24, $7, $3 | ||
| 803 | zapnot $4, 15, $7 | ||
| 804 | mulq $8, $7, $25 | ||
| 805 | zapnot $1, 15, $5 | ||
| 806 | mulq $7, $5, $0 | ||
| 807 | srl $22, 32, $1 | ||
| 808 | cmpult $20, $2, $2 | ||
| 809 | addq $6, $1, $6 | ||
| 810 | addq $2, $6, $6 | ||
| 811 | addq $3, $6, $6 | ||
| 812 | addq $23, $6, $23 | ||
| 813 | cmpult $23, $6, $22 | ||
| 814 | srl $4, 32, $6 | ||
| 815 | mulq $5, $6, $5 | ||
| 816 | bis $31, 1, $21 | ||
| 817 | addq $25, $5, $25 | ||
| 818 | cmpult $25, $5, $1 | ||
| 819 | mulq $6, $8, $6 | ||
| 820 | beq $1, $189 | ||
| 821 | sll $21, 32, $1 | ||
| 822 | addq $6, $1, $6 | ||
| 823 | $189: | ||
| 824 | sll $25, 32, $5 | ||
| 825 | ldq $2, 16($18) | ||
| 826 | addq $0, $5, $0 | ||
| 827 | bis $0, $0, $7 | ||
| 828 | ldq $4, 0($17) | ||
| 829 | addq $24, $7, $24 | ||
| 830 | srl $2, 32, $8 | ||
| 831 | cmpult $24, $7, $3 | ||
| 832 | zapnot $4, 15, $7 | ||
| 833 | mulq $8, $7, $28 | ||
| 834 | srl $25, 32, $1 | ||
| 835 | addq $6, $1, $6 | ||
| 836 | cmpult $0, $5, $1 | ||
| 837 | zapnot $2, 15, $5 | ||
| 838 | addq $1, $6, $6 | ||
| 839 | addq $3, $6, $6 | ||
| 840 | addq $23, $6, $23 | ||
| 841 | cmpult $23, $6, $1 | ||
| 842 | srl $4, 32, $6 | ||
| 843 | mulq $5, $6, $25 | ||
| 844 | mulq $7, $5, $2 | ||
| 845 | addq $1, $22, $22 | ||
| 846 | addq $28, $25, $28 | ||
| 847 | cmpult $28, $25, $1 | ||
| 848 | mulq $6, $8, $6 | ||
| 849 | beq $1, $193 | ||
| 850 | sll $21, 32, $1 | ||
| 851 | addq $6, $1, $6 | ||
| 852 | $193: | ||
| 853 | sll $28, 32, $25 | ||
| 854 | addq $2, $25, $2 | ||
| 855 | bis $2, $2, $7 | ||
| 856 | addq $24, $7, $24 | ||
| 857 | stq $24, 16($16) | ||
| 858 | ldq $4, 0($17) | ||
| 859 | ldq $5, 24($18) | ||
| 860 | cmpult $24, $7, $3 | ||
| 861 | zapnot $4, 15, $7 | ||
| 862 | srl $5, 32, $8 | ||
| 863 | mulq $8, $7, $0 | ||
| 864 | srl $28, 32, $1 | ||
| 865 | cmpult $2, $25, $2 | ||
| 866 | addq $6, $1, $6 | ||
| 867 | addq $2, $6, $6 | ||
| 868 | addq $3, $6, $6 | ||
| 869 | addq $23, $6, $23 | ||
| 870 | cmpult $23, $6, $1 | ||
| 871 | srl $4, 32, $6 | ||
| 872 | zapnot $5, 15, $5 | ||
| 873 | mulq $5, $6, $24 | ||
| 874 | mulq $7, $5, $2 | ||
| 875 | addq $1, $22, $22 | ||
| 876 | addq $0, $24, $0 | ||
| 877 | cmpult $0, $24, $1 | ||
| 878 | mulq $6, $8, $6 | ||
| 879 | beq $1, $197 | ||
| 880 | sll $21, 32, $1 | ||
| 881 | addq $6, $1, $6 | ||
| 882 | $197: | ||
| 883 | sll $0, 32, $24 | ||
| 884 | ldq $1, 16($18) | ||
| 885 | addq $2, $24, $2 | ||
| 886 | bis $2, $2, $7 | ||
| 887 | ldq $4, 8($17) | ||
| 888 | addq $23, $7, $23 | ||
| 889 | srl $1, 32, $8 | ||
| 890 | cmpult $23, $7, $3 | ||
| 891 | zapnot $4, 15, $7 | ||
| 892 | mulq $8, $7, $25 | ||
| 893 | zapnot $1, 15, $5 | ||
| 894 | mulq $7, $5, $21 | ||
| 895 | srl $0, 32, $1 | ||
| 896 | cmpult $2, $24, $2 | ||
| 897 | addq $6, $1, $6 | ||
| 898 | addq $2, $6, $6 | ||
| 899 | addq $3, $6, $6 | ||
| 900 | addq $22, $6, $22 | ||
| 901 | cmpult $22, $6, $24 | ||
| 902 | srl $4, 32, $6 | ||
| 903 | mulq $5, $6, $5 | ||
| 904 | bis $31, 1, $20 | ||
| 905 | addq $25, $5, $25 | ||
| 906 | cmpult $25, $5, $1 | ||
| 907 | mulq $6, $8, $6 | ||
| 908 | beq $1, $201 | ||
| 909 | sll $20, 32, $1 | ||
| 910 | addq $6, $1, $6 | ||
| 911 | $201: | ||
| 912 | sll $25, 32, $5 | ||
| 913 | ldq $2, 8($18) | ||
| 914 | addq $21, $5, $21 | ||
| 915 | bis $21, $21, $7 | ||
| 916 | ldq $4, 16($17) | ||
| 917 | addq $23, $7, $23 | ||
| 918 | srl $2, 32, $8 | ||
| 919 | cmpult $23, $7, $3 | ||
| 920 | zapnot $4, 15, $7 | ||
| 921 | mulq $8, $7, $28 | ||
| 922 | srl $25, 32, $1 | ||
| 923 | addq $6, $1, $6 | ||
| 924 | cmpult $21, $5, $1 | ||
| 925 | zapnot $2, 15, $5 | ||
| 926 | addq $1, $6, $6 | ||
| 927 | addq $3, $6, $6 | ||
| 928 | addq $22, $6, $22 | ||
| 929 | cmpult $22, $6, $1 | ||
| 930 | srl $4, 32, $6 | ||
| 931 | mulq $5, $6, $25 | ||
| 932 | mulq $7, $5, $5 | ||
| 933 | addq $1, $24, $24 | ||
| 934 | addq $28, $25, $28 | ||
| 935 | cmpult $28, $25, $1 | ||
| 936 | mulq $6, $8, $6 | ||
| 937 | beq $1, $205 | ||
| 938 | sll $20, 32, $1 | ||
| 939 | addq $6, $1, $6 | ||
| 940 | $205: | ||
| 941 | sll $28, 32, $25 | ||
| 942 | ldq $2, 0($18) | ||
| 943 | addq $5, $25, $5 | ||
| 944 | bis $5, $5, $7 | ||
| 945 | ldq $4, 24($17) | ||
| 946 | addq $23, $7, $23 | ||
| 947 | srl $2, 32, $8 | ||
| 948 | cmpult $23, $7, $3 | ||
| 949 | zapnot $4, 15, $7 | ||
| 950 | mulq $8, $7, $0 | ||
| 951 | srl $28, 32, $1 | ||
| 952 | addq $6, $1, $6 | ||
| 953 | cmpult $5, $25, $1 | ||
| 954 | zapnot $2, 15, $5 | ||
| 955 | addq $1, $6, $6 | ||
| 956 | addq $3, $6, $6 | ||
| 957 | addq $22, $6, $22 | ||
| 958 | cmpult $22, $6, $1 | ||
| 959 | srl $4, 32, $6 | ||
| 960 | mulq $5, $6, $25 | ||
| 961 | mulq $7, $5, $2 | ||
| 962 | addq $1, $24, $24 | ||
| 963 | addq $0, $25, $0 | ||
| 964 | cmpult $0, $25, $1 | ||
| 965 | mulq $6, $8, $6 | ||
| 966 | beq $1, $209 | ||
| 967 | sll $20, 32, $1 | ||
| 968 | addq $6, $1, $6 | ||
| 969 | $209: | ||
| 970 | sll $0, 32, $25 | ||
| 971 | addq $2, $25, $2 | ||
| 972 | bis $2, $2, $7 | ||
| 973 | addq $23, $7, $23 | ||
| 974 | stq $23, 24($16) | ||
| 975 | ldq $4, 32($17) | ||
| 976 | ldq $5, 0($18) | ||
| 977 | cmpult $23, $7, $3 | ||
| 978 | zapnot $4, 15, $7 | ||
| 979 | srl $5, 32, $8 | ||
| 980 | mulq $8, $7, $28 | ||
| 981 | srl $0, 32, $1 | ||
| 982 | cmpult $2, $25, $2 | ||
| 983 | addq $6, $1, $6 | ||
| 984 | addq $2, $6, $6 | ||
| 985 | addq $3, $6, $6 | ||
| 986 | addq $22, $6, $22 | ||
| 987 | cmpult $22, $6, $1 | ||
| 988 | srl $4, 32, $6 | ||
| 989 | zapnot $5, 15, $5 | ||
| 990 | mulq $5, $6, $23 | ||
| 991 | mulq $7, $5, $2 | ||
| 992 | addq $1, $24, $24 | ||
| 993 | addq $28, $23, $28 | ||
| 994 | cmpult $28, $23, $1 | ||
| 995 | mulq $6, $8, $6 | ||
| 996 | beq $1, $213 | ||
| 997 | sll $20, 32, $1 | ||
| 998 | addq $6, $1, $6 | ||
| 999 | $213: | ||
| 1000 | sll $28, 32, $23 | ||
| 1001 | ldq $1, 8($18) | ||
| 1002 | addq $2, $23, $2 | ||
| 1003 | bis $2, $2, $7 | ||
| 1004 | ldq $4, 24($17) | ||
| 1005 | addq $22, $7, $22 | ||
| 1006 | srl $1, 32, $8 | ||
| 1007 | cmpult $22, $7, $3 | ||
| 1008 | zapnot $4, 15, $7 | ||
| 1009 | mulq $8, $7, $25 | ||
| 1010 | zapnot $1, 15, $5 | ||
| 1011 | mulq $7, $5, $0 | ||
| 1012 | srl $28, 32, $1 | ||
| 1013 | cmpult $2, $23, $2 | ||
| 1014 | addq $6, $1, $6 | ||
| 1015 | addq $2, $6, $6 | ||
| 1016 | addq $3, $6, $6 | ||
| 1017 | addq $24, $6, $24 | ||
| 1018 | cmpult $24, $6, $23 | ||
| 1019 | srl $4, 32, $6 | ||
| 1020 | mulq $5, $6, $5 | ||
| 1021 | bis $31, 1, $21 | ||
| 1022 | addq $25, $5, $25 | ||
| 1023 | cmpult $25, $5, $1 | ||
| 1024 | mulq $6, $8, $6 | ||
| 1025 | beq $1, $217 | ||
| 1026 | sll $21, 32, $1 | ||
| 1027 | addq $6, $1, $6 | ||
| 1028 | $217: | ||
| 1029 | sll $25, 32, $5 | ||
| 1030 | ldq $2, 16($18) | ||
| 1031 | addq $0, $5, $0 | ||
| 1032 | bis $0, $0, $7 | ||
| 1033 | ldq $4, 16($17) | ||
| 1034 | addq $22, $7, $22 | ||
| 1035 | srl $2, 32, $8 | ||
| 1036 | cmpult $22, $7, $3 | ||
| 1037 | zapnot $4, 15, $7 | ||
| 1038 | mulq $8, $7, $28 | ||
| 1039 | srl $25, 32, $1 | ||
| 1040 | addq $6, $1, $6 | ||
| 1041 | cmpult $0, $5, $1 | ||
| 1042 | zapnot $2, 15, $5 | ||
| 1043 | addq $1, $6, $6 | ||
| 1044 | addq $3, $6, $6 | ||
| 1045 | addq $24, $6, $24 | ||
| 1046 | cmpult $24, $6, $1 | ||
| 1047 | srl $4, 32, $6 | ||
| 1048 | mulq $5, $6, $25 | ||
| 1049 | mulq $7, $5, $5 | ||
| 1050 | addq $1, $23, $23 | ||
| 1051 | addq $28, $25, $28 | ||
| 1052 | cmpult $28, $25, $1 | ||
| 1053 | mulq $6, $8, $6 | ||
| 1054 | beq $1, $221 | ||
| 1055 | sll $21, 32, $1 | ||
| 1056 | addq $6, $1, $6 | ||
| 1057 | $221: | ||
| 1058 | sll $28, 32, $25 | ||
| 1059 | ldq $2, 24($18) | ||
| 1060 | addq $5, $25, $5 | ||
| 1061 | bis $5, $5, $7 | ||
| 1062 | ldq $4, 8($17) | ||
| 1063 | addq $22, $7, $22 | ||
| 1064 | srl $2, 32, $8 | ||
| 1065 | cmpult $22, $7, $3 | ||
| 1066 | zapnot $4, 15, $7 | ||
| 1067 | mulq $8, $7, $0 | ||
| 1068 | srl $28, 32, $1 | ||
| 1069 | addq $6, $1, $6 | ||
| 1070 | cmpult $5, $25, $1 | ||
| 1071 | zapnot $2, 15, $5 | ||
| 1072 | addq $1, $6, $6 | ||
| 1073 | addq $3, $6, $6 | ||
| 1074 | addq $24, $6, $24 | ||
| 1075 | cmpult $24, $6, $1 | ||
| 1076 | srl $4, 32, $6 | ||
| 1077 | mulq $5, $6, $25 | ||
| 1078 | mulq $7, $5, $5 | ||
| 1079 | addq $1, $23, $23 | ||
| 1080 | addq $0, $25, $0 | ||
| 1081 | cmpult $0, $25, $1 | ||
| 1082 | mulq $6, $8, $6 | ||
| 1083 | beq $1, $225 | ||
| 1084 | sll $21, 32, $1 | ||
| 1085 | addq $6, $1, $6 | ||
| 1086 | $225: | ||
| 1087 | sll $0, 32, $25 | ||
| 1088 | ldq $2, 32($18) | ||
| 1089 | addq $5, $25, $5 | ||
| 1090 | bis $5, $5, $7 | ||
| 1091 | ldq $4, 0($17) | ||
| 1092 | addq $22, $7, $22 | ||
| 1093 | srl $2, 32, $8 | ||
| 1094 | cmpult $22, $7, $3 | ||
| 1095 | zapnot $4, 15, $7 | ||
| 1096 | mulq $8, $7, $28 | ||
| 1097 | srl $0, 32, $1 | ||
| 1098 | addq $6, $1, $6 | ||
| 1099 | cmpult $5, $25, $1 | ||
| 1100 | zapnot $2, 15, $5 | ||
| 1101 | addq $1, $6, $6 | ||
| 1102 | addq $3, $6, $6 | ||
| 1103 | addq $24, $6, $24 | ||
| 1104 | cmpult $24, $6, $1 | ||
| 1105 | srl $4, 32, $6 | ||
| 1106 | mulq $5, $6, $25 | ||
| 1107 | mulq $7, $5, $2 | ||
| 1108 | addq $1, $23, $23 | ||
| 1109 | addq $28, $25, $28 | ||
| 1110 | cmpult $28, $25, $1 | ||
| 1111 | mulq $6, $8, $6 | ||
| 1112 | beq $1, $229 | ||
| 1113 | sll $21, 32, $1 | ||
| 1114 | addq $6, $1, $6 | ||
| 1115 | $229: | ||
| 1116 | sll $28, 32, $25 | ||
| 1117 | addq $2, $25, $2 | ||
| 1118 | bis $2, $2, $7 | ||
| 1119 | addq $22, $7, $22 | ||
| 1120 | stq $22, 32($16) | ||
| 1121 | ldq $4, 0($17) | ||
| 1122 | ldq $5, 40($18) | ||
| 1123 | cmpult $22, $7, $3 | ||
| 1124 | zapnot $4, 15, $7 | ||
| 1125 | srl $5, 32, $8 | ||
| 1126 | mulq $8, $7, $0 | ||
| 1127 | srl $28, 32, $1 | ||
| 1128 | cmpult $2, $25, $2 | ||
| 1129 | addq $6, $1, $6 | ||
| 1130 | addq $2, $6, $6 | ||
| 1131 | addq $3, $6, $6 | ||
| 1132 | addq $24, $6, $24 | ||
| 1133 | cmpult $24, $6, $1 | ||
| 1134 | srl $4, 32, $6 | ||
| 1135 | zapnot $5, 15, $5 | ||
| 1136 | mulq $5, $6, $22 | ||
| 1137 | mulq $7, $5, $2 | ||
| 1138 | addq $1, $23, $23 | ||
| 1139 | addq $0, $22, $0 | ||
| 1140 | cmpult $0, $22, $1 | ||
| 1141 | mulq $6, $8, $6 | ||
| 1142 | beq $1, $233 | ||
| 1143 | sll $21, 32, $1 | ||
| 1144 | addq $6, $1, $6 | ||
| 1145 | $233: | ||
| 1146 | sll $0, 32, $22 | ||
| 1147 | ldq $1, 32($18) | ||
| 1148 | addq $2, $22, $2 | ||
| 1149 | bis $2, $2, $7 | ||
| 1150 | ldq $4, 8($17) | ||
| 1151 | addq $24, $7, $24 | ||
| 1152 | srl $1, 32, $8 | ||
| 1153 | cmpult $24, $7, $3 | ||
| 1154 | zapnot $4, 15, $7 | ||
| 1155 | mulq $8, $7, $25 | ||
| 1156 | zapnot $1, 15, $5 | ||
| 1157 | mulq $7, $5, $21 | ||
| 1158 | srl $0, 32, $1 | ||
| 1159 | cmpult $2, $22, $2 | ||
| 1160 | addq $6, $1, $6 | ||
| 1161 | addq $2, $6, $6 | ||
| 1162 | addq $3, $6, $6 | ||
| 1163 | addq $23, $6, $23 | ||
| 1164 | cmpult $23, $6, $22 | ||
| 1165 | srl $4, 32, $6 | ||
| 1166 | mulq $5, $6, $5 | ||
| 1167 | bis $31, 1, $20 | ||
| 1168 | addq $25, $5, $25 | ||
| 1169 | cmpult $25, $5, $1 | ||
| 1170 | mulq $6, $8, $6 | ||
| 1171 | beq $1, $237 | ||
| 1172 | sll $20, 32, $1 | ||
| 1173 | addq $6, $1, $6 | ||
| 1174 | $237: | ||
| 1175 | sll $25, 32, $5 | ||
| 1176 | ldq $2, 24($18) | ||
| 1177 | addq $21, $5, $21 | ||
| 1178 | bis $21, $21, $7 | ||
| 1179 | ldq $4, 16($17) | ||
| 1180 | addq $24, $7, $24 | ||
| 1181 | srl $2, 32, $8 | ||
| 1182 | cmpult $24, $7, $3 | ||
| 1183 | zapnot $4, 15, $7 | ||
| 1184 | mulq $8, $7, $28 | ||
| 1185 | srl $25, 32, $1 | ||
| 1186 | addq $6, $1, $6 | ||
| 1187 | cmpult $21, $5, $1 | ||
| 1188 | zapnot $2, 15, $5 | ||
| 1189 | addq $1, $6, $6 | ||
| 1190 | addq $3, $6, $6 | ||
| 1191 | addq $23, $6, $23 | ||
| 1192 | cmpult $23, $6, $1 | ||
| 1193 | srl $4, 32, $6 | ||
| 1194 | mulq $5, $6, $25 | ||
| 1195 | mulq $7, $5, $5 | ||
| 1196 | addq $1, $22, $22 | ||
| 1197 | addq $28, $25, $28 | ||
| 1198 | cmpult $28, $25, $1 | ||
| 1199 | mulq $6, $8, $6 | ||
| 1200 | beq $1, $241 | ||
| 1201 | sll $20, 32, $1 | ||
| 1202 | addq $6, $1, $6 | ||
| 1203 | $241: | ||
| 1204 | sll $28, 32, $25 | ||
| 1205 | ldq $2, 16($18) | ||
| 1206 | addq $5, $25, $5 | ||
| 1207 | bis $5, $5, $7 | ||
| 1208 | ldq $4, 24($17) | ||
| 1209 | addq $24, $7, $24 | ||
| 1210 | srl $2, 32, $8 | ||
| 1211 | cmpult $24, $7, $3 | ||
| 1212 | zapnot $4, 15, $7 | ||
| 1213 | mulq $8, $7, $0 | ||
| 1214 | srl $28, 32, $1 | ||
| 1215 | addq $6, $1, $6 | ||
| 1216 | cmpult $5, $25, $1 | ||
| 1217 | zapnot $2, 15, $5 | ||
| 1218 | addq $1, $6, $6 | ||
| 1219 | addq $3, $6, $6 | ||
| 1220 | addq $23, $6, $23 | ||
| 1221 | cmpult $23, $6, $1 | ||
| 1222 | srl $4, 32, $6 | ||
| 1223 | mulq $5, $6, $25 | ||
| 1224 | mulq $7, $5, $5 | ||
| 1225 | addq $1, $22, $22 | ||
| 1226 | addq $0, $25, $0 | ||
| 1227 | cmpult $0, $25, $1 | ||
| 1228 | mulq $6, $8, $6 | ||
| 1229 | beq $1, $245 | ||
| 1230 | sll $20, 32, $1 | ||
| 1231 | addq $6, $1, $6 | ||
| 1232 | $245: | ||
| 1233 | sll $0, 32, $25 | ||
| 1234 | ldq $2, 8($18) | ||
| 1235 | addq $5, $25, $5 | ||
| 1236 | bis $5, $5, $7 | ||
| 1237 | ldq $4, 32($17) | ||
| 1238 | addq $24, $7, $24 | ||
| 1239 | srl $2, 32, $8 | ||
| 1240 | cmpult $24, $7, $3 | ||
| 1241 | zapnot $4, 15, $7 | ||
| 1242 | mulq $8, $7, $28 | ||
| 1243 | srl $0, 32, $1 | ||
| 1244 | addq $6, $1, $6 | ||
| 1245 | cmpult $5, $25, $1 | ||
| 1246 | zapnot $2, 15, $5 | ||
| 1247 | addq $1, $6, $6 | ||
| 1248 | addq $3, $6, $6 | ||
| 1249 | addq $23, $6, $23 | ||
| 1250 | cmpult $23, $6, $1 | ||
| 1251 | srl $4, 32, $6 | ||
| 1252 | mulq $5, $6, $25 | ||
| 1253 | mulq $7, $5, $5 | ||
| 1254 | addq $1, $22, $22 | ||
| 1255 | addq $28, $25, $28 | ||
| 1256 | cmpult $28, $25, $1 | ||
| 1257 | mulq $6, $8, $6 | ||
| 1258 | beq $1, $249 | ||
| 1259 | sll $20, 32, $1 | ||
| 1260 | addq $6, $1, $6 | ||
| 1261 | $249: | ||
| 1262 | sll $28, 32, $25 | ||
| 1263 | ldq $2, 0($18) | ||
| 1264 | addq $5, $25, $5 | ||
| 1265 | bis $5, $5, $7 | ||
| 1266 | ldq $4, 40($17) | ||
| 1267 | addq $24, $7, $24 | ||
| 1268 | srl $2, 32, $8 | ||
| 1269 | cmpult $24, $7, $3 | ||
| 1270 | zapnot $4, 15, $7 | ||
| 1271 | mulq $8, $7, $0 | ||
| 1272 | srl $28, 32, $1 | ||
| 1273 | addq $6, $1, $6 | ||
| 1274 | cmpult $5, $25, $1 | ||
| 1275 | zapnot $2, 15, $5 | ||
| 1276 | addq $1, $6, $6 | ||
| 1277 | addq $3, $6, $6 | ||
| 1278 | addq $23, $6, $23 | ||
| 1279 | cmpult $23, $6, $1 | ||
| 1280 | srl $4, 32, $6 | ||
| 1281 | mulq $5, $6, $25 | ||
| 1282 | mulq $7, $5, $2 | ||
| 1283 | addq $1, $22, $22 | ||
| 1284 | addq $0, $25, $0 | ||
| 1285 | cmpult $0, $25, $1 | ||
| 1286 | mulq $6, $8, $6 | ||
| 1287 | beq $1, $253 | ||
| 1288 | sll $20, 32, $1 | ||
| 1289 | addq $6, $1, $6 | ||
| 1290 | $253: | ||
| 1291 | sll $0, 32, $25 | ||
| 1292 | addq $2, $25, $2 | ||
| 1293 | bis $2, $2, $7 | ||
| 1294 | addq $24, $7, $24 | ||
| 1295 | stq $24, 40($16) | ||
| 1296 | ldq $4, 48($17) | ||
| 1297 | ldq $5, 0($18) | ||
| 1298 | cmpult $24, $7, $3 | ||
| 1299 | zapnot $4, 15, $7 | ||
| 1300 | srl $5, 32, $8 | ||
| 1301 | mulq $8, $7, $28 | ||
| 1302 | srl $0, 32, $1 | ||
| 1303 | cmpult $2, $25, $2 | ||
| 1304 | addq $6, $1, $6 | ||
| 1305 | addq $2, $6, $6 | ||
| 1306 | addq $3, $6, $6 | ||
| 1307 | addq $23, $6, $23 | ||
| 1308 | cmpult $23, $6, $1 | ||
| 1309 | srl $4, 32, $6 | ||
| 1310 | zapnot $5, 15, $5 | ||
| 1311 | mulq $5, $6, $24 | ||
| 1312 | mulq $7, $5, $2 | ||
| 1313 | addq $1, $22, $22 | ||
| 1314 | addq $28, $24, $28 | ||
| 1315 | cmpult $28, $24, $1 | ||
| 1316 | mulq $6, $8, $6 | ||
| 1317 | beq $1, $257 | ||
| 1318 | sll $20, 32, $1 | ||
| 1319 | addq $6, $1, $6 | ||
| 1320 | $257: | ||
| 1321 | sll $28, 32, $24 | ||
| 1322 | ldq $1, 8($18) | ||
| 1323 | addq $2, $24, $2 | ||
| 1324 | bis $2, $2, $7 | ||
| 1325 | ldq $4, 40($17) | ||
| 1326 | addq $23, $7, $23 | ||
| 1327 | srl $1, 32, $8 | ||
| 1328 | cmpult $23, $7, $3 | ||
| 1329 | zapnot $4, 15, $7 | ||
| 1330 | mulq $8, $7, $25 | ||
| 1331 | zapnot $1, 15, $5 | ||
| 1332 | mulq $7, $5, $0 | ||
| 1333 | srl $28, 32, $1 | ||
| 1334 | cmpult $2, $24, $2 | ||
| 1335 | addq $6, $1, $6 | ||
| 1336 | addq $2, $6, $6 | ||
| 1337 | addq $3, $6, $6 | ||
| 1338 | addq $22, $6, $22 | ||
| 1339 | cmpult $22, $6, $24 | ||
| 1340 | srl $4, 32, $6 | ||
| 1341 | mulq $5, $6, $5 | ||
| 1342 | bis $31, 1, $21 | ||
| 1343 | addq $25, $5, $25 | ||
| 1344 | cmpult $25, $5, $1 | ||
| 1345 | mulq $6, $8, $6 | ||
| 1346 | beq $1, $261 | ||
| 1347 | sll $21, 32, $1 | ||
| 1348 | addq $6, $1, $6 | ||
| 1349 | $261: | ||
| 1350 | sll $25, 32, $5 | ||
| 1351 | ldq $2, 16($18) | ||
| 1352 | addq $0, $5, $0 | ||
| 1353 | bis $0, $0, $7 | ||
| 1354 | ldq $4, 32($17) | ||
| 1355 | addq $23, $7, $23 | ||
| 1356 | srl $2, 32, $8 | ||
| 1357 | cmpult $23, $7, $3 | ||
| 1358 | zapnot $4, 15, $7 | ||
| 1359 | mulq $8, $7, $28 | ||
| 1360 | srl $25, 32, $1 | ||
| 1361 | addq $6, $1, $6 | ||
| 1362 | cmpult $0, $5, $1 | ||
| 1363 | zapnot $2, 15, $5 | ||
| 1364 | addq $1, $6, $6 | ||
| 1365 | addq $3, $6, $6 | ||
| 1366 | addq $22, $6, $22 | ||
| 1367 | cmpult $22, $6, $1 | ||
| 1368 | srl $4, 32, $6 | ||
| 1369 | mulq $5, $6, $25 | ||
| 1370 | mulq $7, $5, $5 | ||
| 1371 | addq $1, $24, $24 | ||
| 1372 | addq $28, $25, $28 | ||
| 1373 | cmpult $28, $25, $1 | ||
| 1374 | mulq $6, $8, $6 | ||
| 1375 | beq $1, $265 | ||
| 1376 | sll $21, 32, $1 | ||
| 1377 | addq $6, $1, $6 | ||
| 1378 | $265: | ||
| 1379 | sll $28, 32, $25 | ||
| 1380 | ldq $2, 24($18) | ||
| 1381 | addq $5, $25, $5 | ||
| 1382 | bis $5, $5, $7 | ||
| 1383 | ldq $4, 24($17) | ||
| 1384 | addq $23, $7, $23 | ||
| 1385 | srl $2, 32, $8 | ||
| 1386 | cmpult $23, $7, $3 | ||
| 1387 | zapnot $4, 15, $7 | ||
| 1388 | mulq $8, $7, $0 | ||
| 1389 | srl $28, 32, $1 | ||
| 1390 | addq $6, $1, $6 | ||
| 1391 | cmpult $5, $25, $1 | ||
| 1392 | zapnot $2, 15, $5 | ||
| 1393 | addq $1, $6, $6 | ||
| 1394 | addq $3, $6, $6 | ||
| 1395 | addq $22, $6, $22 | ||
| 1396 | cmpult $22, $6, $1 | ||
| 1397 | srl $4, 32, $6 | ||
| 1398 | mulq $5, $6, $25 | ||
| 1399 | mulq $7, $5, $5 | ||
| 1400 | addq $1, $24, $24 | ||
| 1401 | addq $0, $25, $0 | ||
| 1402 | cmpult $0, $25, $1 | ||
| 1403 | mulq $6, $8, $6 | ||
| 1404 | beq $1, $269 | ||
| 1405 | sll $21, 32, $1 | ||
| 1406 | addq $6, $1, $6 | ||
| 1407 | $269: | ||
| 1408 | sll $0, 32, $25 | ||
| 1409 | ldq $2, 32($18) | ||
| 1410 | addq $5, $25, $5 | ||
| 1411 | bis $5, $5, $7 | ||
| 1412 | ldq $4, 16($17) | ||
| 1413 | addq $23, $7, $23 | ||
| 1414 | srl $2, 32, $8 | ||
| 1415 | cmpult $23, $7, $3 | ||
| 1416 | zapnot $4, 15, $7 | ||
| 1417 | mulq $8, $7, $28 | ||
| 1418 | srl $0, 32, $1 | ||
| 1419 | addq $6, $1, $6 | ||
| 1420 | cmpult $5, $25, $1 | ||
| 1421 | zapnot $2, 15, $5 | ||
| 1422 | addq $1, $6, $6 | ||
| 1423 | addq $3, $6, $6 | ||
| 1424 | addq $22, $6, $22 | ||
| 1425 | cmpult $22, $6, $1 | ||
| 1426 | srl $4, 32, $6 | ||
| 1427 | mulq $5, $6, $25 | ||
| 1428 | mulq $7, $5, $5 | ||
| 1429 | addq $1, $24, $24 | ||
| 1430 | addq $28, $25, $28 | ||
| 1431 | cmpult $28, $25, $1 | ||
| 1432 | mulq $6, $8, $6 | ||
| 1433 | beq $1, $273 | ||
| 1434 | sll $21, 32, $1 | ||
| 1435 | addq $6, $1, $6 | ||
| 1436 | $273: | ||
| 1437 | sll $28, 32, $25 | ||
| 1438 | ldq $2, 40($18) | ||
| 1439 | addq $5, $25, $5 | ||
| 1440 | bis $5, $5, $7 | ||
| 1441 | ldq $4, 8($17) | ||
| 1442 | addq $23, $7, $23 | ||
| 1443 | srl $2, 32, $8 | ||
| 1444 | cmpult $23, $7, $3 | ||
| 1445 | zapnot $4, 15, $7 | ||
| 1446 | mulq $8, $7, $0 | ||
| 1447 | srl $28, 32, $1 | ||
| 1448 | addq $6, $1, $6 | ||
| 1449 | cmpult $5, $25, $1 | ||
| 1450 | zapnot $2, 15, $5 | ||
| 1451 | addq $1, $6, $6 | ||
| 1452 | addq $3, $6, $6 | ||
| 1453 | addq $22, $6, $22 | ||
| 1454 | cmpult $22, $6, $1 | ||
| 1455 | srl $4, 32, $6 | ||
| 1456 | mulq $5, $6, $25 | ||
| 1457 | mulq $7, $5, $5 | ||
| 1458 | addq $1, $24, $24 | ||
| 1459 | addq $0, $25, $0 | ||
| 1460 | cmpult $0, $25, $1 | ||
| 1461 | mulq $6, $8, $6 | ||
| 1462 | beq $1, $277 | ||
| 1463 | sll $21, 32, $1 | ||
| 1464 | addq $6, $1, $6 | ||
| 1465 | $277: | ||
| 1466 | sll $0, 32, $25 | ||
| 1467 | ldq $2, 48($18) | ||
| 1468 | addq $5, $25, $5 | ||
| 1469 | bis $5, $5, $7 | ||
| 1470 | ldq $4, 0($17) | ||
| 1471 | addq $23, $7, $23 | ||
| 1472 | srl $2, 32, $8 | ||
| 1473 | cmpult $23, $7, $3 | ||
| 1474 | zapnot $4, 15, $7 | ||
| 1475 | mulq $8, $7, $28 | ||
| 1476 | srl $0, 32, $1 | ||
| 1477 | addq $6, $1, $6 | ||
| 1478 | cmpult $5, $25, $1 | ||
| 1479 | zapnot $2, 15, $5 | ||
| 1480 | addq $1, $6, $6 | ||
| 1481 | addq $3, $6, $6 | ||
| 1482 | addq $22, $6, $22 | ||
| 1483 | cmpult $22, $6, $1 | ||
| 1484 | srl $4, 32, $6 | ||
| 1485 | mulq $5, $6, $25 | ||
| 1486 | mulq $7, $5, $2 | ||
| 1487 | addq $1, $24, $24 | ||
| 1488 | addq $28, $25, $28 | ||
| 1489 | cmpult $28, $25, $1 | ||
| 1490 | mulq $6, $8, $6 | ||
| 1491 | beq $1, $281 | ||
| 1492 | sll $21, 32, $1 | ||
| 1493 | addq $6, $1, $6 | ||
| 1494 | $281: | ||
| 1495 | sll $28, 32, $25 | ||
| 1496 | addq $2, $25, $2 | ||
| 1497 | bis $2, $2, $7 | ||
| 1498 | addq $23, $7, $23 | ||
| 1499 | stq $23, 48($16) | ||
| 1500 | ldq $4, 0($17) | ||
| 1501 | ldq $5, 56($18) | ||
| 1502 | cmpult $23, $7, $3 | ||
| 1503 | zapnot $4, 15, $7 | ||
| 1504 | srl $5, 32, $8 | ||
| 1505 | mulq $8, $7, $0 | ||
| 1506 | srl $28, 32, $1 | ||
| 1507 | cmpult $2, $25, $2 | ||
| 1508 | addq $6, $1, $6 | ||
| 1509 | addq $2, $6, $6 | ||
| 1510 | addq $3, $6, $6 | ||
| 1511 | addq $22, $6, $22 | ||
| 1512 | cmpult $22, $6, $1 | ||
| 1513 | srl $4, 32, $6 | ||
| 1514 | zapnot $5, 15, $5 | ||
| 1515 | mulq $5, $6, $23 | ||
| 1516 | mulq $7, $5, $2 | ||
| 1517 | addq $1, $24, $24 | ||
| 1518 | addq $0, $23, $0 | ||
| 1519 | cmpult $0, $23, $1 | ||
| 1520 | mulq $6, $8, $6 | ||
| 1521 | beq $1, $285 | ||
| 1522 | sll $21, 32, $1 | ||
| 1523 | addq $6, $1, $6 | ||
| 1524 | $285: | ||
| 1525 | sll $0, 32, $23 | ||
| 1526 | ldq $1, 48($18) | ||
| 1527 | addq $2, $23, $2 | ||
| 1528 | bis $2, $2, $7 | ||
| 1529 | ldq $4, 8($17) | ||
| 1530 | addq $22, $7, $22 | ||
| 1531 | srl $1, 32, $8 | ||
| 1532 | cmpult $22, $7, $3 | ||
| 1533 | zapnot $4, 15, $7 | ||
| 1534 | mulq $8, $7, $25 | ||
| 1535 | zapnot $1, 15, $5 | ||
| 1536 | mulq $7, $5, $21 | ||
| 1537 | srl $0, 32, $1 | ||
| 1538 | cmpult $2, $23, $2 | ||
| 1539 | addq $6, $1, $6 | ||
| 1540 | addq $2, $6, $6 | ||
| 1541 | addq $3, $6, $6 | ||
| 1542 | addq $24, $6, $24 | ||
| 1543 | cmpult $24, $6, $23 | ||
| 1544 | srl $4, 32, $6 | ||
| 1545 | mulq $5, $6, $5 | ||
| 1546 | bis $31, 1, $20 | ||
| 1547 | addq $25, $5, $25 | ||
| 1548 | cmpult $25, $5, $1 | ||
| 1549 | mulq $6, $8, $6 | ||
| 1550 | beq $1, $289 | ||
| 1551 | sll $20, 32, $1 | ||
| 1552 | addq $6, $1, $6 | ||
| 1553 | $289: | ||
| 1554 | sll $25, 32, $5 | ||
| 1555 | ldq $2, 40($18) | ||
| 1556 | addq $21, $5, $21 | ||
| 1557 | bis $21, $21, $7 | ||
| 1558 | ldq $4, 16($17) | ||
| 1559 | addq $22, $7, $22 | ||
| 1560 | srl $2, 32, $8 | ||
| 1561 | cmpult $22, $7, $3 | ||
| 1562 | zapnot $4, 15, $7 | ||
| 1563 | mulq $8, $7, $28 | ||
| 1564 | srl $25, 32, $1 | ||
| 1565 | addq $6, $1, $6 | ||
| 1566 | cmpult $21, $5, $1 | ||
| 1567 | zapnot $2, 15, $5 | ||
| 1568 | addq $1, $6, $6 | ||
| 1569 | addq $3, $6, $6 | ||
| 1570 | addq $24, $6, $24 | ||
| 1571 | cmpult $24, $6, $1 | ||
| 1572 | srl $4, 32, $6 | ||
| 1573 | mulq $5, $6, $25 | ||
| 1574 | mulq $7, $5, $5 | ||
| 1575 | addq $1, $23, $23 | ||
| 1576 | addq $28, $25, $28 | ||
| 1577 | cmpult $28, $25, $1 | ||
| 1578 | mulq $6, $8, $6 | ||
| 1579 | beq $1, $293 | ||
| 1580 | sll $20, 32, $1 | ||
| 1581 | addq $6, $1, $6 | ||
| 1582 | $293: | ||
| 1583 | sll $28, 32, $25 | ||
| 1584 | ldq $2, 32($18) | ||
| 1585 | addq $5, $25, $5 | ||
| 1586 | bis $5, $5, $7 | ||
| 1587 | ldq $4, 24($17) | ||
| 1588 | addq $22, $7, $22 | ||
| 1589 | srl $2, 32, $8 | ||
| 1590 | cmpult $22, $7, $3 | ||
| 1591 | zapnot $4, 15, $7 | ||
| 1592 | mulq $8, $7, $0 | ||
| 1593 | srl $28, 32, $1 | ||
| 1594 | addq $6, $1, $6 | ||
| 1595 | cmpult $5, $25, $1 | ||
| 1596 | zapnot $2, 15, $5 | ||
| 1597 | addq $1, $6, $6 | ||
| 1598 | addq $3, $6, $6 | ||
| 1599 | addq $24, $6, $24 | ||
| 1600 | cmpult $24, $6, $1 | ||
| 1601 | srl $4, 32, $6 | ||
| 1602 | mulq $5, $6, $25 | ||
| 1603 | mulq $7, $5, $5 | ||
| 1604 | addq $1, $23, $23 | ||
| 1605 | addq $0, $25, $0 | ||
| 1606 | cmpult $0, $25, $1 | ||
| 1607 | mulq $6, $8, $6 | ||
| 1608 | beq $1, $297 | ||
| 1609 | sll $20, 32, $1 | ||
| 1610 | addq $6, $1, $6 | ||
| 1611 | $297: | ||
| 1612 | sll $0, 32, $25 | ||
| 1613 | ldq $2, 24($18) | ||
| 1614 | addq $5, $25, $5 | ||
| 1615 | bis $5, $5, $7 | ||
| 1616 | ldq $4, 32($17) | ||
| 1617 | addq $22, $7, $22 | ||
| 1618 | srl $2, 32, $8 | ||
| 1619 | cmpult $22, $7, $3 | ||
| 1620 | zapnot $4, 15, $7 | ||
| 1621 | mulq $8, $7, $28 | ||
| 1622 | srl $0, 32, $1 | ||
| 1623 | addq $6, $1, $6 | ||
| 1624 | cmpult $5, $25, $1 | ||
| 1625 | zapnot $2, 15, $5 | ||
| 1626 | addq $1, $6, $6 | ||
| 1627 | addq $3, $6, $6 | ||
| 1628 | addq $24, $6, $24 | ||
| 1629 | cmpult $24, $6, $1 | ||
| 1630 | srl $4, 32, $6 | ||
| 1631 | mulq $5, $6, $25 | ||
| 1632 | mulq $7, $5, $5 | ||
| 1633 | addq $1, $23, $23 | ||
| 1634 | addq $28, $25, $28 | ||
| 1635 | cmpult $28, $25, $1 | ||
| 1636 | mulq $6, $8, $6 | ||
| 1637 | beq $1, $301 | ||
| 1638 | sll $20, 32, $1 | ||
| 1639 | addq $6, $1, $6 | ||
| 1640 | $301: | ||
| 1641 | sll $28, 32, $25 | ||
| 1642 | ldq $2, 16($18) | ||
| 1643 | addq $5, $25, $5 | ||
| 1644 | bis $5, $5, $7 | ||
| 1645 | ldq $4, 40($17) | ||
| 1646 | addq $22, $7, $22 | ||
| 1647 | srl $2, 32, $8 | ||
| 1648 | cmpult $22, $7, $3 | ||
| 1649 | zapnot $4, 15, $7 | ||
| 1650 | mulq $8, $7, $0 | ||
| 1651 | srl $28, 32, $1 | ||
| 1652 | addq $6, $1, $6 | ||
| 1653 | cmpult $5, $25, $1 | ||
| 1654 | zapnot $2, 15, $5 | ||
| 1655 | addq $1, $6, $6 | ||
| 1656 | addq $3, $6, $6 | ||
| 1657 | addq $24, $6, $24 | ||
| 1658 | cmpult $24, $6, $1 | ||
| 1659 | srl $4, 32, $6 | ||
| 1660 | mulq $5, $6, $25 | ||
| 1661 | mulq $7, $5, $5 | ||
| 1662 | addq $1, $23, $23 | ||
| 1663 | addq $0, $25, $0 | ||
| 1664 | cmpult $0, $25, $1 | ||
| 1665 | mulq $6, $8, $6 | ||
| 1666 | beq $1, $305 | ||
| 1667 | sll $20, 32, $1 | ||
| 1668 | addq $6, $1, $6 | ||
| 1669 | $305: | ||
| 1670 | sll $0, 32, $25 | ||
| 1671 | ldq $2, 8($18) | ||
| 1672 | addq $5, $25, $5 | ||
| 1673 | bis $5, $5, $7 | ||
| 1674 | ldq $4, 48($17) | ||
| 1675 | addq $22, $7, $22 | ||
| 1676 | srl $2, 32, $8 | ||
| 1677 | cmpult $22, $7, $3 | ||
| 1678 | zapnot $4, 15, $7 | ||
| 1679 | mulq $8, $7, $28 | ||
| 1680 | srl $0, 32, $1 | ||
| 1681 | addq $6, $1, $6 | ||
| 1682 | cmpult $5, $25, $1 | ||
| 1683 | zapnot $2, 15, $5 | ||
| 1684 | addq $1, $6, $6 | ||
| 1685 | addq $3, $6, $6 | ||
| 1686 | addq $24, $6, $24 | ||
| 1687 | cmpult $24, $6, $1 | ||
| 1688 | srl $4, 32, $6 | ||
| 1689 | mulq $5, $6, $25 | ||
| 1690 | mulq $7, $5, $5 | ||
| 1691 | addq $1, $23, $23 | ||
| 1692 | addq $28, $25, $28 | ||
| 1693 | cmpult $28, $25, $1 | ||
| 1694 | mulq $6, $8, $6 | ||
| 1695 | beq $1, $309 | ||
| 1696 | sll $20, 32, $1 | ||
| 1697 | addq $6, $1, $6 | ||
| 1698 | $309: | ||
| 1699 | sll $28, 32, $25 | ||
| 1700 | ldq $2, 0($18) | ||
| 1701 | addq $5, $25, $5 | ||
| 1702 | bis $5, $5, $7 | ||
| 1703 | ldq $4, 56($17) | ||
| 1704 | addq $22, $7, $22 | ||
| 1705 | srl $2, 32, $8 | ||
| 1706 | cmpult $22, $7, $3 | ||
| 1707 | zapnot $4, 15, $7 | ||
| 1708 | mulq $8, $7, $0 | ||
| 1709 | srl $28, 32, $1 | ||
| 1710 | addq $6, $1, $6 | ||
| 1711 | cmpult $5, $25, $1 | ||
| 1712 | zapnot $2, 15, $5 | ||
| 1713 | addq $1, $6, $6 | ||
| 1714 | addq $3, $6, $6 | ||
| 1715 | addq $24, $6, $24 | ||
| 1716 | cmpult $24, $6, $1 | ||
| 1717 | srl $4, 32, $6 | ||
| 1718 | mulq $5, $6, $25 | ||
| 1719 | mulq $7, $5, $2 | ||
| 1720 | addq $1, $23, $23 | ||
| 1721 | addq $0, $25, $0 | ||
| 1722 | cmpult $0, $25, $1 | ||
| 1723 | mulq $6, $8, $6 | ||
| 1724 | beq $1, $313 | ||
| 1725 | sll $20, 32, $1 | ||
| 1726 | addq $6, $1, $6 | ||
| 1727 | $313: | ||
| 1728 | sll $0, 32, $25 | ||
| 1729 | addq $2, $25, $2 | ||
| 1730 | bis $2, $2, $7 | ||
| 1731 | addq $22, $7, $22 | ||
| 1732 | stq $22, 56($16) | ||
| 1733 | ldq $4, 56($17) | ||
| 1734 | ldq $5, 8($18) | ||
| 1735 | cmpult $22, $7, $3 | ||
| 1736 | zapnot $4, 15, $7 | ||
| 1737 | srl $5, 32, $8 | ||
| 1738 | mulq $8, $7, $28 | ||
| 1739 | srl $0, 32, $1 | ||
| 1740 | cmpult $2, $25, $2 | ||
| 1741 | addq $6, $1, $6 | ||
| 1742 | addq $2, $6, $6 | ||
| 1743 | addq $3, $6, $6 | ||
| 1744 | addq $24, $6, $24 | ||
| 1745 | cmpult $24, $6, $1 | ||
| 1746 | srl $4, 32, $6 | ||
| 1747 | zapnot $5, 15, $5 | ||
| 1748 | mulq $5, $6, $22 | ||
| 1749 | mulq $7, $5, $2 | ||
| 1750 | addq $1, $23, $23 | ||
| 1751 | addq $28, $22, $28 | ||
| 1752 | cmpult $28, $22, $1 | ||
| 1753 | mulq $6, $8, $6 | ||
| 1754 | beq $1, $317 | ||
| 1755 | sll $20, 32, $1 | ||
| 1756 | addq $6, $1, $6 | ||
| 1757 | $317: | ||
| 1758 | sll $28, 32, $22 | ||
| 1759 | ldq $1, 16($18) | ||
| 1760 | addq $2, $22, $2 | ||
| 1761 | bis $2, $2, $7 | ||
| 1762 | ldq $4, 48($17) | ||
| 1763 | addq $24, $7, $24 | ||
| 1764 | srl $1, 32, $8 | ||
| 1765 | cmpult $24, $7, $3 | ||
| 1766 | zapnot $4, 15, $7 | ||
| 1767 | mulq $8, $7, $25 | ||
| 1768 | zapnot $1, 15, $5 | ||
| 1769 | mulq $7, $5, $0 | ||
| 1770 | srl $28, 32, $1 | ||
| 1771 | cmpult $2, $22, $2 | ||
| 1772 | addq $6, $1, $6 | ||
| 1773 | addq $2, $6, $6 | ||
| 1774 | addq $3, $6, $6 | ||
| 1775 | addq $23, $6, $23 | ||
| 1776 | cmpult $23, $6, $22 | ||
| 1777 | srl $4, 32, $6 | ||
| 1778 | mulq $5, $6, $5 | ||
| 1779 | bis $31, 1, $21 | ||
| 1780 | addq $25, $5, $25 | ||
| 1781 | cmpult $25, $5, $1 | ||
| 1782 | mulq $6, $8, $6 | ||
| 1783 | beq $1, $321 | ||
| 1784 | sll $21, 32, $1 | ||
| 1785 | addq $6, $1, $6 | ||
| 1786 | $321: | ||
| 1787 | sll $25, 32, $5 | ||
| 1788 | ldq $2, 24($18) | ||
| 1789 | addq $0, $5, $0 | ||
| 1790 | bis $0, $0, $7 | ||
| 1791 | ldq $4, 40($17) | ||
| 1792 | addq $24, $7, $24 | ||
| 1793 | srl $2, 32, $8 | ||
| 1794 | cmpult $24, $7, $3 | ||
| 1795 | zapnot $4, 15, $7 | ||
| 1796 | mulq $8, $7, $28 | ||
| 1797 | srl $25, 32, $1 | ||
| 1798 | addq $6, $1, $6 | ||
| 1799 | cmpult $0, $5, $1 | ||
| 1800 | zapnot $2, 15, $5 | ||
| 1801 | addq $1, $6, $6 | ||
| 1802 | addq $3, $6, $6 | ||
| 1803 | addq $23, $6, $23 | ||
| 1804 | cmpult $23, $6, $1 | ||
| 1805 | srl $4, 32, $6 | ||
| 1806 | mulq $5, $6, $25 | ||
| 1807 | mulq $7, $5, $5 | ||
| 1808 | addq $1, $22, $22 | ||
| 1809 | addq $28, $25, $28 | ||
| 1810 | cmpult $28, $25, $1 | ||
| 1811 | mulq $6, $8, $6 | ||
| 1812 | beq $1, $325 | ||
| 1813 | sll $21, 32, $1 | ||
| 1814 | addq $6, $1, $6 | ||
| 1815 | $325: | ||
| 1816 | sll $28, 32, $25 | ||
| 1817 | ldq $2, 32($18) | ||
| 1818 | addq $5, $25, $5 | ||
| 1819 | bis $5, $5, $7 | ||
| 1820 | ldq $4, 32($17) | ||
| 1821 | addq $24, $7, $24 | ||
| 1822 | srl $2, 32, $8 | ||
| 1823 | cmpult $24, $7, $3 | ||
| 1824 | zapnot $4, 15, $7 | ||
| 1825 | mulq $8, $7, $0 | ||
| 1826 | srl $28, 32, $1 | ||
| 1827 | addq $6, $1, $6 | ||
| 1828 | cmpult $5, $25, $1 | ||
| 1829 | zapnot $2, 15, $5 | ||
| 1830 | addq $1, $6, $6 | ||
| 1831 | addq $3, $6, $6 | ||
| 1832 | addq $23, $6, $23 | ||
| 1833 | cmpult $23, $6, $1 | ||
| 1834 | srl $4, 32, $6 | ||
| 1835 | mulq $5, $6, $25 | ||
| 1836 | mulq $7, $5, $5 | ||
| 1837 | addq $1, $22, $22 | ||
| 1838 | addq $0, $25, $0 | ||
| 1839 | cmpult $0, $25, $1 | ||
| 1840 | mulq $6, $8, $6 | ||
| 1841 | beq $1, $329 | ||
| 1842 | sll $21, 32, $1 | ||
| 1843 | addq $6, $1, $6 | ||
| 1844 | $329: | ||
| 1845 | sll $0, 32, $25 | ||
| 1846 | ldq $2, 40($18) | ||
| 1847 | addq $5, $25, $5 | ||
| 1848 | bis $5, $5, $7 | ||
| 1849 | ldq $4, 24($17) | ||
| 1850 | addq $24, $7, $24 | ||
| 1851 | srl $2, 32, $8 | ||
| 1852 | cmpult $24, $7, $3 | ||
| 1853 | zapnot $4, 15, $7 | ||
| 1854 | mulq $8, $7, $28 | ||
| 1855 | srl $0, 32, $1 | ||
| 1856 | addq $6, $1, $6 | ||
| 1857 | cmpult $5, $25, $1 | ||
| 1858 | zapnot $2, 15, $5 | ||
| 1859 | addq $1, $6, $6 | ||
| 1860 | addq $3, $6, $6 | ||
| 1861 | addq $23, $6, $23 | ||
| 1862 | cmpult $23, $6, $1 | ||
| 1863 | srl $4, 32, $6 | ||
| 1864 | mulq $5, $6, $25 | ||
| 1865 | mulq $7, $5, $5 | ||
| 1866 | addq $1, $22, $22 | ||
| 1867 | addq $28, $25, $28 | ||
| 1868 | cmpult $28, $25, $1 | ||
| 1869 | mulq $6, $8, $6 | ||
| 1870 | beq $1, $333 | ||
| 1871 | sll $21, 32, $1 | ||
| 1872 | addq $6, $1, $6 | ||
| 1873 | $333: | ||
| 1874 | sll $28, 32, $25 | ||
| 1875 | ldq $2, 48($18) | ||
| 1876 | addq $5, $25, $5 | ||
| 1877 | bis $5, $5, $7 | ||
| 1878 | ldq $4, 16($17) | ||
| 1879 | addq $24, $7, $24 | ||
| 1880 | srl $2, 32, $8 | ||
| 1881 | cmpult $24, $7, $3 | ||
| 1882 | zapnot $4, 15, $7 | ||
| 1883 | mulq $8, $7, $0 | ||
| 1884 | srl $28, 32, $1 | ||
| 1885 | addq $6, $1, $6 | ||
| 1886 | cmpult $5, $25, $1 | ||
| 1887 | zapnot $2, 15, $5 | ||
| 1888 | addq $1, $6, $6 | ||
| 1889 | addq $3, $6, $6 | ||
| 1890 | addq $23, $6, $23 | ||
| 1891 | cmpult $23, $6, $1 | ||
| 1892 | srl $4, 32, $6 | ||
| 1893 | mulq $5, $6, $25 | ||
| 1894 | mulq $7, $5, $5 | ||
| 1895 | addq $1, $22, $22 | ||
| 1896 | addq $0, $25, $0 | ||
| 1897 | cmpult $0, $25, $1 | ||
| 1898 | mulq $6, $8, $6 | ||
| 1899 | beq $1, $337 | ||
| 1900 | sll $21, 32, $1 | ||
| 1901 | addq $6, $1, $6 | ||
| 1902 | $337: | ||
| 1903 | sll $0, 32, $25 | ||
| 1904 | ldq $2, 56($18) | ||
| 1905 | addq $5, $25, $5 | ||
| 1906 | bis $5, $5, $7 | ||
| 1907 | ldq $4, 8($17) | ||
| 1908 | addq $24, $7, $24 | ||
| 1909 | srl $2, 32, $8 | ||
| 1910 | cmpult $24, $7, $3 | ||
| 1911 | zapnot $4, 15, $7 | ||
| 1912 | mulq $8, $7, $28 | ||
| 1913 | srl $0, 32, $1 | ||
| 1914 | addq $6, $1, $6 | ||
| 1915 | cmpult $5, $25, $1 | ||
| 1916 | zapnot $2, 15, $5 | ||
| 1917 | addq $1, $6, $6 | ||
| 1918 | addq $3, $6, $6 | ||
| 1919 | addq $23, $6, $23 | ||
| 1920 | cmpult $23, $6, $1 | ||
| 1921 | srl $4, 32, $6 | ||
| 1922 | mulq $5, $6, $25 | ||
| 1923 | mulq $7, $5, $2 | ||
| 1924 | addq $1, $22, $22 | ||
| 1925 | addq $28, $25, $28 | ||
| 1926 | cmpult $28, $25, $1 | ||
| 1927 | mulq $6, $8, $6 | ||
| 1928 | beq $1, $341 | ||
| 1929 | sll $21, 32, $1 | ||
| 1930 | addq $6, $1, $6 | ||
| 1931 | $341: | ||
| 1932 | sll $28, 32, $25 | ||
| 1933 | addq $2, $25, $2 | ||
| 1934 | bis $2, $2, $7 | ||
| 1935 | addq $24, $7, $24 | ||
| 1936 | stq $24, 64($16) | ||
| 1937 | ldq $4, 16($17) | ||
| 1938 | ldq $5, 56($18) | ||
| 1939 | cmpult $24, $7, $3 | ||
| 1940 | zapnot $4, 15, $7 | ||
| 1941 | srl $5, 32, $8 | ||
| 1942 | mulq $8, $7, $0 | ||
| 1943 | srl $28, 32, $1 | ||
| 1944 | cmpult $2, $25, $2 | ||
| 1945 | addq $6, $1, $6 | ||
| 1946 | addq $2, $6, $6 | ||
| 1947 | addq $3, $6, $6 | ||
| 1948 | addq $23, $6, $23 | ||
| 1949 | cmpult $23, $6, $1 | ||
| 1950 | srl $4, 32, $6 | ||
| 1951 | zapnot $5, 15, $5 | ||
| 1952 | mulq $5, $6, $24 | ||
| 1953 | mulq $7, $5, $2 | ||
| 1954 | addq $1, $22, $22 | ||
| 1955 | addq $0, $24, $0 | ||
| 1956 | cmpult $0, $24, $1 | ||
| 1957 | mulq $6, $8, $6 | ||
| 1958 | beq $1, $345 | ||
| 1959 | sll $21, 32, $1 | ||
| 1960 | addq $6, $1, $6 | ||
| 1961 | $345: | ||
| 1962 | sll $0, 32, $24 | ||
| 1963 | ldq $1, 48($18) | ||
| 1964 | addq $2, $24, $2 | ||
| 1965 | bis $2, $2, $7 | ||
| 1966 | ldq $4, 24($17) | ||
| 1967 | addq $23, $7, $23 | ||
| 1968 | srl $1, 32, $8 | ||
| 1969 | cmpult $23, $7, $3 | ||
| 1970 | zapnot $4, 15, $7 | ||
| 1971 | mulq $8, $7, $25 | ||
| 1972 | zapnot $1, 15, $5 | ||
| 1973 | mulq $7, $5, $21 | ||
| 1974 | srl $0, 32, $1 | ||
| 1975 | cmpult $2, $24, $2 | ||
| 1976 | addq $6, $1, $6 | ||
| 1977 | addq $2, $6, $6 | ||
| 1978 | addq $3, $6, $6 | ||
| 1979 | addq $22, $6, $22 | ||
| 1980 | cmpult $22, $6, $24 | ||
| 1981 | srl $4, 32, $6 | ||
| 1982 | mulq $5, $6, $5 | ||
| 1983 | bis $31, 1, $20 | ||
| 1984 | addq $25, $5, $25 | ||
| 1985 | cmpult $25, $5, $1 | ||
| 1986 | mulq $6, $8, $6 | ||
| 1987 | beq $1, $349 | ||
| 1988 | sll $20, 32, $1 | ||
| 1989 | addq $6, $1, $6 | ||
| 1990 | $349: | ||
| 1991 | sll $25, 32, $5 | ||
| 1992 | ldq $2, 40($18) | ||
| 1993 | addq $21, $5, $21 | ||
| 1994 | bis $21, $21, $7 | ||
| 1995 | ldq $4, 32($17) | ||
| 1996 | addq $23, $7, $23 | ||
| 1997 | srl $2, 32, $8 | ||
| 1998 | cmpult $23, $7, $3 | ||
| 1999 | zapnot $4, 15, $7 | ||
| 2000 | mulq $8, $7, $28 | ||
| 2001 | srl $25, 32, $1 | ||
| 2002 | addq $6, $1, $6 | ||
| 2003 | cmpult $21, $5, $1 | ||
| 2004 | zapnot $2, 15, $5 | ||
| 2005 | addq $1, $6, $6 | ||
| 2006 | addq $3, $6, $6 | ||
| 2007 | addq $22, $6, $22 | ||
| 2008 | cmpult $22, $6, $1 | ||
| 2009 | srl $4, 32, $6 | ||
| 2010 | mulq $5, $6, $25 | ||
| 2011 | mulq $7, $5, $5 | ||
| 2012 | addq $1, $24, $24 | ||
| 2013 | addq $28, $25, $28 | ||
| 2014 | cmpult $28, $25, $1 | ||
| 2015 | mulq $6, $8, $6 | ||
| 2016 | beq $1, $353 | ||
| 2017 | sll $20, 32, $1 | ||
| 2018 | addq $6, $1, $6 | ||
| 2019 | $353: | ||
| 2020 | sll $28, 32, $25 | ||
| 2021 | ldq $2, 32($18) | ||
| 2022 | addq $5, $25, $5 | ||
| 2023 | bis $5, $5, $7 | ||
| 2024 | ldq $4, 40($17) | ||
| 2025 | addq $23, $7, $23 | ||
| 2026 | srl $2, 32, $8 | ||
| 2027 | cmpult $23, $7, $3 | ||
| 2028 | zapnot $4, 15, $7 | ||
| 2029 | mulq $8, $7, $0 | ||
| 2030 | srl $28, 32, $1 | ||
| 2031 | addq $6, $1, $6 | ||
| 2032 | cmpult $5, $25, $1 | ||
| 2033 | zapnot $2, 15, $5 | ||
| 2034 | addq $1, $6, $6 | ||
| 2035 | addq $3, $6, $6 | ||
| 2036 | addq $22, $6, $22 | ||
| 2037 | cmpult $22, $6, $1 | ||
| 2038 | srl $4, 32, $6 | ||
| 2039 | mulq $5, $6, $25 | ||
| 2040 | mulq $7, $5, $5 | ||
| 2041 | addq $1, $24, $24 | ||
| 2042 | addq $0, $25, $0 | ||
| 2043 | cmpult $0, $25, $1 | ||
| 2044 | mulq $6, $8, $6 | ||
| 2045 | beq $1, $357 | ||
| 2046 | sll $20, 32, $1 | ||
| 2047 | addq $6, $1, $6 | ||
| 2048 | $357: | ||
| 2049 | sll $0, 32, $25 | ||
| 2050 | ldq $2, 24($18) | ||
| 2051 | addq $5, $25, $5 | ||
| 2052 | bis $5, $5, $7 | ||
| 2053 | ldq $4, 48($17) | ||
| 2054 | addq $23, $7, $23 | ||
| 2055 | srl $2, 32, $8 | ||
| 2056 | cmpult $23, $7, $3 | ||
| 2057 | zapnot $4, 15, $7 | ||
| 2058 | mulq $8, $7, $28 | ||
| 2059 | srl $0, 32, $1 | ||
| 2060 | addq $6, $1, $6 | ||
| 2061 | cmpult $5, $25, $1 | ||
| 2062 | zapnot $2, 15, $5 | ||
| 2063 | addq $1, $6, $6 | ||
| 2064 | addq $3, $6, $6 | ||
| 2065 | addq $22, $6, $22 | ||
| 2066 | cmpult $22, $6, $1 | ||
| 2067 | srl $4, 32, $6 | ||
| 2068 | mulq $5, $6, $25 | ||
| 2069 | mulq $7, $5, $5 | ||
| 2070 | addq $1, $24, $24 | ||
| 2071 | addq $28, $25, $28 | ||
| 2072 | cmpult $28, $25, $1 | ||
| 2073 | mulq $6, $8, $6 | ||
| 2074 | beq $1, $361 | ||
| 2075 | sll $20, 32, $1 | ||
| 2076 | addq $6, $1, $6 | ||
| 2077 | $361: | ||
| 2078 | sll $28, 32, $25 | ||
| 2079 | ldq $2, 16($18) | ||
| 2080 | addq $5, $25, $5 | ||
| 2081 | bis $5, $5, $7 | ||
| 2082 | ldq $4, 56($17) | ||
| 2083 | addq $23, $7, $23 | ||
| 2084 | srl $2, 32, $8 | ||
| 2085 | cmpult $23, $7, $3 | ||
| 2086 | zapnot $4, 15, $7 | ||
| 2087 | mulq $8, $7, $0 | ||
| 2088 | srl $28, 32, $1 | ||
| 2089 | addq $6, $1, $6 | ||
| 2090 | cmpult $5, $25, $1 | ||
| 2091 | zapnot $2, 15, $5 | ||
| 2092 | addq $1, $6, $6 | ||
| 2093 | addq $3, $6, $6 | ||
| 2094 | addq $22, $6, $22 | ||
| 2095 | cmpult $22, $6, $1 | ||
| 2096 | srl $4, 32, $6 | ||
| 2097 | mulq $5, $6, $25 | ||
| 2098 | mulq $7, $5, $2 | ||
| 2099 | addq $1, $24, $24 | ||
| 2100 | addq $0, $25, $0 | ||
| 2101 | cmpult $0, $25, $1 | ||
| 2102 | mulq $6, $8, $6 | ||
| 2103 | beq $1, $365 | ||
| 2104 | sll $20, 32, $1 | ||
| 2105 | addq $6, $1, $6 | ||
| 2106 | $365: | ||
| 2107 | sll $0, 32, $25 | ||
| 2108 | addq $2, $25, $2 | ||
| 2109 | bis $2, $2, $7 | ||
| 2110 | addq $23, $7, $23 | ||
| 2111 | stq $23, 72($16) | ||
| 2112 | ldq $4, 56($17) | ||
| 2113 | ldq $5, 24($18) | ||
| 2114 | cmpult $23, $7, $3 | ||
| 2115 | zapnot $4, 15, $7 | ||
| 2116 | srl $5, 32, $8 | ||
| 2117 | mulq $8, $7, $28 | ||
| 2118 | srl $0, 32, $1 | ||
| 2119 | cmpult $2, $25, $2 | ||
| 2120 | addq $6, $1, $6 | ||
| 2121 | addq $2, $6, $6 | ||
| 2122 | addq $3, $6, $6 | ||
| 2123 | addq $22, $6, $22 | ||
| 2124 | cmpult $22, $6, $1 | ||
| 2125 | srl $4, 32, $6 | ||
| 2126 | zapnot $5, 15, $5 | ||
| 2127 | mulq $5, $6, $23 | ||
| 2128 | mulq $7, $5, $2 | ||
| 2129 | addq $1, $24, $24 | ||
| 2130 | addq $28, $23, $28 | ||
| 2131 | cmpult $28, $23, $1 | ||
| 2132 | mulq $6, $8, $6 | ||
| 2133 | beq $1, $369 | ||
| 2134 | sll $20, 32, $1 | ||
| 2135 | addq $6, $1, $6 | ||
| 2136 | $369: | ||
| 2137 | sll $28, 32, $23 | ||
| 2138 | ldq $1, 32($18) | ||
| 2139 | addq $2, $23, $2 | ||
| 2140 | bis $2, $2, $7 | ||
| 2141 | ldq $4, 48($17) | ||
| 2142 | addq $22, $7, $22 | ||
| 2143 | srl $1, 32, $8 | ||
| 2144 | cmpult $22, $7, $3 | ||
| 2145 | zapnot $4, 15, $7 | ||
| 2146 | mulq $8, $7, $25 | ||
| 2147 | zapnot $1, 15, $5 | ||
| 2148 | mulq $7, $5, $0 | ||
| 2149 | srl $28, 32, $1 | ||
| 2150 | cmpult $2, $23, $2 | ||
| 2151 | addq $6, $1, $6 | ||
| 2152 | addq $2, $6, $6 | ||
| 2153 | addq $3, $6, $6 | ||
| 2154 | addq $24, $6, $24 | ||
| 2155 | cmpult $24, $6, $23 | ||
| 2156 | srl $4, 32, $6 | ||
| 2157 | mulq $5, $6, $5 | ||
| 2158 | bis $31, 1, $21 | ||
| 2159 | addq $25, $5, $25 | ||
| 2160 | cmpult $25, $5, $1 | ||
| 2161 | mulq $6, $8, $6 | ||
| 2162 | beq $1, $373 | ||
| 2163 | sll $21, 32, $1 | ||
| 2164 | addq $6, $1, $6 | ||
| 2165 | $373: | ||
| 2166 | sll $25, 32, $5 | ||
| 2167 | ldq $2, 40($18) | ||
| 2168 | addq $0, $5, $0 | ||
| 2169 | bis $0, $0, $7 | ||
| 2170 | ldq $4, 40($17) | ||
| 2171 | addq $22, $7, $22 | ||
| 2172 | srl $2, 32, $8 | ||
| 2173 | cmpult $22, $7, $3 | ||
| 2174 | zapnot $4, 15, $7 | ||
| 2175 | mulq $8, $7, $28 | ||
| 2176 | srl $25, 32, $1 | ||
| 2177 | addq $6, $1, $6 | ||
| 2178 | cmpult $0, $5, $1 | ||
| 2179 | zapnot $2, 15, $5 | ||
| 2180 | addq $1, $6, $6 | ||
| 2181 | addq $3, $6, $6 | ||
| 2182 | addq $24, $6, $24 | ||
| 2183 | cmpult $24, $6, $1 | ||
| 2184 | srl $4, 32, $6 | ||
| 2185 | mulq $5, $6, $25 | ||
| 2186 | mulq $7, $5, $5 | ||
| 2187 | addq $1, $23, $23 | ||
| 2188 | addq $28, $25, $28 | ||
| 2189 | cmpult $28, $25, $1 | ||
| 2190 | mulq $6, $8, $6 | ||
| 2191 | beq $1, $377 | ||
| 2192 | sll $21, 32, $1 | ||
| 2193 | addq $6, $1, $6 | ||
| 2194 | $377: | ||
| 2195 | sll $28, 32, $25 | ||
| 2196 | ldq $2, 48($18) | ||
| 2197 | addq $5, $25, $5 | ||
| 2198 | bis $5, $5, $7 | ||
| 2199 | ldq $4, 32($17) | ||
| 2200 | addq $22, $7, $22 | ||
| 2201 | srl $2, 32, $8 | ||
| 2202 | cmpult $22, $7, $3 | ||
| 2203 | zapnot $4, 15, $7 | ||
| 2204 | mulq $8, $7, $0 | ||
| 2205 | srl $28, 32, $1 | ||
| 2206 | addq $6, $1, $6 | ||
| 2207 | cmpult $5, $25, $1 | ||
| 2208 | zapnot $2, 15, $5 | ||
| 2209 | addq $1, $6, $6 | ||
| 2210 | addq $3, $6, $6 | ||
| 2211 | addq $24, $6, $24 | ||
| 2212 | cmpult $24, $6, $1 | ||
| 2213 | srl $4, 32, $6 | ||
| 2214 | mulq $5, $6, $25 | ||
| 2215 | mulq $7, $5, $5 | ||
| 2216 | addq $1, $23, $23 | ||
| 2217 | addq $0, $25, $0 | ||
| 2218 | cmpult $0, $25, $1 | ||
| 2219 | mulq $6, $8, $6 | ||
| 2220 | beq $1, $381 | ||
| 2221 | sll $21, 32, $1 | ||
| 2222 | addq $6, $1, $6 | ||
| 2223 | $381: | ||
| 2224 | sll $0, 32, $25 | ||
| 2225 | ldq $2, 56($18) | ||
| 2226 | addq $5, $25, $5 | ||
| 2227 | bis $5, $5, $7 | ||
| 2228 | ldq $4, 24($17) | ||
| 2229 | addq $22, $7, $22 | ||
| 2230 | srl $2, 32, $8 | ||
| 2231 | cmpult $22, $7, $3 | ||
| 2232 | zapnot $4, 15, $7 | ||
| 2233 | mulq $8, $7, $28 | ||
| 2234 | srl $0, 32, $1 | ||
| 2235 | addq $6, $1, $6 | ||
| 2236 | cmpult $5, $25, $1 | ||
| 2237 | zapnot $2, 15, $5 | ||
| 2238 | addq $1, $6, $6 | ||
| 2239 | addq $3, $6, $6 | ||
| 2240 | addq $24, $6, $24 | ||
| 2241 | cmpult $24, $6, $1 | ||
| 2242 | srl $4, 32, $6 | ||
| 2243 | mulq $5, $6, $25 | ||
| 2244 | mulq $7, $5, $2 | ||
| 2245 | addq $1, $23, $23 | ||
| 2246 | addq $28, $25, $28 | ||
| 2247 | cmpult $28, $25, $1 | ||
| 2248 | mulq $6, $8, $6 | ||
| 2249 | beq $1, $385 | ||
| 2250 | sll $21, 32, $1 | ||
| 2251 | addq $6, $1, $6 | ||
| 2252 | $385: | ||
| 2253 | sll $28, 32, $25 | ||
| 2254 | addq $2, $25, $2 | ||
| 2255 | bis $2, $2, $7 | ||
| 2256 | addq $22, $7, $22 | ||
| 2257 | stq $22, 80($16) | ||
| 2258 | ldq $4, 32($17) | ||
| 2259 | ldq $5, 56($18) | ||
| 2260 | cmpult $22, $7, $3 | ||
| 2261 | zapnot $4, 15, $7 | ||
| 2262 | srl $5, 32, $8 | ||
| 2263 | mulq $8, $7, $0 | ||
| 2264 | srl $28, 32, $1 | ||
| 2265 | cmpult $2, $25, $2 | ||
| 2266 | addq $6, $1, $6 | ||
| 2267 | addq $2, $6, $6 | ||
| 2268 | addq $3, $6, $6 | ||
| 2269 | addq $24, $6, $24 | ||
| 2270 | cmpult $24, $6, $1 | ||
| 2271 | srl $4, 32, $6 | ||
| 2272 | zapnot $5, 15, $5 | ||
| 2273 | mulq $5, $6, $22 | ||
| 2274 | mulq $7, $5, $2 | ||
| 2275 | addq $1, $23, $23 | ||
| 2276 | addq $0, $22, $0 | ||
| 2277 | cmpult $0, $22, $1 | ||
| 2278 | mulq $6, $8, $6 | ||
| 2279 | beq $1, $389 | ||
| 2280 | sll $21, 32, $1 | ||
| 2281 | addq $6, $1, $6 | ||
| 2282 | $389: | ||
| 2283 | sll $0, 32, $22 | ||
| 2284 | ldq $1, 48($18) | ||
| 2285 | addq $2, $22, $2 | ||
| 2286 | bis $2, $2, $7 | ||
| 2287 | ldq $4, 40($17) | ||
| 2288 | addq $24, $7, $24 | ||
| 2289 | srl $1, 32, $8 | ||
| 2290 | cmpult $24, $7, $3 | ||
| 2291 | zapnot $4, 15, $7 | ||
| 2292 | mulq $8, $7, $25 | ||
| 2293 | zapnot $1, 15, $5 | ||
| 2294 | mulq $7, $5, $21 | ||
| 2295 | srl $0, 32, $1 | ||
| 2296 | cmpult $2, $22, $2 | ||
| 2297 | addq $6, $1, $6 | ||
| 2298 | addq $2, $6, $6 | ||
| 2299 | addq $3, $6, $6 | ||
| 2300 | addq $23, $6, $23 | ||
| 2301 | cmpult $23, $6, $22 | ||
| 2302 | srl $4, 32, $6 | ||
| 2303 | mulq $5, $6, $5 | ||
| 2304 | bis $31, 1, $20 | ||
| 2305 | addq $25, $5, $25 | ||
| 2306 | cmpult $25, $5, $1 | ||
| 2307 | mulq $6, $8, $6 | ||
| 2308 | beq $1, $393 | ||
| 2309 | sll $20, 32, $1 | ||
| 2310 | addq $6, $1, $6 | ||
| 2311 | $393: | ||
| 2312 | sll $25, 32, $5 | ||
| 2313 | ldq $2, 40($18) | ||
| 2314 | addq $21, $5, $21 | ||
| 2315 | bis $21, $21, $7 | ||
| 2316 | ldq $4, 48($17) | ||
| 2317 | addq $24, $7, $24 | ||
| 2318 | srl $2, 32, $8 | ||
| 2319 | cmpult $24, $7, $3 | ||
| 2320 | zapnot $4, 15, $7 | ||
| 2321 | mulq $8, $7, $28 | ||
| 2322 | srl $25, 32, $1 | ||
| 2323 | addq $6, $1, $6 | ||
| 2324 | cmpult $21, $5, $1 | ||
| 2325 | zapnot $2, 15, $5 | ||
| 2326 | addq $1, $6, $6 | ||
| 2327 | addq $3, $6, $6 | ||
| 2328 | addq $23, $6, $23 | ||
| 2329 | cmpult $23, $6, $1 | ||
| 2330 | srl $4, 32, $6 | ||
| 2331 | mulq $5, $6, $25 | ||
| 2332 | mulq $7, $5, $5 | ||
| 2333 | addq $1, $22, $22 | ||
| 2334 | addq $28, $25, $28 | ||
| 2335 | cmpult $28, $25, $1 | ||
| 2336 | mulq $6, $8, $6 | ||
| 2337 | beq $1, $397 | ||
| 2338 | sll $20, 32, $1 | ||
| 2339 | addq $6, $1, $6 | ||
| 2340 | $397: | ||
| 2341 | sll $28, 32, $25 | ||
| 2342 | ldq $2, 32($18) | ||
| 2343 | addq $5, $25, $5 | ||
| 2344 | bis $5, $5, $7 | ||
| 2345 | ldq $4, 56($17) | ||
| 2346 | addq $24, $7, $24 | ||
| 2347 | srl $2, 32, $8 | ||
| 2348 | cmpult $24, $7, $3 | ||
| 2349 | zapnot $4, 15, $7 | ||
| 2350 | mulq $8, $7, $21 | ||
| 2351 | srl $28, 32, $1 | ||
| 2352 | addq $6, $1, $6 | ||
| 2353 | cmpult $5, $25, $1 | ||
| 2354 | zapnot $2, 15, $5 | ||
| 2355 | addq $1, $6, $6 | ||
| 2356 | addq $3, $6, $6 | ||
| 2357 | addq $23, $6, $23 | ||
| 2358 | cmpult $23, $6, $1 | ||
| 2359 | srl $4, 32, $6 | ||
| 2360 | mulq $5, $6, $25 | ||
| 2361 | mulq $7, $5, $2 | ||
| 2362 | addq $1, $22, $22 | ||
| 2363 | addq $21, $25, $21 | ||
| 2364 | cmpult $21, $25, $1 | ||
| 2365 | mulq $6, $8, $6 | ||
| 2366 | beq $1, $401 | ||
| 2367 | sll $20, 32, $1 | ||
| 2368 | addq $6, $1, $6 | ||
| 2369 | $401: | ||
| 2370 | sll $21, 32, $25 | ||
| 2371 | addq $2, $25, $2 | ||
| 2372 | bis $2, $2, $7 | ||
| 2373 | addq $24, $7, $24 | ||
| 2374 | stq $24, 88($16) | ||
| 2375 | ldq $4, 56($17) | ||
| 2376 | ldq $5, 40($18) | ||
| 2377 | cmpult $24, $7, $3 | ||
| 2378 | zapnot $4, 15, $7 | ||
| 2379 | srl $5, 32, $8 | ||
| 2380 | mulq $8, $7, $0 | ||
| 2381 | srl $21, 32, $1 | ||
| 2382 | cmpult $2, $25, $2 | ||
| 2383 | addq $6, $1, $6 | ||
| 2384 | addq $2, $6, $6 | ||
| 2385 | addq $3, $6, $6 | ||
| 2386 | addq $23, $6, $23 | ||
| 2387 | cmpult $23, $6, $1 | ||
| 2388 | srl $4, 32, $6 | ||
| 2389 | zapnot $5, 15, $5 | ||
| 2390 | mulq $5, $6, $24 | ||
| 2391 | mulq $7, $5, $5 | ||
| 2392 | addq $1, $22, $22 | ||
| 2393 | addq $0, $24, $0 | ||
| 2394 | cmpult $0, $24, $1 | ||
| 2395 | mulq $6, $8, $6 | ||
| 2396 | beq $1, $405 | ||
| 2397 | sll $20, 32, $1 | ||
| 2398 | addq $6, $1, $6 | ||
| 2399 | $405: | ||
| 2400 | sll $0, 32, $24 | ||
| 2401 | ldq $2, 48($18) | ||
| 2402 | addq $5, $24, $5 | ||
| 2403 | bis $5, $5, $7 | ||
| 2404 | ldq $4, 48($17) | ||
| 2405 | addq $23, $7, $23 | ||
| 2406 | srl $2, 32, $8 | ||
| 2407 | cmpult $23, $7, $3 | ||
| 2408 | zapnot $4, 15, $7 | ||
| 2409 | mulq $8, $7, $28 | ||
| 2410 | srl $0, 32, $1 | ||
| 2411 | addq $6, $1, $6 | ||
| 2412 | cmpult $5, $24, $1 | ||
| 2413 | zapnot $2, 15, $5 | ||
| 2414 | addq $1, $6, $6 | ||
| 2415 | addq $3, $6, $6 | ||
| 2416 | addq $22, $6, $22 | ||
| 2417 | cmpult $22, $6, $24 | ||
| 2418 | srl $4, 32, $6 | ||
| 2419 | mulq $5, $6, $25 | ||
| 2420 | mulq $7, $5, $5 | ||
| 2421 | addq $28, $25, $28 | ||
| 2422 | cmpult $28, $25, $1 | ||
| 2423 | mulq $6, $8, $6 | ||
| 2424 | beq $1, $409 | ||
| 2425 | sll $20, 32, $1 | ||
| 2426 | addq $6, $1, $6 | ||
| 2427 | $409: | ||
| 2428 | sll $28, 32, $25 | ||
| 2429 | ldq $2, 56($18) | ||
| 2430 | addq $5, $25, $5 | ||
| 2431 | bis $5, $5, $7 | ||
| 2432 | ldq $4, 40($17) | ||
| 2433 | addq $23, $7, $23 | ||
| 2434 | srl $2, 32, $8 | ||
| 2435 | cmpult $23, $7, $3 | ||
| 2436 | zapnot $4, 15, $7 | ||
| 2437 | mulq $8, $7, $0 | ||
| 2438 | srl $28, 32, $1 | ||
| 2439 | addq $6, $1, $6 | ||
| 2440 | cmpult $5, $25, $1 | ||
| 2441 | zapnot $2, 15, $5 | ||
| 2442 | addq $1, $6, $6 | ||
| 2443 | addq $3, $6, $6 | ||
| 2444 | addq $22, $6, $22 | ||
| 2445 | cmpult $22, $6, $1 | ||
| 2446 | srl $4, 32, $6 | ||
| 2447 | mulq $5, $6, $25 | ||
| 2448 | mulq $7, $5, $2 | ||
| 2449 | addq $1, $24, $24 | ||
| 2450 | addq $0, $25, $0 | ||
| 2451 | cmpult $0, $25, $1 | ||
| 2452 | mulq $6, $8, $6 | ||
| 2453 | beq $1, $413 | ||
| 2454 | sll $20, 32, $1 | ||
| 2455 | addq $6, $1, $6 | ||
| 2456 | $413: | ||
| 2457 | sll $0, 32, $25 | ||
| 2458 | addq $2, $25, $2 | ||
| 2459 | bis $2, $2, $7 | ||
| 2460 | addq $23, $7, $23 | ||
| 2461 | stq $23, 96($16) | ||
| 2462 | ldq $4, 48($17) | ||
| 2463 | ldq $5, 56($18) | ||
| 2464 | cmpult $23, $7, $3 | ||
| 2465 | zapnot $4, 15, $7 | ||
| 2466 | srl $5, 32, $8 | ||
| 2467 | mulq $8, $7, $28 | ||
| 2468 | srl $0, 32, $1 | ||
| 2469 | cmpult $2, $25, $2 | ||
| 2470 | addq $6, $1, $6 | ||
| 2471 | addq $2, $6, $6 | ||
| 2472 | addq $3, $6, $6 | ||
| 2473 | addq $22, $6, $22 | ||
| 2474 | cmpult $22, $6, $1 | ||
| 2475 | srl $4, 32, $6 | ||
| 2476 | zapnot $5, 15, $5 | ||
| 2477 | mulq $5, $6, $23 | ||
| 2478 | mulq $7, $5, $5 | ||
| 2479 | addq $1, $24, $24 | ||
| 2480 | addq $28, $23, $28 | ||
| 2481 | cmpult $28, $23, $1 | ||
| 2482 | mulq $6, $8, $6 | ||
| 2483 | beq $1, $417 | ||
| 2484 | sll $20, 32, $1 | ||
| 2485 | addq $6, $1, $6 | ||
| 2486 | $417: | ||
| 2487 | sll $28, 32, $23 | ||
| 2488 | ldq $2, 48($18) | ||
| 2489 | addq $5, $23, $5 | ||
| 2490 | bis $5, $5, $7 | ||
| 2491 | ldq $4, 56($17) | ||
| 2492 | addq $22, $7, $22 | ||
| 2493 | srl $2, 32, $8 | ||
| 2494 | cmpult $22, $7, $3 | ||
| 2495 | zapnot $4, 15, $7 | ||
| 2496 | mulq $8, $7, $0 | ||
| 2497 | srl $28, 32, $1 | ||
| 2498 | addq $6, $1, $6 | ||
| 2499 | cmpult $5, $23, $1 | ||
| 2500 | zapnot $2, 15, $5 | ||
| 2501 | addq $1, $6, $6 | ||
| 2502 | addq $3, $6, $6 | ||
| 2503 | addq $24, $6, $24 | ||
| 2504 | cmpult $24, $6, $23 | ||
| 2505 | srl $4, 32, $6 | ||
| 2506 | mulq $5, $6, $25 | ||
| 2507 | mulq $7, $5, $2 | ||
| 2508 | addq $0, $25, $0 | ||
| 2509 | cmpult $0, $25, $1 | ||
| 2510 | mulq $6, $8, $6 | ||
| 2511 | beq $1, $421 | ||
| 2512 | sll $20, 32, $1 | ||
| 2513 | addq $6, $1, $6 | ||
| 2514 | $421: | ||
| 2515 | sll $0, 32, $25 | ||
| 2516 | addq $2, $25, $2 | ||
| 2517 | bis $2, $2, $7 | ||
| 2518 | addq $22, $7, $22 | ||
| 2519 | stq $22, 104($16) | ||
| 2520 | ldq $4, 56($17) | ||
| 2521 | ldq $5, 56($18) | ||
| 2522 | cmpult $22, $7, $3 | ||
| 2523 | zapnot $4, 15, $7 | ||
| 2524 | srl $5, 32, $8 | ||
| 2525 | mulq $8, $7, $28 | ||
| 2526 | srl $0, 32, $1 | ||
| 2527 | cmpult $2, $25, $2 | ||
| 2528 | addq $6, $1, $6 | ||
| 2529 | addq $2, $6, $6 | ||
| 2530 | addq $3, $6, $6 | ||
| 2531 | addq $24, $6, $24 | ||
| 2532 | cmpult $24, $6, $1 | ||
| 2533 | srl $4, 32, $6 | ||
| 2534 | zapnot $5, 15, $5 | ||
| 2535 | mulq $5, $6, $22 | ||
| 2536 | mulq $7, $5, $2 | ||
| 2537 | addq $1, $23, $23 | ||
| 2538 | addq $28, $22, $28 | ||
| 2539 | cmpult $28, $22, $1 | ||
| 2540 | mulq $6, $8, $3 | ||
| 2541 | beq $1, $425 | ||
| 2542 | sll $20, 32, $1 | ||
| 2543 | addq $3, $1, $3 | ||
| 2544 | $425: | ||
| 2545 | sll $28, 32, $22 | ||
| 2546 | srl $28, 32, $1 | ||
| 2547 | addq $2, $22, $2 | ||
| 2548 | addq $3, $1, $3 | ||
| 2549 | bis $2, $2, $7 | ||
| 2550 | addq $24, $7, $24 | ||
| 2551 | cmpult $7, $22, $1 | ||
| 2552 | cmpult $24, $7, $2 | ||
| 2553 | addq $1, $3, $6 | ||
| 2554 | addq $2, $6, $6 | ||
| 2555 | stq $24, 112($16) | ||
| 2556 | addq $23, $6, $23 | ||
| 2557 | stq $23, 120($16) | ||
| 2558 | ret $31, ($26), 1 | ||
| 2559 | .end bn_mul_comba8 | ||
| 2560 | .text | ||
| 2561 | .align 3 | ||
| 2562 | .globl bn_sqr_comba4 | ||
| 2563 | .ent bn_sqr_comba4 | ||
| 2564 | bn_sqr_comba4: | ||
| 2565 | bn_sqr_comba4..ng: | ||
| 2566 | .frame $30,0,$26,0 | ||
| 2567 | .prologue 0 | ||
| 2568 | |||
| 2569 | ldq $0, 0($17) | ||
| 2570 | ldq $1, 8($17) | ||
| 2571 | ldq $2, 16($17) | ||
| 2572 | ldq $3, 24($17) | ||
| 2573 | bis $31, $31, $6 | ||
| 2574 | mulq $0, $0, $4 | ||
| 2575 | umulh $0, $0, $5 | ||
| 2576 | stq $4, 0($16) | ||
| 2577 | bis $31, $31, $4 | ||
| 2578 | mulq $0, $1, $7 | ||
| 2579 | umulh $0, $1, $8 | ||
| 2580 | cmplt $7, $31, $22 | ||
| 2581 | cmplt $8, $31, $23 | ||
| 2582 | addq $7, $7, $7 | ||
| 2583 | addq $8, $8, $8 | ||
| 2584 | addq $8, $22, $8 | ||
| 2585 | addq $4, $23, $4 | ||
| 2586 | addq $5, $7, $5 | ||
| 2587 | addq $6, $8, $6 | ||
| 2588 | cmpult $5, $7, $24 | ||
| 2589 | cmpult $6, $8, $25 | ||
| 2590 | addq $6, $24, $6 | ||
| 2591 | addq $4, $25, $4 | ||
| 2592 | stq $5, 8($16) | ||
| 2593 | bis $31, $31, $5 | ||
| 2594 | mulq $1, $1, $27 | ||
| 2595 | umulh $1, $1, $28 | ||
| 2596 | addq $6, $27, $6 | ||
| 2597 | addq $4, $28, $4 | ||
| 2598 | cmpult $6, $27, $21 | ||
| 2599 | cmpult $4, $28, $20 | ||
| 2600 | addq $4, $21, $4 | ||
| 2601 | addq $5, $20, $5 | ||
| 2602 | mulq $2, $0, $19 | ||
| 2603 | umulh $2, $0, $18 | ||
| 2604 | cmplt $19, $31, $17 | ||
| 2605 | cmplt $18, $31, $22 | ||
| 2606 | addq $19, $19, $19 | ||
| 2607 | addq $18, $18, $18 | ||
| 2608 | addq $18, $17, $18 | ||
| 2609 | addq $5, $22, $5 | ||
| 2610 | addq $6, $19, $6 | ||
| 2611 | addq $4, $18, $4 | ||
| 2612 | cmpult $6, $19, $23 | ||
| 2613 | cmpult $4, $18, $7 | ||
| 2614 | addq $4, $23, $4 | ||
| 2615 | addq $5, $7, $5 | ||
| 2616 | stq $6, 16($16) | ||
| 2617 | bis $31, $31, $6 | ||
| 2618 | mulq $3, $0, $8 | ||
| 2619 | umulh $3, $0, $24 | ||
| 2620 | cmplt $8, $31, $25 | ||
| 2621 | cmplt $24, $31, $27 | ||
| 2622 | addq $8, $8, $8 | ||
| 2623 | addq $24, $24, $24 | ||
| 2624 | addq $24, $25, $24 | ||
| 2625 | addq $6, $27, $6 | ||
| 2626 | addq $4, $8, $4 | ||
| 2627 | addq $5, $24, $5 | ||
| 2628 | cmpult $4, $8, $28 | ||
| 2629 | cmpult $5, $24, $21 | ||
| 2630 | addq $5, $28, $5 | ||
| 2631 | addq $6, $21, $6 | ||
| 2632 | mulq $2, $1, $20 | ||
| 2633 | umulh $2, $1, $17 | ||
| 2634 | cmplt $20, $31, $22 | ||
| 2635 | cmplt $17, $31, $19 | ||
| 2636 | addq $20, $20, $20 | ||
| 2637 | addq $17, $17, $17 | ||
| 2638 | addq $17, $22, $17 | ||
| 2639 | addq $6, $19, $6 | ||
| 2640 | addq $4, $20, $4 | ||
| 2641 | addq $5, $17, $5 | ||
| 2642 | cmpult $4, $20, $18 | ||
| 2643 | cmpult $5, $17, $23 | ||
| 2644 | addq $5, $18, $5 | ||
| 2645 | addq $6, $23, $6 | ||
| 2646 | stq $4, 24($16) | ||
| 2647 | bis $31, $31, $4 | ||
| 2648 | mulq $2, $2, $7 | ||
| 2649 | umulh $2, $2, $25 | ||
| 2650 | addq $5, $7, $5 | ||
| 2651 | addq $6, $25, $6 | ||
| 2652 | cmpult $5, $7, $27 | ||
| 2653 | cmpult $6, $25, $8 | ||
| 2654 | addq $6, $27, $6 | ||
| 2655 | addq $4, $8, $4 | ||
| 2656 | mulq $3, $1, $24 | ||
| 2657 | umulh $3, $1, $28 | ||
| 2658 | cmplt $24, $31, $21 | ||
| 2659 | cmplt $28, $31, $22 | ||
| 2660 | addq $24, $24, $24 | ||
| 2661 | addq $28, $28, $28 | ||
| 2662 | addq $28, $21, $28 | ||
| 2663 | addq $4, $22, $4 | ||
| 2664 | addq $5, $24, $5 | ||
| 2665 | addq $6, $28, $6 | ||
| 2666 | cmpult $5, $24, $19 | ||
| 2667 | cmpult $6, $28, $20 | ||
| 2668 | addq $6, $19, $6 | ||
| 2669 | addq $4, $20, $4 | ||
| 2670 | stq $5, 32($16) | ||
| 2671 | bis $31, $31, $5 | ||
| 2672 | mulq $3, $2, $17 | ||
| 2673 | umulh $3, $2, $18 | ||
| 2674 | cmplt $17, $31, $23 | ||
| 2675 | cmplt $18, $31, $7 | ||
| 2676 | addq $17, $17, $17 | ||
| 2677 | addq $18, $18, $18 | ||
| 2678 | addq $18, $23, $18 | ||
| 2679 | addq $5, $7, $5 | ||
| 2680 | addq $6, $17, $6 | ||
| 2681 | addq $4, $18, $4 | ||
| 2682 | cmpult $6, $17, $25 | ||
| 2683 | cmpult $4, $18, $27 | ||
| 2684 | addq $4, $25, $4 | ||
| 2685 | addq $5, $27, $5 | ||
| 2686 | stq $6, 40($16) | ||
| 2687 | bis $31, $31, $6 | ||
| 2688 | mulq $3, $3, $8 | ||
| 2689 | umulh $3, $3, $21 | ||
| 2690 | addq $4, $8, $4 | ||
| 2691 | addq $5, $21, $5 | ||
| 2692 | cmpult $4, $8, $22 | ||
| 2693 | cmpult $5, $21, $24 | ||
| 2694 | addq $5, $22, $5 | ||
| 2695 | addq $6, $24, $6 | ||
| 2696 | stq $4, 48($16) | ||
| 2697 | stq $5, 56($16) | ||
| 2698 | ret $31,($26),1 | ||
| 2699 | .end bn_sqr_comba4 | ||
| 2700 | .text | ||
| 2701 | .align 3 | ||
| 2702 | .globl bn_sqr_comba8 | ||
| 2703 | .ent bn_sqr_comba8 | ||
| 2704 | bn_sqr_comba8: | ||
| 2705 | bn_sqr_comba8..ng: | ||
| 2706 | .frame $30,0,$26,0 | ||
| 2707 | .prologue 0 | ||
| 2708 | |||
| 2709 | ldq $0, 0($17) | ||
| 2710 | ldq $1, 8($17) | ||
| 2711 | ldq $2, 16($17) | ||
| 2712 | ldq $3, 24($17) | ||
| 2713 | ldq $4, 32($17) | ||
| 2714 | ldq $5, 40($17) | ||
| 2715 | ldq $6, 48($17) | ||
| 2716 | ldq $7, 56($17) | ||
| 2717 | bis $31, $31, $23 | ||
| 2718 | mulq $0, $0, $8 | ||
| 2719 | umulh $0, $0, $22 | ||
| 2720 | stq $8, 0($16) | ||
| 2721 | bis $31, $31, $8 | ||
| 2722 | mulq $1, $0, $24 | ||
| 2723 | umulh $1, $0, $25 | ||
| 2724 | cmplt $24, $31, $27 | ||
| 2725 | cmplt $25, $31, $28 | ||
| 2726 | addq $24, $24, $24 | ||
| 2727 | addq $25, $25, $25 | ||
| 2728 | addq $25, $27, $25 | ||
| 2729 | addq $8, $28, $8 | ||
| 2730 | addq $22, $24, $22 | ||
| 2731 | addq $23, $25, $23 | ||
| 2732 | cmpult $22, $24, $21 | ||
| 2733 | cmpult $23, $25, $20 | ||
| 2734 | addq $23, $21, $23 | ||
| 2735 | addq $8, $20, $8 | ||
| 2736 | stq $22, 8($16) | ||
| 2737 | bis $31, $31, $22 | ||
| 2738 | mulq $1, $1, $19 | ||
| 2739 | umulh $1, $1, $18 | ||
| 2740 | addq $23, $19, $23 | ||
| 2741 | addq $8, $18, $8 | ||
| 2742 | cmpult $23, $19, $17 | ||
| 2743 | cmpult $8, $18, $27 | ||
| 2744 | addq $8, $17, $8 | ||
| 2745 | addq $22, $27, $22 | ||
| 2746 | mulq $2, $0, $28 | ||
| 2747 | umulh $2, $0, $24 | ||
| 2748 | cmplt $28, $31, $25 | ||
| 2749 | cmplt $24, $31, $21 | ||
| 2750 | addq $28, $28, $28 | ||
| 2751 | addq $24, $24, $24 | ||
| 2752 | addq $24, $25, $24 | ||
| 2753 | addq $22, $21, $22 | ||
| 2754 | addq $23, $28, $23 | ||
| 2755 | addq $8, $24, $8 | ||
| 2756 | cmpult $23, $28, $20 | ||
| 2757 | cmpult $8, $24, $19 | ||
| 2758 | addq $8, $20, $8 | ||
| 2759 | addq $22, $19, $22 | ||
| 2760 | stq $23, 16($16) | ||
| 2761 | bis $31, $31, $23 | ||
| 2762 | mulq $2, $1, $18 | ||
| 2763 | umulh $2, $1, $17 | ||
| 2764 | cmplt $18, $31, $27 | ||
| 2765 | cmplt $17, $31, $25 | ||
| 2766 | addq $18, $18, $18 | ||
| 2767 | addq $17, $17, $17 | ||
| 2768 | addq $17, $27, $17 | ||
| 2769 | addq $23, $25, $23 | ||
| 2770 | addq $8, $18, $8 | ||
| 2771 | addq $22, $17, $22 | ||
| 2772 | cmpult $8, $18, $21 | ||
| 2773 | cmpult $22, $17, $28 | ||
| 2774 | addq $22, $21, $22 | ||
| 2775 | addq $23, $28, $23 | ||
| 2776 | mulq $3, $0, $24 | ||
| 2777 | umulh $3, $0, $20 | ||
| 2778 | cmplt $24, $31, $19 | ||
| 2779 | cmplt $20, $31, $27 | ||
| 2780 | addq $24, $24, $24 | ||
| 2781 | addq $20, $20, $20 | ||
| 2782 | addq $20, $19, $20 | ||
| 2783 | addq $23, $27, $23 | ||
| 2784 | addq $8, $24, $8 | ||
| 2785 | addq $22, $20, $22 | ||
| 2786 | cmpult $8, $24, $25 | ||
| 2787 | cmpult $22, $20, $18 | ||
| 2788 | addq $22, $25, $22 | ||
| 2789 | addq $23, $18, $23 | ||
| 2790 | stq $8, 24($16) | ||
| 2791 | bis $31, $31, $8 | ||
| 2792 | mulq $2, $2, $17 | ||
| 2793 | umulh $2, $2, $21 | ||
| 2794 | addq $22, $17, $22 | ||
| 2795 | addq $23, $21, $23 | ||
| 2796 | cmpult $22, $17, $28 | ||
| 2797 | cmpult $23, $21, $19 | ||
| 2798 | addq $23, $28, $23 | ||
| 2799 | addq $8, $19, $8 | ||
| 2800 | mulq $3, $1, $27 | ||
| 2801 | umulh $3, $1, $24 | ||
| 2802 | cmplt $27, $31, $20 | ||
| 2803 | cmplt $24, $31, $25 | ||
| 2804 | addq $27, $27, $27 | ||
| 2805 | addq $24, $24, $24 | ||
| 2806 | addq $24, $20, $24 | ||
| 2807 | addq $8, $25, $8 | ||
| 2808 | addq $22, $27, $22 | ||
| 2809 | addq $23, $24, $23 | ||
| 2810 | cmpult $22, $27, $18 | ||
| 2811 | cmpult $23, $24, $17 | ||
| 2812 | addq $23, $18, $23 | ||
| 2813 | addq $8, $17, $8 | ||
| 2814 | mulq $4, $0, $21 | ||
| 2815 | umulh $4, $0, $28 | ||
| 2816 | cmplt $21, $31, $19 | ||
| 2817 | cmplt $28, $31, $20 | ||
| 2818 | addq $21, $21, $21 | ||
| 2819 | addq $28, $28, $28 | ||
| 2820 | addq $28, $19, $28 | ||
| 2821 | addq $8, $20, $8 | ||
| 2822 | addq $22, $21, $22 | ||
| 2823 | addq $23, $28, $23 | ||
| 2824 | cmpult $22, $21, $25 | ||
| 2825 | cmpult $23, $28, $27 | ||
| 2826 | addq $23, $25, $23 | ||
| 2827 | addq $8, $27, $8 | ||
| 2828 | stq $22, 32($16) | ||
| 2829 | bis $31, $31, $22 | ||
| 2830 | mulq $3, $2, $24 | ||
| 2831 | umulh $3, $2, $18 | ||
| 2832 | cmplt $24, $31, $17 | ||
| 2833 | cmplt $18, $31, $19 | ||
| 2834 | addq $24, $24, $24 | ||
| 2835 | addq $18, $18, $18 | ||
| 2836 | addq $18, $17, $18 | ||
| 2837 | addq $22, $19, $22 | ||
| 2838 | addq $23, $24, $23 | ||
| 2839 | addq $8, $18, $8 | ||
| 2840 | cmpult $23, $24, $20 | ||
| 2841 | cmpult $8, $18, $21 | ||
| 2842 | addq $8, $20, $8 | ||
| 2843 | addq $22, $21, $22 | ||
| 2844 | mulq $4, $1, $28 | ||
| 2845 | umulh $4, $1, $25 | ||
| 2846 | cmplt $28, $31, $27 | ||
| 2847 | cmplt $25, $31, $17 | ||
| 2848 | addq $28, $28, $28 | ||
| 2849 | addq $25, $25, $25 | ||
| 2850 | addq $25, $27, $25 | ||
| 2851 | addq $22, $17, $22 | ||
| 2852 | addq $23, $28, $23 | ||
| 2853 | addq $8, $25, $8 | ||
| 2854 | cmpult $23, $28, $19 | ||
| 2855 | cmpult $8, $25, $24 | ||
| 2856 | addq $8, $19, $8 | ||
| 2857 | addq $22, $24, $22 | ||
| 2858 | mulq $5, $0, $18 | ||
| 2859 | umulh $5, $0, $20 | ||
| 2860 | cmplt $18, $31, $21 | ||
| 2861 | cmplt $20, $31, $27 | ||
| 2862 | addq $18, $18, $18 | ||
| 2863 | addq $20, $20, $20 | ||
| 2864 | addq $20, $21, $20 | ||
| 2865 | addq $22, $27, $22 | ||
| 2866 | addq $23, $18, $23 | ||
| 2867 | addq $8, $20, $8 | ||
| 2868 | cmpult $23, $18, $17 | ||
| 2869 | cmpult $8, $20, $28 | ||
| 2870 | addq $8, $17, $8 | ||
| 2871 | addq $22, $28, $22 | ||
| 2872 | stq $23, 40($16) | ||
| 2873 | bis $31, $31, $23 | ||
| 2874 | mulq $3, $3, $25 | ||
| 2875 | umulh $3, $3, $19 | ||
| 2876 | addq $8, $25, $8 | ||
| 2877 | addq $22, $19, $22 | ||
| 2878 | cmpult $8, $25, $24 | ||
| 2879 | cmpult $22, $19, $21 | ||
| 2880 | addq $22, $24, $22 | ||
| 2881 | addq $23, $21, $23 | ||
| 2882 | mulq $4, $2, $27 | ||
| 2883 | umulh $4, $2, $18 | ||
| 2884 | cmplt $27, $31, $20 | ||
| 2885 | cmplt $18, $31, $17 | ||
| 2886 | addq $27, $27, $27 | ||
| 2887 | addq $18, $18, $18 | ||
| 2888 | addq $18, $20, $18 | ||
| 2889 | addq $23, $17, $23 | ||
| 2890 | addq $8, $27, $8 | ||
| 2891 | addq $22, $18, $22 | ||
| 2892 | cmpult $8, $27, $28 | ||
| 2893 | cmpult $22, $18, $25 | ||
| 2894 | addq $22, $28, $22 | ||
| 2895 | addq $23, $25, $23 | ||
| 2896 | mulq $5, $1, $19 | ||
| 2897 | umulh $5, $1, $24 | ||
| 2898 | cmplt $19, $31, $21 | ||
| 2899 | cmplt $24, $31, $20 | ||
| 2900 | addq $19, $19, $19 | ||
| 2901 | addq $24, $24, $24 | ||
| 2902 | addq $24, $21, $24 | ||
| 2903 | addq $23, $20, $23 | ||
| 2904 | addq $8, $19, $8 | ||
| 2905 | addq $22, $24, $22 | ||
| 2906 | cmpult $8, $19, $17 | ||
| 2907 | cmpult $22, $24, $27 | ||
| 2908 | addq $22, $17, $22 | ||
| 2909 | addq $23, $27, $23 | ||
| 2910 | mulq $6, $0, $18 | ||
| 2911 | umulh $6, $0, $28 | ||
| 2912 | cmplt $18, $31, $25 | ||
| 2913 | cmplt $28, $31, $21 | ||
| 2914 | addq $18, $18, $18 | ||
| 2915 | addq $28, $28, $28 | ||
| 2916 | addq $28, $25, $28 | ||
| 2917 | addq $23, $21, $23 | ||
| 2918 | addq $8, $18, $8 | ||
| 2919 | addq $22, $28, $22 | ||
| 2920 | cmpult $8, $18, $20 | ||
| 2921 | cmpult $22, $28, $19 | ||
| 2922 | addq $22, $20, $22 | ||
| 2923 | addq $23, $19, $23 | ||
| 2924 | stq $8, 48($16) | ||
| 2925 | bis $31, $31, $8 | ||
| 2926 | mulq $4, $3, $24 | ||
| 2927 | umulh $4, $3, $17 | ||
| 2928 | cmplt $24, $31, $27 | ||
| 2929 | cmplt $17, $31, $25 | ||
| 2930 | addq $24, $24, $24 | ||
| 2931 | addq $17, $17, $17 | ||
| 2932 | addq $17, $27, $17 | ||
| 2933 | addq $8, $25, $8 | ||
| 2934 | addq $22, $24, $22 | ||
| 2935 | addq $23, $17, $23 | ||
| 2936 | cmpult $22, $24, $21 | ||
| 2937 | cmpult $23, $17, $18 | ||
| 2938 | addq $23, $21, $23 | ||
| 2939 | addq $8, $18, $8 | ||
| 2940 | mulq $5, $2, $28 | ||
| 2941 | umulh $5, $2, $20 | ||
| 2942 | cmplt $28, $31, $19 | ||
| 2943 | cmplt $20, $31, $27 | ||
| 2944 | addq $28, $28, $28 | ||
| 2945 | addq $20, $20, $20 | ||
| 2946 | addq $20, $19, $20 | ||
| 2947 | addq $8, $27, $8 | ||
| 2948 | addq $22, $28, $22 | ||
| 2949 | addq $23, $20, $23 | ||
| 2950 | cmpult $22, $28, $25 | ||
| 2951 | cmpult $23, $20, $24 | ||
| 2952 | addq $23, $25, $23 | ||
| 2953 | addq $8, $24, $8 | ||
| 2954 | mulq $6, $1, $17 | ||
| 2955 | umulh $6, $1, $21 | ||
| 2956 | cmplt $17, $31, $18 | ||
| 2957 | cmplt $21, $31, $19 | ||
| 2958 | addq $17, $17, $17 | ||
| 2959 | addq $21, $21, $21 | ||
| 2960 | addq $21, $18, $21 | ||
| 2961 | addq $8, $19, $8 | ||
| 2962 | addq $22, $17, $22 | ||
| 2963 | addq $23, $21, $23 | ||
| 2964 | cmpult $22, $17, $27 | ||
| 2965 | cmpult $23, $21, $28 | ||
| 2966 | addq $23, $27, $23 | ||
| 2967 | addq $8, $28, $8 | ||
| 2968 | mulq $7, $0, $20 | ||
| 2969 | umulh $7, $0, $25 | ||
| 2970 | cmplt $20, $31, $24 | ||
| 2971 | cmplt $25, $31, $18 | ||
| 2972 | addq $20, $20, $20 | ||
| 2973 | addq $25, $25, $25 | ||
| 2974 | addq $25, $24, $25 | ||
| 2975 | addq $8, $18, $8 | ||
| 2976 | addq $22, $20, $22 | ||
| 2977 | addq $23, $25, $23 | ||
| 2978 | cmpult $22, $20, $19 | ||
| 2979 | cmpult $23, $25, $17 | ||
| 2980 | addq $23, $19, $23 | ||
| 2981 | addq $8, $17, $8 | ||
| 2982 | stq $22, 56($16) | ||
| 2983 | bis $31, $31, $22 | ||
| 2984 | mulq $4, $4, $21 | ||
| 2985 | umulh $4, $4, $27 | ||
| 2986 | addq $23, $21, $23 | ||
| 2987 | addq $8, $27, $8 | ||
| 2988 | cmpult $23, $21, $28 | ||
| 2989 | cmpult $8, $27, $24 | ||
| 2990 | addq $8, $28, $8 | ||
| 2991 | addq $22, $24, $22 | ||
| 2992 | mulq $5, $3, $18 | ||
| 2993 | umulh $5, $3, $20 | ||
| 2994 | cmplt $18, $31, $25 | ||
| 2995 | cmplt $20, $31, $19 | ||
| 2996 | addq $18, $18, $18 | ||
| 2997 | addq $20, $20, $20 | ||
| 2998 | addq $20, $25, $20 | ||
| 2999 | addq $22, $19, $22 | ||
| 3000 | addq $23, $18, $23 | ||
| 3001 | addq $8, $20, $8 | ||
| 3002 | cmpult $23, $18, $17 | ||
| 3003 | cmpult $8, $20, $21 | ||
| 3004 | addq $8, $17, $8 | ||
| 3005 | addq $22, $21, $22 | ||
| 3006 | mulq $6, $2, $27 | ||
| 3007 | umulh $6, $2, $28 | ||
| 3008 | cmplt $27, $31, $24 | ||
| 3009 | cmplt $28, $31, $25 | ||
| 3010 | addq $27, $27, $27 | ||
| 3011 | addq $28, $28, $28 | ||
| 3012 | addq $28, $24, $28 | ||
| 3013 | addq $22, $25, $22 | ||
| 3014 | addq $23, $27, $23 | ||
| 3015 | addq $8, $28, $8 | ||
| 3016 | cmpult $23, $27, $19 | ||
| 3017 | cmpult $8, $28, $18 | ||
| 3018 | addq $8, $19, $8 | ||
| 3019 | addq $22, $18, $22 | ||
| 3020 | mulq $7, $1, $20 | ||
| 3021 | umulh $7, $1, $17 | ||
| 3022 | cmplt $20, $31, $21 | ||
| 3023 | cmplt $17, $31, $24 | ||
| 3024 | addq $20, $20, $20 | ||
| 3025 | addq $17, $17, $17 | ||
| 3026 | addq $17, $21, $17 | ||
| 3027 | addq $22, $24, $22 | ||
| 3028 | addq $23, $20, $23 | ||
| 3029 | addq $8, $17, $8 | ||
| 3030 | cmpult $23, $20, $25 | ||
| 3031 | cmpult $8, $17, $27 | ||
| 3032 | addq $8, $25, $8 | ||
| 3033 | addq $22, $27, $22 | ||
| 3034 | stq $23, 64($16) | ||
| 3035 | bis $31, $31, $23 | ||
| 3036 | mulq $5, $4, $28 | ||
| 3037 | umulh $5, $4, $19 | ||
| 3038 | cmplt $28, $31, $18 | ||
| 3039 | cmplt $19, $31, $21 | ||
| 3040 | addq $28, $28, $28 | ||
| 3041 | addq $19, $19, $19 | ||
| 3042 | addq $19, $18, $19 | ||
| 3043 | addq $23, $21, $23 | ||
| 3044 | addq $8, $28, $8 | ||
| 3045 | addq $22, $19, $22 | ||
| 3046 | cmpult $8, $28, $24 | ||
| 3047 | cmpult $22, $19, $20 | ||
| 3048 | addq $22, $24, $22 | ||
| 3049 | addq $23, $20, $23 | ||
| 3050 | mulq $6, $3, $17 | ||
| 3051 | umulh $6, $3, $25 | ||
| 3052 | cmplt $17, $31, $27 | ||
| 3053 | cmplt $25, $31, $18 | ||
| 3054 | addq $17, $17, $17 | ||
| 3055 | addq $25, $25, $25 | ||
| 3056 | addq $25, $27, $25 | ||
| 3057 | addq $23, $18, $23 | ||
| 3058 | addq $8, $17, $8 | ||
| 3059 | addq $22, $25, $22 | ||
| 3060 | cmpult $8, $17, $21 | ||
| 3061 | cmpult $22, $25, $28 | ||
| 3062 | addq $22, $21, $22 | ||
| 3063 | addq $23, $28, $23 | ||
| 3064 | mulq $7, $2, $19 | ||
| 3065 | umulh $7, $2, $24 | ||
| 3066 | cmplt $19, $31, $20 | ||
| 3067 | cmplt $24, $31, $27 | ||
| 3068 | addq $19, $19, $19 | ||
| 3069 | addq $24, $24, $24 | ||
| 3070 | addq $24, $20, $24 | ||
| 3071 | addq $23, $27, $23 | ||
| 3072 | addq $8, $19, $8 | ||
| 3073 | addq $22, $24, $22 | ||
| 3074 | cmpult $8, $19, $18 | ||
| 3075 | cmpult $22, $24, $17 | ||
| 3076 | addq $22, $18, $22 | ||
| 3077 | addq $23, $17, $23 | ||
| 3078 | stq $8, 72($16) | ||
| 3079 | bis $31, $31, $8 | ||
| 3080 | mulq $5, $5, $25 | ||
| 3081 | umulh $5, $5, $21 | ||
| 3082 | addq $22, $25, $22 | ||
| 3083 | addq $23, $21, $23 | ||
| 3084 | cmpult $22, $25, $28 | ||
| 3085 | cmpult $23, $21, $20 | ||
| 3086 | addq $23, $28, $23 | ||
| 3087 | addq $8, $20, $8 | ||
| 3088 | mulq $6, $4, $27 | ||
| 3089 | umulh $6, $4, $19 | ||
| 3090 | cmplt $27, $31, $24 | ||
| 3091 | cmplt $19, $31, $18 | ||
| 3092 | addq $27, $27, $27 | ||
| 3093 | addq $19, $19, $19 | ||
| 3094 | addq $19, $24, $19 | ||
| 3095 | addq $8, $18, $8 | ||
| 3096 | addq $22, $27, $22 | ||
| 3097 | addq $23, $19, $23 | ||
| 3098 | cmpult $22, $27, $17 | ||
| 3099 | cmpult $23, $19, $25 | ||
| 3100 | addq $23, $17, $23 | ||
| 3101 | addq $8, $25, $8 | ||
| 3102 | mulq $7, $3, $21 | ||
| 3103 | umulh $7, $3, $28 | ||
| 3104 | cmplt $21, $31, $20 | ||
| 3105 | cmplt $28, $31, $24 | ||
| 3106 | addq $21, $21, $21 | ||
| 3107 | addq $28, $28, $28 | ||
| 3108 | addq $28, $20, $28 | ||
| 3109 | addq $8, $24, $8 | ||
| 3110 | addq $22, $21, $22 | ||
| 3111 | addq $23, $28, $23 | ||
| 3112 | cmpult $22, $21, $18 | ||
| 3113 | cmpult $23, $28, $27 | ||
| 3114 | addq $23, $18, $23 | ||
| 3115 | addq $8, $27, $8 | ||
| 3116 | stq $22, 80($16) | ||
| 3117 | bis $31, $31, $22 | ||
| 3118 | mulq $6, $5, $19 | ||
| 3119 | umulh $6, $5, $17 | ||
| 3120 | cmplt $19, $31, $25 | ||
| 3121 | cmplt $17, $31, $20 | ||
| 3122 | addq $19, $19, $19 | ||
| 3123 | addq $17, $17, $17 | ||
| 3124 | addq $17, $25, $17 | ||
| 3125 | addq $22, $20, $22 | ||
| 3126 | addq $23, $19, $23 | ||
| 3127 | addq $8, $17, $8 | ||
| 3128 | cmpult $23, $19, $24 | ||
| 3129 | cmpult $8, $17, $21 | ||
| 3130 | addq $8, $24, $8 | ||
| 3131 | addq $22, $21, $22 | ||
| 3132 | mulq $7, $4, $28 | ||
| 3133 | umulh $7, $4, $18 | ||
| 3134 | cmplt $28, $31, $27 | ||
| 3135 | cmplt $18, $31, $25 | ||
| 3136 | addq $28, $28, $28 | ||
| 3137 | addq $18, $18, $18 | ||
| 3138 | addq $18, $27, $18 | ||
| 3139 | addq $22, $25, $22 | ||
| 3140 | addq $23, $28, $23 | ||
| 3141 | addq $8, $18, $8 | ||
| 3142 | cmpult $23, $28, $20 | ||
| 3143 | cmpult $8, $18, $19 | ||
| 3144 | addq $8, $20, $8 | ||
| 3145 | addq $22, $19, $22 | ||
| 3146 | stq $23, 88($16) | ||
| 3147 | bis $31, $31, $23 | ||
| 3148 | mulq $6, $6, $17 | ||
| 3149 | umulh $6, $6, $24 | ||
| 3150 | addq $8, $17, $8 | ||
| 3151 | addq $22, $24, $22 | ||
| 3152 | cmpult $8, $17, $21 | ||
| 3153 | cmpult $22, $24, $27 | ||
| 3154 | addq $22, $21, $22 | ||
| 3155 | addq $23, $27, $23 | ||
| 3156 | mulq $7, $5, $25 | ||
| 3157 | umulh $7, $5, $28 | ||
| 3158 | cmplt $25, $31, $18 | ||
| 3159 | cmplt $28, $31, $20 | ||
| 3160 | addq $25, $25, $25 | ||
| 3161 | addq $28, $28, $28 | ||
| 3162 | addq $28, $18, $28 | ||
| 3163 | addq $23, $20, $23 | ||
| 3164 | addq $8, $25, $8 | ||
| 3165 | addq $22, $28, $22 | ||
| 3166 | cmpult $8, $25, $19 | ||
| 3167 | cmpult $22, $28, $17 | ||
| 3168 | addq $22, $19, $22 | ||
| 3169 | addq $23, $17, $23 | ||
| 3170 | stq $8, 96($16) | ||
| 3171 | bis $31, $31, $8 | ||
| 3172 | mulq $7, $6, $24 | ||
| 3173 | umulh $7, $6, $21 | ||
| 3174 | cmplt $24, $31, $27 | ||
| 3175 | cmplt $21, $31, $18 | ||
| 3176 | addq $24, $24, $24 | ||
| 3177 | addq $21, $21, $21 | ||
| 3178 | addq $21, $27, $21 | ||
| 3179 | addq $8, $18, $8 | ||
| 3180 | addq $22, $24, $22 | ||
| 3181 | addq $23, $21, $23 | ||
| 3182 | cmpult $22, $24, $20 | ||
| 3183 | cmpult $23, $21, $25 | ||
| 3184 | addq $23, $20, $23 | ||
| 3185 | addq $8, $25, $8 | ||
| 3186 | stq $22, 104($16) | ||
| 3187 | bis $31, $31, $22 | ||
| 3188 | mulq $7, $7, $28 | ||
| 3189 | umulh $7, $7, $19 | ||
| 3190 | addq $23, $28, $23 | ||
| 3191 | addq $8, $19, $8 | ||
| 3192 | cmpult $23, $28, $17 | ||
| 3193 | cmpult $8, $19, $27 | ||
| 3194 | addq $8, $17, $8 | ||
| 3195 | addq $22, $27, $22 | ||
| 3196 | stq $23, 112($16) | ||
| 3197 | stq $8, 120($16) | ||
| 3198 | ret $31,($26),1 | ||
| 3199 | .end bn_sqr_comba8 | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.s.works b/src/lib/libcrypto/bn/asm/alpha.s.works deleted file mode 100644 index ee6c587809..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.s.works +++ /dev/null | |||
| @@ -1,533 +0,0 @@ | |||
| 1 | |||
| 2 | # DEC Alpha assember | ||
| 3 | # The bn_div64 is actually gcc output but the other parts are hand done. | ||
| 4 | # Thanks to tzeruch@ceddec.com for sending me the gcc output for | ||
| 5 | # bn_div64. | ||
| 6 | # I've gone back and re-done most of routines. | ||
| 7 | # The key thing to remeber for the 164 CPU is that while a | ||
| 8 | # multiply operation takes 8 cycles, another one can only be issued | ||
| 9 | # after 4 cycles have elapsed. I've done modification to help | ||
| 10 | # improve this. Also, normally, a ld instruction will not be available | ||
| 11 | # for about 3 cycles. | ||
| 12 | .file 1 "bn_asm.c" | ||
| 13 | .set noat | ||
| 14 | gcc2_compiled.: | ||
| 15 | __gnu_compiled_c: | ||
| 16 | .text | ||
| 17 | .align 3 | ||
| 18 | .globl bn_mul_add_words | ||
| 19 | .ent bn_mul_add_words | ||
| 20 | bn_mul_add_words: | ||
| 21 | bn_mul_add_words..ng: | ||
| 22 | .frame $30,0,$26,0 | ||
| 23 | .prologue 0 | ||
| 24 | .align 5 | ||
| 25 | subq $18,4,$18 | ||
| 26 | bis $31,$31,$0 | ||
| 27 | blt $18,$43 # if we are -1, -2, -3 or -4 goto tail code | ||
| 28 | ldq $20,0($17) # 1 1 | ||
| 29 | ldq $1,0($16) # 1 1 | ||
| 30 | .align 3 | ||
| 31 | $42: | ||
| 32 | mulq $20,$19,$5 # 1 2 1 ###### | ||
| 33 | ldq $21,8($17) # 2 1 | ||
| 34 | ldq $2,8($16) # 2 1 | ||
| 35 | umulh $20,$19,$20 # 1 2 ###### | ||
| 36 | ldq $27,16($17) # 3 1 | ||
| 37 | ldq $3,16($16) # 3 1 | ||
| 38 | mulq $21,$19,$6 # 2 2 1 ###### | ||
| 39 | ldq $28,24($17) # 4 1 | ||
| 40 | addq $1,$5,$1 # 1 2 2 | ||
| 41 | ldq $4,24($16) # 4 1 | ||
| 42 | umulh $21,$19,$21 # 2 2 ###### | ||
| 43 | cmpult $1,$5,$22 # 1 2 3 1 | ||
| 44 | addq $20,$22,$20 # 1 3 1 | ||
| 45 | addq $1,$0,$1 # 1 2 3 1 | ||
| 46 | mulq $27,$19,$7 # 3 2 1 ###### | ||
| 47 | cmpult $1,$0,$0 # 1 2 3 2 | ||
| 48 | addq $2,$6,$2 # 2 2 2 | ||
| 49 | addq $20,$0,$0 # 1 3 2 | ||
| 50 | cmpult $2,$6,$23 # 2 2 3 1 | ||
| 51 | addq $21,$23,$21 # 2 3 1 | ||
| 52 | umulh $27,$19,$27 # 3 2 ###### | ||
| 53 | addq $2,$0,$2 # 2 2 3 1 | ||
| 54 | cmpult $2,$0,$0 # 2 2 3 2 | ||
| 55 | subq $18,4,$18 | ||
| 56 | mulq $28,$19,$8 # 4 2 1 ###### | ||
| 57 | addq $21,$0,$0 # 2 3 2 | ||
| 58 | addq $3,$7,$3 # 3 2 2 | ||
| 59 | addq $16,32,$16 | ||
| 60 | cmpult $3,$7,$24 # 3 2 3 1 | ||
| 61 | stq $1,-32($16) # 1 2 4 | ||
| 62 | umulh $28,$19,$28 # 4 2 ###### | ||
| 63 | addq $27,$24,$27 # 3 3 1 | ||
| 64 | addq $3,$0,$3 # 3 2 3 1 | ||
| 65 | stq $2,-24($16) # 2 2 4 | ||
| 66 | cmpult $3,$0,$0 # 3 2 3 2 | ||
| 67 | stq $3,-16($16) # 3 2 4 | ||
| 68 | addq $4,$8,$4 # 4 2 2 | ||
| 69 | addq $27,$0,$0 # 3 3 2 | ||
| 70 | cmpult $4,$8,$25 # 4 2 3 1 | ||
| 71 | addq $17,32,$17 | ||
| 72 | addq $28,$25,$28 # 4 3 1 | ||
| 73 | addq $4,$0,$4 # 4 2 3 1 | ||
| 74 | cmpult $4,$0,$0 # 4 2 3 2 | ||
| 75 | stq $4,-8($16) # 4 2 4 | ||
| 76 | addq $28,$0,$0 # 4 3 2 | ||
| 77 | blt $18,$43 | ||
| 78 | |||
| 79 | ldq $20,0($17) # 1 1 | ||
| 80 | ldq $1,0($16) # 1 1 | ||
| 81 | |||
| 82 | br $42 | ||
| 83 | |||
| 84 | .align 4 | ||
| 85 | $45: | ||
| 86 | ldq $20,0($17) # 4 1 | ||
| 87 | ldq $1,0($16) # 4 1 | ||
| 88 | mulq $20,$19,$5 # 4 2 1 | ||
| 89 | subq $18,1,$18 | ||
| 90 | addq $16,8,$16 | ||
| 91 | addq $17,8,$17 | ||
| 92 | umulh $20,$19,$20 # 4 2 | ||
| 93 | addq $1,$5,$1 # 4 2 2 | ||
| 94 | cmpult $1,$5,$22 # 4 2 3 1 | ||
| 95 | addq $20,$22,$20 # 4 3 1 | ||
| 96 | addq $1,$0,$1 # 4 2 3 1 | ||
| 97 | cmpult $1,$0,$0 # 4 2 3 2 | ||
| 98 | addq $20,$0,$0 # 4 3 2 | ||
| 99 | stq $1,-8($16) # 4 2 4 | ||
| 100 | bgt $18,$45 | ||
| 101 | ret $31,($26),1 # else exit | ||
| 102 | |||
| 103 | .align 4 | ||
| 104 | $43: | ||
| 105 | addq $18,4,$18 | ||
| 106 | bgt $18,$45 # goto tail code | ||
| 107 | ret $31,($26),1 # else exit | ||
| 108 | |||
| 109 | .end bn_mul_add_words | ||
| 110 | .align 3 | ||
| 111 | .globl bn_mul_words | ||
| 112 | .ent bn_mul_words | ||
| 113 | bn_mul_words: | ||
| 114 | bn_mul_words..ng: | ||
| 115 | .frame $30,0,$26,0 | ||
| 116 | .prologue 0 | ||
| 117 | .align 5 | ||
| 118 | subq $18,4,$18 | ||
| 119 | bis $31,$31,$0 | ||
| 120 | blt $18,$143 # if we are -1, -2, -3 or -4 goto tail code | ||
| 121 | ldq $20,0($17) # 1 1 | ||
| 122 | .align 3 | ||
| 123 | $142: | ||
| 124 | |||
| 125 | mulq $20,$19,$5 # 1 2 1 ##### | ||
| 126 | ldq $21,8($17) # 2 1 | ||
| 127 | ldq $27,16($17) # 3 1 | ||
| 128 | umulh $20,$19,$20 # 1 2 ##### | ||
| 129 | ldq $28,24($17) # 4 1 | ||
| 130 | mulq $21,$19,$6 # 2 2 1 ##### | ||
| 131 | addq $5,$0,$5 # 1 2 3 1 | ||
| 132 | subq $18,4,$18 | ||
| 133 | cmpult $5,$0,$0 # 1 2 3 2 | ||
| 134 | umulh $21,$19,$21 # 2 2 ##### | ||
| 135 | addq $20,$0,$0 # 1 3 2 | ||
| 136 | addq $17,32,$17 | ||
| 137 | addq $6,$0,$6 # 2 2 3 1 | ||
| 138 | mulq $27,$19,$7 # 3 2 1 ##### | ||
| 139 | cmpult $6,$0,$0 # 2 2 3 2 | ||
| 140 | addq $21,$0,$0 # 2 3 2 | ||
| 141 | addq $16,32,$16 | ||
| 142 | umulh $27,$19,$27 # 3 2 ##### | ||
| 143 | stq $5,-32($16) # 1 2 4 | ||
| 144 | mulq $28,$19,$8 # 4 2 1 ##### | ||
| 145 | addq $7,$0,$7 # 3 2 3 1 | ||
| 146 | stq $6,-24($16) # 2 2 4 | ||
| 147 | cmpult $7,$0,$0 # 3 2 3 2 | ||
| 148 | umulh $28,$19,$28 # 4 2 ##### | ||
| 149 | addq $27,$0,$0 # 3 3 2 | ||
| 150 | stq $7,-16($16) # 3 2 4 | ||
| 151 | addq $8,$0,$8 # 4 2 3 1 | ||
| 152 | cmpult $8,$0,$0 # 4 2 3 2 | ||
| 153 | |||
| 154 | addq $28,$0,$0 # 4 3 2 | ||
| 155 | |||
| 156 | stq $8,-8($16) # 4 2 4 | ||
| 157 | |||
| 158 | blt $18,$143 | ||
| 159 | |||
| 160 | ldq $20,0($17) # 1 1 | ||
| 161 | |||
| 162 | br $142 | ||
| 163 | |||
| 164 | .align 4 | ||
| 165 | $145: | ||
| 166 | ldq $20,0($17) # 4 1 | ||
| 167 | mulq $20,$19,$5 # 4 2 1 | ||
| 168 | subq $18,1,$18 | ||
| 169 | umulh $20,$19,$20 # 4 2 | ||
| 170 | addq $5,$0,$5 # 4 2 3 1 | ||
| 171 | addq $16,8,$16 | ||
| 172 | cmpult $5,$0,$0 # 4 2 3 2 | ||
| 173 | addq $17,8,$17 | ||
| 174 | addq $20,$0,$0 # 4 3 2 | ||
| 175 | stq $5,-8($16) # 4 2 4 | ||
| 176 | |||
| 177 | bgt $18,$145 | ||
| 178 | ret $31,($26),1 # else exit | ||
| 179 | |||
| 180 | .align 4 | ||
| 181 | $143: | ||
| 182 | addq $18,4,$18 | ||
| 183 | bgt $18,$145 # goto tail code | ||
| 184 | ret $31,($26),1 # else exit | ||
| 185 | |||
| 186 | .end bn_mul_words | ||
| 187 | .align 3 | ||
| 188 | .globl bn_sqr_words | ||
| 189 | .ent bn_sqr_words | ||
| 190 | bn_sqr_words: | ||
| 191 | bn_sqr_words..ng: | ||
| 192 | .frame $30,0,$26,0 | ||
| 193 | .prologue 0 | ||
| 194 | |||
| 195 | subq $18,4,$18 | ||
| 196 | blt $18,$543 # if we are -1, -2, -3 or -4 goto tail code | ||
| 197 | ldq $20,0($17) # 1 1 | ||
| 198 | .align 3 | ||
| 199 | $542: | ||
| 200 | mulq $20,$20,$5 ###### | ||
| 201 | ldq $21,8($17) # 1 1 | ||
| 202 | subq $18,4 | ||
| 203 | umulh $20,$20,$1 ###### | ||
| 204 | ldq $27,16($17) # 1 1 | ||
| 205 | mulq $21,$21,$6 ###### | ||
| 206 | ldq $28,24($17) # 1 1 | ||
| 207 | stq $5,0($16) # r[0] | ||
| 208 | umulh $21,$21,$2 ###### | ||
| 209 | stq $1,8($16) # r[1] | ||
| 210 | mulq $27,$27,$7 ###### | ||
| 211 | stq $6,16($16) # r[0] | ||
| 212 | umulh $27,$27,$3 ###### | ||
| 213 | stq $2,24($16) # r[1] | ||
| 214 | mulq $28,$28,$8 ###### | ||
| 215 | stq $7,32($16) # r[0] | ||
| 216 | umulh $28,$28,$4 ###### | ||
| 217 | stq $3,40($16) # r[1] | ||
| 218 | |||
| 219 | addq $16,64,$16 | ||
| 220 | addq $17,32,$17 | ||
| 221 | stq $8,-16($16) # r[0] | ||
| 222 | stq $4,-8($16) # r[1] | ||
| 223 | |||
| 224 | blt $18,$543 | ||
| 225 | ldq $20,0($17) # 1 1 | ||
| 226 | br $542 | ||
| 227 | |||
| 228 | $442: | ||
| 229 | ldq $20,0($17) # a[0] | ||
| 230 | mulq $20,$20,$5 # a[0]*w low part r2 | ||
| 231 | addq $16,16,$16 | ||
| 232 | addq $17,8,$17 | ||
| 233 | subq $18,1,$18 | ||
| 234 | umulh $20,$20,$1 # a[0]*w high part r3 | ||
| 235 | stq $5,-16($16) # r[0] | ||
| 236 | stq $1,-8($16) # r[1] | ||
| 237 | |||
| 238 | bgt $18,$442 | ||
| 239 | ret $31,($26),1 # else exit | ||
| 240 | |||
| 241 | .align 4 | ||
| 242 | $543: | ||
| 243 | addq $18,4,$18 | ||
| 244 | bgt $18,$442 # goto tail code | ||
| 245 | ret $31,($26),1 # else exit | ||
| 246 | .end bn_sqr_words | ||
| 247 | |||
| 248 | .align 3 | ||
| 249 | .globl bn_add_words | ||
| 250 | .ent bn_add_words | ||
| 251 | bn_add_words: | ||
| 252 | bn_add_words..ng: | ||
| 253 | .frame $30,0,$26,0 | ||
| 254 | .prologue 0 | ||
| 255 | |||
| 256 | subq $19,4,$19 | ||
| 257 | bis $31,$31,$0 # carry = 0 | ||
| 258 | blt $19,$900 | ||
| 259 | ldq $5,0($17) # a[0] | ||
| 260 | ldq $1,0($18) # b[1] | ||
| 261 | .align 3 | ||
| 262 | $901: | ||
| 263 | addq $1,$5,$1 # r=a+b; | ||
| 264 | ldq $6,8($17) # a[1] | ||
| 265 | cmpult $1,$5,$22 # did we overflow? | ||
| 266 | ldq $2,8($18) # b[1] | ||
| 267 | addq $1,$0,$1 # c+= overflow | ||
| 268 | ldq $7,16($17) # a[2] | ||
| 269 | cmpult $1,$0,$0 # overflow? | ||
| 270 | ldq $3,16($18) # b[2] | ||
| 271 | addq $0,$22,$0 | ||
| 272 | ldq $8,24($17) # a[3] | ||
| 273 | addq $2,$6,$2 # r=a+b; | ||
| 274 | ldq $4,24($18) # b[3] | ||
| 275 | cmpult $2,$6,$23 # did we overflow? | ||
| 276 | addq $3,$7,$3 # r=a+b; | ||
| 277 | addq $2,$0,$2 # c+= overflow | ||
| 278 | cmpult $3,$7,$24 # did we overflow? | ||
| 279 | cmpult $2,$0,$0 # overflow? | ||
| 280 | addq $4,$8,$4 # r=a+b; | ||
| 281 | addq $0,$23,$0 | ||
| 282 | cmpult $4,$8,$25 # did we overflow? | ||
| 283 | addq $3,$0,$3 # c+= overflow | ||
| 284 | stq $1,0($16) # r[0]=c | ||
| 285 | cmpult $3,$0,$0 # overflow? | ||
| 286 | stq $2,8($16) # r[1]=c | ||
| 287 | addq $0,$24,$0 | ||
| 288 | stq $3,16($16) # r[2]=c | ||
| 289 | addq $4,$0,$4 # c+= overflow | ||
| 290 | subq $19,4,$19 # loop-- | ||
| 291 | cmpult $4,$0,$0 # overflow? | ||
| 292 | addq $17,32,$17 # a++ | ||
| 293 | addq $0,$25,$0 | ||
| 294 | stq $4,24($16) # r[3]=c | ||
| 295 | addq $18,32,$18 # b++ | ||
| 296 | addq $16,32,$16 # r++ | ||
| 297 | |||
| 298 | blt $19,$900 | ||
| 299 | ldq $5,0($17) # a[0] | ||
| 300 | ldq $1,0($18) # b[1] | ||
| 301 | br $901 | ||
| 302 | .align 4 | ||
| 303 | $945: | ||
| 304 | ldq $5,0($17) # a[0] | ||
| 305 | ldq $1,0($18) # b[1] | ||
| 306 | addq $1,$5,$1 # r=a+b; | ||
| 307 | subq $19,1,$19 # loop-- | ||
| 308 | addq $1,$0,$1 # c+= overflow | ||
| 309 | addq $17,8,$17 # a++ | ||
| 310 | cmpult $1,$5,$22 # did we overflow? | ||
| 311 | cmpult $1,$0,$0 # overflow? | ||
| 312 | addq $18,8,$18 # b++ | ||
| 313 | stq $1,0($16) # r[0]=c | ||
| 314 | addq $0,$22,$0 | ||
| 315 | addq $16,8,$16 # r++ | ||
| 316 | |||
| 317 | bgt $19,$945 | ||
| 318 | ret $31,($26),1 # else exit | ||
| 319 | |||
| 320 | $900: | ||
| 321 | addq $19,4,$19 | ||
| 322 | bgt $19,$945 # goto tail code | ||
| 323 | ret $31,($26),1 # else exit | ||
| 324 | .end bn_add_words | ||
| 325 | |||
| 326 | # | ||
| 327 | # What follows was taken directly from the C compiler with a few | ||
| 328 | # hacks to redo the lables. | ||
| 329 | # | ||
| 330 | .text | ||
| 331 | .align 3 | ||
| 332 | .globl bn_div64 | ||
| 333 | .ent bn_div64 | ||
| 334 | bn_div64: | ||
| 335 | ldgp $29,0($27) | ||
| 336 | bn_div64..ng: | ||
| 337 | lda $30,-48($30) | ||
| 338 | .frame $30,48,$26,0 | ||
| 339 | stq $26,0($30) | ||
| 340 | stq $9,8($30) | ||
| 341 | stq $10,16($30) | ||
| 342 | stq $11,24($30) | ||
| 343 | stq $12,32($30) | ||
| 344 | stq $13,40($30) | ||
| 345 | .mask 0x4003e00,-48 | ||
| 346 | .prologue 1 | ||
| 347 | bis $16,$16,$9 | ||
| 348 | bis $17,$17,$10 | ||
| 349 | bis $18,$18,$11 | ||
| 350 | bis $31,$31,$13 | ||
| 351 | bis $31,2,$12 | ||
| 352 | bne $11,$119 | ||
| 353 | lda $0,-1 | ||
| 354 | br $31,$136 | ||
| 355 | .align 4 | ||
| 356 | $119: | ||
| 357 | bis $11,$11,$16 | ||
| 358 | jsr $26,BN_num_bits_word | ||
| 359 | ldgp $29,0($26) | ||
| 360 | subq $0,64,$1 | ||
| 361 | beq $1,$120 | ||
| 362 | bis $31,1,$1 | ||
| 363 | sll $1,$0,$1 | ||
| 364 | cmpule $9,$1,$1 | ||
| 365 | bne $1,$120 | ||
| 366 | # lda $16,_IO_stderr_ | ||
| 367 | # lda $17,$C32 | ||
| 368 | # bis $0,$0,$18 | ||
| 369 | # jsr $26,fprintf | ||
| 370 | # ldgp $29,0($26) | ||
| 371 | jsr $26,abort | ||
| 372 | ldgp $29,0($26) | ||
| 373 | .align 4 | ||
| 374 | $120: | ||
| 375 | bis $31,64,$3 | ||
| 376 | cmpult $9,$11,$2 | ||
| 377 | subq $3,$0,$1 | ||
| 378 | addl $1,$31,$0 | ||
| 379 | subq $9,$11,$1 | ||
| 380 | cmoveq $2,$1,$9 | ||
| 381 | beq $0,$122 | ||
| 382 | zapnot $0,15,$2 | ||
| 383 | subq $3,$0,$1 | ||
| 384 | sll $11,$2,$11 | ||
| 385 | sll $9,$2,$3 | ||
| 386 | srl $10,$1,$1 | ||
| 387 | sll $10,$2,$10 | ||
| 388 | bis $3,$1,$9 | ||
| 389 | $122: | ||
| 390 | srl $11,32,$5 | ||
| 391 | zapnot $11,15,$6 | ||
| 392 | lda $7,-1 | ||
| 393 | .align 5 | ||
| 394 | $123: | ||
| 395 | srl $9,32,$1 | ||
| 396 | subq $1,$5,$1 | ||
| 397 | bne $1,$126 | ||
| 398 | zapnot $7,15,$27 | ||
| 399 | br $31,$127 | ||
| 400 | .align 4 | ||
| 401 | $126: | ||
| 402 | bis $9,$9,$24 | ||
| 403 | bis $5,$5,$25 | ||
| 404 | divqu $24,$25,$27 | ||
| 405 | $127: | ||
| 406 | srl $10,32,$4 | ||
| 407 | .align 5 | ||
| 408 | $128: | ||
| 409 | mulq $27,$5,$1 | ||
| 410 | subq $9,$1,$3 | ||
| 411 | zapnot $3,240,$1 | ||
| 412 | bne $1,$129 | ||
| 413 | mulq $6,$27,$2 | ||
| 414 | sll $3,32,$1 | ||
| 415 | addq $1,$4,$1 | ||
| 416 | cmpule $2,$1,$2 | ||
| 417 | bne $2,$129 | ||
| 418 | subq $27,1,$27 | ||
| 419 | br $31,$128 | ||
| 420 | .align 4 | ||
| 421 | $129: | ||
| 422 | mulq $27,$6,$1 | ||
| 423 | mulq $27,$5,$4 | ||
| 424 | srl $1,32,$3 | ||
| 425 | sll $1,32,$1 | ||
| 426 | addq $4,$3,$4 | ||
| 427 | cmpult $10,$1,$2 | ||
| 428 | subq $10,$1,$10 | ||
| 429 | addq $2,$4,$2 | ||
| 430 | cmpult $9,$2,$1 | ||
| 431 | bis $2,$2,$4 | ||
| 432 | beq $1,$134 | ||
| 433 | addq $9,$11,$9 | ||
| 434 | subq $27,1,$27 | ||
| 435 | $134: | ||
| 436 | subl $12,1,$12 | ||
| 437 | subq $9,$4,$9 | ||
| 438 | beq $12,$124 | ||
| 439 | sll $27,32,$13 | ||
| 440 | sll $9,32,$2 | ||
| 441 | srl $10,32,$1 | ||
| 442 | sll $10,32,$10 | ||
| 443 | bis $2,$1,$9 | ||
| 444 | br $31,$123 | ||
| 445 | .align 4 | ||
| 446 | $124: | ||
| 447 | bis $13,$27,$0 | ||
| 448 | $136: | ||
| 449 | ldq $26,0($30) | ||
| 450 | ldq $9,8($30) | ||
| 451 | ldq $10,16($30) | ||
| 452 | ldq $11,24($30) | ||
| 453 | ldq $12,32($30) | ||
| 454 | ldq $13,40($30) | ||
| 455 | addq $30,48,$30 | ||
| 456 | ret $31,($26),1 | ||
| 457 | .end bn_div64 | ||
| 458 | |||
| 459 | .set noat | ||
| 460 | .text | ||
| 461 | .align 3 | ||
| 462 | .globl bn_sub_words | ||
| 463 | .ent bn_sub_words | ||
| 464 | bn_sub_words: | ||
| 465 | bn_sub_words..ng: | ||
| 466 | .frame $30,0,$26,0 | ||
| 467 | .prologue 0 | ||
| 468 | |||
| 469 | subq $19, 4, $19 | ||
| 470 | bis $31, $31, $0 | ||
| 471 | blt $19, $100 | ||
| 472 | ldq $1, 0($17) | ||
| 473 | ldq $2, 0($18) | ||
| 474 | $101: | ||
| 475 | ldq $3, 8($17) | ||
| 476 | cmpult $1, $2, $4 | ||
| 477 | ldq $5, 8($18) | ||
| 478 | subq $1, $2, $1 | ||
| 479 | ldq $6, 16($17) | ||
| 480 | cmpult $1, $0, $2 | ||
| 481 | ldq $7, 16($18) | ||
| 482 | subq $1, $0, $23 | ||
| 483 | ldq $8, 24($17) | ||
| 484 | addq $2, $4, $0 | ||
| 485 | cmpult $3, $5, $24 | ||
| 486 | subq $3, $5, $3 | ||
| 487 | ldq $22, 24($18) | ||
| 488 | cmpult $3, $0, $5 | ||
| 489 | subq $3, $0, $25 | ||
| 490 | addq $5, $24, $0 | ||
| 491 | cmpult $6, $7, $27 | ||
| 492 | subq $6, $7, $6 | ||
| 493 | stq $23, 0($16) | ||
| 494 | cmpult $6, $0, $7 | ||
| 495 | subq $6, $0, $28 | ||
| 496 | addq $7, $27, $0 | ||
| 497 | cmpult $8, $22, $21 | ||
| 498 | subq $8, $22, $8 | ||
| 499 | stq $25, 8($16) | ||
| 500 | cmpult $8, $0, $22 | ||
| 501 | subq $8, $0, $20 | ||
| 502 | addq $22, $21, $0 | ||
| 503 | stq $28, 16($16) | ||
| 504 | subq $19, 4, $19 | ||
| 505 | stq $20, 24($16) | ||
| 506 | addq $17, 32, $17 | ||
| 507 | addq $18, 32, $18 | ||
| 508 | addq $16, 32, $16 | ||
| 509 | blt $19, $100 | ||
| 510 | ldq $1, 0($17) | ||
| 511 | ldq $2, 0($18) | ||
| 512 | br $101 | ||
| 513 | $102: | ||
| 514 | ldq $1, 0($17) | ||
| 515 | ldq $2, 0($18) | ||
| 516 | cmpult $1, $2, $27 | ||
| 517 | subq $1, $2, $1 | ||
| 518 | cmpult $1, $0, $2 | ||
| 519 | subq $1, $0, $1 | ||
| 520 | stq $1, 0($16) | ||
| 521 | addq $2, $27, $0 | ||
| 522 | addq $17, 8, $17 | ||
| 523 | addq $18, 8, $18 | ||
| 524 | addq $16, 8, $16 | ||
| 525 | subq $19, 1, $19 | ||
| 526 | bgt $19, $102 | ||
| 527 | ret $31,($26),1 | ||
| 528 | $100: | ||
| 529 | addq $19, 4, $19 | ||
| 530 | bgt $19, $102 | ||
| 531 | $103: | ||
| 532 | ret $31,($26),1 | ||
| 533 | .end bn_sub_words | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/add.pl b/src/lib/libcrypto/bn/asm/alpha.works/add.pl deleted file mode 100644 index 4dc76e6b69..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/add.pl +++ /dev/null | |||
| @@ -1,119 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_add_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | $count=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &br(&label("finish")); | ||
| 23 | &blt($count,&label("finish")); | ||
| 24 | |||
| 25 | ($a0,$b0)=&NR(2); | ||
| 26 | &ld($a0,&QWPw(0,$ap)); | ||
| 27 | &ld($b0,&QWPw(0,$bp)); | ||
| 28 | |||
| 29 | ########################################################## | ||
| 30 | &set_label("loop"); | ||
| 31 | |||
| 32 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 33 | ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp)); | ||
| 34 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 35 | ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp)); | ||
| 36 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 37 | ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp)); | ||
| 38 | |||
| 39 | ($o0,$t0)=&NR(2); | ||
| 40 | &add($a0,$b0,$o0); | ||
| 41 | &cmpult($o0,$b0,$t0); | ||
| 42 | &add($o0,$cc,$o0); | ||
| 43 | &cmpult($o0,$cc,$cc); | ||
| 44 | &add($cc,$t0,$cc); &FR($t0); | ||
| 45 | |||
| 46 | ($t1,$o1)=&NR(2); | ||
| 47 | |||
| 48 | &add($a1,$b1,$o1); &FR($a1); | ||
| 49 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 50 | &add($o1,$cc,$o1); | ||
| 51 | &cmpult($o1,$cc,$cc); | ||
| 52 | &add($cc,$t1,$cc); &FR($t1); | ||
| 53 | |||
| 54 | ($t2,$o2)=&NR(2); | ||
| 55 | |||
| 56 | &add($a2,$b2,$o2); &FR($a2); | ||
| 57 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 58 | &add($o2,$cc,$o2); | ||
| 59 | &cmpult($o2,$cc,$cc); | ||
| 60 | &add($cc,$t2,$cc); &FR($t2); | ||
| 61 | |||
| 62 | ($t3,$o3)=&NR(2); | ||
| 63 | |||
| 64 | &add($a3,$b3,$o3); &FR($a3); | ||
| 65 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 66 | &add($o3,$cc,$o3); | ||
| 67 | &cmpult($o3,$cc,$cc); | ||
| 68 | &add($cc,$t3,$cc); &FR($t3); | ||
| 69 | |||
| 70 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 71 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 72 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 73 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 74 | |||
| 75 | &sub($count,4,$count); # count-=4 | ||
| 76 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 77 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 78 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 79 | |||
| 80 | &blt($count,&label("finish")); | ||
| 81 | &ld($a0,&QWPw(0,$ap)); | ||
| 82 | &ld($b0,&QWPw(0,$bp)); | ||
| 83 | &br(&label("loop")); | ||
| 84 | ################################################## | ||
| 85 | # Do the last 0..3 words | ||
| 86 | |||
| 87 | ($t0,$o0)=&NR(2); | ||
| 88 | &set_label("last_loop"); | ||
| 89 | |||
| 90 | &ld($a0,&QWPw(0,$ap)); # get a | ||
| 91 | &ld($b0,&QWPw(0,$bp)); # get b | ||
| 92 | |||
| 93 | &add($a0,$b0,$o0); | ||
| 94 | &cmpult($o0,$b0,$t0); # will we borrow? | ||
| 95 | &add($o0,$cc,$o0); # will we borrow? | ||
| 96 | &cmpult($o0,$cc,$cc); # will we borrow? | ||
| 97 | &add($cc,$t0,$cc); # add the borrows | ||
| 98 | &st($o0,&QWPw(0,$rp)); # save | ||
| 99 | |||
| 100 | &add($ap,$QWS,$ap); | ||
| 101 | &add($bp,$QWS,$bp); | ||
| 102 | &add($rp,$QWS,$rp); | ||
| 103 | &sub($count,1,$count); | ||
| 104 | &bgt($count,&label("last_loop")); | ||
| 105 | &function_end_A($name); | ||
| 106 | |||
| 107 | ###################################################### | ||
| 108 | &set_label("finish"); | ||
| 109 | &add($count,4,$count); | ||
| 110 | &bgt($count,&label("last_loop")); | ||
| 111 | |||
| 112 | &FR($o0,$t0,$a0,$b0); | ||
| 113 | &set_label("end"); | ||
| 114 | &function_end($name); | ||
| 115 | |||
| 116 | &fin_pool; | ||
| 117 | } | ||
| 118 | |||
| 119 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/div.pl b/src/lib/libcrypto/bn/asm/alpha.works/div.pl deleted file mode 100644 index 7ec144377f..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/div.pl +++ /dev/null | |||
| @@ -1,144 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | sub bn_div64 | ||
| 4 | { | ||
| 5 | local($data)=<<'EOF'; | ||
| 6 | # | ||
| 7 | # What follows was taken directly from the C compiler with a few | ||
| 8 | # hacks to redo the lables. | ||
| 9 | # | ||
| 10 | .text | ||
| 11 | .set noreorder | ||
| 12 | .set volatile | ||
| 13 | .align 3 | ||
| 14 | .globl bn_div64 | ||
| 15 | .ent bn_div64 | ||
| 16 | bn_div64: | ||
| 17 | ldgp $29,0($27) | ||
| 18 | bn_div64..ng: | ||
| 19 | lda $30,-48($30) | ||
| 20 | .frame $30,48,$26,0 | ||
| 21 | stq $26,0($30) | ||
| 22 | stq $9,8($30) | ||
| 23 | stq $10,16($30) | ||
| 24 | stq $11,24($30) | ||
| 25 | stq $12,32($30) | ||
| 26 | stq $13,40($30) | ||
| 27 | .mask 0x4003e00,-48 | ||
| 28 | .prologue 1 | ||
| 29 | bis $16,$16,$9 | ||
| 30 | bis $17,$17,$10 | ||
| 31 | bis $18,$18,$11 | ||
| 32 | bis $31,$31,$13 | ||
| 33 | bis $31,2,$12 | ||
| 34 | bne $11,$9119 | ||
| 35 | lda $0,-1 | ||
| 36 | br $31,$9136 | ||
| 37 | .align 4 | ||
| 38 | $9119: | ||
| 39 | bis $11,$11,$16 | ||
| 40 | jsr $26,BN_num_bits_word | ||
| 41 | ldgp $29,0($26) | ||
| 42 | subq $0,64,$1 | ||
| 43 | beq $1,$9120 | ||
| 44 | bis $31,1,$1 | ||
| 45 | sll $1,$0,$1 | ||
| 46 | cmpule $9,$1,$1 | ||
| 47 | bne $1,$9120 | ||
| 48 | # lda $16,_IO_stderr_ | ||
| 49 | # lda $17,$C32 | ||
| 50 | # bis $0,$0,$18 | ||
| 51 | # jsr $26,fprintf | ||
| 52 | # ldgp $29,0($26) | ||
| 53 | jsr $26,abort | ||
| 54 | ldgp $29,0($26) | ||
| 55 | .align 4 | ||
| 56 | $9120: | ||
| 57 | bis $31,64,$3 | ||
| 58 | cmpult $9,$11,$2 | ||
| 59 | subq $3,$0,$1 | ||
| 60 | addl $1,$31,$0 | ||
| 61 | subq $9,$11,$1 | ||
| 62 | cmoveq $2,$1,$9 | ||
| 63 | beq $0,$9122 | ||
| 64 | zapnot $0,15,$2 | ||
| 65 | subq $3,$0,$1 | ||
| 66 | sll $11,$2,$11 | ||
| 67 | sll $9,$2,$3 | ||
| 68 | srl $10,$1,$1 | ||
| 69 | sll $10,$2,$10 | ||
| 70 | bis $3,$1,$9 | ||
| 71 | $9122: | ||
| 72 | srl $11,32,$5 | ||
| 73 | zapnot $11,15,$6 | ||
| 74 | lda $7,-1 | ||
| 75 | .align 5 | ||
| 76 | $9123: | ||
| 77 | srl $9,32,$1 | ||
| 78 | subq $1,$5,$1 | ||
| 79 | bne $1,$9126 | ||
| 80 | zapnot $7,15,$27 | ||
| 81 | br $31,$9127 | ||
| 82 | .align 4 | ||
| 83 | $9126: | ||
| 84 | bis $9,$9,$24 | ||
| 85 | bis $5,$5,$25 | ||
| 86 | divqu $24,$25,$27 | ||
| 87 | $9127: | ||
| 88 | srl $10,32,$4 | ||
| 89 | .align 5 | ||
| 90 | $9128: | ||
| 91 | mulq $27,$5,$1 | ||
| 92 | subq $9,$1,$3 | ||
| 93 | zapnot $3,240,$1 | ||
| 94 | bne $1,$9129 | ||
| 95 | mulq $6,$27,$2 | ||
| 96 | sll $3,32,$1 | ||
| 97 | addq $1,$4,$1 | ||
| 98 | cmpule $2,$1,$2 | ||
| 99 | bne $2,$9129 | ||
| 100 | subq $27,1,$27 | ||
| 101 | br $31,$9128 | ||
| 102 | .align 4 | ||
| 103 | $9129: | ||
| 104 | mulq $27,$6,$1 | ||
| 105 | mulq $27,$5,$4 | ||
| 106 | srl $1,32,$3 | ||
| 107 | sll $1,32,$1 | ||
| 108 | addq $4,$3,$4 | ||
| 109 | cmpult $10,$1,$2 | ||
| 110 | subq $10,$1,$10 | ||
| 111 | addq $2,$4,$2 | ||
| 112 | cmpult $9,$2,$1 | ||
| 113 | bis $2,$2,$4 | ||
| 114 | beq $1,$9134 | ||
| 115 | addq $9,$11,$9 | ||
| 116 | subq $27,1,$27 | ||
| 117 | $9134: | ||
| 118 | subl $12,1,$12 | ||
| 119 | subq $9,$4,$9 | ||
| 120 | beq $12,$9124 | ||
| 121 | sll $27,32,$13 | ||
| 122 | sll $9,32,$2 | ||
| 123 | srl $10,32,$1 | ||
| 124 | sll $10,32,$10 | ||
| 125 | bis $2,$1,$9 | ||
| 126 | br $31,$9123 | ||
| 127 | .align 4 | ||
| 128 | $9124: | ||
| 129 | bis $13,$27,$0 | ||
| 130 | $9136: | ||
| 131 | ldq $26,0($30) | ||
| 132 | ldq $9,8($30) | ||
| 133 | ldq $10,16($30) | ||
| 134 | ldq $11,24($30) | ||
| 135 | ldq $12,32($30) | ||
| 136 | ldq $13,40($30) | ||
| 137 | addq $30,48,$30 | ||
| 138 | ret $31,($26),1 | ||
| 139 | .end bn_div64 | ||
| 140 | EOF | ||
| 141 | &asm_add($data); | ||
| 142 | } | ||
| 143 | |||
| 144 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul.pl deleted file mode 100644 index b182bae452..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/mul.pl +++ /dev/null | |||
| @@ -1,116 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | $word=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &br(&label("finish")); | ||
| 23 | &blt($count,&label("finish")); | ||
| 24 | |||
| 25 | ($a0,$r0)=&NR(2); | ||
| 26 | &ld($a0,&QWPw(0,$ap)); | ||
| 27 | &ld($r0,&QWPw(0,$rp)); | ||
| 28 | |||
| 29 | $a=<<'EOF'; | ||
| 30 | ########################################################## | ||
| 31 | &set_label("loop"); | ||
| 32 | |||
| 33 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 34 | ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp)); | ||
| 35 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 36 | ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp)); | ||
| 37 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 38 | ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp)); | ||
| 39 | |||
| 40 | ($o0,$t0)=&NR(2); | ||
| 41 | &add($a0,$b0,$o0); | ||
| 42 | &cmpult($o0,$b0,$t0); | ||
| 43 | &add($o0,$cc,$o0); | ||
| 44 | &cmpult($o0,$cc,$cc); | ||
| 45 | &add($cc,$t0,$cc); &FR($t0); | ||
| 46 | |||
| 47 | ($t1,$o1)=&NR(2); | ||
| 48 | |||
| 49 | &add($a1,$b1,$o1); &FR($a1); | ||
| 50 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 51 | &add($o1,$cc,$o1); | ||
| 52 | &cmpult($o1,$cc,$cc); | ||
| 53 | &add($cc,$t1,$cc); &FR($t1); | ||
| 54 | |||
| 55 | ($t2,$o2)=&NR(2); | ||
| 56 | |||
| 57 | &add($a2,$b2,$o2); &FR($a2); | ||
| 58 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 59 | &add($o2,$cc,$o2); | ||
| 60 | &cmpult($o2,$cc,$cc); | ||
| 61 | &add($cc,$t2,$cc); &FR($t2); | ||
| 62 | |||
| 63 | ($t3,$o3)=&NR(2); | ||
| 64 | |||
| 65 | &add($a3,$b3,$o3); &FR($a3); | ||
| 66 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 67 | &add($o3,$cc,$o3); | ||
| 68 | &cmpult($o3,$cc,$cc); | ||
| 69 | &add($cc,$t3,$cc); &FR($t3); | ||
| 70 | |||
| 71 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 72 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 73 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 74 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 75 | |||
| 76 | &sub($count,4,$count); # count-=4 | ||
| 77 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 78 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 79 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 80 | |||
| 81 | &blt($count,&label("finish")); | ||
| 82 | &ld($a0,&QWPw(0,$ap)); | ||
| 83 | &ld($b0,&QWPw(0,$bp)); | ||
| 84 | &br(&label("loop")); | ||
| 85 | EOF | ||
| 86 | ################################################## | ||
| 87 | # Do the last 0..3 words | ||
| 88 | |||
| 89 | &set_label("last_loop"); | ||
| 90 | |||
| 91 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 92 | &mul($a0,$word,($l0)=&NR(1)); | ||
| 93 | &add($ap,$QWS,$ap); | ||
| 94 | &muh($a0,$word,($h0)=&NR(1)); &FR($a0); | ||
| 95 | &add($l0,$cc,$l0); | ||
| 96 | &add($rp,$QWS,$rp); | ||
| 97 | &sub($count,1,$count); | ||
| 98 | &cmpult($l0,$cc,$cc); | ||
| 99 | &st($l0,&QWPw(-1,$rp)); &FR($l0); | ||
| 100 | &add($h0,$cc,$cc); &FR($h0); | ||
| 101 | |||
| 102 | &bgt($count,&label("last_loop")); | ||
| 103 | &function_end_A($name); | ||
| 104 | |||
| 105 | ###################################################### | ||
| 106 | &set_label("finish"); | ||
| 107 | &add($count,4,$count); | ||
| 108 | &bgt($count,&label("last_loop")); | ||
| 109 | |||
| 110 | &set_label("end"); | ||
| 111 | &function_end($name); | ||
| 112 | |||
| 113 | &fin_pool; | ||
| 114 | } | ||
| 115 | |||
| 116 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_add.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_add.pl deleted file mode 100644 index e37f6315fb..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/mul_add.pl +++ /dev/null | |||
| @@ -1,120 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_add_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | $word=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &br(&label("finish")); | ||
| 23 | &blt($count,&label("finish")); | ||
| 24 | |||
| 25 | ($a0,$r0)=&NR(2); | ||
| 26 | &ld($a0,&QWPw(0,$ap)); | ||
| 27 | &ld($r0,&QWPw(0,$rp)); | ||
| 28 | |||
| 29 | $a=<<'EOF'; | ||
| 30 | ########################################################## | ||
| 31 | &set_label("loop"); | ||
| 32 | |||
| 33 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 34 | ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp)); | ||
| 35 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 36 | ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp)); | ||
| 37 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 38 | ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp)); | ||
| 39 | |||
| 40 | ($o0,$t0)=&NR(2); | ||
| 41 | &add($a0,$b0,$o0); | ||
| 42 | &cmpult($o0,$b0,$t0); | ||
| 43 | &add($o0,$cc,$o0); | ||
| 44 | &cmpult($o0,$cc,$cc); | ||
| 45 | &add($cc,$t0,$cc); &FR($t0); | ||
| 46 | |||
| 47 | ($t1,$o1)=&NR(2); | ||
| 48 | |||
| 49 | &add($a1,$b1,$o1); &FR($a1); | ||
| 50 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 51 | &add($o1,$cc,$o1); | ||
| 52 | &cmpult($o1,$cc,$cc); | ||
| 53 | &add($cc,$t1,$cc); &FR($t1); | ||
| 54 | |||
| 55 | ($t2,$o2)=&NR(2); | ||
| 56 | |||
| 57 | &add($a2,$b2,$o2); &FR($a2); | ||
| 58 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 59 | &add($o2,$cc,$o2); | ||
| 60 | &cmpult($o2,$cc,$cc); | ||
| 61 | &add($cc,$t2,$cc); &FR($t2); | ||
| 62 | |||
| 63 | ($t3,$o3)=&NR(2); | ||
| 64 | |||
| 65 | &add($a3,$b3,$o3); &FR($a3); | ||
| 66 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 67 | &add($o3,$cc,$o3); | ||
| 68 | &cmpult($o3,$cc,$cc); | ||
| 69 | &add($cc,$t3,$cc); &FR($t3); | ||
| 70 | |||
| 71 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 72 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 73 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 74 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 75 | |||
| 76 | &sub($count,4,$count); # count-=4 | ||
| 77 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 78 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 79 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 80 | |||
| 81 | &blt($count,&label("finish")); | ||
| 82 | &ld($a0,&QWPw(0,$ap)); | ||
| 83 | &ld($b0,&QWPw(0,$bp)); | ||
| 84 | &br(&label("loop")); | ||
| 85 | EOF | ||
| 86 | ################################################## | ||
| 87 | # Do the last 0..3 words | ||
| 88 | |||
| 89 | &set_label("last_loop"); | ||
| 90 | |||
| 91 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 92 | &ld(($r0)=&NR(1),&QWPw(0,$rp)); # get b | ||
| 93 | &mul($a0,$word,($l0)=&NR(1)); | ||
| 94 | &sub($count,1,$count); | ||
| 95 | &add($ap,$QWS,$ap); | ||
| 96 | &muh($a0,$word,($h0)=&NR(1)); &FR($a0); | ||
| 97 | &add($r0,$l0,$r0); | ||
| 98 | &add($rp,$QWS,$rp); | ||
| 99 | &cmpult($r0,$l0,($t0)=&NR(1)); &FR($l0); | ||
| 100 | &add($r0,$cc,$r0); | ||
| 101 | &add($h0,$t0,$h0); &FR($t0); | ||
| 102 | &cmpult($r0,$cc,$cc); | ||
| 103 | &st($r0,&QWPw(-1,$rp)); &FR($r0); | ||
| 104 | &add($h0,$cc,$cc); &FR($h0); | ||
| 105 | |||
| 106 | &bgt($count,&label("last_loop")); | ||
| 107 | &function_end_A($name); | ||
| 108 | |||
| 109 | ###################################################### | ||
| 110 | &set_label("finish"); | ||
| 111 | &add($count,4,$count); | ||
| 112 | &bgt($count,&label("last_loop")); | ||
| 113 | |||
| 114 | &set_label("end"); | ||
| 115 | &function_end($name); | ||
| 116 | |||
| 117 | &fin_pool; | ||
| 118 | } | ||
| 119 | |||
| 120 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.pl deleted file mode 100644 index 5efd201281..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.pl +++ /dev/null | |||
| @@ -1,213 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub mul_add_c | ||
| 5 | { | ||
| 6 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 7 | local($l1,$h1,$t1,$t2); | ||
| 8 | |||
| 9 | &mul($a,$b,($l1)=&NR(1)); | ||
| 10 | &muh($a,$b,($h1)=&NR(1)); | ||
| 11 | &add($c0,$l1,$c0); | ||
| 12 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 13 | &add($t1,$h1,$h1); &FR($t1); | ||
| 14 | &add($c1,$h1,$c1); | ||
| 15 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 16 | &add($c2,$t2,$c2); &FR($t2); | ||
| 17 | } | ||
| 18 | |||
| 19 | sub bn_mul_comba4 | ||
| 20 | { | ||
| 21 | local($name)=@_; | ||
| 22 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 23 | |||
| 24 | $cnt=1; | ||
| 25 | &init_pool(3); | ||
| 26 | |||
| 27 | $rp=&wparam(0); | ||
| 28 | $ap=&wparam(1); | ||
| 29 | $bp=&wparam(2); | ||
| 30 | |||
| 31 | &function_begin($name,""); | ||
| 32 | |||
| 33 | &comment(""); | ||
| 34 | |||
| 35 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 36 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 37 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 38 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 39 | &mul($a[0],$b[0],($r00)=&NR(1)); | ||
| 40 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 41 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 42 | &muh($a[0],$b[0],($r01)=&NR(1)); | ||
| 43 | &FR($ap); &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 44 | &FR($bp); &ld(($b[3])=&NR(1),&QWPw(3,$bp)); | ||
| 45 | &mul($a[0],$b[1],($r02)=&NR(1)); | ||
| 46 | |||
| 47 | ($R,$H1,$H2)=&NR(3); | ||
| 48 | |||
| 49 | &st($r00,&QWPw(0,$rp)); &FR($r00); | ||
| 50 | |||
| 51 | &mov("zero",$R); | ||
| 52 | &mul($a[1],$b[0],($r03)=&NR(1)); | ||
| 53 | |||
| 54 | &mov("zero",$H1); | ||
| 55 | &mov("zero",$H0); | ||
| 56 | &add($R,$r01,$R); | ||
| 57 | &muh($a[0],$b[1],($r04)=&NR(1)); | ||
| 58 | &cmpult($R,$r01,($t01)=&NR(1)); &FR($r01); | ||
| 59 | &add($R,$r02,$R); | ||
| 60 | &add($H1,$t01,$H1) &FR($t01); | ||
| 61 | &muh($a[1],$b[0],($r05)=&NR(1)); | ||
| 62 | &cmpult($R,$r02,($t02)=&NR(1)); &FR($r02); | ||
| 63 | &add($R,$r03,$R); | ||
| 64 | &add($H2,$t02,$H2) &FR($t02); | ||
| 65 | &mul($a[0],$b[2],($r06)=&NR(1)); | ||
| 66 | &cmpult($R,$r03,($t03)=&NR(1)); &FR($r03); | ||
| 67 | &add($H1,$t03,$H1) &FR($t03); | ||
| 68 | &st($R,&QWPw(1,$rp)); | ||
| 69 | &add($H1,$H2,$R); | ||
| 70 | |||
| 71 | &mov("zero",$H1); | ||
| 72 | &add($R,$r04,$R); | ||
| 73 | &mov("zero",$H2); | ||
| 74 | &mul($a[1],$b[1],($r07)=&NR(1)); | ||
| 75 | &cmpult($R,$r04,($t04)=&NR(1)); &FR($r04); | ||
| 76 | &add($R,$r05,$R); | ||
| 77 | &add($H1,$t04,$H1) &FR($t04); | ||
| 78 | &mul($a[2],$b[0],($r08)=&NR(1)); | ||
| 79 | &cmpult($R,$r05,($t05)=&NR(1)); &FR($r05); | ||
| 80 | &add($R,$r01,$R); | ||
| 81 | &add($H2,$t05,$H2) &FR($t05); | ||
| 82 | &muh($a[0],$b[2],($r09)=&NR(1)); | ||
| 83 | &cmpult($R,$r06,($t06)=&NR(1)); &FR($r06); | ||
| 84 | &add($R,$r07,$R); | ||
| 85 | &add($H1,$t06,$H1) &FR($t06); | ||
| 86 | &muh($a[1],$b[1],($r10)=&NR(1)); | ||
| 87 | &cmpult($R,$r07,($t07)=&NR(1)); &FR($r07); | ||
| 88 | &add($R,$r08,$R); | ||
| 89 | &add($H2,$t07,$H2) &FR($t07); | ||
| 90 | &muh($a[2],$b[0],($r11)=&NR(1)); | ||
| 91 | &cmpult($R,$r08,($t08)=&NR(1)); &FR($r08); | ||
| 92 | &add($H1,$t08,$H1) &FR($t08); | ||
| 93 | &st($R,&QWPw(2,$rp)); | ||
| 94 | &add($H1,$H2,$R); | ||
| 95 | |||
| 96 | &mov("zero",$H1); | ||
| 97 | &add($R,$r09,$R); | ||
| 98 | &mov("zero",$H2); | ||
| 99 | &mul($a[0],$b[3],($r12)=&NR(1)); | ||
| 100 | &cmpult($R,$r09,($t09)=&NR(1)); &FR($r09); | ||
| 101 | &add($R,$r10,$R); | ||
| 102 | &add($H1,$t09,$H1) &FR($t09); | ||
| 103 | &mul($a[1],$b[2],($r13)=&NR(1)); | ||
| 104 | &cmpult($R,$r10,($t10)=&NR(1)); &FR($r10); | ||
| 105 | &add($R,$r11,$R); | ||
| 106 | &add($H1,$t10,$H1) &FR($t10); | ||
| 107 | &mul($a[2],$b[1],($r14)=&NR(1)); | ||
| 108 | &cmpult($R,$r11,($t11)=&NR(1)); &FR($r11); | ||
| 109 | &add($R,$r12,$R); | ||
| 110 | &add($H1,$t11,$H1) &FR($t11); | ||
| 111 | &mul($a[3],$b[0],($r15)=&NR(1)); | ||
| 112 | &cmpult($R,$r12,($t12)=&NR(1)); &FR($r12); | ||
| 113 | &add($R,$r13,$R); | ||
| 114 | &add($H1,$t12,$H1) &FR($t12); | ||
| 115 | &muh($a[0],$b[3],($r16)=&NR(1)); | ||
| 116 | &cmpult($R,$r13,($t13)=&NR(1)); &FR($r13); | ||
| 117 | &add($R,$r14,$R); | ||
| 118 | &add($H1,$t13,$H1) &FR($t13); | ||
| 119 | &muh($a[1],$b[2],($r17)=&NR(1)); | ||
| 120 | &cmpult($R,$r14,($t14)=&NR(1)); &FR($r14); | ||
| 121 | &add($R,$r15,$R); | ||
| 122 | &add($H1,$t14,$H1) &FR($t14); | ||
| 123 | &muh($a[2],$b[1],($r18)=&NR(1)); | ||
| 124 | &cmpult($R,$r15,($t15)=&NR(1)); &FR($r15); | ||
| 125 | &add($H1,$t15,$H1) &FR($t15); | ||
| 126 | &st($R,&QWPw(3,$rp)); | ||
| 127 | &add($H1,$H2,$R); | ||
| 128 | |||
| 129 | &mov("zero",$H1); | ||
| 130 | &add($R,$r16,$R); | ||
| 131 | &mov("zero",$H2); | ||
| 132 | &muh($a[3],$b[0],($r19)=&NR(1)); | ||
| 133 | &cmpult($R,$r16,($t16)=&NR(1)); &FR($r16); | ||
| 134 | &add($R,$r17,$R); | ||
| 135 | &add($H1,$t16,$H1) &FR($t16); | ||
| 136 | &mul($a[1],$b[3],($r20)=&NR(1)); | ||
| 137 | &cmpult($R,$r17,($t17)=&NR(1)); &FR($r17); | ||
| 138 | &add($R,$r18,$R); | ||
| 139 | &add($H1,$t17,$H1) &FR($t17); | ||
| 140 | &mul($a[2],$b[2],($r21)=&NR(1)); | ||
| 141 | &cmpult($R,$r18,($t18)=&NR(1)); &FR($r18); | ||
| 142 | &add($R,$r19,$R); | ||
| 143 | &add($H1,$t18,$H1) &FR($t18); | ||
| 144 | &mul($a[3],$b[1],($r22)=&NR(1)); | ||
| 145 | &cmpult($R,$r19,($t19)=&NR(1)); &FR($r19); | ||
| 146 | &add($R,$r20,$R); | ||
| 147 | &add($H1,$t19,$H1) &FR($t19); | ||
| 148 | &muh($a[1],$b[3],($r23)=&NR(1)); | ||
| 149 | &cmpult($R,$r20,($t20)=&NR(1)); &FR($r20); | ||
| 150 | &add($R,$r21,$R); | ||
| 151 | &add($H1,$t20,$H1) &FR($t20); | ||
| 152 | &muh($a[2],$b[2],($r24)=&NR(1)); | ||
| 153 | &cmpult($R,$r21,($t21)=&NR(1)); &FR($r21); | ||
| 154 | &add($R,$r22,$R); | ||
| 155 | &add($H1,$t21,$H1) &FR($t21); | ||
| 156 | &muh($a[3],$b[1],($r25)=&NR(1)); | ||
| 157 | &cmpult($R,$r22,($t22)=&NR(1)); &FR($r22); | ||
| 158 | &add($H1,$t22,$H1) &FR($t22); | ||
| 159 | &st($R,&QWPw(4,$rp)); | ||
| 160 | &add($H1,$H2,$R); | ||
| 161 | |||
| 162 | &mov("zero",$H1); | ||
| 163 | &add($R,$r23,$R); | ||
| 164 | &mov("zero",$H2); | ||
| 165 | &mul($a[2],$b[3],($r26)=&NR(1)); | ||
| 166 | &cmpult($R,$r23,($t23)=&NR(1)); &FR($r23); | ||
| 167 | &add($R,$r24,$R); | ||
| 168 | &add($H1,$t23,$H1) &FR($t23); | ||
| 169 | &mul($a[3],$b[2],($r27)=&NR(1)); | ||
| 170 | &cmpult($R,$r24,($t24)=&NR(1)); &FR($r24); | ||
| 171 | &add($R,$r25,$R); | ||
| 172 | &add($H1,$t24,$H1) &FR($t24); | ||
| 173 | &muh($a[2],$b[3],($r28)=&NR(1)); | ||
| 174 | &cmpult($R,$r25,($t25)=&NR(1)); &FR($r25); | ||
| 175 | &add($R,$r26,$R); | ||
| 176 | &add($H1,$t25,$H1) &FR($t25); | ||
| 177 | &muh($a[3],$b[2],($r29)=&NR(1)); | ||
| 178 | &cmpult($R,$r26,($t26)=&NR(1)); &FR($r26); | ||
| 179 | &add($R,$r27,$R); | ||
| 180 | &add($H1,$t26,$H1) &FR($t26); | ||
| 181 | &mul($a[3],$b[3],($r30)=&NR(1)); | ||
| 182 | &cmpult($R,$r27,($t27)=&NR(1)); &FR($r27); | ||
| 183 | &add($H1,$t27,$H1) &FR($t27); | ||
| 184 | &st($R,&QWPw(5,$rp)); | ||
| 185 | &add($H1,$H2,$R); | ||
| 186 | |||
| 187 | &mov("zero",$H1); | ||
| 188 | &add($R,$r28,$R); | ||
| 189 | &mov("zero",$H2); | ||
| 190 | &muh($a[3],$b[3],($r31)=&NR(1)); | ||
| 191 | &cmpult($R,$r28,($t28)=&NR(1)); &FR($r28); | ||
| 192 | &add($R,$r29,$R); | ||
| 193 | &add($H1,$t28,$H1) &FR($t28); | ||
| 194 | ############ | ||
| 195 | &cmpult($R,$r29,($t29)=&NR(1)); &FR($r29); | ||
| 196 | &add($R,$r30,$R); | ||
| 197 | &add($H1,$t29,$H1) &FR($t29); | ||
| 198 | ############ | ||
| 199 | &cmpult($R,$r30,($t30)=&NR(1)); &FR($r30); | ||
| 200 | &add($H1,$t30,$H1) &FR($t30); | ||
| 201 | &st($R,&QWPw(6,$rp)); | ||
| 202 | &add($H1,$H2,$R); | ||
| 203 | |||
| 204 | &add($R,$r31,$R); &FR($r31); | ||
| 205 | &st($R,&QWPw(7,$rp)); | ||
| 206 | |||
| 207 | &FR($R,$H1,$H2); | ||
| 208 | &function_end($name); | ||
| 209 | |||
| 210 | &fin_pool; | ||
| 211 | } | ||
| 212 | |||
| 213 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.works.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.works.pl deleted file mode 100644 index 79d86dd25c..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.works.pl +++ /dev/null | |||
| @@ -1,98 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub mul_add_c | ||
| 5 | { | ||
| 6 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 7 | local($l1,$h1,$t1,$t2); | ||
| 8 | |||
| 9 | print STDERR "count=$cnt\n"; $cnt++; | ||
| 10 | &mul($a,$b,($l1)=&NR(1)); | ||
| 11 | &muh($a,$b,($h1)=&NR(1)); | ||
| 12 | &add($c0,$l1,$c0); | ||
| 13 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 14 | &add($t1,$h1,$h1); &FR($t1); | ||
| 15 | &add($c1,$h1,$c1); | ||
| 16 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 17 | &add($c2,$t2,$c2); &FR($t2); | ||
| 18 | } | ||
| 19 | |||
| 20 | sub bn_mul_comba4 | ||
| 21 | { | ||
| 22 | local($name)=@_; | ||
| 23 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 24 | |||
| 25 | $cnt=1; | ||
| 26 | &init_pool(3); | ||
| 27 | |||
| 28 | $rp=&wparam(0); | ||
| 29 | $ap=&wparam(1); | ||
| 30 | $bp=&wparam(2); | ||
| 31 | |||
| 32 | &function_begin($name,""); | ||
| 33 | |||
| 34 | &comment(""); | ||
| 35 | |||
| 36 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 37 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 38 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 39 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 40 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 41 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 42 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap); | ||
| 43 | &ld(($b[3])=&NR(1),&QWPw(3,$bp)); &FR($bp); | ||
| 44 | |||
| 45 | ($c0,$c1,$c2)=&NR(3); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | &mul($a[0],$b[0],$c0); | ||
| 48 | &muh($a[0],$b[0],$c1); | ||
| 49 | &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 50 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 51 | &mov("zero",$c2); | ||
| 52 | |||
| 53 | &mul_add_c($a[0],$b[1],$c0,$c1,$c2); | ||
| 54 | &mul_add_c($a[1],$b[0],$c0,$c1,$c2); | ||
| 55 | &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 56 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 57 | &mov("zero",$c2); | ||
| 58 | |||
| 59 | &mul_add_c($a[1],$b[1],$c0,$c1,$c2); | ||
| 60 | &mul_add_c($a[0],$b[2],$c0,$c1,$c2); | ||
| 61 | &mul_add_c($a[2],$b[0],$c0,$c1,$c2); | ||
| 62 | &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 63 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 64 | &mov("zero",$c2); | ||
| 65 | |||
| 66 | &mul_add_c($a[0],$b[3],$c0,$c1,$c2); &FR($a[0]); | ||
| 67 | &mul_add_c($a[1],$b[2],$c0,$c1,$c2); | ||
| 68 | &mul_add_c($a[2],$b[1],$c0,$c1,$c2); | ||
| 69 | &mul_add_c($a[3],$b[0],$c0,$c1,$c2); &FR($b[0]); | ||
| 70 | &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 71 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 72 | &mov("zero",$c2); | ||
| 73 | |||
| 74 | &mul_add_c($a[1],$b[3],$c0,$c1,$c2); &FR($a[1]); | ||
| 75 | &mul_add_c($a[2],$b[2],$c0,$c1,$c2); | ||
| 76 | &mul_add_c($a[3],$b[1],$c0,$c1,$c2); &FR($b[1]); | ||
| 77 | &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 78 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 79 | &mov("zero",$c2); | ||
| 80 | |||
| 81 | &mul_add_c($a[2],$b[3],$c0,$c1,$c2); &FR($a[2]); | ||
| 82 | &mul_add_c($a[3],$b[2],$c0,$c1,$c2); &FR($b[2]); | ||
| 83 | &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 84 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 85 | &mov("zero",$c2); | ||
| 86 | |||
| 87 | &mul_add_c($a[3],$b[3],$c0,$c1,$c2); &FR($a[3],$b[3]); | ||
| 88 | &st($c0,&QWPw(6,$rp)); | ||
| 89 | &st($c1,&QWPw(7,$rp)); | ||
| 90 | |||
| 91 | &FR($c0,$c1,$c2); | ||
| 92 | |||
| 93 | &function_end($name); | ||
| 94 | |||
| 95 | &fin_pool; | ||
| 96 | } | ||
| 97 | |||
| 98 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_c8.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_c8.pl deleted file mode 100644 index 525ca7494b..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/mul_c8.pl +++ /dev/null | |||
| @@ -1,177 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_comba8 | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 8 | |||
| 9 | $cnt=1; | ||
| 10 | &init_pool(3); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | |||
| 16 | &function_begin($name,""); | ||
| 17 | |||
| 18 | &comment(""); | ||
| 19 | |||
| 20 | &stack_push(2); | ||
| 21 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 22 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 23 | &st($reg_s0,&swtmp(0)); &FR($reg_s0); | ||
| 24 | &st($reg_s1,&swtmp(1)); &FR($reg_s1); | ||
| 25 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 26 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 27 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 28 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 29 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 30 | &ld(($b[3])=&NR(1),&QWPw(3,$bp)); | ||
| 31 | &ld(($a[4])=&NR(1),&QWPw(1,$ap)); | ||
| 32 | &ld(($b[4])=&NR(1),&QWPw(1,$bp)); | ||
| 33 | &ld(($a[5])=&NR(1),&QWPw(1,$ap)); | ||
| 34 | &ld(($b[5])=&NR(1),&QWPw(1,$bp)); | ||
| 35 | &ld(($a[6])=&NR(1),&QWPw(1,$ap)); | ||
| 36 | &ld(($b[6])=&NR(1),&QWPw(1,$bp)); | ||
| 37 | &ld(($a[7])=&NR(1),&QWPw(1,$ap)); &FR($ap); | ||
| 38 | &ld(($b[7])=&NR(1),&QWPw(1,$bp)); &FR($bp); | ||
| 39 | |||
| 40 | ($c0,$c1,$c2)=&NR(3); | ||
| 41 | &mov("zero",$c2); | ||
| 42 | &mul($a[0],$b[0],$c0); | ||
| 43 | &muh($a[0],$b[0],$c1); | ||
| 44 | &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 45 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | |||
| 48 | &mul_add_c($a[0],$b[1],$c0,$c1,$c2); | ||
| 49 | &mul_add_c($a[1],$b[0],$c0,$c1,$c2); | ||
| 50 | &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 51 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 52 | &mov("zero",$c2); | ||
| 53 | |||
| 54 | &mul_add_c($a[0],$b[2],$c0,$c1,$c2); | ||
| 55 | &mul_add_c($a[1],$b[1],$c0,$c1,$c2); | ||
| 56 | &mul_add_c($a[2],$b[0],$c0,$c1,$c2); | ||
| 57 | &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 58 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 59 | &mov("zero",$c2); | ||
| 60 | |||
| 61 | &mul_add_c($a[0],$b[3],$c0,$c1,$c2); | ||
| 62 | &mul_add_c($a[1],$b[2],$c0,$c1,$c2); | ||
| 63 | &mul_add_c($a[2],$b[1],$c0,$c1,$c2); | ||
| 64 | &mul_add_c($a[3],$b[0],$c0,$c1,$c2); | ||
| 65 | &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 66 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 67 | &mov("zero",$c2); | ||
| 68 | |||
| 69 | &mul_add_c($a[0],$b[4],$c0,$c1,$c2); | ||
| 70 | &mul_add_c($a[1],$b[3],$c0,$c1,$c2); | ||
| 71 | &mul_add_c($a[2],$b[2],$c0,$c1,$c2); | ||
| 72 | &mul_add_c($a[3],$b[1],$c0,$c1,$c2); | ||
| 73 | &mul_add_c($a[4],$b[0],$c0,$c1,$c2); | ||
| 74 | &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 75 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 76 | &mov("zero",$c2); | ||
| 77 | |||
| 78 | &mul_add_c($a[0],$b[5],$c0,$c1,$c2); | ||
| 79 | &mul_add_c($a[1],$b[4],$c0,$c1,$c2); | ||
| 80 | &mul_add_c($a[2],$b[3],$c0,$c1,$c2); | ||
| 81 | &mul_add_c($a[3],$b[2],$c0,$c1,$c2); | ||
| 82 | &mul_add_c($a[4],$b[1],$c0,$c1,$c2); | ||
| 83 | &mul_add_c($a[5],$b[0],$c0,$c1,$c2); | ||
| 84 | &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 85 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 86 | &mov("zero",$c2); | ||
| 87 | |||
| 88 | &mul_add_c($a[0],$b[6],$c0,$c1,$c2); | ||
| 89 | &mul_add_c($a[1],$b[5],$c0,$c1,$c2); | ||
| 90 | &mul_add_c($a[2],$b[4],$c0,$c1,$c2); | ||
| 91 | &mul_add_c($a[3],$b[3],$c0,$c1,$c2); | ||
| 92 | &mul_add_c($a[4],$b[2],$c0,$c1,$c2); | ||
| 93 | &mul_add_c($a[5],$b[1],$c0,$c1,$c2); | ||
| 94 | &mul_add_c($a[6],$b[0],$c0,$c1,$c2); | ||
| 95 | &st($c0,&QWPw(6,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 96 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 97 | &mov("zero",$c2); | ||
| 98 | |||
| 99 | &mul_add_c($a[0],$b[7],$c0,$c1,$c2); &FR($a[0]); | ||
| 100 | &mul_add_c($a[1],$b[6],$c0,$c1,$c2); | ||
| 101 | &mul_add_c($a[2],$b[5],$c0,$c1,$c2); | ||
| 102 | &mul_add_c($a[3],$b[4],$c0,$c1,$c2); | ||
| 103 | &mul_add_c($a[4],$b[3],$c0,$c1,$c2); | ||
| 104 | &mul_add_c($a[5],$b[2],$c0,$c1,$c2); | ||
| 105 | &mul_add_c($a[6],$b[1],$c0,$c1,$c2); | ||
| 106 | &mul_add_c($a[7],$b[0],$c0,$c1,$c2); &FR($b[0]); | ||
| 107 | &st($c0,&QWPw(7,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 108 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 109 | &mov("zero",$c2); | ||
| 110 | |||
| 111 | &mul_add_c($a[1],$b[7],$c0,$c1,$c2); &FR($a[1]); | ||
| 112 | &mul_add_c($a[2],$b[6],$c0,$c1,$c2); | ||
| 113 | &mul_add_c($a[3],$b[5],$c0,$c1,$c2); | ||
| 114 | &mul_add_c($a[4],$b[4],$c0,$c1,$c2); | ||
| 115 | &mul_add_c($a[5],$b[3],$c0,$c1,$c2); | ||
| 116 | &mul_add_c($a[6],$b[2],$c0,$c1,$c2); | ||
| 117 | &mul_add_c($a[7],$b[1],$c0,$c1,$c2); &FR($b[1]); | ||
| 118 | &st($c0,&QWPw(8,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 119 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 120 | &mov("zero",$c2); | ||
| 121 | |||
| 122 | &mul_add_c($a[2],$b[7],$c0,$c1,$c2); &FR($a[2]); | ||
| 123 | &mul_add_c($a[3],$b[6],$c0,$c1,$c2); | ||
| 124 | &mul_add_c($a[4],$b[5],$c0,$c1,$c2); | ||
| 125 | &mul_add_c($a[5],$b[4],$c0,$c1,$c2); | ||
| 126 | &mul_add_c($a[6],$b[3],$c0,$c1,$c2); | ||
| 127 | &mul_add_c($a[7],$b[2],$c0,$c1,$c2); &FR($b[2]); | ||
| 128 | &st($c0,&QWPw(9,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 129 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 130 | &mov("zero",$c2); | ||
| 131 | |||
| 132 | &mul_add_c($a[3],$b[7],$c0,$c1,$c2); &FR($a[3]); | ||
| 133 | &mul_add_c($a[4],$b[6],$c0,$c1,$c2); | ||
| 134 | &mul_add_c($a[5],$b[5],$c0,$c1,$c2); | ||
| 135 | &mul_add_c($a[6],$b[4],$c0,$c1,$c2); | ||
| 136 | &mul_add_c($a[7],$b[3],$c0,$c1,$c2); &FR($b[3]); | ||
| 137 | &st($c0,&QWPw(10,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 138 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 139 | &mov("zero",$c2); | ||
| 140 | |||
| 141 | &mul_add_c($a[4],$b[7],$c0,$c1,$c2); &FR($a[4]); | ||
| 142 | &mul_add_c($a[5],$b[6],$c0,$c1,$c2); | ||
| 143 | &mul_add_c($a[6],$b[5],$c0,$c1,$c2); | ||
| 144 | &mul_add_c($a[7],$b[4],$c0,$c1,$c2); &FR($b[4]); | ||
| 145 | &st($c0,&QWPw(11,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 146 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 147 | &mov("zero",$c2); | ||
| 148 | |||
| 149 | &mul_add_c($a[5],$b[7],$c0,$c1,$c2); &FR($a[5]); | ||
| 150 | &mul_add_c($a[6],$b[6],$c0,$c1,$c2); | ||
| 151 | &mul_add_c($a[7],$b[5],$c0,$c1,$c2); &FR($b[5]); | ||
| 152 | &st($c0,&QWPw(12,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 153 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 154 | &mov("zero",$c2); | ||
| 155 | |||
| 156 | &mul_add_c($a[6],$b[7],$c0,$c1,$c2); &FR($a[6]); | ||
| 157 | &mul_add_c($a[7],$b[6],$c0,$c1,$c2); &FR($b[6]); | ||
| 158 | &st($c0,&QWPw(13,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 159 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 160 | &mov("zero",$c2); | ||
| 161 | |||
| 162 | &mul_add_c($a[7],$b[7],$c0,$c1,$c2); &FR($a[7],$b[7]); | ||
| 163 | &st($c0,&QWPw(14,$rp)); | ||
| 164 | &st($c1,&QWPw(15,$rp)); | ||
| 165 | |||
| 166 | &FR($c0,$c1,$c2); | ||
| 167 | |||
| 168 | &ld($reg_s0,&swtmp(0)); | ||
| 169 | &ld($reg_s1,&swtmp(1)); | ||
| 170 | &stack_pop(2); | ||
| 171 | |||
| 172 | &function_end($name); | ||
| 173 | |||
| 174 | &fin_pool; | ||
| 175 | } | ||
| 176 | |||
| 177 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sqr.pl b/src/lib/libcrypto/bn/asm/alpha.works/sqr.pl deleted file mode 100644 index a55b696906..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/sqr.pl +++ /dev/null | |||
| @@ -1,113 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sqr_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(3); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | |||
| 16 | &function_begin($name,""); | ||
| 17 | |||
| 18 | &comment(""); | ||
| 19 | &sub($count,4,$count); | ||
| 20 | &mov("zero",$cc); | ||
| 21 | &br(&label("finish")); | ||
| 22 | &blt($count,&label("finish")); | ||
| 23 | |||
| 24 | ($a0,$r0)=&NR(2); | ||
| 25 | &ld($a0,&QWPw(0,$ap)); | ||
| 26 | &ld($r0,&QWPw(0,$rp)); | ||
| 27 | |||
| 28 | $a=<<'EOF'; | ||
| 29 | ########################################################## | ||
| 30 | &set_label("loop"); | ||
| 31 | |||
| 32 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 33 | ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp)); | ||
| 34 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 35 | ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp)); | ||
| 36 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 37 | ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp)); | ||
| 38 | |||
| 39 | ($o0,$t0)=&NR(2); | ||
| 40 | &add($a0,$b0,$o0); | ||
| 41 | &cmpult($o0,$b0,$t0); | ||
| 42 | &add($o0,$cc,$o0); | ||
| 43 | &cmpult($o0,$cc,$cc); | ||
| 44 | &add($cc,$t0,$cc); &FR($t0); | ||
| 45 | |||
| 46 | ($t1,$o1)=&NR(2); | ||
| 47 | |||
| 48 | &add($a1,$b1,$o1); &FR($a1); | ||
| 49 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 50 | &add($o1,$cc,$o1); | ||
| 51 | &cmpult($o1,$cc,$cc); | ||
| 52 | &add($cc,$t1,$cc); &FR($t1); | ||
| 53 | |||
| 54 | ($t2,$o2)=&NR(2); | ||
| 55 | |||
| 56 | &add($a2,$b2,$o2); &FR($a2); | ||
| 57 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 58 | &add($o2,$cc,$o2); | ||
| 59 | &cmpult($o2,$cc,$cc); | ||
| 60 | &add($cc,$t2,$cc); &FR($t2); | ||
| 61 | |||
| 62 | ($t3,$o3)=&NR(2); | ||
| 63 | |||
| 64 | &add($a3,$b3,$o3); &FR($a3); | ||
| 65 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 66 | &add($o3,$cc,$o3); | ||
| 67 | &cmpult($o3,$cc,$cc); | ||
| 68 | &add($cc,$t3,$cc); &FR($t3); | ||
| 69 | |||
| 70 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 71 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 72 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 73 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 74 | |||
| 75 | &sub($count,4,$count); # count-=4 | ||
| 76 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 77 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 78 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 79 | |||
| 80 | &blt($count,&label("finish")); | ||
| 81 | &ld($a0,&QWPw(0,$ap)); | ||
| 82 | &ld($b0,&QWPw(0,$bp)); | ||
| 83 | &br(&label("loop")); | ||
| 84 | EOF | ||
| 85 | ################################################## | ||
| 86 | # Do the last 0..3 words | ||
| 87 | |||
| 88 | &set_label("last_loop"); | ||
| 89 | |||
| 90 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 91 | &mul($a0,$a0,($l0)=&NR(1)); | ||
| 92 | &add($ap,$QWS,$ap); | ||
| 93 | &add($rp,2*$QWS,$rp); | ||
| 94 | &sub($count,1,$count); | ||
| 95 | &muh($a0,$a0,($h0)=&NR(1)); &FR($a0); | ||
| 96 | &st($l0,&QWPw(-2,$rp)); &FR($l0); | ||
| 97 | &st($h0,&QWPw(-1,$rp)); &FR($h0); | ||
| 98 | |||
| 99 | &bgt($count,&label("last_loop")); | ||
| 100 | &function_end_A($name); | ||
| 101 | |||
| 102 | ###################################################### | ||
| 103 | &set_label("finish"); | ||
| 104 | &add($count,4,$count); | ||
| 105 | &bgt($count,&label("last_loop")); | ||
| 106 | |||
| 107 | &set_label("end"); | ||
| 108 | &function_end($name); | ||
| 109 | |||
| 110 | &fin_pool; | ||
| 111 | } | ||
| 112 | |||
| 113 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sqr_c4.pl b/src/lib/libcrypto/bn/asm/alpha.works/sqr_c4.pl deleted file mode 100644 index bf33f5b503..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/sqr_c4.pl +++ /dev/null | |||
| @@ -1,109 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub sqr_add_c | ||
| 5 | { | ||
| 6 | local($a,$c0,$c1,$c2)=@_; | ||
| 7 | local($l1,$h1,$t1,$t2); | ||
| 8 | |||
| 9 | &mul($a,$a,($l1)=&NR(1)); | ||
| 10 | &muh($a,$a,($h1)=&NR(1)); | ||
| 11 | &add($c0,$l1,$c0); | ||
| 12 | &add($c1,$h1,$c1); | ||
| 13 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 14 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 15 | &add($c1,$t1,$c1); &FR($t1); | ||
| 16 | &add($c2,$t2,$c2); &FR($t2); | ||
| 17 | } | ||
| 18 | |||
| 19 | sub sqr_add_c2 | ||
| 20 | { | ||
| 21 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 22 | local($l1,$h1,$t1,$t2); | ||
| 23 | |||
| 24 | &mul($a,$b,($l1)=&NR(1)); | ||
| 25 | &muh($a,$b,($h1)=&NR(1)); | ||
| 26 | &cmplt($l1,"zero",($lc1)=&NR(1)); | ||
| 27 | &cmplt($h1,"zero",($hc1)=&NR(1)); | ||
| 28 | &add($l1,$l1,$l1); | ||
| 29 | &add($h1,$h1,$h1); | ||
| 30 | &add($h1,$lc1,$h1); &FR($lc1); | ||
| 31 | &add($c2,$hc1,$c2); &FR($hc1); | ||
| 32 | |||
| 33 | &add($c0,$l1,$c0); | ||
| 34 | &add($c1,$h1,$c1); | ||
| 35 | &cmpult($c0,$l1,($lc1)=&NR(1)); &FR($l1); | ||
| 36 | &cmpult($c1,$h1,($hc1)=&NR(1)); &FR($h1); | ||
| 37 | |||
| 38 | &add($c1,$lc1,$c1); &FR($lc1); | ||
| 39 | &add($c2,$hc1,$c2); &FR($hc1); | ||
| 40 | } | ||
| 41 | |||
| 42 | |||
| 43 | sub bn_sqr_comba4 | ||
| 44 | { | ||
| 45 | local($name)=@_; | ||
| 46 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 47 | |||
| 48 | $cnt=1; | ||
| 49 | &init_pool(2); | ||
| 50 | |||
| 51 | $rp=&wparam(0); | ||
| 52 | $ap=&wparam(1); | ||
| 53 | |||
| 54 | &function_begin($name,""); | ||
| 55 | |||
| 56 | &comment(""); | ||
| 57 | |||
| 58 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 59 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 60 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 61 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap); | ||
| 62 | |||
| 63 | ($c0,$c1,$c2)=&NR(3); | ||
| 64 | |||
| 65 | &mov("zero",$c2); | ||
| 66 | &mul($a[0],$a[0],$c0); | ||
| 67 | &muh($a[0],$a[0],$c1); | ||
| 68 | &st($c0,&QWPw(0,$rp)); | ||
| 69 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 70 | &mov("zero",$c2); | ||
| 71 | |||
| 72 | &sqr_add_c2($a[0],$a[1],$c0,$c1,$c2); | ||
| 73 | &st($c0,&QWPw(1,$rp)); | ||
| 74 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 75 | &mov("zero",$c2); | ||
| 76 | |||
| 77 | &sqr_add_c($a[1],$c0,$c1,$c2); | ||
| 78 | &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2); | ||
| 79 | &st($c0,&QWPw(2,$rp)); | ||
| 80 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 81 | &mov("zero",$c2); | ||
| 82 | |||
| 83 | &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2); | ||
| 84 | &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2); | ||
| 85 | &st($c0,&QWPw(3,$rp)); | ||
| 86 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 87 | &mov("zero",$c2); | ||
| 88 | |||
| 89 | &sqr_add_c($a[2],$c0,$c1,$c2); | ||
| 90 | &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2); | ||
| 91 | &st($c0,&QWPw(4,$rp)); | ||
| 92 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 93 | &mov("zero",$c2); | ||
| 94 | |||
| 95 | &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2); | ||
| 96 | &st($c0,&QWPw(5,$rp)); | ||
| 97 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 98 | &mov("zero",$c2); | ||
| 99 | |||
| 100 | &sqr_add_c($a[3],$c0,$c1,$c2); | ||
| 101 | &st($c0,&QWPw(6,$rp)); | ||
| 102 | &st($c1,&QWPw(7,$rp)); | ||
| 103 | |||
| 104 | &function_end($name); | ||
| 105 | |||
| 106 | &fin_pool; | ||
| 107 | } | ||
| 108 | |||
| 109 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sqr_c8.pl b/src/lib/libcrypto/bn/asm/alpha.works/sqr_c8.pl deleted file mode 100644 index b4afe085f1..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/sqr_c8.pl +++ /dev/null | |||
| @@ -1,132 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sqr_comba8 | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 8 | |||
| 9 | $cnt=1; | ||
| 10 | &init_pool(2); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | |||
| 15 | &function_begin($name,""); | ||
| 16 | |||
| 17 | &comment(""); | ||
| 18 | |||
| 19 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 20 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 21 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 22 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 23 | &ld(($a[4])=&NR(1),&QWPw(4,$ap)); | ||
| 24 | &ld(($a[5])=&NR(1),&QWPw(5,$ap)); | ||
| 25 | &ld(($a[6])=&NR(1),&QWPw(6,$ap)); | ||
| 26 | &ld(($a[7])=&NR(1),&QWPw(7,$ap)); &FR($ap); | ||
| 27 | |||
| 28 | ($c0,$c1,$c2)=&NR(3); | ||
| 29 | |||
| 30 | &mov("zero",$c2); | ||
| 31 | &mul($a[0],$a[0],$c0); | ||
| 32 | &muh($a[0],$a[0],$c1); | ||
| 33 | &st($c0,&QWPw(0,$rp)); | ||
| 34 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 35 | &mov("zero",$c2); | ||
| 36 | |||
| 37 | &sqr_add_c2($a[1],$a[0],$c0,$c1,$c2); | ||
| 38 | &st($c0,&QWPw(1,$rp)); | ||
| 39 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 40 | &mov("zero",$c2); | ||
| 41 | |||
| 42 | &sqr_add_c($a[1],$c0,$c1,$c2); | ||
| 43 | &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2); | ||
| 44 | &st($c0,&QWPw(2,$rp)); | ||
| 45 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | |||
| 48 | &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2); | ||
| 49 | &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2); | ||
| 50 | &st($c0,&QWPw(3,$rp)); | ||
| 51 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 52 | &mov("zero",$c2); | ||
| 53 | |||
| 54 | &sqr_add_c($a[2],$c0,$c1,$c2); | ||
| 55 | &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2); | ||
| 56 | &sqr_add_c2($a[4],$a[0],$c0,$c1,$c2); | ||
| 57 | &st($c0,&QWPw(4,$rp)); | ||
| 58 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 59 | &mov("zero",$c2); | ||
| 60 | |||
| 61 | &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2); | ||
| 62 | &sqr_add_c2($a[4],$a[1],$c0,$c1,$c2); | ||
| 63 | &sqr_add_c2($a[5],$a[0],$c0,$c1,$c2); | ||
| 64 | &st($c0,&QWPw(5,$rp)); | ||
| 65 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 66 | &mov("zero",$c2); | ||
| 67 | |||
| 68 | &sqr_add_c($a[3],$c0,$c1,$c2); | ||
| 69 | &sqr_add_c2($a[4],$a[2],$c0,$c1,$c2); | ||
| 70 | &sqr_add_c2($a[5],$a[1],$c0,$c1,$c2); | ||
| 71 | &sqr_add_c2($a[6],$a[0],$c0,$c1,$c2); | ||
| 72 | &st($c0,&QWPw(6,$rp)); | ||
| 73 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 74 | &mov("zero",$c2); | ||
| 75 | |||
| 76 | &sqr_add_c2($a[4],$a[3],$c0,$c1,$c2); | ||
| 77 | &sqr_add_c2($a[5],$a[2],$c0,$c1,$c2); | ||
| 78 | &sqr_add_c2($a[6],$a[1],$c0,$c1,$c2); | ||
| 79 | &sqr_add_c2($a[7],$a[0],$c0,$c1,$c2); | ||
| 80 | &st($c0,&QWPw(7,$rp)); | ||
| 81 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 82 | &mov("zero",$c2); | ||
| 83 | |||
| 84 | &sqr_add_c($a[4],$c0,$c1,$c2); | ||
| 85 | &sqr_add_c2($a[5],$a[3],$c0,$c1,$c2); | ||
| 86 | &sqr_add_c2($a[6],$a[2],$c0,$c1,$c2); | ||
| 87 | &sqr_add_c2($a[7],$a[1],$c0,$c1,$c2); | ||
| 88 | &st($c0,&QWPw(8,$rp)); | ||
| 89 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 90 | &mov("zero",$c2); | ||
| 91 | |||
| 92 | &sqr_add_c2($a[5],$a[4],$c0,$c1,$c2); | ||
| 93 | &sqr_add_c2($a[6],$a[3],$c0,$c1,$c2); | ||
| 94 | &sqr_add_c2($a[7],$a[2],$c0,$c1,$c2); | ||
| 95 | &st($c0,&QWPw(9,$rp)); | ||
| 96 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 97 | &mov("zero",$c2); | ||
| 98 | |||
| 99 | &sqr_add_c($a[5],$c0,$c1,$c2); | ||
| 100 | &sqr_add_c2($a[6],$a[4],$c0,$c1,$c2); | ||
| 101 | &sqr_add_c2($a[7],$a[3],$c0,$c1,$c2); | ||
| 102 | &st($c0,&QWPw(10,$rp)); | ||
| 103 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 104 | &mov("zero",$c2); | ||
| 105 | |||
| 106 | &sqr_add_c2($a[6],$a[5],$c0,$c1,$c2); | ||
| 107 | &sqr_add_c2($a[7],$a[4],$c0,$c1,$c2); | ||
| 108 | &st($c0,&QWPw(11,$rp)); | ||
| 109 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 110 | &mov("zero",$c2); | ||
| 111 | |||
| 112 | &sqr_add_c($a[6],$c0,$c1,$c2); | ||
| 113 | &sqr_add_c2($a[7],$a[5],$c0,$c1,$c2); | ||
| 114 | &st($c0,&QWPw(12,$rp)); | ||
| 115 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 116 | &mov("zero",$c2); | ||
| 117 | |||
| 118 | &sqr_add_c2($a[7],$a[6],$c0,$c1,$c2); | ||
| 119 | &st($c0,&QWPw(13,$rp)); | ||
| 120 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 121 | &mov("zero",$c2); | ||
| 122 | |||
| 123 | &sqr_add_c($a[7],$c0,$c1,$c2); | ||
| 124 | &st($c0,&QWPw(14,$rp)); | ||
| 125 | &st($c1,&QWPw(15,$rp)); | ||
| 126 | |||
| 127 | &function_end($name); | ||
| 128 | |||
| 129 | &fin_pool; | ||
| 130 | } | ||
| 131 | |||
| 132 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sub.pl b/src/lib/libcrypto/bn/asm/alpha.works/sub.pl deleted file mode 100644 index d998da5c21..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/sub.pl +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sub_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | $count=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &blt($count,&label("finish")); | ||
| 23 | |||
| 24 | ($a0,$b0)=&NR(2); | ||
| 25 | &ld($a0,&QWPw(0,$ap)); | ||
| 26 | &ld($b0,&QWPw(0,$bp)); | ||
| 27 | |||
| 28 | ########################################################## | ||
| 29 | &set_label("loop"); | ||
| 30 | |||
| 31 | ($a1,$tmp,$b1,$a2,$b2,$a3,$b3,$o0)=&NR(8); | ||
| 32 | &ld($a1,&QWPw(1,$ap)); | ||
| 33 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 34 | &ld($b1,&QWPw(1,$bp)); | ||
| 35 | &sub($a0,$b0,$a0); # do the subtract | ||
| 36 | &ld($a2,&QWPw(2,$ap)); | ||
| 37 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 38 | &ld($b2,&QWPw(2,$bp)); | ||
| 39 | &sub($a0,$cc,$o0); # will we borrow? | ||
| 40 | &ld($a3,&QWPw(3,$ap)); | ||
| 41 | &add($b0,$tmp,$cc); ($t1,$o1)=&NR(2); &FR($tmp); | ||
| 42 | |||
| 43 | &cmpult($a1,$b1,$t1); # will we borrow? | ||
| 44 | &sub($a1,$b1,$a1); # do the subtract | ||
| 45 | &ld($b3,&QWPw(3,$bp)); | ||
| 46 | &cmpult($a1,$cc,$b1); # will we borrow? | ||
| 47 | &sub($a1,$cc,$o1); # will we borrow? | ||
| 48 | &add($b1,$t1,$cc); ($tmp,$o2)=&NR(2); &FR($t1,$a1,$b1); | ||
| 49 | |||
| 50 | &cmpult($a2,$b2,$tmp); # will we borrow? | ||
| 51 | &sub($a2,$b2,$a2); # do the subtract | ||
| 52 | &st($o0,&QWPw(0,$rp)); &FR($o0); # save | ||
| 53 | &cmpult($a2,$cc,$b2); # will we borrow? | ||
| 54 | &sub($a2,$cc,$o2); # will we borrow? | ||
| 55 | &add($b2,$tmp,$cc); ($t3,$o3)=&NR(2); &FR($tmp,$a2,$b2); | ||
| 56 | |||
| 57 | &cmpult($a3,$b3,$t3); # will we borrow? | ||
| 58 | &sub($a3,$b3,$a3); # do the subtract | ||
| 59 | &st($o1,&QWPw(1,$rp)); &FR($o1); | ||
| 60 | &cmpult($a3,$cc,$b3); # will we borrow? | ||
| 61 | &sub($a3,$cc,$o3); # will we borrow? | ||
| 62 | &add($b3,$t3,$cc); &FR($t3,$a3,$b3); | ||
| 63 | |||
| 64 | &st($o2,&QWPw(2,$rp)); &FR($o2); | ||
| 65 | &sub($count,4,$count); # count-=4 | ||
| 66 | &st($o3,&QWPw(3,$rp)); &FR($o3); | ||
| 67 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 68 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 69 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 70 | |||
| 71 | &blt($count,&label("finish")); | ||
| 72 | &ld($a0,&QWPw(0,$ap)); | ||
| 73 | &ld($b0,&QWPw(0,$bp)); | ||
| 74 | &br(&label("loop")); | ||
| 75 | ################################################## | ||
| 76 | # Do the last 0..3 words | ||
| 77 | |||
| 78 | &set_label("last_loop"); | ||
| 79 | |||
| 80 | &ld($a0,&QWPw(0,$ap)); # get a | ||
| 81 | &ld($b0,&QWPw(0,$bp)); # get b | ||
| 82 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 83 | &sub($a0,$b0,$a0); # do the subtract | ||
| 84 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 85 | &sub($a0,$cc,$a0); # will we borrow? | ||
| 86 | &st($a0,&QWPw(0,$rp)); # save | ||
| 87 | &add($b0,$tmp,$cc); # add the borrows | ||
| 88 | |||
| 89 | &add($ap,$QWS,$ap); | ||
| 90 | &add($bp,$QWS,$bp); | ||
| 91 | &add($rp,$QWS,$rp); | ||
| 92 | &sub($count,1,$count); | ||
| 93 | &bgt($count,&label("last_loop")); | ||
| 94 | &function_end_A($name); | ||
| 95 | |||
| 96 | ###################################################### | ||
| 97 | &set_label("finish"); | ||
| 98 | &add($count,4,$count); | ||
| 99 | &bgt($count,&label("last_loop")); | ||
| 100 | |||
| 101 | &FR($a0,$b0); | ||
| 102 | &set_label("end"); | ||
| 103 | &function_end($name); | ||
| 104 | |||
| 105 | &fin_pool; | ||
| 106 | } | ||
| 107 | |||
| 108 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/add.pl b/src/lib/libcrypto/bn/asm/alpha/add.pl deleted file mode 100644 index 13bf516428..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/add.pl +++ /dev/null | |||
| @@ -1,118 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_add_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | $count=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &blt($count,&label("finish")); | ||
| 23 | |||
| 24 | ($a0,$b0)=&NR(2); | ||
| 25 | |||
| 26 | ########################################################## | ||
| 27 | &set_label("loop"); | ||
| 28 | |||
| 29 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); | ||
| 30 | &ld(($b0)=&NR(1),&QWPw(0,$bp)); | ||
| 31 | &ld(($a1)=&NR(1),&QWPw(1,$ap)); | ||
| 32 | &ld(($b1)=&NR(1),&QWPw(1,$bp)); | ||
| 33 | |||
| 34 | ($o0,$t0)=&NR(2); | ||
| 35 | &add($a0,$b0,$o0); | ||
| 36 | &ld(($a2)=&NR(1),&QWPw(2,$ap)); | ||
| 37 | &cmpult($o0,$b0,$t0); | ||
| 38 | &add($o0,$cc,$o0); | ||
| 39 | &cmpult($o0,$cc,$cc); | ||
| 40 | &ld(($b2)=&NR(1),&QWPw(2,$bp)); | ||
| 41 | &add($cc,$t0,$cc); &FR($t0); | ||
| 42 | |||
| 43 | ($t1,$o1)=&NR(2); | ||
| 44 | |||
| 45 | &add($a1,$b1,$o1); &FR($a1); | ||
| 46 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 47 | &add($o1,$cc,$o1); | ||
| 48 | &cmpult($o1,$cc,$cc); | ||
| 49 | &ld(($a3)=&NR(1),&QWPw(3,$ap)); | ||
| 50 | &add($cc,$t1,$cc); &FR($t1); | ||
| 51 | |||
| 52 | ($t2,$o2)=&NR(2); | ||
| 53 | |||
| 54 | &add($a2,$b2,$o2); &FR($a2); | ||
| 55 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 56 | &add($o2,$cc,$o2); | ||
| 57 | &cmpult($o2,$cc,$cc); | ||
| 58 | &ld(($b3)=&NR(1),&QWPw(3,$bp)); | ||
| 59 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 60 | &add($cc,$t2,$cc); &FR($t2); | ||
| 61 | |||
| 62 | ($t3,$o3)=&NR(2); | ||
| 63 | |||
| 64 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 65 | &add($a3,$b3,$o3); &FR($a3); | ||
| 66 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 67 | &add($o3,$cc,$o3); | ||
| 68 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 69 | &cmpult($o3,$cc,$cc); | ||
| 70 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 71 | &add($cc,$t3,$cc); &FR($t3); | ||
| 72 | |||
| 73 | |||
| 74 | &sub($count,4,$count); # count-=4 | ||
| 75 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 76 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 77 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 78 | |||
| 79 | ### | ||
| 80 | &bge($count,&label("loop")); | ||
| 81 | ### | ||
| 82 | &br(&label("finish")); | ||
| 83 | ################################################## | ||
| 84 | # Do the last 0..3 words | ||
| 85 | |||
| 86 | ($t0,$o0)=&NR(2); | ||
| 87 | &set_label("last_loop"); | ||
| 88 | |||
| 89 | &ld($a0,&QWPw(0,$ap)); # get a | ||
| 90 | &ld($b0,&QWPw(0,$bp)); # get b | ||
| 91 | &add($ap,$QWS,$ap); | ||
| 92 | &add($bp,$QWS,$bp); | ||
| 93 | &add($a0,$b0,$o0); | ||
| 94 | &sub($count,1,$count); | ||
| 95 | &cmpult($o0,$b0,$t0); # will we borrow? | ||
| 96 | &add($o0,$cc,$o0); # will we borrow? | ||
| 97 | &cmpult($o0,$cc,$cc); # will we borrow? | ||
| 98 | &add($rp,$QWS,$rp); | ||
| 99 | &st($o0,&QWPw(-1,$rp)); # save | ||
| 100 | &add($cc,$t0,$cc); # add the borrows | ||
| 101 | |||
| 102 | ### | ||
| 103 | &bgt($count,&label("last_loop")); | ||
| 104 | &function_end_A($name); | ||
| 105 | |||
| 106 | ###################################################### | ||
| 107 | &set_label("finish"); | ||
| 108 | &add($count,4,$count); | ||
| 109 | &bgt($count,&label("last_loop")); | ||
| 110 | |||
| 111 | &FR($o0,$t0,$a0,$b0); | ||
| 112 | &set_label("end"); | ||
| 113 | &function_end($name); | ||
| 114 | |||
| 115 | &fin_pool; | ||
| 116 | } | ||
| 117 | |||
| 118 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/div.pl b/src/lib/libcrypto/bn/asm/alpha/div.pl deleted file mode 100644 index e9e680897a..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/div.pl +++ /dev/null | |||
| @@ -1,144 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | sub bn_div_words | ||
| 4 | { | ||
| 5 | local($data)=<<'EOF'; | ||
| 6 | # | ||
| 7 | # What follows was taken directly from the C compiler with a few | ||
| 8 | # hacks to redo the lables. | ||
| 9 | # | ||
| 10 | .text | ||
| 11 | .set noreorder | ||
| 12 | .set volatile | ||
| 13 | .align 3 | ||
| 14 | .globl bn_div_words | ||
| 15 | .ent bn_div_words | ||
| 16 | bn_div_words | ||
| 17 | ldgp $29,0($27) | ||
| 18 | bn_div_words.ng: | ||
| 19 | lda $30,-48($30) | ||
| 20 | .frame $30,48,$26,0 | ||
| 21 | stq $26,0($30) | ||
| 22 | stq $9,8($30) | ||
| 23 | stq $10,16($30) | ||
| 24 | stq $11,24($30) | ||
| 25 | stq $12,32($30) | ||
| 26 | stq $13,40($30) | ||
| 27 | .mask 0x4003e00,-48 | ||
| 28 | .prologue 1 | ||
| 29 | bis $16,$16,$9 | ||
| 30 | bis $17,$17,$10 | ||
| 31 | bis $18,$18,$11 | ||
| 32 | bis $31,$31,$13 | ||
| 33 | bis $31,2,$12 | ||
| 34 | bne $11,$9119 | ||
| 35 | lda $0,-1 | ||
| 36 | br $31,$9136 | ||
| 37 | .align 4 | ||
| 38 | $9119: | ||
| 39 | bis $11,$11,$16 | ||
| 40 | jsr $26,BN_num_bits_word | ||
| 41 | ldgp $29,0($26) | ||
| 42 | subq $0,64,$1 | ||
| 43 | beq $1,$9120 | ||
| 44 | bis $31,1,$1 | ||
| 45 | sll $1,$0,$1 | ||
| 46 | cmpule $9,$1,$1 | ||
| 47 | bne $1,$9120 | ||
| 48 | # lda $16,_IO_stderr_ | ||
| 49 | # lda $17,$C32 | ||
| 50 | # bis $0,$0,$18 | ||
| 51 | # jsr $26,fprintf | ||
| 52 | # ldgp $29,0($26) | ||
| 53 | jsr $26,abort | ||
| 54 | ldgp $29,0($26) | ||
| 55 | .align 4 | ||
| 56 | $9120: | ||
| 57 | bis $31,64,$3 | ||
| 58 | cmpult $9,$11,$2 | ||
| 59 | subq $3,$0,$1 | ||
| 60 | addl $1,$31,$0 | ||
| 61 | subq $9,$11,$1 | ||
| 62 | cmoveq $2,$1,$9 | ||
| 63 | beq $0,$9122 | ||
| 64 | zapnot $0,15,$2 | ||
| 65 | subq $3,$0,$1 | ||
| 66 | sll $11,$2,$11 | ||
| 67 | sll $9,$2,$3 | ||
| 68 | srl $10,$1,$1 | ||
| 69 | sll $10,$2,$10 | ||
| 70 | bis $3,$1,$9 | ||
| 71 | $9122: | ||
| 72 | srl $11,32,$5 | ||
| 73 | zapnot $11,15,$6 | ||
| 74 | lda $7,-1 | ||
| 75 | .align 5 | ||
| 76 | $9123: | ||
| 77 | srl $9,32,$1 | ||
| 78 | subq $1,$5,$1 | ||
| 79 | bne $1,$9126 | ||
| 80 | zapnot $7,15,$27 | ||
| 81 | br $31,$9127 | ||
| 82 | .align 4 | ||
| 83 | $9126: | ||
| 84 | bis $9,$9,$24 | ||
| 85 | bis $5,$5,$25 | ||
| 86 | divqu $24,$25,$27 | ||
| 87 | $9127: | ||
| 88 | srl $10,32,$4 | ||
| 89 | .align 5 | ||
| 90 | $9128: | ||
| 91 | mulq $27,$5,$1 | ||
| 92 | subq $9,$1,$3 | ||
| 93 | zapnot $3,240,$1 | ||
| 94 | bne $1,$9129 | ||
| 95 | mulq $6,$27,$2 | ||
| 96 | sll $3,32,$1 | ||
| 97 | addq $1,$4,$1 | ||
| 98 | cmpule $2,$1,$2 | ||
| 99 | bne $2,$9129 | ||
| 100 | subq $27,1,$27 | ||
| 101 | br $31,$9128 | ||
| 102 | .align 4 | ||
| 103 | $9129: | ||
| 104 | mulq $27,$6,$1 | ||
| 105 | mulq $27,$5,$4 | ||
| 106 | srl $1,32,$3 | ||
| 107 | sll $1,32,$1 | ||
| 108 | addq $4,$3,$4 | ||
| 109 | cmpult $10,$1,$2 | ||
| 110 | subq $10,$1,$10 | ||
| 111 | addq $2,$4,$2 | ||
| 112 | cmpult $9,$2,$1 | ||
| 113 | bis $2,$2,$4 | ||
| 114 | beq $1,$9134 | ||
| 115 | addq $9,$11,$9 | ||
| 116 | subq $27,1,$27 | ||
| 117 | $9134: | ||
| 118 | subl $12,1,$12 | ||
| 119 | subq $9,$4,$9 | ||
| 120 | beq $12,$9124 | ||
| 121 | sll $27,32,$13 | ||
| 122 | sll $9,32,$2 | ||
| 123 | srl $10,32,$1 | ||
| 124 | sll $10,32,$10 | ||
| 125 | bis $2,$1,$9 | ||
| 126 | br $31,$9123 | ||
| 127 | .align 4 | ||
| 128 | $9124: | ||
| 129 | bis $13,$27,$0 | ||
| 130 | $9136: | ||
| 131 | ldq $26,0($30) | ||
| 132 | ldq $9,8($30) | ||
| 133 | ldq $10,16($30) | ||
| 134 | ldq $11,24($30) | ||
| 135 | ldq $12,32($30) | ||
| 136 | ldq $13,40($30) | ||
| 137 | addq $30,48,$30 | ||
| 138 | ret $31,($26),1 | ||
| 139 | .end bn_div_words | ||
| 140 | EOF | ||
| 141 | &asm_add($data); | ||
| 142 | } | ||
| 143 | |||
| 144 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul.pl b/src/lib/libcrypto/bn/asm/alpha/mul.pl deleted file mode 100644 index 76c926566c..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/mul.pl +++ /dev/null | |||
| @@ -1,104 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | $word=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | ### | ||
| 23 | &blt($count,&label("finish")); | ||
| 24 | |||
| 25 | ($a0)=&NR(1); &ld($a0,&QWPw(0,$ap)); | ||
| 26 | |||
| 27 | &set_label("loop"); | ||
| 28 | |||
| 29 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 30 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 31 | |||
| 32 | &muh($a0,$word,($h0)=&NR(1)); &FR($a0); | ||
| 33 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 34 | ### wait 8 | ||
| 35 | &mul($a0,$word,($l0)=&NR(1)); &FR($a0); | ||
| 36 | ### wait 8 | ||
| 37 | &muh($a1,$word,($h1)=&NR(1)); &FR($a1); | ||
| 38 | &add($l0,$cc,$l0); ### wait 8 | ||
| 39 | &mul($a1,$word,($l1)=&NR(1)); &FR($a1); | ||
| 40 | &cmpult($l0,$cc,$cc); ### wait 8 | ||
| 41 | &muh($a2,$word,($h2)=&NR(1)); &FR($a2); | ||
| 42 | &add($h0,$cc,$cc); &FR($h0); ### wait 8 | ||
| 43 | &mul($a2,$word,($l2)=&NR(1)); &FR($a2); | ||
| 44 | &add($l1,$cc,$l1); ### wait 8 | ||
| 45 | &st($l0,&QWPw(0,$rp)); &FR($l0); | ||
| 46 | &cmpult($l1,$cc,$cc); ### wait 8 | ||
| 47 | &muh($a3,$word,($h3)=&NR(1)); &FR($a3); | ||
| 48 | &add($h1,$cc,$cc); &FR($h1); | ||
| 49 | &mul($a3,$word,($l3)=&NR(1)); &FR($a3); | ||
| 50 | &add($l2,$cc,$l2); | ||
| 51 | &st($l1,&QWPw(1,$rp)); &FR($l1); | ||
| 52 | &cmpult($l2,$cc,$cc); | ||
| 53 | &add($h2,$cc,$cc); &FR($h2); | ||
| 54 | &sub($count,4,$count); # count-=4 | ||
| 55 | &st($l2,&QWPw(2,$rp)); &FR($l2); | ||
| 56 | &add($l3,$cc,$l3); | ||
| 57 | &cmpult($l3,$cc,$cc); | ||
| 58 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 59 | &add($h3,$cc,$cc); &FR($h3); | ||
| 60 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 61 | &st($l3,&QWPw(3,$rp)); &FR($l3); | ||
| 62 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 63 | ### | ||
| 64 | &blt($count,&label("finish")); | ||
| 65 | ($a0)=&NR(1); &ld($a0,&QWPw(0,$ap)); | ||
| 66 | &br(&label("finish")); | ||
| 67 | ################################################## | ||
| 68 | |||
| 69 | ################################################## | ||
| 70 | # Do the last 0..3 words | ||
| 71 | |||
| 72 | &set_label("last_loop"); | ||
| 73 | |||
| 74 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 75 | ### | ||
| 76 | ### | ||
| 77 | ### | ||
| 78 | &muh($a0,$word,($h0)=&NR(1)); | ||
| 79 | ### Wait 8 for next mul issue | ||
| 80 | &mul($a0,$word,($l0)=&NR(1)); &FR($a0) | ||
| 81 | &add($ap,$QWS,$ap); | ||
| 82 | ### Loose 12 until result is available | ||
| 83 | &add($rp,$QWS,$rp); | ||
| 84 | &sub($count,1,$count); | ||
| 85 | &add($l0,$cc,$l0); | ||
| 86 | ### | ||
| 87 | &st($l0,&QWPw(-1,$rp)); &FR($l0); | ||
| 88 | &cmpult($l0,$cc,$cc); | ||
| 89 | &add($h0,$cc,$cc); &FR($h0); | ||
| 90 | &bgt($count,&label("last_loop")); | ||
| 91 | &function_end_A($name); | ||
| 92 | |||
| 93 | ###################################################### | ||
| 94 | &set_label("finish"); | ||
| 95 | &add($count,4,$count); | ||
| 96 | &bgt($count,&label("last_loop")); | ||
| 97 | |||
| 98 | &set_label("end"); | ||
| 99 | &function_end($name); | ||
| 100 | |||
| 101 | &fin_pool; | ||
| 102 | } | ||
| 103 | |||
| 104 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_add.pl b/src/lib/libcrypto/bn/asm/alpha/mul_add.pl deleted file mode 100644 index 0d6df69bc4..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/mul_add.pl +++ /dev/null | |||
| @@ -1,123 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_add_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | $word=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | ### | ||
| 23 | &blt($count,&label("finish")); | ||
| 24 | |||
| 25 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); | ||
| 26 | |||
| 27 | $a=<<'EOF'; | ||
| 28 | ########################################################## | ||
| 29 | &set_label("loop"); | ||
| 30 | |||
| 31 | &ld(($r0)=&NR(1),&QWPw(0,$rp)); | ||
| 32 | &ld(($a1)=&NR(1),&QWPw(1,$ap)); | ||
| 33 | &muh($a0,$word,($h0)=&NR(1)); | ||
| 34 | &ld(($r1)=&NR(1),&QWPw(1,$rp)); | ||
| 35 | &ld(($a2)=&NR(1),&QWPw(2,$ap)); | ||
| 36 | ### | ||
| 37 | &mul($a0,$word,($l0)=&NR(1)); &FR($a0); | ||
| 38 | &ld(($r2)=&NR(1),&QWPw(2,$rp)); | ||
| 39 | &muh($a1,$word,($h1)=&NR(1)); | ||
| 40 | &ld(($a3)=&NR(1),&QWPw(3,$ap)); | ||
| 41 | &mul($a1,$word,($l1)=&NR(1)); &FR($a1); | ||
| 42 | &ld(($r3)=&NR(1),&QWPw(3,$rp)); | ||
| 43 | &add($r0,$l0,$r0); | ||
| 44 | &add($r1,$l1,$r1); | ||
| 45 | &cmpult($r0,$l0,($t0)=&NR(1)); &FR($l0); | ||
| 46 | &cmpult($r1,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 47 | &muh($a2,$word,($h2)=&NR(1)); | ||
| 48 | &add($r0,$cc,$r0); | ||
| 49 | &add($h0,$t0,$h0); &FR($t0); | ||
| 50 | &cmpult($r0,$cc,$cc); | ||
| 51 | &add($h1,$t1,$h1); &FR($t1); | ||
| 52 | &add($h0,$cc,$cc); &FR($h0); | ||
| 53 | &mul($a2,$word,($l2)=&NR(1)); &FR($a2); | ||
| 54 | &add($r1,$cc,$r1); | ||
| 55 | &cmpult($r1,$cc,$cc); | ||
| 56 | &add($r2,$l2,$r2); | ||
| 57 | &add($h1,$cc,$cc); &FR($h1); | ||
| 58 | &cmpult($r2,$l2,($t2)=&NR(1)); &FR($l2); | ||
| 59 | &muh($a3,$word,($h3)=&NR(1)); | ||
| 60 | &add($r2,$cc,$r2); | ||
| 61 | &st($r0,&QWPw(0,$rp)); &FR($r0); | ||
| 62 | &add($h2,$t2,$h2); &FR($t2); | ||
| 63 | &st($r1,&QWPw(1,$rp)); &FR($r1); | ||
| 64 | &cmpult($r2,$cc,$cc); | ||
| 65 | &mul($a3,$word,($l3)=&NR(1)); &FR($a3); | ||
| 66 | &add($h2,$cc,$cc); &FR($h2); | ||
| 67 | &st($r2,&QWPw(2,$rp)); &FR($r2); | ||
| 68 | &sub($count,4,$count); # count-=4 | ||
| 69 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 70 | &add($r3,$l3,$r3); | ||
| 71 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 72 | &cmpult($r3,$l3,($t3)=&NR(1)); &FR($l3); | ||
| 73 | &add($r3,$cc,$r3); | ||
| 74 | &add($h3,$t3,$h3); &FR($t3); | ||
| 75 | &cmpult($r3,$cc,$cc); | ||
| 76 | &st($r3,&QWPw(-1,$rp)); &FR($r3); | ||
| 77 | &add($h3,$cc,$cc); &FR($h3); | ||
| 78 | |||
| 79 | ### | ||
| 80 | &blt($count,&label("finish")); | ||
| 81 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); | ||
| 82 | &br(&label("loop")); | ||
| 83 | EOF | ||
| 84 | ################################################## | ||
| 85 | # Do the last 0..3 words | ||
| 86 | |||
| 87 | &set_label("last_loop"); | ||
| 88 | |||
| 89 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 90 | &ld(($r0)=&NR(1),&QWPw(0,$rp)); # get b | ||
| 91 | ### | ||
| 92 | ### | ||
| 93 | &muh($a0,$word,($h0)=&NR(1)); &FR($a0); | ||
| 94 | ### wait 8 | ||
| 95 | &mul($a0,$word,($l0)=&NR(1)); &FR($a0); | ||
| 96 | &add($rp,$QWS,$rp); | ||
| 97 | &add($ap,$QWS,$ap); | ||
| 98 | &sub($count,1,$count); | ||
| 99 | ### wait 3 until l0 is available | ||
| 100 | &add($r0,$l0,$r0); | ||
| 101 | ### | ||
| 102 | &cmpult($r0,$l0,($t0)=&NR(1)); &FR($l0); | ||
| 103 | &add($r0,$cc,$r0); | ||
| 104 | &add($h0,$t0,$h0); &FR($t0); | ||
| 105 | &cmpult($r0,$cc,$cc); | ||
| 106 | &add($h0,$cc,$cc); &FR($h0); | ||
| 107 | |||
| 108 | &st($r0,&QWPw(-1,$rp)); &FR($r0); | ||
| 109 | &bgt($count,&label("last_loop")); | ||
| 110 | &function_end_A($name); | ||
| 111 | |||
| 112 | ###################################################### | ||
| 113 | &set_label("finish"); | ||
| 114 | &add($count,4,$count); | ||
| 115 | &bgt($count,&label("last_loop")); | ||
| 116 | |||
| 117 | &set_label("end"); | ||
| 118 | &function_end($name); | ||
| 119 | |||
| 120 | &fin_pool; | ||
| 121 | } | ||
| 122 | |||
| 123 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_c4.pl b/src/lib/libcrypto/bn/asm/alpha/mul_c4.pl deleted file mode 100644 index 9cc876ded4..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/mul_c4.pl +++ /dev/null | |||
| @@ -1,215 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | # upto | ||
| 5 | |||
| 6 | sub mul_add_c | ||
| 7 | { | ||
| 8 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 9 | local($l1,$h1,$t1,$t2); | ||
| 10 | |||
| 11 | &mul($a,$b,($l1)=&NR(1)); | ||
| 12 | &muh($a,$b,($h1)=&NR(1)); | ||
| 13 | &add($c0,$l1,$c0); | ||
| 14 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 15 | &add($t1,$h1,$h1); &FR($t1); | ||
| 16 | &add($c1,$h1,$c1); | ||
| 17 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 18 | &add($c2,$t2,$c2); &FR($t2); | ||
| 19 | } | ||
| 20 | |||
| 21 | sub bn_mul_comba4 | ||
| 22 | { | ||
| 23 | local($name)=@_; | ||
| 24 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 25 | |||
| 26 | $cnt=1; | ||
| 27 | &init_pool(3); | ||
| 28 | |||
| 29 | $rp=&wparam(0); | ||
| 30 | $ap=&wparam(1); | ||
| 31 | $bp=&wparam(2); | ||
| 32 | |||
| 33 | &function_begin($name,""); | ||
| 34 | |||
| 35 | &comment(""); | ||
| 36 | |||
| 37 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 38 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 39 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 40 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 41 | &mul($a[0],$b[0],($r00)=&NR(1)); | ||
| 42 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 43 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 44 | &muh($a[0],$b[0],($r01)=&NR(1)); | ||
| 45 | &FR($ap); &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 46 | &FR($bp); &ld(($b[3])=&NR(1),&QWPw(3,$bp)); | ||
| 47 | &mul($a[0],$b[1],($r02)=&NR(1)); | ||
| 48 | |||
| 49 | ($R,$H1,$H2)=&NR(3); | ||
| 50 | |||
| 51 | &st($r00,&QWPw(0,$rp)); &FR($r00); | ||
| 52 | |||
| 53 | &mov("zero",$R); | ||
| 54 | &mul($a[1],$b[0],($r03)=&NR(1)); | ||
| 55 | |||
| 56 | &mov("zero",$H1); | ||
| 57 | &mov("zero",$H0); | ||
| 58 | &add($R,$r01,$R); | ||
| 59 | &muh($a[0],$b[1],($r04)=&NR(1)); | ||
| 60 | &cmpult($R,$r01,($t01)=&NR(1)); &FR($r01); | ||
| 61 | &add($R,$r02,$R); | ||
| 62 | &add($H1,$t01,$H1) &FR($t01); | ||
| 63 | &muh($a[1],$b[0],($r05)=&NR(1)); | ||
| 64 | &cmpult($R,$r02,($t02)=&NR(1)); &FR($r02); | ||
| 65 | &add($R,$r03,$R); | ||
| 66 | &add($H2,$t02,$H2) &FR($t02); | ||
| 67 | &mul($a[0],$b[2],($r06)=&NR(1)); | ||
| 68 | &cmpult($R,$r03,($t03)=&NR(1)); &FR($r03); | ||
| 69 | &add($H1,$t03,$H1) &FR($t03); | ||
| 70 | &st($R,&QWPw(1,$rp)); | ||
| 71 | &add($H1,$H2,$R); | ||
| 72 | |||
| 73 | &mov("zero",$H1); | ||
| 74 | &add($R,$r04,$R); | ||
| 75 | &mov("zero",$H2); | ||
| 76 | &mul($a[1],$b[1],($r07)=&NR(1)); | ||
| 77 | &cmpult($R,$r04,($t04)=&NR(1)); &FR($r04); | ||
| 78 | &add($R,$r05,$R); | ||
| 79 | &add($H1,$t04,$H1) &FR($t04); | ||
| 80 | &mul($a[2],$b[0],($r08)=&NR(1)); | ||
| 81 | &cmpult($R,$r05,($t05)=&NR(1)); &FR($r05); | ||
| 82 | &add($R,$r01,$R); | ||
| 83 | &add($H2,$t05,$H2) &FR($t05); | ||
| 84 | &muh($a[0],$b[2],($r09)=&NR(1)); | ||
| 85 | &cmpult($R,$r06,($t06)=&NR(1)); &FR($r06); | ||
| 86 | &add($R,$r07,$R); | ||
| 87 | &add($H1,$t06,$H1) &FR($t06); | ||
| 88 | &muh($a[1],$b[1],($r10)=&NR(1)); | ||
| 89 | &cmpult($R,$r07,($t07)=&NR(1)); &FR($r07); | ||
| 90 | &add($R,$r08,$R); | ||
| 91 | &add($H2,$t07,$H2) &FR($t07); | ||
| 92 | &muh($a[2],$b[0],($r11)=&NR(1)); | ||
| 93 | &cmpult($R,$r08,($t08)=&NR(1)); &FR($r08); | ||
| 94 | &add($H1,$t08,$H1) &FR($t08); | ||
| 95 | &st($R,&QWPw(2,$rp)); | ||
| 96 | &add($H1,$H2,$R); | ||
| 97 | |||
| 98 | &mov("zero",$H1); | ||
| 99 | &add($R,$r09,$R); | ||
| 100 | &mov("zero",$H2); | ||
| 101 | &mul($a[0],$b[3],($r12)=&NR(1)); | ||
| 102 | &cmpult($R,$r09,($t09)=&NR(1)); &FR($r09); | ||
| 103 | &add($R,$r10,$R); | ||
| 104 | &add($H1,$t09,$H1) &FR($t09); | ||
| 105 | &mul($a[1],$b[2],($r13)=&NR(1)); | ||
| 106 | &cmpult($R,$r10,($t10)=&NR(1)); &FR($r10); | ||
| 107 | &add($R,$r11,$R); | ||
| 108 | &add($H1,$t10,$H1) &FR($t10); | ||
| 109 | &mul($a[2],$b[1],($r14)=&NR(1)); | ||
| 110 | &cmpult($R,$r11,($t11)=&NR(1)); &FR($r11); | ||
| 111 | &add($R,$r12,$R); | ||
| 112 | &add($H1,$t11,$H1) &FR($t11); | ||
| 113 | &mul($a[3],$b[0],($r15)=&NR(1)); | ||
| 114 | &cmpult($R,$r12,($t12)=&NR(1)); &FR($r12); | ||
| 115 | &add($R,$r13,$R); | ||
| 116 | &add($H1,$t12,$H1) &FR($t12); | ||
| 117 | &muh($a[0],$b[3],($r16)=&NR(1)); | ||
| 118 | &cmpult($R,$r13,($t13)=&NR(1)); &FR($r13); | ||
| 119 | &add($R,$r14,$R); | ||
| 120 | &add($H1,$t13,$H1) &FR($t13); | ||
| 121 | &muh($a[1],$b[2],($r17)=&NR(1)); | ||
| 122 | &cmpult($R,$r14,($t14)=&NR(1)); &FR($r14); | ||
| 123 | &add($R,$r15,$R); | ||
| 124 | &add($H1,$t14,$H1) &FR($t14); | ||
| 125 | &muh($a[2],$b[1],($r18)=&NR(1)); | ||
| 126 | &cmpult($R,$r15,($t15)=&NR(1)); &FR($r15); | ||
| 127 | &add($H1,$t15,$H1) &FR($t15); | ||
| 128 | &st($R,&QWPw(3,$rp)); | ||
| 129 | &add($H1,$H2,$R); | ||
| 130 | |||
| 131 | &mov("zero",$H1); | ||
| 132 | &add($R,$r16,$R); | ||
| 133 | &mov("zero",$H2); | ||
| 134 | &muh($a[3],$b[0],($r19)=&NR(1)); | ||
| 135 | &cmpult($R,$r16,($t16)=&NR(1)); &FR($r16); | ||
| 136 | &add($R,$r17,$R); | ||
| 137 | &add($H1,$t16,$H1) &FR($t16); | ||
| 138 | &mul($a[1],$b[3],($r20)=&NR(1)); | ||
| 139 | &cmpult($R,$r17,($t17)=&NR(1)); &FR($r17); | ||
| 140 | &add($R,$r18,$R); | ||
| 141 | &add($H1,$t17,$H1) &FR($t17); | ||
| 142 | &mul($a[2],$b[2],($r21)=&NR(1)); | ||
| 143 | &cmpult($R,$r18,($t18)=&NR(1)); &FR($r18); | ||
| 144 | &add($R,$r19,$R); | ||
| 145 | &add($H1,$t18,$H1) &FR($t18); | ||
| 146 | &mul($a[3],$b[1],($r22)=&NR(1)); | ||
| 147 | &cmpult($R,$r19,($t19)=&NR(1)); &FR($r19); | ||
| 148 | &add($R,$r20,$R); | ||
| 149 | &add($H1,$t19,$H1) &FR($t19); | ||
| 150 | &muh($a[1],$b[3],($r23)=&NR(1)); | ||
| 151 | &cmpult($R,$r20,($t20)=&NR(1)); &FR($r20); | ||
| 152 | &add($R,$r21,$R); | ||
| 153 | &add($H1,$t20,$H1) &FR($t20); | ||
| 154 | &muh($a[2],$b[2],($r24)=&NR(1)); | ||
| 155 | &cmpult($R,$r21,($t21)=&NR(1)); &FR($r21); | ||
| 156 | &add($R,$r22,$R); | ||
| 157 | &add($H1,$t21,$H1) &FR($t21); | ||
| 158 | &muh($a[3],$b[1],($r25)=&NR(1)); | ||
| 159 | &cmpult($R,$r22,($t22)=&NR(1)); &FR($r22); | ||
| 160 | &add($H1,$t22,$H1) &FR($t22); | ||
| 161 | &st($R,&QWPw(4,$rp)); | ||
| 162 | &add($H1,$H2,$R); | ||
| 163 | |||
| 164 | &mov("zero",$H1); | ||
| 165 | &add($R,$r23,$R); | ||
| 166 | &mov("zero",$H2); | ||
| 167 | &mul($a[2],$b[3],($r26)=&NR(1)); | ||
| 168 | &cmpult($R,$r23,($t23)=&NR(1)); &FR($r23); | ||
| 169 | &add($R,$r24,$R); | ||
| 170 | &add($H1,$t23,$H1) &FR($t23); | ||
| 171 | &mul($a[3],$b[2],($r27)=&NR(1)); | ||
| 172 | &cmpult($R,$r24,($t24)=&NR(1)); &FR($r24); | ||
| 173 | &add($R,$r25,$R); | ||
| 174 | &add($H1,$t24,$H1) &FR($t24); | ||
| 175 | &muh($a[2],$b[3],($r28)=&NR(1)); | ||
| 176 | &cmpult($R,$r25,($t25)=&NR(1)); &FR($r25); | ||
| 177 | &add($R,$r26,$R); | ||
| 178 | &add($H1,$t25,$H1) &FR($t25); | ||
| 179 | &muh($a[3],$b[2],($r29)=&NR(1)); | ||
| 180 | &cmpult($R,$r26,($t26)=&NR(1)); &FR($r26); | ||
| 181 | &add($R,$r27,$R); | ||
| 182 | &add($H1,$t26,$H1) &FR($t26); | ||
| 183 | &mul($a[3],$b[3],($r30)=&NR(1)); | ||
| 184 | &cmpult($R,$r27,($t27)=&NR(1)); &FR($r27); | ||
| 185 | &add($H1,$t27,$H1) &FR($t27); | ||
| 186 | &st($R,&QWPw(5,$rp)); | ||
| 187 | &add($H1,$H2,$R); | ||
| 188 | |||
| 189 | &mov("zero",$H1); | ||
| 190 | &add($R,$r28,$R); | ||
| 191 | &mov("zero",$H2); | ||
| 192 | &muh($a[3],$b[3],($r31)=&NR(1)); | ||
| 193 | &cmpult($R,$r28,($t28)=&NR(1)); &FR($r28); | ||
| 194 | &add($R,$r29,$R); | ||
| 195 | &add($H1,$t28,$H1) &FR($t28); | ||
| 196 | ############ | ||
| 197 | &cmpult($R,$r29,($t29)=&NR(1)); &FR($r29); | ||
| 198 | &add($R,$r30,$R); | ||
| 199 | &add($H1,$t29,$H1) &FR($t29); | ||
| 200 | ############ | ||
| 201 | &cmpult($R,$r30,($t30)=&NR(1)); &FR($r30); | ||
| 202 | &add($H1,$t30,$H1) &FR($t30); | ||
| 203 | &st($R,&QWPw(6,$rp)); | ||
| 204 | &add($H1,$H2,$R); | ||
| 205 | |||
| 206 | &add($R,$r31,$R); &FR($r31); | ||
| 207 | &st($R,&QWPw(7,$rp)); | ||
| 208 | |||
| 209 | &FR($R,$H1,$H2); | ||
| 210 | &function_end($name); | ||
| 211 | |||
| 212 | &fin_pool; | ||
| 213 | } | ||
| 214 | |||
| 215 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_c4.works.pl b/src/lib/libcrypto/bn/asm/alpha/mul_c4.works.pl deleted file mode 100644 index 79d86dd25c..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/mul_c4.works.pl +++ /dev/null | |||
| @@ -1,98 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub mul_add_c | ||
| 5 | { | ||
| 6 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 7 | local($l1,$h1,$t1,$t2); | ||
| 8 | |||
| 9 | print STDERR "count=$cnt\n"; $cnt++; | ||
| 10 | &mul($a,$b,($l1)=&NR(1)); | ||
| 11 | &muh($a,$b,($h1)=&NR(1)); | ||
| 12 | &add($c0,$l1,$c0); | ||
| 13 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 14 | &add($t1,$h1,$h1); &FR($t1); | ||
| 15 | &add($c1,$h1,$c1); | ||
| 16 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 17 | &add($c2,$t2,$c2); &FR($t2); | ||
| 18 | } | ||
| 19 | |||
| 20 | sub bn_mul_comba4 | ||
| 21 | { | ||
| 22 | local($name)=@_; | ||
| 23 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 24 | |||
| 25 | $cnt=1; | ||
| 26 | &init_pool(3); | ||
| 27 | |||
| 28 | $rp=&wparam(0); | ||
| 29 | $ap=&wparam(1); | ||
| 30 | $bp=&wparam(2); | ||
| 31 | |||
| 32 | &function_begin($name,""); | ||
| 33 | |||
| 34 | &comment(""); | ||
| 35 | |||
| 36 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 37 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 38 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 39 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 40 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 41 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 42 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap); | ||
| 43 | &ld(($b[3])=&NR(1),&QWPw(3,$bp)); &FR($bp); | ||
| 44 | |||
| 45 | ($c0,$c1,$c2)=&NR(3); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | &mul($a[0],$b[0],$c0); | ||
| 48 | &muh($a[0],$b[0],$c1); | ||
| 49 | &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 50 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 51 | &mov("zero",$c2); | ||
| 52 | |||
| 53 | &mul_add_c($a[0],$b[1],$c0,$c1,$c2); | ||
| 54 | &mul_add_c($a[1],$b[0],$c0,$c1,$c2); | ||
| 55 | &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 56 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 57 | &mov("zero",$c2); | ||
| 58 | |||
| 59 | &mul_add_c($a[1],$b[1],$c0,$c1,$c2); | ||
| 60 | &mul_add_c($a[0],$b[2],$c0,$c1,$c2); | ||
| 61 | &mul_add_c($a[2],$b[0],$c0,$c1,$c2); | ||
| 62 | &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 63 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 64 | &mov("zero",$c2); | ||
| 65 | |||
| 66 | &mul_add_c($a[0],$b[3],$c0,$c1,$c2); &FR($a[0]); | ||
| 67 | &mul_add_c($a[1],$b[2],$c0,$c1,$c2); | ||
| 68 | &mul_add_c($a[2],$b[1],$c0,$c1,$c2); | ||
| 69 | &mul_add_c($a[3],$b[0],$c0,$c1,$c2); &FR($b[0]); | ||
| 70 | &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 71 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 72 | &mov("zero",$c2); | ||
| 73 | |||
| 74 | &mul_add_c($a[1],$b[3],$c0,$c1,$c2); &FR($a[1]); | ||
| 75 | &mul_add_c($a[2],$b[2],$c0,$c1,$c2); | ||
| 76 | &mul_add_c($a[3],$b[1],$c0,$c1,$c2); &FR($b[1]); | ||
| 77 | &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 78 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 79 | &mov("zero",$c2); | ||
| 80 | |||
| 81 | &mul_add_c($a[2],$b[3],$c0,$c1,$c2); &FR($a[2]); | ||
| 82 | &mul_add_c($a[3],$b[2],$c0,$c1,$c2); &FR($b[2]); | ||
| 83 | &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 84 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 85 | &mov("zero",$c2); | ||
| 86 | |||
| 87 | &mul_add_c($a[3],$b[3],$c0,$c1,$c2); &FR($a[3],$b[3]); | ||
| 88 | &st($c0,&QWPw(6,$rp)); | ||
| 89 | &st($c1,&QWPw(7,$rp)); | ||
| 90 | |||
| 91 | &FR($c0,$c1,$c2); | ||
| 92 | |||
| 93 | &function_end($name); | ||
| 94 | |||
| 95 | &fin_pool; | ||
| 96 | } | ||
| 97 | |||
| 98 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_c8.pl b/src/lib/libcrypto/bn/asm/alpha/mul_c8.pl deleted file mode 100644 index 525ca7494b..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/mul_c8.pl +++ /dev/null | |||
| @@ -1,177 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_comba8 | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 8 | |||
| 9 | $cnt=1; | ||
| 10 | &init_pool(3); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | |||
| 16 | &function_begin($name,""); | ||
| 17 | |||
| 18 | &comment(""); | ||
| 19 | |||
| 20 | &stack_push(2); | ||
| 21 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 22 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 23 | &st($reg_s0,&swtmp(0)); &FR($reg_s0); | ||
| 24 | &st($reg_s1,&swtmp(1)); &FR($reg_s1); | ||
| 25 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 26 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 27 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 28 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 29 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 30 | &ld(($b[3])=&NR(1),&QWPw(3,$bp)); | ||
| 31 | &ld(($a[4])=&NR(1),&QWPw(1,$ap)); | ||
| 32 | &ld(($b[4])=&NR(1),&QWPw(1,$bp)); | ||
| 33 | &ld(($a[5])=&NR(1),&QWPw(1,$ap)); | ||
| 34 | &ld(($b[5])=&NR(1),&QWPw(1,$bp)); | ||
| 35 | &ld(($a[6])=&NR(1),&QWPw(1,$ap)); | ||
| 36 | &ld(($b[6])=&NR(1),&QWPw(1,$bp)); | ||
| 37 | &ld(($a[7])=&NR(1),&QWPw(1,$ap)); &FR($ap); | ||
| 38 | &ld(($b[7])=&NR(1),&QWPw(1,$bp)); &FR($bp); | ||
| 39 | |||
| 40 | ($c0,$c1,$c2)=&NR(3); | ||
| 41 | &mov("zero",$c2); | ||
| 42 | &mul($a[0],$b[0],$c0); | ||
| 43 | &muh($a[0],$b[0],$c1); | ||
| 44 | &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 45 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | |||
| 48 | &mul_add_c($a[0],$b[1],$c0,$c1,$c2); | ||
| 49 | &mul_add_c($a[1],$b[0],$c0,$c1,$c2); | ||
| 50 | &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 51 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 52 | &mov("zero",$c2); | ||
| 53 | |||
| 54 | &mul_add_c($a[0],$b[2],$c0,$c1,$c2); | ||
| 55 | &mul_add_c($a[1],$b[1],$c0,$c1,$c2); | ||
| 56 | &mul_add_c($a[2],$b[0],$c0,$c1,$c2); | ||
| 57 | &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 58 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 59 | &mov("zero",$c2); | ||
| 60 | |||
| 61 | &mul_add_c($a[0],$b[3],$c0,$c1,$c2); | ||
| 62 | &mul_add_c($a[1],$b[2],$c0,$c1,$c2); | ||
| 63 | &mul_add_c($a[2],$b[1],$c0,$c1,$c2); | ||
| 64 | &mul_add_c($a[3],$b[0],$c0,$c1,$c2); | ||
| 65 | &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 66 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 67 | &mov("zero",$c2); | ||
| 68 | |||
| 69 | &mul_add_c($a[0],$b[4],$c0,$c1,$c2); | ||
| 70 | &mul_add_c($a[1],$b[3],$c0,$c1,$c2); | ||
| 71 | &mul_add_c($a[2],$b[2],$c0,$c1,$c2); | ||
| 72 | &mul_add_c($a[3],$b[1],$c0,$c1,$c2); | ||
| 73 | &mul_add_c($a[4],$b[0],$c0,$c1,$c2); | ||
| 74 | &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 75 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 76 | &mov("zero",$c2); | ||
| 77 | |||
| 78 | &mul_add_c($a[0],$b[5],$c0,$c1,$c2); | ||
| 79 | &mul_add_c($a[1],$b[4],$c0,$c1,$c2); | ||
| 80 | &mul_add_c($a[2],$b[3],$c0,$c1,$c2); | ||
| 81 | &mul_add_c($a[3],$b[2],$c0,$c1,$c2); | ||
| 82 | &mul_add_c($a[4],$b[1],$c0,$c1,$c2); | ||
| 83 | &mul_add_c($a[5],$b[0],$c0,$c1,$c2); | ||
| 84 | &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 85 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 86 | &mov("zero",$c2); | ||
| 87 | |||
| 88 | &mul_add_c($a[0],$b[6],$c0,$c1,$c2); | ||
| 89 | &mul_add_c($a[1],$b[5],$c0,$c1,$c2); | ||
| 90 | &mul_add_c($a[2],$b[4],$c0,$c1,$c2); | ||
| 91 | &mul_add_c($a[3],$b[3],$c0,$c1,$c2); | ||
| 92 | &mul_add_c($a[4],$b[2],$c0,$c1,$c2); | ||
| 93 | &mul_add_c($a[5],$b[1],$c0,$c1,$c2); | ||
| 94 | &mul_add_c($a[6],$b[0],$c0,$c1,$c2); | ||
| 95 | &st($c0,&QWPw(6,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 96 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 97 | &mov("zero",$c2); | ||
| 98 | |||
| 99 | &mul_add_c($a[0],$b[7],$c0,$c1,$c2); &FR($a[0]); | ||
| 100 | &mul_add_c($a[1],$b[6],$c0,$c1,$c2); | ||
| 101 | &mul_add_c($a[2],$b[5],$c0,$c1,$c2); | ||
| 102 | &mul_add_c($a[3],$b[4],$c0,$c1,$c2); | ||
| 103 | &mul_add_c($a[4],$b[3],$c0,$c1,$c2); | ||
| 104 | &mul_add_c($a[5],$b[2],$c0,$c1,$c2); | ||
| 105 | &mul_add_c($a[6],$b[1],$c0,$c1,$c2); | ||
| 106 | &mul_add_c($a[7],$b[0],$c0,$c1,$c2); &FR($b[0]); | ||
| 107 | &st($c0,&QWPw(7,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 108 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 109 | &mov("zero",$c2); | ||
| 110 | |||
| 111 | &mul_add_c($a[1],$b[7],$c0,$c1,$c2); &FR($a[1]); | ||
| 112 | &mul_add_c($a[2],$b[6],$c0,$c1,$c2); | ||
| 113 | &mul_add_c($a[3],$b[5],$c0,$c1,$c2); | ||
| 114 | &mul_add_c($a[4],$b[4],$c0,$c1,$c2); | ||
| 115 | &mul_add_c($a[5],$b[3],$c0,$c1,$c2); | ||
| 116 | &mul_add_c($a[6],$b[2],$c0,$c1,$c2); | ||
| 117 | &mul_add_c($a[7],$b[1],$c0,$c1,$c2); &FR($b[1]); | ||
| 118 | &st($c0,&QWPw(8,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 119 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 120 | &mov("zero",$c2); | ||
| 121 | |||
| 122 | &mul_add_c($a[2],$b[7],$c0,$c1,$c2); &FR($a[2]); | ||
| 123 | &mul_add_c($a[3],$b[6],$c0,$c1,$c2); | ||
| 124 | &mul_add_c($a[4],$b[5],$c0,$c1,$c2); | ||
| 125 | &mul_add_c($a[5],$b[4],$c0,$c1,$c2); | ||
| 126 | &mul_add_c($a[6],$b[3],$c0,$c1,$c2); | ||
| 127 | &mul_add_c($a[7],$b[2],$c0,$c1,$c2); &FR($b[2]); | ||
| 128 | &st($c0,&QWPw(9,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 129 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 130 | &mov("zero",$c2); | ||
| 131 | |||
| 132 | &mul_add_c($a[3],$b[7],$c0,$c1,$c2); &FR($a[3]); | ||
| 133 | &mul_add_c($a[4],$b[6],$c0,$c1,$c2); | ||
| 134 | &mul_add_c($a[5],$b[5],$c0,$c1,$c2); | ||
| 135 | &mul_add_c($a[6],$b[4],$c0,$c1,$c2); | ||
| 136 | &mul_add_c($a[7],$b[3],$c0,$c1,$c2); &FR($b[3]); | ||
| 137 | &st($c0,&QWPw(10,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 138 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 139 | &mov("zero",$c2); | ||
| 140 | |||
| 141 | &mul_add_c($a[4],$b[7],$c0,$c1,$c2); &FR($a[4]); | ||
| 142 | &mul_add_c($a[5],$b[6],$c0,$c1,$c2); | ||
| 143 | &mul_add_c($a[6],$b[5],$c0,$c1,$c2); | ||
| 144 | &mul_add_c($a[7],$b[4],$c0,$c1,$c2); &FR($b[4]); | ||
| 145 | &st($c0,&QWPw(11,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 146 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 147 | &mov("zero",$c2); | ||
| 148 | |||
| 149 | &mul_add_c($a[5],$b[7],$c0,$c1,$c2); &FR($a[5]); | ||
| 150 | &mul_add_c($a[6],$b[6],$c0,$c1,$c2); | ||
| 151 | &mul_add_c($a[7],$b[5],$c0,$c1,$c2); &FR($b[5]); | ||
| 152 | &st($c0,&QWPw(12,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 153 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 154 | &mov("zero",$c2); | ||
| 155 | |||
| 156 | &mul_add_c($a[6],$b[7],$c0,$c1,$c2); &FR($a[6]); | ||
| 157 | &mul_add_c($a[7],$b[6],$c0,$c1,$c2); &FR($b[6]); | ||
| 158 | &st($c0,&QWPw(13,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 159 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 160 | &mov("zero",$c2); | ||
| 161 | |||
| 162 | &mul_add_c($a[7],$b[7],$c0,$c1,$c2); &FR($a[7],$b[7]); | ||
| 163 | &st($c0,&QWPw(14,$rp)); | ||
| 164 | &st($c1,&QWPw(15,$rp)); | ||
| 165 | |||
| 166 | &FR($c0,$c1,$c2); | ||
| 167 | |||
| 168 | &ld($reg_s0,&swtmp(0)); | ||
| 169 | &ld($reg_s1,&swtmp(1)); | ||
| 170 | &stack_pop(2); | ||
| 171 | |||
| 172 | &function_end($name); | ||
| 173 | |||
| 174 | &fin_pool; | ||
| 175 | } | ||
| 176 | |||
| 177 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/sqr.pl b/src/lib/libcrypto/bn/asm/alpha/sqr.pl deleted file mode 100644 index a55b696906..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/sqr.pl +++ /dev/null | |||
| @@ -1,113 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sqr_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(3); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | |||
| 16 | &function_begin($name,""); | ||
| 17 | |||
| 18 | &comment(""); | ||
| 19 | &sub($count,4,$count); | ||
| 20 | &mov("zero",$cc); | ||
| 21 | &br(&label("finish")); | ||
| 22 | &blt($count,&label("finish")); | ||
| 23 | |||
| 24 | ($a0,$r0)=&NR(2); | ||
| 25 | &ld($a0,&QWPw(0,$ap)); | ||
| 26 | &ld($r0,&QWPw(0,$rp)); | ||
| 27 | |||
| 28 | $a=<<'EOF'; | ||
| 29 | ########################################################## | ||
| 30 | &set_label("loop"); | ||
| 31 | |||
| 32 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 33 | ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp)); | ||
| 34 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 35 | ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp)); | ||
| 36 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 37 | ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp)); | ||
| 38 | |||
| 39 | ($o0,$t0)=&NR(2); | ||
| 40 | &add($a0,$b0,$o0); | ||
| 41 | &cmpult($o0,$b0,$t0); | ||
| 42 | &add($o0,$cc,$o0); | ||
| 43 | &cmpult($o0,$cc,$cc); | ||
| 44 | &add($cc,$t0,$cc); &FR($t0); | ||
| 45 | |||
| 46 | ($t1,$o1)=&NR(2); | ||
| 47 | |||
| 48 | &add($a1,$b1,$o1); &FR($a1); | ||
| 49 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 50 | &add($o1,$cc,$o1); | ||
| 51 | &cmpult($o1,$cc,$cc); | ||
| 52 | &add($cc,$t1,$cc); &FR($t1); | ||
| 53 | |||
| 54 | ($t2,$o2)=&NR(2); | ||
| 55 | |||
| 56 | &add($a2,$b2,$o2); &FR($a2); | ||
| 57 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 58 | &add($o2,$cc,$o2); | ||
| 59 | &cmpult($o2,$cc,$cc); | ||
| 60 | &add($cc,$t2,$cc); &FR($t2); | ||
| 61 | |||
| 62 | ($t3,$o3)=&NR(2); | ||
| 63 | |||
| 64 | &add($a3,$b3,$o3); &FR($a3); | ||
| 65 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 66 | &add($o3,$cc,$o3); | ||
| 67 | &cmpult($o3,$cc,$cc); | ||
| 68 | &add($cc,$t3,$cc); &FR($t3); | ||
| 69 | |||
| 70 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 71 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 72 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 73 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 74 | |||
| 75 | &sub($count,4,$count); # count-=4 | ||
| 76 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 77 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 78 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 79 | |||
| 80 | &blt($count,&label("finish")); | ||
| 81 | &ld($a0,&QWPw(0,$ap)); | ||
| 82 | &ld($b0,&QWPw(0,$bp)); | ||
| 83 | &br(&label("loop")); | ||
| 84 | EOF | ||
| 85 | ################################################## | ||
| 86 | # Do the last 0..3 words | ||
| 87 | |||
| 88 | &set_label("last_loop"); | ||
| 89 | |||
| 90 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 91 | &mul($a0,$a0,($l0)=&NR(1)); | ||
| 92 | &add($ap,$QWS,$ap); | ||
| 93 | &add($rp,2*$QWS,$rp); | ||
| 94 | &sub($count,1,$count); | ||
| 95 | &muh($a0,$a0,($h0)=&NR(1)); &FR($a0); | ||
| 96 | &st($l0,&QWPw(-2,$rp)); &FR($l0); | ||
| 97 | &st($h0,&QWPw(-1,$rp)); &FR($h0); | ||
| 98 | |||
| 99 | &bgt($count,&label("last_loop")); | ||
| 100 | &function_end_A($name); | ||
| 101 | |||
| 102 | ###################################################### | ||
| 103 | &set_label("finish"); | ||
| 104 | &add($count,4,$count); | ||
| 105 | &bgt($count,&label("last_loop")); | ||
| 106 | |||
| 107 | &set_label("end"); | ||
| 108 | &function_end($name); | ||
| 109 | |||
| 110 | &fin_pool; | ||
| 111 | } | ||
| 112 | |||
| 113 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/sqr_c4.pl b/src/lib/libcrypto/bn/asm/alpha/sqr_c4.pl deleted file mode 100644 index bf33f5b503..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/sqr_c4.pl +++ /dev/null | |||
| @@ -1,109 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub sqr_add_c | ||
| 5 | { | ||
| 6 | local($a,$c0,$c1,$c2)=@_; | ||
| 7 | local($l1,$h1,$t1,$t2); | ||
| 8 | |||
| 9 | &mul($a,$a,($l1)=&NR(1)); | ||
| 10 | &muh($a,$a,($h1)=&NR(1)); | ||
| 11 | &add($c0,$l1,$c0); | ||
| 12 | &add($c1,$h1,$c1); | ||
| 13 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 14 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 15 | &add($c1,$t1,$c1); &FR($t1); | ||
| 16 | &add($c2,$t2,$c2); &FR($t2); | ||
| 17 | } | ||
| 18 | |||
| 19 | sub sqr_add_c2 | ||
| 20 | { | ||
| 21 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 22 | local($l1,$h1,$t1,$t2); | ||
| 23 | |||
| 24 | &mul($a,$b,($l1)=&NR(1)); | ||
| 25 | &muh($a,$b,($h1)=&NR(1)); | ||
| 26 | &cmplt($l1,"zero",($lc1)=&NR(1)); | ||
| 27 | &cmplt($h1,"zero",($hc1)=&NR(1)); | ||
| 28 | &add($l1,$l1,$l1); | ||
| 29 | &add($h1,$h1,$h1); | ||
| 30 | &add($h1,$lc1,$h1); &FR($lc1); | ||
| 31 | &add($c2,$hc1,$c2); &FR($hc1); | ||
| 32 | |||
| 33 | &add($c0,$l1,$c0); | ||
| 34 | &add($c1,$h1,$c1); | ||
| 35 | &cmpult($c0,$l1,($lc1)=&NR(1)); &FR($l1); | ||
| 36 | &cmpult($c1,$h1,($hc1)=&NR(1)); &FR($h1); | ||
| 37 | |||
| 38 | &add($c1,$lc1,$c1); &FR($lc1); | ||
| 39 | &add($c2,$hc1,$c2); &FR($hc1); | ||
| 40 | } | ||
| 41 | |||
| 42 | |||
| 43 | sub bn_sqr_comba4 | ||
| 44 | { | ||
| 45 | local($name)=@_; | ||
| 46 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 47 | |||
| 48 | $cnt=1; | ||
| 49 | &init_pool(2); | ||
| 50 | |||
| 51 | $rp=&wparam(0); | ||
| 52 | $ap=&wparam(1); | ||
| 53 | |||
| 54 | &function_begin($name,""); | ||
| 55 | |||
| 56 | &comment(""); | ||
| 57 | |||
| 58 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 59 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 60 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 61 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap); | ||
| 62 | |||
| 63 | ($c0,$c1,$c2)=&NR(3); | ||
| 64 | |||
| 65 | &mov("zero",$c2); | ||
| 66 | &mul($a[0],$a[0],$c0); | ||
| 67 | &muh($a[0],$a[0],$c1); | ||
| 68 | &st($c0,&QWPw(0,$rp)); | ||
| 69 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 70 | &mov("zero",$c2); | ||
| 71 | |||
| 72 | &sqr_add_c2($a[0],$a[1],$c0,$c1,$c2); | ||
| 73 | &st($c0,&QWPw(1,$rp)); | ||
| 74 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 75 | &mov("zero",$c2); | ||
| 76 | |||
| 77 | &sqr_add_c($a[1],$c0,$c1,$c2); | ||
| 78 | &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2); | ||
| 79 | &st($c0,&QWPw(2,$rp)); | ||
| 80 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 81 | &mov("zero",$c2); | ||
| 82 | |||
| 83 | &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2); | ||
| 84 | &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2); | ||
| 85 | &st($c0,&QWPw(3,$rp)); | ||
| 86 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 87 | &mov("zero",$c2); | ||
| 88 | |||
| 89 | &sqr_add_c($a[2],$c0,$c1,$c2); | ||
| 90 | &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2); | ||
| 91 | &st($c0,&QWPw(4,$rp)); | ||
| 92 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 93 | &mov("zero",$c2); | ||
| 94 | |||
| 95 | &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2); | ||
| 96 | &st($c0,&QWPw(5,$rp)); | ||
| 97 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 98 | &mov("zero",$c2); | ||
| 99 | |||
| 100 | &sqr_add_c($a[3],$c0,$c1,$c2); | ||
| 101 | &st($c0,&QWPw(6,$rp)); | ||
| 102 | &st($c1,&QWPw(7,$rp)); | ||
| 103 | |||
| 104 | &function_end($name); | ||
| 105 | |||
| 106 | &fin_pool; | ||
| 107 | } | ||
| 108 | |||
| 109 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/sqr_c8.pl b/src/lib/libcrypto/bn/asm/alpha/sqr_c8.pl deleted file mode 100644 index b4afe085f1..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/sqr_c8.pl +++ /dev/null | |||
| @@ -1,132 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sqr_comba8 | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 8 | |||
| 9 | $cnt=1; | ||
| 10 | &init_pool(2); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | |||
| 15 | &function_begin($name,""); | ||
| 16 | |||
| 17 | &comment(""); | ||
| 18 | |||
| 19 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 20 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 21 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 22 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 23 | &ld(($a[4])=&NR(1),&QWPw(4,$ap)); | ||
| 24 | &ld(($a[5])=&NR(1),&QWPw(5,$ap)); | ||
| 25 | &ld(($a[6])=&NR(1),&QWPw(6,$ap)); | ||
| 26 | &ld(($a[7])=&NR(1),&QWPw(7,$ap)); &FR($ap); | ||
| 27 | |||
| 28 | ($c0,$c1,$c2)=&NR(3); | ||
| 29 | |||
| 30 | &mov("zero",$c2); | ||
| 31 | &mul($a[0],$a[0],$c0); | ||
| 32 | &muh($a[0],$a[0],$c1); | ||
| 33 | &st($c0,&QWPw(0,$rp)); | ||
| 34 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 35 | &mov("zero",$c2); | ||
| 36 | |||
| 37 | &sqr_add_c2($a[1],$a[0],$c0,$c1,$c2); | ||
| 38 | &st($c0,&QWPw(1,$rp)); | ||
| 39 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 40 | &mov("zero",$c2); | ||
| 41 | |||
| 42 | &sqr_add_c($a[1],$c0,$c1,$c2); | ||
| 43 | &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2); | ||
| 44 | &st($c0,&QWPw(2,$rp)); | ||
| 45 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | |||
| 48 | &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2); | ||
| 49 | &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2); | ||
| 50 | &st($c0,&QWPw(3,$rp)); | ||
| 51 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 52 | &mov("zero",$c2); | ||
| 53 | |||
| 54 | &sqr_add_c($a[2],$c0,$c1,$c2); | ||
| 55 | &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2); | ||
| 56 | &sqr_add_c2($a[4],$a[0],$c0,$c1,$c2); | ||
| 57 | &st($c0,&QWPw(4,$rp)); | ||
| 58 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 59 | &mov("zero",$c2); | ||
| 60 | |||
| 61 | &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2); | ||
| 62 | &sqr_add_c2($a[4],$a[1],$c0,$c1,$c2); | ||
| 63 | &sqr_add_c2($a[5],$a[0],$c0,$c1,$c2); | ||
| 64 | &st($c0,&QWPw(5,$rp)); | ||
| 65 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 66 | &mov("zero",$c2); | ||
| 67 | |||
| 68 | &sqr_add_c($a[3],$c0,$c1,$c2); | ||
| 69 | &sqr_add_c2($a[4],$a[2],$c0,$c1,$c2); | ||
| 70 | &sqr_add_c2($a[5],$a[1],$c0,$c1,$c2); | ||
| 71 | &sqr_add_c2($a[6],$a[0],$c0,$c1,$c2); | ||
| 72 | &st($c0,&QWPw(6,$rp)); | ||
| 73 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 74 | &mov("zero",$c2); | ||
| 75 | |||
| 76 | &sqr_add_c2($a[4],$a[3],$c0,$c1,$c2); | ||
| 77 | &sqr_add_c2($a[5],$a[2],$c0,$c1,$c2); | ||
| 78 | &sqr_add_c2($a[6],$a[1],$c0,$c1,$c2); | ||
| 79 | &sqr_add_c2($a[7],$a[0],$c0,$c1,$c2); | ||
| 80 | &st($c0,&QWPw(7,$rp)); | ||
| 81 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 82 | &mov("zero",$c2); | ||
| 83 | |||
| 84 | &sqr_add_c($a[4],$c0,$c1,$c2); | ||
| 85 | &sqr_add_c2($a[5],$a[3],$c0,$c1,$c2); | ||
| 86 | &sqr_add_c2($a[6],$a[2],$c0,$c1,$c2); | ||
| 87 | &sqr_add_c2($a[7],$a[1],$c0,$c1,$c2); | ||
| 88 | &st($c0,&QWPw(8,$rp)); | ||
| 89 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 90 | &mov("zero",$c2); | ||
| 91 | |||
| 92 | &sqr_add_c2($a[5],$a[4],$c0,$c1,$c2); | ||
| 93 | &sqr_add_c2($a[6],$a[3],$c0,$c1,$c2); | ||
| 94 | &sqr_add_c2($a[7],$a[2],$c0,$c1,$c2); | ||
| 95 | &st($c0,&QWPw(9,$rp)); | ||
| 96 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 97 | &mov("zero",$c2); | ||
| 98 | |||
| 99 | &sqr_add_c($a[5],$c0,$c1,$c2); | ||
| 100 | &sqr_add_c2($a[6],$a[4],$c0,$c1,$c2); | ||
| 101 | &sqr_add_c2($a[7],$a[3],$c0,$c1,$c2); | ||
| 102 | &st($c0,&QWPw(10,$rp)); | ||
| 103 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 104 | &mov("zero",$c2); | ||
| 105 | |||
| 106 | &sqr_add_c2($a[6],$a[5],$c0,$c1,$c2); | ||
| 107 | &sqr_add_c2($a[7],$a[4],$c0,$c1,$c2); | ||
| 108 | &st($c0,&QWPw(11,$rp)); | ||
| 109 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 110 | &mov("zero",$c2); | ||
| 111 | |||
| 112 | &sqr_add_c($a[6],$c0,$c1,$c2); | ||
| 113 | &sqr_add_c2($a[7],$a[5],$c0,$c1,$c2); | ||
| 114 | &st($c0,&QWPw(12,$rp)); | ||
| 115 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 116 | &mov("zero",$c2); | ||
| 117 | |||
| 118 | &sqr_add_c2($a[7],$a[6],$c0,$c1,$c2); | ||
| 119 | &st($c0,&QWPw(13,$rp)); | ||
| 120 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 121 | &mov("zero",$c2); | ||
| 122 | |||
| 123 | &sqr_add_c($a[7],$c0,$c1,$c2); | ||
| 124 | &st($c0,&QWPw(14,$rp)); | ||
| 125 | &st($c1,&QWPw(15,$rp)); | ||
| 126 | |||
| 127 | &function_end($name); | ||
| 128 | |||
| 129 | &fin_pool; | ||
| 130 | } | ||
| 131 | |||
| 132 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/sub.pl b/src/lib/libcrypto/bn/asm/alpha/sub.pl deleted file mode 100644 index d998da5c21..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/sub.pl +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sub_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | $count=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &blt($count,&label("finish")); | ||
| 23 | |||
| 24 | ($a0,$b0)=&NR(2); | ||
| 25 | &ld($a0,&QWPw(0,$ap)); | ||
| 26 | &ld($b0,&QWPw(0,$bp)); | ||
| 27 | |||
| 28 | ########################################################## | ||
| 29 | &set_label("loop"); | ||
| 30 | |||
| 31 | ($a1,$tmp,$b1,$a2,$b2,$a3,$b3,$o0)=&NR(8); | ||
| 32 | &ld($a1,&QWPw(1,$ap)); | ||
| 33 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 34 | &ld($b1,&QWPw(1,$bp)); | ||
| 35 | &sub($a0,$b0,$a0); # do the subtract | ||
| 36 | &ld($a2,&QWPw(2,$ap)); | ||
| 37 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 38 | &ld($b2,&QWPw(2,$bp)); | ||
| 39 | &sub($a0,$cc,$o0); # will we borrow? | ||
| 40 | &ld($a3,&QWPw(3,$ap)); | ||
| 41 | &add($b0,$tmp,$cc); ($t1,$o1)=&NR(2); &FR($tmp); | ||
| 42 | |||
| 43 | &cmpult($a1,$b1,$t1); # will we borrow? | ||
| 44 | &sub($a1,$b1,$a1); # do the subtract | ||
| 45 | &ld($b3,&QWPw(3,$bp)); | ||
| 46 | &cmpult($a1,$cc,$b1); # will we borrow? | ||
| 47 | &sub($a1,$cc,$o1); # will we borrow? | ||
| 48 | &add($b1,$t1,$cc); ($tmp,$o2)=&NR(2); &FR($t1,$a1,$b1); | ||
| 49 | |||
| 50 | &cmpult($a2,$b2,$tmp); # will we borrow? | ||
| 51 | &sub($a2,$b2,$a2); # do the subtract | ||
| 52 | &st($o0,&QWPw(0,$rp)); &FR($o0); # save | ||
| 53 | &cmpult($a2,$cc,$b2); # will we borrow? | ||
| 54 | &sub($a2,$cc,$o2); # will we borrow? | ||
| 55 | &add($b2,$tmp,$cc); ($t3,$o3)=&NR(2); &FR($tmp,$a2,$b2); | ||
| 56 | |||
| 57 | &cmpult($a3,$b3,$t3); # will we borrow? | ||
| 58 | &sub($a3,$b3,$a3); # do the subtract | ||
| 59 | &st($o1,&QWPw(1,$rp)); &FR($o1); | ||
| 60 | &cmpult($a3,$cc,$b3); # will we borrow? | ||
| 61 | &sub($a3,$cc,$o3); # will we borrow? | ||
| 62 | &add($b3,$t3,$cc); &FR($t3,$a3,$b3); | ||
| 63 | |||
| 64 | &st($o2,&QWPw(2,$rp)); &FR($o2); | ||
| 65 | &sub($count,4,$count); # count-=4 | ||
| 66 | &st($o3,&QWPw(3,$rp)); &FR($o3); | ||
| 67 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 68 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 69 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 70 | |||
| 71 | &blt($count,&label("finish")); | ||
| 72 | &ld($a0,&QWPw(0,$ap)); | ||
| 73 | &ld($b0,&QWPw(0,$bp)); | ||
| 74 | &br(&label("loop")); | ||
| 75 | ################################################## | ||
| 76 | # Do the last 0..3 words | ||
| 77 | |||
| 78 | &set_label("last_loop"); | ||
| 79 | |||
| 80 | &ld($a0,&QWPw(0,$ap)); # get a | ||
| 81 | &ld($b0,&QWPw(0,$bp)); # get b | ||
| 82 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 83 | &sub($a0,$b0,$a0); # do the subtract | ||
| 84 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 85 | &sub($a0,$cc,$a0); # will we borrow? | ||
| 86 | &st($a0,&QWPw(0,$rp)); # save | ||
| 87 | &add($b0,$tmp,$cc); # add the borrows | ||
| 88 | |||
| 89 | &add($ap,$QWS,$ap); | ||
| 90 | &add($bp,$QWS,$bp); | ||
| 91 | &add($rp,$QWS,$rp); | ||
| 92 | &sub($count,1,$count); | ||
| 93 | &bgt($count,&label("last_loop")); | ||
| 94 | &function_end_A($name); | ||
| 95 | |||
| 96 | ###################################################### | ||
| 97 | &set_label("finish"); | ||
| 98 | &add($count,4,$count); | ||
| 99 | &bgt($count,&label("last_loop")); | ||
| 100 | |||
| 101 | &FR($a0,$b0); | ||
| 102 | &set_label("end"); | ||
| 103 | &function_end($name); | ||
| 104 | |||
| 105 | &fin_pool; | ||
| 106 | } | ||
| 107 | |||
| 108 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/bn-586.pl b/src/lib/libcrypto/bn/asm/bn-586.pl index 26c2685a72..332ef3e91d 100644 --- a/src/lib/libcrypto/bn/asm/bn-586.pl +++ b/src/lib/libcrypto/bn/asm/bn-586.pl | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #!/usr/local/bin/perl | 1 | #!/usr/local/bin/perl |
| 2 | 2 | ||
| 3 | push(@INC,"perlasm","../../perlasm"); | 3 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 4 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 4 | require "x86asm.pl"; | 5 | require "x86asm.pl"; |
| 5 | 6 | ||
| 6 | &asm_init($ARGV[0],$0); | 7 | &asm_init($ARGV[0],$0); |
| @@ -24,38 +25,25 @@ sub bn_mul_add_words | |||
| 24 | { | 25 | { |
| 25 | local($name)=@_; | 26 | local($name)=@_; |
| 26 | 27 | ||
| 27 | &function_begin($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":""); | 28 | &function_begin_B($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":""); |
| 28 | 29 | ||
| 29 | &comment(""); | 30 | $r="eax"; |
| 30 | $Low="eax"; | 31 | $a="edx"; |
| 31 | $High="edx"; | 32 | $c="ecx"; |
| 32 | $a="ebx"; | ||
| 33 | $w="ebp"; | ||
| 34 | $r="edi"; | ||
| 35 | $c="esi"; | ||
| 36 | |||
| 37 | &xor($c,$c); # clear carry | ||
| 38 | &mov($r,&wparam(0)); # | ||
| 39 | |||
| 40 | &mov("ecx",&wparam(2)); # | ||
| 41 | &mov($a,&wparam(1)); # | ||
| 42 | |||
| 43 | &and("ecx",0xfffffff8); # num / 8 | ||
| 44 | &mov($w,&wparam(3)); # | ||
| 45 | |||
| 46 | &push("ecx"); # Up the stack for a tmp variable | ||
| 47 | |||
| 48 | &jz(&label("maw_finish")); | ||
| 49 | 33 | ||
| 50 | if ($sse2) { | 34 | if ($sse2) { |
| 51 | &picmeup("eax","OPENSSL_ia32cap_P"); | 35 | &picmeup("eax","OPENSSL_ia32cap_P"); |
| 52 | &bt(&DWP(0,"eax"),26); | 36 | &bt(&DWP(0,"eax"),26); |
| 53 | &jnc(&label("maw_loop")); | 37 | &jnc(&label("maw_non_sse2")); |
| 54 | 38 | ||
| 55 | &movd("mm0",$w); # mm0 = w | 39 | &mov($r,&wparam(0)); |
| 40 | &mov($a,&wparam(1)); | ||
| 41 | &mov($c,&wparam(2)); | ||
| 42 | &movd("mm0",&wparam(3)); # mm0 = w | ||
| 56 | &pxor("mm1","mm1"); # mm1 = carry_in | 43 | &pxor("mm1","mm1"); # mm1 = carry_in |
| 57 | 44 | &jmp(&label("maw_sse2_entry")); | |
| 58 | &set_label("maw_sse2_loop",0); | 45 | |
| 46 | &set_label("maw_sse2_unrolled",16); | ||
| 59 | &movd("mm3",&DWP(0,$r,"",0)); # mm3 = r[0] | 47 | &movd("mm3",&DWP(0,$r,"",0)); # mm3 = r[0] |
| 60 | &paddq("mm1","mm3"); # mm1 = carry_in + r[0] | 48 | &paddq("mm1","mm3"); # mm1 = carry_in + r[0] |
| 61 | &movd("mm2",&DWP(0,$a,"",0)); # mm2 = a[0] | 49 | &movd("mm2",&DWP(0,$a,"",0)); # mm2 = a[0] |
| @@ -112,42 +100,82 @@ sub bn_mul_add_words | |||
| 112 | &psrlq("mm1",32); # mm1 = carry6 | 100 | &psrlq("mm1",32); # mm1 = carry6 |
| 113 | &paddq("mm1","mm3"); # mm1 = carry6 + r[7] + w*a[7] | 101 | &paddq("mm1","mm3"); # mm1 = carry6 + r[7] + w*a[7] |
| 114 | &movd(&DWP(28,$r,"",0),"mm1"); | 102 | &movd(&DWP(28,$r,"",0),"mm1"); |
| 115 | &add($r,32); | 103 | &lea($r,&DWP(32,$r)); |
| 116 | &psrlq("mm1",32); # mm1 = carry_out | 104 | &psrlq("mm1",32); # mm1 = carry_out |
| 117 | 105 | ||
| 118 | &sub("ecx",8); | 106 | &sub($c,8); |
| 107 | &jz(&label("maw_sse2_exit")); | ||
| 108 | &set_label("maw_sse2_entry"); | ||
| 109 | &test($c,0xfffffff8); | ||
| 110 | &jnz(&label("maw_sse2_unrolled")); | ||
| 111 | |||
| 112 | &set_label("maw_sse2_loop",4); | ||
| 113 | &movd("mm2",&DWP(0,$a)); # mm2 = a[i] | ||
| 114 | &movd("mm3",&DWP(0,$r)); # mm3 = r[i] | ||
| 115 | &pmuludq("mm2","mm0"); # a[i] *= w | ||
| 116 | &lea($a,&DWP(4,$a)); | ||
| 117 | &paddq("mm1","mm3"); # carry += r[i] | ||
| 118 | &paddq("mm1","mm2"); # carry += a[i]*w | ||
| 119 | &movd(&DWP(0,$r),"mm1"); # r[i] = carry_low | ||
| 120 | &sub($c,1); | ||
| 121 | &psrlq("mm1",32); # carry = carry_high | ||
| 122 | &lea($r,&DWP(4,$r)); | ||
| 119 | &jnz(&label("maw_sse2_loop")); | 123 | &jnz(&label("maw_sse2_loop")); |
| 120 | 124 | &set_label("maw_sse2_exit"); | |
| 121 | &movd($c,"mm1"); # c = carry_out | 125 | &movd("eax","mm1"); # c = carry_out |
| 122 | &emms(); | 126 | &emms(); |
| 127 | &ret(); | ||
| 123 | 128 | ||
| 124 | &jmp(&label("maw_finish")); | 129 | &set_label("maw_non_sse2",16); |
| 125 | } | 130 | } |
| 126 | 131 | ||
| 127 | &set_label("maw_loop",0); | 132 | # function_begin prologue |
| 133 | &push("ebp"); | ||
| 134 | &push("ebx"); | ||
| 135 | &push("esi"); | ||
| 136 | &push("edi"); | ||
| 137 | |||
| 138 | &comment(""); | ||
| 139 | $Low="eax"; | ||
| 140 | $High="edx"; | ||
| 141 | $a="ebx"; | ||
| 142 | $w="ebp"; | ||
| 143 | $r="edi"; | ||
| 144 | $c="esi"; | ||
| 145 | |||
| 146 | &xor($c,$c); # clear carry | ||
| 147 | &mov($r,&wparam(0)); # | ||
| 148 | |||
| 149 | &mov("ecx",&wparam(2)); # | ||
| 150 | &mov($a,&wparam(1)); # | ||
| 151 | |||
| 152 | &and("ecx",0xfffffff8); # num / 8 | ||
| 153 | &mov($w,&wparam(3)); # | ||
| 128 | 154 | ||
| 129 | &mov(&swtmp(0),"ecx"); # | 155 | &push("ecx"); # Up the stack for a tmp variable |
| 156 | |||
| 157 | &jz(&label("maw_finish")); | ||
| 158 | |||
| 159 | &set_label("maw_loop",16); | ||
| 130 | 160 | ||
| 131 | for ($i=0; $i<32; $i+=4) | 161 | for ($i=0; $i<32; $i+=4) |
| 132 | { | 162 | { |
| 133 | &comment("Round $i"); | 163 | &comment("Round $i"); |
| 134 | 164 | ||
| 135 | &mov("eax",&DWP($i,$a,"",0)); # *a | 165 | &mov("eax",&DWP($i,$a)); # *a |
| 136 | &mul($w); # *a * w | 166 | &mul($w); # *a * w |
| 137 | &add("eax",$c); # L(t)+= *r | 167 | &add("eax",$c); # L(t)+= c |
| 138 | &mov($c,&DWP($i,$r,"",0)); # L(t)+= *r | ||
| 139 | &adc("edx",0); # H(t)+=carry | 168 | &adc("edx",0); # H(t)+=carry |
| 140 | &add("eax",$c); # L(t)+=c | 169 | &add("eax",&DWP($i,$r)); # L(t)+= *r |
| 141 | &adc("edx",0); # H(t)+=carry | 170 | &adc("edx",0); # H(t)+=carry |
| 142 | &mov(&DWP($i,$r,"",0),"eax"); # *r= L(t); | 171 | &mov(&DWP($i,$r),"eax"); # *r= L(t); |
| 143 | &mov($c,"edx"); # c= H(t); | 172 | &mov($c,"edx"); # c= H(t); |
| 144 | } | 173 | } |
| 145 | 174 | ||
| 146 | &comment(""); | 175 | &comment(""); |
| 147 | &mov("ecx",&swtmp(0)); # | ||
| 148 | &add($a,32); | ||
| 149 | &add($r,32); | ||
| 150 | &sub("ecx",8); | 176 | &sub("ecx",8); |
| 177 | &lea($a,&DWP(32,$a)); | ||
| 178 | &lea($r,&DWP(32,$r)); | ||
| 151 | &jnz(&label("maw_loop")); | 179 | &jnz(&label("maw_loop")); |
| 152 | 180 | ||
| 153 | &set_label("maw_finish",0); | 181 | &set_label("maw_finish",0); |
| @@ -160,16 +188,15 @@ sub bn_mul_add_words | |||
| 160 | for ($i=0; $i<7; $i++) | 188 | for ($i=0; $i<7; $i++) |
| 161 | { | 189 | { |
| 162 | &comment("Tail Round $i"); | 190 | &comment("Tail Round $i"); |
| 163 | &mov("eax",&DWP($i*4,$a,"",0));# *a | 191 | &mov("eax",&DWP($i*4,$a)); # *a |
| 164 | &mul($w); # *a * w | 192 | &mul($w); # *a * w |
| 165 | &add("eax",$c); # L(t)+=c | 193 | &add("eax",$c); # L(t)+=c |
| 166 | &mov($c,&DWP($i*4,$r,"",0)); # L(t)+= *r | ||
| 167 | &adc("edx",0); # H(t)+=carry | 194 | &adc("edx",0); # H(t)+=carry |
| 168 | &add("eax",$c); | 195 | &add("eax",&DWP($i*4,$r)); # L(t)+= *r |
| 169 | &adc("edx",0); # H(t)+=carry | 196 | &adc("edx",0); # H(t)+=carry |
| 170 | &dec("ecx") if ($i != 7-1); | 197 | &dec("ecx") if ($i != 7-1); |
| 171 | &mov(&DWP($i*4,$r,"",0),"eax"); # *r= L(t); | 198 | &mov(&DWP($i*4,$r),"eax"); # *r= L(t); |
| 172 | &mov($c,"edx"); # c= H(t); | 199 | &mov($c,"edx"); # c= H(t); |
| 173 | &jz(&label("maw_end")) if ($i != 7-1); | 200 | &jz(&label("maw_end")) if ($i != 7-1); |
| 174 | } | 201 | } |
| 175 | &set_label("maw_end",0); | 202 | &set_label("maw_end",0); |
| @@ -184,7 +211,45 @@ sub bn_mul_words | |||
| 184 | { | 211 | { |
| 185 | local($name)=@_; | 212 | local($name)=@_; |
| 186 | 213 | ||
| 187 | &function_begin($name,""); | 214 | &function_begin_B($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":""); |
| 215 | |||
| 216 | $r="eax"; | ||
| 217 | $a="edx"; | ||
| 218 | $c="ecx"; | ||
| 219 | |||
| 220 | if ($sse2) { | ||
| 221 | &picmeup("eax","OPENSSL_ia32cap_P"); | ||
| 222 | &bt(&DWP(0,"eax"),26); | ||
| 223 | &jnc(&label("mw_non_sse2")); | ||
| 224 | |||
| 225 | &mov($r,&wparam(0)); | ||
| 226 | &mov($a,&wparam(1)); | ||
| 227 | &mov($c,&wparam(2)); | ||
| 228 | &movd("mm0",&wparam(3)); # mm0 = w | ||
| 229 | &pxor("mm1","mm1"); # mm1 = carry = 0 | ||
| 230 | |||
| 231 | &set_label("mw_sse2_loop",16); | ||
| 232 | &movd("mm2",&DWP(0,$a)); # mm2 = a[i] | ||
| 233 | &pmuludq("mm2","mm0"); # a[i] *= w | ||
| 234 | &lea($a,&DWP(4,$a)); | ||
| 235 | &paddq("mm1","mm2"); # carry += a[i]*w | ||
| 236 | &movd(&DWP(0,$r),"mm1"); # r[i] = carry_low | ||
| 237 | &sub($c,1); | ||
| 238 | &psrlq("mm1",32); # carry = carry_high | ||
| 239 | &lea($r,&DWP(4,$r)); | ||
| 240 | &jnz(&label("mw_sse2_loop")); | ||
| 241 | |||
| 242 | &movd("eax","mm1"); # return carry | ||
| 243 | &emms(); | ||
| 244 | &ret(); | ||
| 245 | &set_label("mw_non_sse2",16); | ||
| 246 | } | ||
| 247 | |||
| 248 | # function_begin prologue | ||
| 249 | &push("ebp"); | ||
| 250 | &push("ebx"); | ||
| 251 | &push("esi"); | ||
| 252 | &push("edi"); | ||
| 188 | 253 | ||
| 189 | &comment(""); | 254 | &comment(""); |
| 190 | $Low="eax"; | 255 | $Low="eax"; |
| @@ -257,7 +322,40 @@ sub bn_sqr_words | |||
| 257 | { | 322 | { |
| 258 | local($name)=@_; | 323 | local($name)=@_; |
| 259 | 324 | ||
| 260 | &function_begin($name,""); | 325 | &function_begin_B($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":""); |
| 326 | |||
| 327 | $r="eax"; | ||
| 328 | $a="edx"; | ||
| 329 | $c="ecx"; | ||
| 330 | |||
| 331 | if ($sse2) { | ||
| 332 | &picmeup("eax","OPENSSL_ia32cap_P"); | ||
| 333 | &bt(&DWP(0,"eax"),26); | ||
| 334 | &jnc(&label("sqr_non_sse2")); | ||
| 335 | |||
| 336 | &mov($r,&wparam(0)); | ||
| 337 | &mov($a,&wparam(1)); | ||
| 338 | &mov($c,&wparam(2)); | ||
| 339 | |||
| 340 | &set_label("sqr_sse2_loop",16); | ||
| 341 | &movd("mm0",&DWP(0,$a)); # mm0 = a[i] | ||
| 342 | &pmuludq("mm0","mm0"); # a[i] *= a[i] | ||
| 343 | &lea($a,&DWP(4,$a)); # a++ | ||
| 344 | &movq(&QWP(0,$r),"mm0"); # r[i] = a[i]*a[i] | ||
| 345 | &sub($c,1); | ||
| 346 | &lea($r,&DWP(8,$r)); # r += 2 | ||
| 347 | &jnz(&label("sqr_sse2_loop")); | ||
| 348 | |||
| 349 | &emms(); | ||
| 350 | &ret(); | ||
| 351 | &set_label("sqr_non_sse2",16); | ||
| 352 | } | ||
| 353 | |||
| 354 | # function_begin prologue | ||
| 355 | &push("ebp"); | ||
| 356 | &push("ebx"); | ||
| 357 | &push("esi"); | ||
| 358 | &push("edi"); | ||
| 261 | 359 | ||
| 262 | &comment(""); | 360 | &comment(""); |
| 263 | $r="esi"; | 361 | $r="esi"; |
| @@ -313,12 +411,13 @@ sub bn_div_words | |||
| 313 | { | 411 | { |
| 314 | local($name)=@_; | 412 | local($name)=@_; |
| 315 | 413 | ||
| 316 | &function_begin($name,""); | 414 | &function_begin_B($name,""); |
| 317 | &mov("edx",&wparam(0)); # | 415 | &mov("edx",&wparam(0)); # |
| 318 | &mov("eax",&wparam(1)); # | 416 | &mov("eax",&wparam(1)); # |
| 319 | &mov("ebx",&wparam(2)); # | 417 | &mov("ecx",&wparam(2)); # |
| 320 | &div("ebx"); | 418 | &div("ecx"); |
| 321 | &function_end($name); | 419 | &ret(); |
| 420 | &function_end_B($name); | ||
| 322 | } | 421 | } |
| 323 | 422 | ||
| 324 | sub bn_add_words | 423 | sub bn_add_words |
diff --git a/src/lib/libcrypto/bn/asm/bn-alpha.pl b/src/lib/libcrypto/bn/asm/bn-alpha.pl deleted file mode 100644 index 302edf2376..0000000000 --- a/src/lib/libcrypto/bn/asm/bn-alpha.pl +++ /dev/null | |||
| @@ -1,571 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # I have this in perl so I can use more usefull register names and then convert | ||
| 3 | # them into alpha registers. | ||
| 4 | # | ||
| 5 | |||
| 6 | $d=&data(); | ||
| 7 | $d =~ s/CC/0/g; | ||
| 8 | $d =~ s/R1/1/g; | ||
| 9 | $d =~ s/R2/2/g; | ||
| 10 | $d =~ s/R3/3/g; | ||
| 11 | $d =~ s/R4/4/g; | ||
| 12 | $d =~ s/L1/5/g; | ||
| 13 | $d =~ s/L2/6/g; | ||
| 14 | $d =~ s/L3/7/g; | ||
| 15 | $d =~ s/L4/8/g; | ||
| 16 | $d =~ s/O1/22/g; | ||
| 17 | $d =~ s/O2/23/g; | ||
| 18 | $d =~ s/O3/24/g; | ||
| 19 | $d =~ s/O4/25/g; | ||
| 20 | $d =~ s/A1/20/g; | ||
| 21 | $d =~ s/A2/21/g; | ||
| 22 | $d =~ s/A3/27/g; | ||
| 23 | $d =~ s/A4/28/g; | ||
| 24 | if (0){ | ||
| 25 | } | ||
| 26 | |||
| 27 | print $d; | ||
| 28 | |||
| 29 | sub data | ||
| 30 | { | ||
| 31 | local($data)=<<'EOF'; | ||
| 32 | |||
| 33 | # DEC Alpha assember | ||
| 34 | # The bn_div_words is actually gcc output but the other parts are hand done. | ||
| 35 | # Thanks to tzeruch@ceddec.com for sending me the gcc output for | ||
| 36 | # bn_div_words. | ||
| 37 | # I've gone back and re-done most of routines. | ||
| 38 | # The key thing to remeber for the 164 CPU is that while a | ||
| 39 | # multiply operation takes 8 cycles, another one can only be issued | ||
| 40 | # after 4 cycles have elapsed. I've done modification to help | ||
| 41 | # improve this. Also, normally, a ld instruction will not be available | ||
| 42 | # for about 3 cycles. | ||
| 43 | .file 1 "bn_asm.c" | ||
| 44 | .set noat | ||
| 45 | gcc2_compiled.: | ||
| 46 | __gnu_compiled_c: | ||
| 47 | .text | ||
| 48 | .align 3 | ||
| 49 | .globl bn_mul_add_words | ||
| 50 | .ent bn_mul_add_words | ||
| 51 | bn_mul_add_words: | ||
| 52 | bn_mul_add_words..ng: | ||
| 53 | .frame $30,0,$26,0 | ||
| 54 | .prologue 0 | ||
| 55 | .align 5 | ||
| 56 | subq $18,4,$18 | ||
| 57 | bis $31,$31,$CC | ||
| 58 | blt $18,$43 # if we are -1, -2, -3 or -4 goto tail code | ||
| 59 | ldq $A1,0($17) # 1 1 | ||
| 60 | ldq $R1,0($16) # 1 1 | ||
| 61 | .align 3 | ||
| 62 | $42: | ||
| 63 | mulq $A1,$19,$L1 # 1 2 1 ###### | ||
| 64 | ldq $A2,8($17) # 2 1 | ||
| 65 | ldq $R2,8($16) # 2 1 | ||
| 66 | umulh $A1,$19,$A1 # 1 2 ###### | ||
| 67 | ldq $A3,16($17) # 3 1 | ||
| 68 | ldq $R3,16($16) # 3 1 | ||
| 69 | mulq $A2,$19,$L2 # 2 2 1 ###### | ||
| 70 | ldq $A4,24($17) # 4 1 | ||
| 71 | addq $R1,$L1,$R1 # 1 2 2 | ||
| 72 | ldq $R4,24($16) # 4 1 | ||
| 73 | umulh $A2,$19,$A2 # 2 2 ###### | ||
| 74 | cmpult $R1,$L1,$O1 # 1 2 3 1 | ||
| 75 | addq $A1,$O1,$A1 # 1 3 1 | ||
| 76 | addq $R1,$CC,$R1 # 1 2 3 1 | ||
| 77 | mulq $A3,$19,$L3 # 3 2 1 ###### | ||
| 78 | cmpult $R1,$CC,$CC # 1 2 3 2 | ||
| 79 | addq $R2,$L2,$R2 # 2 2 2 | ||
| 80 | addq $A1,$CC,$CC # 1 3 2 | ||
| 81 | cmpult $R2,$L2,$O2 # 2 2 3 1 | ||
| 82 | addq $A2,$O2,$A2 # 2 3 1 | ||
| 83 | umulh $A3,$19,$A3 # 3 2 ###### | ||
| 84 | addq $R2,$CC,$R2 # 2 2 3 1 | ||
| 85 | cmpult $R2,$CC,$CC # 2 2 3 2 | ||
| 86 | subq $18,4,$18 | ||
| 87 | mulq $A4,$19,$L4 # 4 2 1 ###### | ||
| 88 | addq $A2,$CC,$CC # 2 3 2 | ||
| 89 | addq $R3,$L3,$R3 # 3 2 2 | ||
| 90 | addq $16,32,$16 | ||
| 91 | cmpult $R3,$L3,$O3 # 3 2 3 1 | ||
| 92 | stq $R1,-32($16) # 1 2 4 | ||
| 93 | umulh $A4,$19,$A4 # 4 2 ###### | ||
| 94 | addq $A3,$O3,$A3 # 3 3 1 | ||
| 95 | addq $R3,$CC,$R3 # 3 2 3 1 | ||
| 96 | stq $R2,-24($16) # 2 2 4 | ||
| 97 | cmpult $R3,$CC,$CC # 3 2 3 2 | ||
| 98 | stq $R3,-16($16) # 3 2 4 | ||
| 99 | addq $R4,$L4,$R4 # 4 2 2 | ||
| 100 | addq $A3,$CC,$CC # 3 3 2 | ||
| 101 | cmpult $R4,$L4,$O4 # 4 2 3 1 | ||
| 102 | addq $17,32,$17 | ||
| 103 | addq $A4,$O4,$A4 # 4 3 1 | ||
| 104 | addq $R4,$CC,$R4 # 4 2 3 1 | ||
| 105 | cmpult $R4,$CC,$CC # 4 2 3 2 | ||
| 106 | stq $R4,-8($16) # 4 2 4 | ||
| 107 | addq $A4,$CC,$CC # 4 3 2 | ||
| 108 | blt $18,$43 | ||
| 109 | |||
| 110 | ldq $A1,0($17) # 1 1 | ||
| 111 | ldq $R1,0($16) # 1 1 | ||
| 112 | |||
| 113 | br $42 | ||
| 114 | |||
| 115 | .align 4 | ||
| 116 | $45: | ||
| 117 | ldq $A1,0($17) # 4 1 | ||
| 118 | ldq $R1,0($16) # 4 1 | ||
| 119 | mulq $A1,$19,$L1 # 4 2 1 | ||
| 120 | subq $18,1,$18 | ||
| 121 | addq $16,8,$16 | ||
| 122 | addq $17,8,$17 | ||
| 123 | umulh $A1,$19,$A1 # 4 2 | ||
| 124 | addq $R1,$L1,$R1 # 4 2 2 | ||
| 125 | cmpult $R1,$L1,$O1 # 4 2 3 1 | ||
| 126 | addq $A1,$O1,$A1 # 4 3 1 | ||
| 127 | addq $R1,$CC,$R1 # 4 2 3 1 | ||
| 128 | cmpult $R1,$CC,$CC # 4 2 3 2 | ||
| 129 | addq $A1,$CC,$CC # 4 3 2 | ||
| 130 | stq $R1,-8($16) # 4 2 4 | ||
| 131 | bgt $18,$45 | ||
| 132 | ret $31,($26),1 # else exit | ||
| 133 | |||
| 134 | .align 4 | ||
| 135 | $43: | ||
| 136 | addq $18,4,$18 | ||
| 137 | bgt $18,$45 # goto tail code | ||
| 138 | ret $31,($26),1 # else exit | ||
| 139 | |||
| 140 | .end bn_mul_add_words | ||
| 141 | .align 3 | ||
| 142 | .globl bn_mul_words | ||
| 143 | .ent bn_mul_words | ||
| 144 | bn_mul_words: | ||
| 145 | bn_mul_words..ng: | ||
| 146 | .frame $30,0,$26,0 | ||
| 147 | .prologue 0 | ||
| 148 | .align 5 | ||
| 149 | subq $18,4,$18 | ||
| 150 | bis $31,$31,$CC | ||
| 151 | blt $18,$143 # if we are -1, -2, -3 or -4 goto tail code | ||
| 152 | ldq $A1,0($17) # 1 1 | ||
| 153 | .align 3 | ||
| 154 | $142: | ||
| 155 | |||
| 156 | mulq $A1,$19,$L1 # 1 2 1 ##### | ||
| 157 | ldq $A2,8($17) # 2 1 | ||
| 158 | ldq $A3,16($17) # 3 1 | ||
| 159 | umulh $A1,$19,$A1 # 1 2 ##### | ||
| 160 | ldq $A4,24($17) # 4 1 | ||
| 161 | mulq $A2,$19,$L2 # 2 2 1 ##### | ||
| 162 | addq $L1,$CC,$L1 # 1 2 3 1 | ||
| 163 | subq $18,4,$18 | ||
| 164 | cmpult $L1,$CC,$CC # 1 2 3 2 | ||
| 165 | umulh $A2,$19,$A2 # 2 2 ##### | ||
| 166 | addq $A1,$CC,$CC # 1 3 2 | ||
| 167 | addq $17,32,$17 | ||
| 168 | addq $L2,$CC,$L2 # 2 2 3 1 | ||
| 169 | mulq $A3,$19,$L3 # 3 2 1 ##### | ||
| 170 | cmpult $L2,$CC,$CC # 2 2 3 2 | ||
| 171 | addq $A2,$CC,$CC # 2 3 2 | ||
| 172 | addq $16,32,$16 | ||
| 173 | umulh $A3,$19,$A3 # 3 2 ##### | ||
| 174 | stq $L1,-32($16) # 1 2 4 | ||
| 175 | mulq $A4,$19,$L4 # 4 2 1 ##### | ||
| 176 | addq $L3,$CC,$L3 # 3 2 3 1 | ||
| 177 | stq $L2,-24($16) # 2 2 4 | ||
| 178 | cmpult $L3,$CC,$CC # 3 2 3 2 | ||
| 179 | umulh $A4,$19,$A4 # 4 2 ##### | ||
| 180 | addq $A3,$CC,$CC # 3 3 2 | ||
| 181 | stq $L3,-16($16) # 3 2 4 | ||
| 182 | addq $L4,$CC,$L4 # 4 2 3 1 | ||
| 183 | cmpult $L4,$CC,$CC # 4 2 3 2 | ||
| 184 | |||
| 185 | addq $A4,$CC,$CC # 4 3 2 | ||
| 186 | |||
| 187 | stq $L4,-8($16) # 4 2 4 | ||
| 188 | |||
| 189 | blt $18,$143 | ||
| 190 | |||
| 191 | ldq $A1,0($17) # 1 1 | ||
| 192 | |||
| 193 | br $142 | ||
| 194 | |||
| 195 | .align 4 | ||
| 196 | $145: | ||
| 197 | ldq $A1,0($17) # 4 1 | ||
| 198 | mulq $A1,$19,$L1 # 4 2 1 | ||
| 199 | subq $18,1,$18 | ||
| 200 | umulh $A1,$19,$A1 # 4 2 | ||
| 201 | addq $L1,$CC,$L1 # 4 2 3 1 | ||
| 202 | addq $16,8,$16 | ||
| 203 | cmpult $L1,$CC,$CC # 4 2 3 2 | ||
| 204 | addq $17,8,$17 | ||
| 205 | addq $A1,$CC,$CC # 4 3 2 | ||
| 206 | stq $L1,-8($16) # 4 2 4 | ||
| 207 | |||
| 208 | bgt $18,$145 | ||
| 209 | ret $31,($26),1 # else exit | ||
| 210 | |||
| 211 | .align 4 | ||
| 212 | $143: | ||
| 213 | addq $18,4,$18 | ||
| 214 | bgt $18,$145 # goto tail code | ||
| 215 | ret $31,($26),1 # else exit | ||
| 216 | |||
| 217 | .end bn_mul_words | ||
| 218 | .align 3 | ||
| 219 | .globl bn_sqr_words | ||
| 220 | .ent bn_sqr_words | ||
| 221 | bn_sqr_words: | ||
| 222 | bn_sqr_words..ng: | ||
| 223 | .frame $30,0,$26,0 | ||
| 224 | .prologue 0 | ||
| 225 | |||
| 226 | subq $18,4,$18 | ||
| 227 | blt $18,$543 # if we are -1, -2, -3 or -4 goto tail code | ||
| 228 | ldq $A1,0($17) # 1 1 | ||
| 229 | .align 3 | ||
| 230 | $542: | ||
| 231 | mulq $A1,$A1,$L1 ###### | ||
| 232 | ldq $A2,8($17) # 1 1 | ||
| 233 | subq $18,4 | ||
| 234 | umulh $A1,$A1,$R1 ###### | ||
| 235 | ldq $A3,16($17) # 1 1 | ||
| 236 | mulq $A2,$A2,$L2 ###### | ||
| 237 | ldq $A4,24($17) # 1 1 | ||
| 238 | stq $L1,0($16) # r[0] | ||
| 239 | umulh $A2,$A2,$R2 ###### | ||
| 240 | stq $R1,8($16) # r[1] | ||
| 241 | mulq $A3,$A3,$L3 ###### | ||
| 242 | stq $L2,16($16) # r[0] | ||
| 243 | umulh $A3,$A3,$R3 ###### | ||
| 244 | stq $R2,24($16) # r[1] | ||
| 245 | mulq $A4,$A4,$L4 ###### | ||
| 246 | stq $L3,32($16) # r[0] | ||
| 247 | umulh $A4,$A4,$R4 ###### | ||
| 248 | stq $R3,40($16) # r[1] | ||
| 249 | |||
| 250 | addq $16,64,$16 | ||
| 251 | addq $17,32,$17 | ||
| 252 | stq $L4,-16($16) # r[0] | ||
| 253 | stq $R4,-8($16) # r[1] | ||
| 254 | |||
| 255 | blt $18,$543 | ||
| 256 | ldq $A1,0($17) # 1 1 | ||
| 257 | br $542 | ||
| 258 | |||
| 259 | $442: | ||
| 260 | ldq $A1,0($17) # a[0] | ||
| 261 | mulq $A1,$A1,$L1 # a[0]*w low part r2 | ||
| 262 | addq $16,16,$16 | ||
| 263 | addq $17,8,$17 | ||
| 264 | subq $18,1,$18 | ||
| 265 | umulh $A1,$A1,$R1 # a[0]*w high part r3 | ||
| 266 | stq $L1,-16($16) # r[0] | ||
| 267 | stq $R1,-8($16) # r[1] | ||
| 268 | |||
| 269 | bgt $18,$442 | ||
| 270 | ret $31,($26),1 # else exit | ||
| 271 | |||
| 272 | .align 4 | ||
| 273 | $543: | ||
| 274 | addq $18,4,$18 | ||
| 275 | bgt $18,$442 # goto tail code | ||
| 276 | ret $31,($26),1 # else exit | ||
| 277 | .end bn_sqr_words | ||
| 278 | |||
| 279 | .align 3 | ||
| 280 | .globl bn_add_words | ||
| 281 | .ent bn_add_words | ||
| 282 | bn_add_words: | ||
| 283 | bn_add_words..ng: | ||
| 284 | .frame $30,0,$26,0 | ||
| 285 | .prologue 0 | ||
| 286 | |||
| 287 | subq $19,4,$19 | ||
| 288 | bis $31,$31,$CC # carry = 0 | ||
| 289 | blt $19,$900 | ||
| 290 | ldq $L1,0($17) # a[0] | ||
| 291 | ldq $R1,0($18) # b[1] | ||
| 292 | .align 3 | ||
| 293 | $901: | ||
| 294 | addq $R1,$L1,$R1 # r=a+b; | ||
| 295 | ldq $L2,8($17) # a[1] | ||
| 296 | cmpult $R1,$L1,$O1 # did we overflow? | ||
| 297 | ldq $R2,8($18) # b[1] | ||
| 298 | addq $R1,$CC,$R1 # c+= overflow | ||
| 299 | ldq $L3,16($17) # a[2] | ||
| 300 | cmpult $R1,$CC,$CC # overflow? | ||
| 301 | ldq $R3,16($18) # b[2] | ||
| 302 | addq $CC,$O1,$CC | ||
| 303 | ldq $L4,24($17) # a[3] | ||
| 304 | addq $R2,$L2,$R2 # r=a+b; | ||
| 305 | ldq $R4,24($18) # b[3] | ||
| 306 | cmpult $R2,$L2,$O2 # did we overflow? | ||
| 307 | addq $R3,$L3,$R3 # r=a+b; | ||
| 308 | addq $R2,$CC,$R2 # c+= overflow | ||
| 309 | cmpult $R3,$L3,$O3 # did we overflow? | ||
| 310 | cmpult $R2,$CC,$CC # overflow? | ||
| 311 | addq $R4,$L4,$R4 # r=a+b; | ||
| 312 | addq $CC,$O2,$CC | ||
| 313 | cmpult $R4,$L4,$O4 # did we overflow? | ||
| 314 | addq $R3,$CC,$R3 # c+= overflow | ||
| 315 | stq $R1,0($16) # r[0]=c | ||
| 316 | cmpult $R3,$CC,$CC # overflow? | ||
| 317 | stq $R2,8($16) # r[1]=c | ||
| 318 | addq $CC,$O3,$CC | ||
| 319 | stq $R3,16($16) # r[2]=c | ||
| 320 | addq $R4,$CC,$R4 # c+= overflow | ||
| 321 | subq $19,4,$19 # loop-- | ||
| 322 | cmpult $R4,$CC,$CC # overflow? | ||
| 323 | addq $17,32,$17 # a++ | ||
| 324 | addq $CC,$O4,$CC | ||
| 325 | stq $R4,24($16) # r[3]=c | ||
| 326 | addq $18,32,$18 # b++ | ||
| 327 | addq $16,32,$16 # r++ | ||
| 328 | |||
| 329 | blt $19,$900 | ||
| 330 | ldq $L1,0($17) # a[0] | ||
| 331 | ldq $R1,0($18) # b[1] | ||
| 332 | br $901 | ||
| 333 | .align 4 | ||
| 334 | $945: | ||
| 335 | ldq $L1,0($17) # a[0] | ||
| 336 | ldq $R1,0($18) # b[1] | ||
| 337 | addq $R1,$L1,$R1 # r=a+b; | ||
| 338 | subq $19,1,$19 # loop-- | ||
| 339 | addq $R1,$CC,$R1 # c+= overflow | ||
| 340 | addq $17,8,$17 # a++ | ||
| 341 | cmpult $R1,$L1,$O1 # did we overflow? | ||
| 342 | cmpult $R1,$CC,$CC # overflow? | ||
| 343 | addq $18,8,$18 # b++ | ||
| 344 | stq $R1,0($16) # r[0]=c | ||
| 345 | addq $CC,$O1,$CC | ||
| 346 | addq $16,8,$16 # r++ | ||
| 347 | |||
| 348 | bgt $19,$945 | ||
| 349 | ret $31,($26),1 # else exit | ||
| 350 | |||
| 351 | $900: | ||
| 352 | addq $19,4,$19 | ||
| 353 | bgt $19,$945 # goto tail code | ||
| 354 | ret $31,($26),1 # else exit | ||
| 355 | .end bn_add_words | ||
| 356 | |||
| 357 | .align 3 | ||
| 358 | .globl bn_sub_words | ||
| 359 | .ent bn_sub_words | ||
| 360 | bn_sub_words: | ||
| 361 | bn_sub_words..ng: | ||
| 362 | .frame $30,0,$26,0 | ||
| 363 | .prologue 0 | ||
| 364 | |||
| 365 | subq $19,4,$19 | ||
| 366 | bis $31,$31,$CC # carry = 0 | ||
| 367 | br $800 | ||
| 368 | blt $19,$800 | ||
| 369 | ldq $L1,0($17) # a[0] | ||
| 370 | ldq $R1,0($18) # b[1] | ||
| 371 | .align 3 | ||
| 372 | $801: | ||
| 373 | addq $R1,$L1,$R1 # r=a+b; | ||
| 374 | ldq $L2,8($17) # a[1] | ||
| 375 | cmpult $R1,$L1,$O1 # did we overflow? | ||
| 376 | ldq $R2,8($18) # b[1] | ||
| 377 | addq $R1,$CC,$R1 # c+= overflow | ||
| 378 | ldq $L3,16($17) # a[2] | ||
| 379 | cmpult $R1,$CC,$CC # overflow? | ||
| 380 | ldq $R3,16($18) # b[2] | ||
| 381 | addq $CC,$O1,$CC | ||
| 382 | ldq $L4,24($17) # a[3] | ||
| 383 | addq $R2,$L2,$R2 # r=a+b; | ||
| 384 | ldq $R4,24($18) # b[3] | ||
| 385 | cmpult $R2,$L2,$O2 # did we overflow? | ||
| 386 | addq $R3,$L3,$R3 # r=a+b; | ||
| 387 | addq $R2,$CC,$R2 # c+= overflow | ||
| 388 | cmpult $R3,$L3,$O3 # did we overflow? | ||
| 389 | cmpult $R2,$CC,$CC # overflow? | ||
| 390 | addq $R4,$L4,$R4 # r=a+b; | ||
| 391 | addq $CC,$O2,$CC | ||
| 392 | cmpult $R4,$L4,$O4 # did we overflow? | ||
| 393 | addq $R3,$CC,$R3 # c+= overflow | ||
| 394 | stq $R1,0($16) # r[0]=c | ||
| 395 | cmpult $R3,$CC,$CC # overflow? | ||
| 396 | stq $R2,8($16) # r[1]=c | ||
| 397 | addq $CC,$O3,$CC | ||
| 398 | stq $R3,16($16) # r[2]=c | ||
| 399 | addq $R4,$CC,$R4 # c+= overflow | ||
| 400 | subq $19,4,$19 # loop-- | ||
| 401 | cmpult $R4,$CC,$CC # overflow? | ||
| 402 | addq $17,32,$17 # a++ | ||
| 403 | addq $CC,$O4,$CC | ||
| 404 | stq $R4,24($16) # r[3]=c | ||
| 405 | addq $18,32,$18 # b++ | ||
| 406 | addq $16,32,$16 # r++ | ||
| 407 | |||
| 408 | blt $19,$800 | ||
| 409 | ldq $L1,0($17) # a[0] | ||
| 410 | ldq $R1,0($18) # b[1] | ||
| 411 | br $801 | ||
| 412 | .align 4 | ||
| 413 | $845: | ||
| 414 | ldq $L1,0($17) # a[0] | ||
| 415 | ldq $R1,0($18) # b[1] | ||
| 416 | cmpult $L1,$R1,$O1 # will we borrow? | ||
| 417 | subq $L1,$R1,$R1 # r=a-b; | ||
| 418 | subq $19,1,$19 # loop-- | ||
| 419 | cmpult $R1,$CC,$O2 # will we borrow? | ||
| 420 | subq $R1,$CC,$R1 # c+= overflow | ||
| 421 | addq $17,8,$17 # a++ | ||
| 422 | addq $18,8,$18 # b++ | ||
| 423 | stq $R1,0($16) # r[0]=c | ||
| 424 | addq $O2,$O1,$CC | ||
| 425 | addq $16,8,$16 # r++ | ||
| 426 | |||
| 427 | bgt $19,$845 | ||
| 428 | ret $31,($26),1 # else exit | ||
| 429 | |||
| 430 | $800: | ||
| 431 | addq $19,4,$19 | ||
| 432 | bgt $19,$845 # goto tail code | ||
| 433 | ret $31,($26),1 # else exit | ||
| 434 | .end bn_sub_words | ||
| 435 | |||
| 436 | # | ||
| 437 | # What follows was taken directly from the C compiler with a few | ||
| 438 | # hacks to redo the lables. | ||
| 439 | # | ||
| 440 | .text | ||
| 441 | .align 3 | ||
| 442 | .globl bn_div_words | ||
| 443 | .ent bn_div_words | ||
| 444 | bn_div_words: | ||
| 445 | ldgp $29,0($27) | ||
| 446 | bn_div_words..ng: | ||
| 447 | lda $30,-48($30) | ||
| 448 | .frame $30,48,$26,0 | ||
| 449 | stq $26,0($30) | ||
| 450 | stq $9,8($30) | ||
| 451 | stq $10,16($30) | ||
| 452 | stq $11,24($30) | ||
| 453 | stq $12,32($30) | ||
| 454 | stq $13,40($30) | ||
| 455 | .mask 0x4003e00,-48 | ||
| 456 | .prologue 1 | ||
| 457 | bis $16,$16,$9 | ||
| 458 | bis $17,$17,$10 | ||
| 459 | bis $18,$18,$11 | ||
| 460 | bis $31,$31,$13 | ||
| 461 | bis $31,2,$12 | ||
| 462 | bne $11,$119 | ||
| 463 | lda $0,-1 | ||
| 464 | br $31,$136 | ||
| 465 | .align 4 | ||
| 466 | $119: | ||
| 467 | bis $11,$11,$16 | ||
| 468 | jsr $26,BN_num_bits_word | ||
| 469 | ldgp $29,0($26) | ||
| 470 | subq $0,64,$1 | ||
| 471 | beq $1,$120 | ||
| 472 | bis $31,1,$1 | ||
| 473 | sll $1,$0,$1 | ||
| 474 | cmpule $9,$1,$1 | ||
| 475 | bne $1,$120 | ||
| 476 | # lda $16,_IO_stderr_ | ||
| 477 | # lda $17,$C32 | ||
| 478 | # bis $0,$0,$18 | ||
| 479 | # jsr $26,fprintf | ||
| 480 | # ldgp $29,0($26) | ||
| 481 | jsr $26,abort | ||
| 482 | ldgp $29,0($26) | ||
| 483 | .align 4 | ||
| 484 | $120: | ||
| 485 | bis $31,64,$3 | ||
| 486 | cmpult $9,$11,$2 | ||
| 487 | subq $3,$0,$1 | ||
| 488 | addl $1,$31,$0 | ||
| 489 | subq $9,$11,$1 | ||
| 490 | cmoveq $2,$1,$9 | ||
| 491 | beq $0,$122 | ||
| 492 | zapnot $0,15,$2 | ||
| 493 | subq $3,$0,$1 | ||
| 494 | sll $11,$2,$11 | ||
| 495 | sll $9,$2,$3 | ||
| 496 | srl $10,$1,$1 | ||
| 497 | sll $10,$2,$10 | ||
| 498 | bis $3,$1,$9 | ||
| 499 | $122: | ||
| 500 | srl $11,32,$5 | ||
| 501 | zapnot $11,15,$6 | ||
| 502 | lda $7,-1 | ||
| 503 | .align 5 | ||
| 504 | $123: | ||
| 505 | srl $9,32,$1 | ||
| 506 | subq $1,$5,$1 | ||
| 507 | bne $1,$126 | ||
| 508 | zapnot $7,15,$27 | ||
| 509 | br $31,$127 | ||
| 510 | .align 4 | ||
| 511 | $126: | ||
| 512 | bis $9,$9,$24 | ||
| 513 | bis $5,$5,$25 | ||
| 514 | divqu $24,$25,$27 | ||
| 515 | $127: | ||
| 516 | srl $10,32,$4 | ||
| 517 | .align 5 | ||
| 518 | $128: | ||
| 519 | mulq $27,$5,$1 | ||
| 520 | subq $9,$1,$3 | ||
| 521 | zapnot $3,240,$1 | ||
| 522 | bne $1,$129 | ||
| 523 | mulq $6,$27,$2 | ||
| 524 | sll $3,32,$1 | ||
| 525 | addq $1,$4,$1 | ||
| 526 | cmpule $2,$1,$2 | ||
| 527 | bne $2,$129 | ||
| 528 | subq $27,1,$27 | ||
| 529 | br $31,$128 | ||
| 530 | .align 4 | ||
| 531 | $129: | ||
| 532 | mulq $27,$6,$1 | ||
| 533 | mulq $27,$5,$4 | ||
| 534 | srl $1,32,$3 | ||
| 535 | sll $1,32,$1 | ||
| 536 | addq $4,$3,$4 | ||
| 537 | cmpult $10,$1,$2 | ||
| 538 | subq $10,$1,$10 | ||
| 539 | addq $2,$4,$2 | ||
| 540 | cmpult $9,$2,$1 | ||
| 541 | bis $2,$2,$4 | ||
| 542 | beq $1,$134 | ||
| 543 | addq $9,$11,$9 | ||
| 544 | subq $27,1,$27 | ||
| 545 | $134: | ||
| 546 | subl $12,1,$12 | ||
| 547 | subq $9,$4,$9 | ||
| 548 | beq $12,$124 | ||
| 549 | sll $27,32,$13 | ||
| 550 | sll $9,32,$2 | ||
| 551 | srl $10,32,$1 | ||
| 552 | sll $10,32,$10 | ||
| 553 | bis $2,$1,$9 | ||
| 554 | br $31,$123 | ||
| 555 | .align 4 | ||
| 556 | $124: | ||
| 557 | bis $13,$27,$0 | ||
| 558 | $136: | ||
| 559 | ldq $26,0($30) | ||
| 560 | ldq $9,8($30) | ||
| 561 | ldq $10,16($30) | ||
| 562 | ldq $11,24($30) | ||
| 563 | ldq $12,32($30) | ||
| 564 | ldq $13,40($30) | ||
| 565 | addq $30,48,$30 | ||
| 566 | ret $31,($26),1 | ||
| 567 | .end bn_div_words | ||
| 568 | EOF | ||
| 569 | return($data); | ||
| 570 | } | ||
| 571 | |||
diff --git a/src/lib/libcrypto/bn/asm/ca.pl b/src/lib/libcrypto/bn/asm/ca.pl deleted file mode 100644 index c1ce67a6b4..0000000000 --- a/src/lib/libcrypto/bn/asm/ca.pl +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # I have this in perl so I can use more usefull register names and then convert | ||
| 3 | # them into alpha registers. | ||
| 4 | # | ||
| 5 | |||
| 6 | push(@INC,"perlasm","../../perlasm"); | ||
| 7 | require "alpha.pl"; | ||
| 8 | require "alpha/mul_add.pl"; | ||
| 9 | require "alpha/mul.pl"; | ||
| 10 | require "alpha/sqr.pl"; | ||
| 11 | require "alpha/add.pl"; | ||
| 12 | require "alpha/sub.pl"; | ||
| 13 | require "alpha/mul_c8.pl"; | ||
| 14 | require "alpha/mul_c4.pl"; | ||
| 15 | require "alpha/sqr_c4.pl"; | ||
| 16 | require "alpha/sqr_c8.pl"; | ||
| 17 | require "alpha/div.pl"; | ||
| 18 | |||
| 19 | &asm_init($ARGV[0],$0); | ||
| 20 | |||
| 21 | &bn_mul_words("bn_mul_words"); | ||
| 22 | &bn_sqr_words("bn_sqr_words"); | ||
| 23 | &bn_mul_add_words("bn_mul_add_words"); | ||
| 24 | &bn_add_words("bn_add_words"); | ||
| 25 | &bn_sub_words("bn_sub_words"); | ||
| 26 | &bn_div_words("bn_div_words"); | ||
| 27 | &bn_mul_comba8("bn_mul_comba8"); | ||
| 28 | &bn_mul_comba4("bn_mul_comba4"); | ||
| 29 | &bn_sqr_comba4("bn_sqr_comba4"); | ||
| 30 | &bn_sqr_comba8("bn_sqr_comba8"); | ||
| 31 | |||
| 32 | &asm_finish(); | ||
| 33 | |||
diff --git a/src/lib/libcrypto/bn/asm/co-586.pl b/src/lib/libcrypto/bn/asm/co-586.pl index 5d962cb957..57101a6bd7 100644 --- a/src/lib/libcrypto/bn/asm/co-586.pl +++ b/src/lib/libcrypto/bn/asm/co-586.pl | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #!/usr/local/bin/perl | 1 | #!/usr/local/bin/perl |
| 2 | 2 | ||
| 3 | push(@INC,"perlasm","../../perlasm"); | 3 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 4 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 4 | require "x86asm.pl"; | 5 | require "x86asm.pl"; |
| 5 | 6 | ||
| 6 | &asm_init($ARGV[0],$0); | 7 | &asm_init($ARGV[0],$0); |
diff --git a/src/lib/libcrypto/bn/asm/co-alpha.pl b/src/lib/libcrypto/bn/asm/co-alpha.pl deleted file mode 100644 index 67dad3e3d5..0000000000 --- a/src/lib/libcrypto/bn/asm/co-alpha.pl +++ /dev/null | |||
| @@ -1,116 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # I have this in perl so I can use more usefull register names and then convert | ||
| 3 | # them into alpha registers. | ||
| 4 | # | ||
| 5 | |||
| 6 | push(@INC,"perlasm","../../perlasm"); | ||
| 7 | require "alpha.pl"; | ||
| 8 | |||
| 9 | &asm_init($ARGV[0],$0); | ||
| 10 | |||
| 11 | print &bn_sub_words("bn_sub_words"); | ||
| 12 | |||
| 13 | &asm_finish(); | ||
| 14 | |||
| 15 | sub bn_sub_words | ||
| 16 | { | ||
| 17 | local($name)=@_; | ||
| 18 | local($cc,$a,$b,$r); | ||
| 19 | |||
| 20 | $cc="r0"; | ||
| 21 | $a0="r1"; $b0="r5"; $r0="r9"; $tmp="r13"; | ||
| 22 | $a1="r2"; $b1="r6"; $r1="r10"; $t1="r14"; | ||
| 23 | $a2="r3"; $b2="r7"; $r2="r11"; | ||
| 24 | $a3="r4"; $b3="r8"; $r3="r12"; $t3="r15"; | ||
| 25 | |||
| 26 | $rp=&wparam(0); | ||
| 27 | $ap=&wparam(1); | ||
| 28 | $bp=&wparam(2); | ||
| 29 | $count=&wparam(3); | ||
| 30 | |||
| 31 | &function_begin($name,""); | ||
| 32 | |||
| 33 | &comment(""); | ||
| 34 | &sub($count,4,$count); | ||
| 35 | &mov("zero",$cc); | ||
| 36 | &blt($count,&label("finish")); | ||
| 37 | |||
| 38 | &ld($a0,&QWPw(0,$ap)); | ||
| 39 | &ld($b0,&QWPw(0,$bp)); | ||
| 40 | |||
| 41 | ########################################################## | ||
| 42 | &set_label("loop"); | ||
| 43 | |||
| 44 | &ld($a1,&QWPw(1,$ap)); | ||
| 45 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 46 | &ld($b1,&QWPw(1,$bp)); | ||
| 47 | &sub($a0,$b0,$a0); # do the subtract | ||
| 48 | &ld($a2,&QWPw(2,$ap)); | ||
| 49 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 50 | &ld($b2,&QWPw(2,$bp)); | ||
| 51 | &sub($a0,$cc,$a0); # will we borrow? | ||
| 52 | &ld($a3,&QWPw(3,$ap)); | ||
| 53 | &add($b0,$tmp,$cc); # add the borrows | ||
| 54 | |||
| 55 | &cmpult($a1,$b1,$t1); # will we borrow? | ||
| 56 | &sub($a1,$b1,$a1); # do the subtract | ||
| 57 | &ld($b3,&QWPw(3,$bp)); | ||
| 58 | &cmpult($a1,$cc,$b1); # will we borrow? | ||
| 59 | &sub($a1,$cc,$a1); # will we borrow? | ||
| 60 | &add($b1,$t1,$cc); # add the borrows | ||
| 61 | |||
| 62 | &cmpult($a2,$b2,$tmp); # will we borrow? | ||
| 63 | &sub($a2,$b2,$a2); # do the subtract | ||
| 64 | &st($a0,&QWPw(0,$rp)); # save | ||
| 65 | &cmpult($a2,$cc,$b2); # will we borrow? | ||
| 66 | &sub($a2,$cc,$a2); # will we borrow? | ||
| 67 | &add($b2,$tmp,$cc); # add the borrows | ||
| 68 | |||
| 69 | &cmpult($a3,$b3,$t3); # will we borrow? | ||
| 70 | &sub($a3,$b3,$a3); # do the subtract | ||
| 71 | &st($a1,&QWPw(1,$rp)); # save | ||
| 72 | &cmpult($a3,$cc,$b3); # will we borrow? | ||
| 73 | &sub($a3,$cc,$a3); # will we borrow? | ||
| 74 | &add($b3,$t3,$cc); # add the borrows | ||
| 75 | |||
| 76 | &st($a2,&QWPw(2,$rp)); # save | ||
| 77 | &sub($count,4,$count); # count-=4 | ||
| 78 | &st($a3,&QWPw(3,$rp)); # save | ||
| 79 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 80 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 81 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 82 | |||
| 83 | &blt($count,&label("finish")); | ||
| 84 | &ld($a0,&QWPw(0,$ap)); | ||
| 85 | &ld($b0,&QWPw(0,$bp)); | ||
| 86 | &br(&label("loop")); | ||
| 87 | ################################################## | ||
| 88 | # Do the last 0..3 words | ||
| 89 | |||
| 90 | &set_label("last_loop"); | ||
| 91 | |||
| 92 | &ld($a0,&QWPw(0,$ap)); # get a | ||
| 93 | &ld($b0,&QWPw(0,$bp)); # get b | ||
| 94 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 95 | &sub($a0,$b0,$a0); # do the subtract | ||
| 96 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 97 | &sub($a0,$cc,$a0); # will we borrow? | ||
| 98 | &st($a0,&QWPw(0,$rp)); # save | ||
| 99 | &add($b0,$tmp,$cc); # add the borrows | ||
| 100 | |||
| 101 | &add($ap,$QWS,$ap); | ||
| 102 | &add($bp,$QWS,$bp); | ||
| 103 | &add($rp,$QWS,$rp); | ||
| 104 | &sub($count,1,$count); | ||
| 105 | &bgt($count,&label("last_loop")); | ||
| 106 | &function_end_A($name); | ||
| 107 | |||
| 108 | ###################################################### | ||
| 109 | &set_label("finish"); | ||
| 110 | &add($count,4,$count); | ||
| 111 | &bgt($count,&label("last_loop")); | ||
| 112 | |||
| 113 | &set_label("end"); | ||
| 114 | &function_end($name); | ||
| 115 | } | ||
| 116 | |||
diff --git a/src/lib/libcrypto/bn/asm/mips1.s b/src/lib/libcrypto/bn/asm/mips1.s deleted file mode 100644 index 44fa1254c7..0000000000 --- a/src/lib/libcrypto/bn/asm/mips1.s +++ /dev/null | |||
| @@ -1,539 +0,0 @@ | |||
| 1 | /* This assember is for R2000/R3000 machines, or higher ones that do | ||
| 2 | * no want to do any 64 bit arithmatic. | ||
| 3 | * Make sure that the SSLeay bignum library is compiled with | ||
| 4 | * THIRTY_TWO_BIT set. | ||
| 5 | * This must either be compiled with the system CC, or, if you use GNU gas, | ||
| 6 | * cc -E mips1.s|gas -o mips1.o | ||
| 7 | */ | ||
| 8 | .set reorder | ||
| 9 | .set noat | ||
| 10 | |||
| 11 | #define R1 $1 | ||
| 12 | #define CC $2 | ||
| 13 | #define R2 $3 | ||
| 14 | #define R3 $8 | ||
| 15 | #define R4 $9 | ||
| 16 | #define L1 $10 | ||
| 17 | #define L2 $11 | ||
| 18 | #define L3 $12 | ||
| 19 | #define L4 $13 | ||
| 20 | #define H1 $14 | ||
| 21 | #define H2 $15 | ||
| 22 | #define H3 $24 | ||
| 23 | #define H4 $25 | ||
| 24 | |||
| 25 | #define P1 $4 | ||
| 26 | #define P2 $5 | ||
| 27 | #define P3 $6 | ||
| 28 | #define P4 $7 | ||
| 29 | |||
| 30 | .align 2 | ||
| 31 | .ent bn_mul_add_words | ||
| 32 | .globl bn_mul_add_words | ||
| 33 | .text | ||
| 34 | bn_mul_add_words: | ||
| 35 | .frame $sp,0,$31 | ||
| 36 | .mask 0x00000000,0 | ||
| 37 | .fmask 0x00000000,0 | ||
| 38 | |||
| 39 | #blt P3,4,$lab34 | ||
| 40 | |||
| 41 | subu R1,P3,4 | ||
| 42 | move CC,$0 | ||
| 43 | bltz R1,$lab34 | ||
| 44 | $lab2: | ||
| 45 | lw R1,0(P1) | ||
| 46 | lw L1,0(P2) | ||
| 47 | lw R2,4(P1) | ||
| 48 | lw L2,4(P2) | ||
| 49 | lw R3,8(P1) | ||
| 50 | lw L3,8(P2) | ||
| 51 | lw R4,12(P1) | ||
| 52 | lw L4,12(P2) | ||
| 53 | multu L1,P4 | ||
| 54 | addu R1,R1,CC | ||
| 55 | mflo L1 | ||
| 56 | sltu CC,R1,CC | ||
| 57 | addu R1,R1,L1 | ||
| 58 | mfhi H1 | ||
| 59 | sltu L1,R1,L1 | ||
| 60 | sw R1,0(P1) | ||
| 61 | addu CC,CC,L1 | ||
| 62 | multu L2,P4 | ||
| 63 | addu CC,H1,CC | ||
| 64 | mflo L2 | ||
| 65 | addu R2,R2,CC | ||
| 66 | sltu CC,R2,CC | ||
| 67 | mfhi H2 | ||
| 68 | addu R2,R2,L2 | ||
| 69 | addu P2,P2,16 | ||
| 70 | sltu L2,R2,L2 | ||
| 71 | sw R2,4(P1) | ||
| 72 | addu CC,CC,L2 | ||
| 73 | multu L3,P4 | ||
| 74 | addu CC,H2,CC | ||
| 75 | mflo L3 | ||
| 76 | addu R3,R3,CC | ||
| 77 | sltu CC,R3,CC | ||
| 78 | mfhi H3 | ||
| 79 | addu R3,R3,L3 | ||
| 80 | addu P1,P1,16 | ||
| 81 | sltu L3,R3,L3 | ||
| 82 | sw R3,-8(P1) | ||
| 83 | addu CC,CC,L3 | ||
| 84 | multu L4,P4 | ||
| 85 | addu CC,H3,CC | ||
| 86 | mflo L4 | ||
| 87 | addu R4,R4,CC | ||
| 88 | sltu CC,R4,CC | ||
| 89 | mfhi H4 | ||
| 90 | addu R4,R4,L4 | ||
| 91 | subu P3,P3,4 | ||
| 92 | sltu L4,R4,L4 | ||
| 93 | addu CC,CC,L4 | ||
| 94 | addu CC,H4,CC | ||
| 95 | |||
| 96 | subu R1,P3,4 | ||
| 97 | sw R4,-4(P1) # delay slot | ||
| 98 | bgez R1,$lab2 | ||
| 99 | |||
| 100 | bleu P3,0,$lab3 | ||
| 101 | .align 2 | ||
| 102 | $lab33: | ||
| 103 | lw L1,0(P2) | ||
| 104 | lw R1,0(P1) | ||
| 105 | multu L1,P4 | ||
| 106 | addu R1,R1,CC | ||
| 107 | sltu CC,R1,CC | ||
| 108 | addu P1,P1,4 | ||
| 109 | mflo L1 | ||
| 110 | mfhi H1 | ||
| 111 | addu R1,R1,L1 | ||
| 112 | addu P2,P2,4 | ||
| 113 | sltu L1,R1,L1 | ||
| 114 | subu P3,P3,1 | ||
| 115 | addu CC,CC,L1 | ||
| 116 | sw R1,-4(P1) | ||
| 117 | addu CC,H1,CC | ||
| 118 | bgtz P3,$lab33 | ||
| 119 | j $31 | ||
| 120 | .align 2 | ||
| 121 | $lab3: | ||
| 122 | j $31 | ||
| 123 | .align 2 | ||
| 124 | $lab34: | ||
| 125 | bgt P3,0,$lab33 | ||
| 126 | j $31 | ||
| 127 | .end bn_mul_add_words | ||
| 128 | |||
| 129 | .align 2 | ||
| 130 | # Program Unit: bn_mul_words | ||
| 131 | .ent bn_mul_words | ||
| 132 | .globl bn_mul_words | ||
| 133 | .text | ||
| 134 | bn_mul_words: | ||
| 135 | .frame $sp,0,$31 | ||
| 136 | .mask 0x00000000,0 | ||
| 137 | .fmask 0x00000000,0 | ||
| 138 | |||
| 139 | subu P3,P3,4 | ||
| 140 | move CC,$0 | ||
| 141 | bltz P3,$lab45 | ||
| 142 | $lab44: | ||
| 143 | lw L1,0(P2) | ||
| 144 | lw L2,4(P2) | ||
| 145 | lw L3,8(P2) | ||
| 146 | lw L4,12(P2) | ||
| 147 | multu L1,P4 | ||
| 148 | subu P3,P3,4 | ||
| 149 | mflo L1 | ||
| 150 | mfhi H1 | ||
| 151 | addu L1,L1,CC | ||
| 152 | multu L2,P4 | ||
| 153 | sltu CC,L1,CC | ||
| 154 | sw L1,0(P1) | ||
| 155 | addu CC,H1,CC | ||
| 156 | mflo L2 | ||
| 157 | mfhi H2 | ||
| 158 | addu L2,L2,CC | ||
| 159 | multu L3,P4 | ||
| 160 | sltu CC,L2,CC | ||
| 161 | sw L2,4(P1) | ||
| 162 | addu CC,H2,CC | ||
| 163 | mflo L3 | ||
| 164 | mfhi H3 | ||
| 165 | addu L3,L3,CC | ||
| 166 | multu L4,P4 | ||
| 167 | sltu CC,L3,CC | ||
| 168 | sw L3,8(P1) | ||
| 169 | addu CC,H3,CC | ||
| 170 | mflo L4 | ||
| 171 | mfhi H4 | ||
| 172 | addu L4,L4,CC | ||
| 173 | addu P1,P1,16 | ||
| 174 | sltu CC,L4,CC | ||
| 175 | addu P2,P2,16 | ||
| 176 | addu CC,H4,CC | ||
| 177 | sw L4,-4(P1) | ||
| 178 | |||
| 179 | bgez P3,$lab44 | ||
| 180 | b $lab45 | ||
| 181 | $lab46: | ||
| 182 | lw L1,0(P2) | ||
| 183 | addu P1,P1,4 | ||
| 184 | multu L1,P4 | ||
| 185 | addu P2,P2,4 | ||
| 186 | mflo L1 | ||
| 187 | mfhi H1 | ||
| 188 | addu L1,L1,CC | ||
| 189 | subu P3,P3,1 | ||
| 190 | sltu CC,L1,CC | ||
| 191 | sw L1,-4(P1) | ||
| 192 | addu CC,H1,CC | ||
| 193 | bgtz P3,$lab46 | ||
| 194 | j $31 | ||
| 195 | $lab45: | ||
| 196 | addu P3,P3,4 | ||
| 197 | bgtz P3,$lab46 | ||
| 198 | j $31 | ||
| 199 | .align 2 | ||
| 200 | .end bn_mul_words | ||
| 201 | |||
| 202 | # Program Unit: bn_sqr_words | ||
| 203 | .ent bn_sqr_words | ||
| 204 | .globl bn_sqr_words | ||
| 205 | .text | ||
| 206 | bn_sqr_words: | ||
| 207 | .frame $sp,0,$31 | ||
| 208 | .mask 0x00000000,0 | ||
| 209 | .fmask 0x00000000,0 | ||
| 210 | |||
| 211 | subu P3,P3,4 | ||
| 212 | bltz P3,$lab55 | ||
| 213 | $lab54: | ||
| 214 | lw L1,0(P2) | ||
| 215 | lw L2,4(P2) | ||
| 216 | lw L3,8(P2) | ||
| 217 | lw L4,12(P2) | ||
| 218 | |||
| 219 | multu L1,L1 | ||
| 220 | subu P3,P3,4 | ||
| 221 | mflo L1 | ||
| 222 | mfhi H1 | ||
| 223 | sw L1,0(P1) | ||
| 224 | sw H1,4(P1) | ||
| 225 | |||
| 226 | multu L2,L2 | ||
| 227 | addu P1,P1,32 | ||
| 228 | mflo L2 | ||
| 229 | mfhi H2 | ||
| 230 | sw L2,-24(P1) | ||
| 231 | sw H2,-20(P1) | ||
| 232 | |||
| 233 | multu L3,L3 | ||
| 234 | addu P2,P2,16 | ||
| 235 | mflo L3 | ||
| 236 | mfhi H3 | ||
| 237 | sw L3,-16(P1) | ||
| 238 | sw H3,-12(P1) | ||
| 239 | |||
| 240 | multu L4,L4 | ||
| 241 | |||
| 242 | mflo L4 | ||
| 243 | mfhi H4 | ||
| 244 | sw L4,-8(P1) | ||
| 245 | sw H4,-4(P1) | ||
| 246 | |||
| 247 | bgtz P3,$lab54 | ||
| 248 | b $lab55 | ||
| 249 | $lab56: | ||
| 250 | lw L1,0(P2) | ||
| 251 | addu P1,P1,8 | ||
| 252 | multu L1,L1 | ||
| 253 | addu P2,P2,4 | ||
| 254 | subu P3,P3,1 | ||
| 255 | mflo L1 | ||
| 256 | mfhi H1 | ||
| 257 | sw L1,-8(P1) | ||
| 258 | sw H1,-4(P1) | ||
| 259 | |||
| 260 | bgtz P3,$lab56 | ||
| 261 | j $31 | ||
| 262 | $lab55: | ||
| 263 | addu P3,P3,4 | ||
| 264 | bgtz P3,$lab56 | ||
| 265 | j $31 | ||
| 266 | .align 2 | ||
| 267 | .end bn_sqr_words | ||
| 268 | |||
| 269 | # Program Unit: bn_add_words | ||
| 270 | .ent bn_add_words | ||
| 271 | .globl bn_add_words | ||
| 272 | .text | ||
| 273 | bn_add_words: # 0x590 | ||
| 274 | .frame $sp,0,$31 | ||
| 275 | .mask 0x00000000,0 | ||
| 276 | .fmask 0x00000000,0 | ||
| 277 | |||
| 278 | subu P4,P4,4 | ||
| 279 | move CC,$0 | ||
| 280 | bltz P4,$lab65 | ||
| 281 | $lab64: | ||
| 282 | lw L1,0(P2) | ||
| 283 | lw R1,0(P3) | ||
| 284 | lw L2,4(P2) | ||
| 285 | lw R2,4(P3) | ||
| 286 | |||
| 287 | addu L1,L1,CC | ||
| 288 | lw L3,8(P2) | ||
| 289 | sltu CC,L1,CC | ||
| 290 | addu L1,L1,R1 | ||
| 291 | sltu R1,L1,R1 | ||
| 292 | lw R3,8(P3) | ||
| 293 | addu CC,CC,R1 | ||
| 294 | lw L4,12(P2) | ||
| 295 | |||
| 296 | addu L2,L2,CC | ||
| 297 | lw R4,12(P3) | ||
| 298 | sltu CC,L2,CC | ||
| 299 | addu L2,L2,R2 | ||
| 300 | sltu R2,L2,R2 | ||
| 301 | sw L1,0(P1) | ||
| 302 | addu CC,CC,R2 | ||
| 303 | addu P1,P1,16 | ||
| 304 | addu L3,L3,CC | ||
| 305 | sw L2,-12(P1) | ||
| 306 | |||
| 307 | sltu CC,L3,CC | ||
| 308 | addu L3,L3,R3 | ||
| 309 | sltu R3,L3,R3 | ||
| 310 | addu P2,P2,16 | ||
| 311 | addu CC,CC,R3 | ||
| 312 | |||
| 313 | addu L4,L4,CC | ||
| 314 | addu P3,P3,16 | ||
| 315 | sltu CC,L4,CC | ||
| 316 | addu L4,L4,R4 | ||
| 317 | subu P4,P4,4 | ||
| 318 | sltu R4,L4,R4 | ||
| 319 | sw L3,-8(P1) | ||
| 320 | addu CC,CC,R4 | ||
| 321 | sw L4,-4(P1) | ||
| 322 | |||
| 323 | bgtz P4,$lab64 | ||
| 324 | b $lab65 | ||
| 325 | $lab66: | ||
| 326 | lw L1,0(P2) | ||
| 327 | lw R1,0(P3) | ||
| 328 | addu L1,L1,CC | ||
| 329 | addu P1,P1,4 | ||
| 330 | sltu CC,L1,CC | ||
| 331 | addu P2,P2,4 | ||
| 332 | addu P3,P3,4 | ||
| 333 | addu L1,L1,R1 | ||
| 334 | subu P4,P4,1 | ||
| 335 | sltu R1,L1,R1 | ||
| 336 | sw L1,-4(P1) | ||
| 337 | addu CC,CC,R1 | ||
| 338 | |||
| 339 | bgtz P4,$lab66 | ||
| 340 | j $31 | ||
| 341 | $lab65: | ||
| 342 | addu P4,P4,4 | ||
| 343 | bgtz P4,$lab66 | ||
| 344 | j $31 | ||
| 345 | .end bn_add_words | ||
| 346 | |||
| 347 | # Program Unit: bn_div64 | ||
| 348 | .set at | ||
| 349 | .set reorder | ||
| 350 | .text | ||
| 351 | .align 2 | ||
| 352 | .globl bn_div64 | ||
| 353 | # 321 { | ||
| 354 | .ent bn_div64 2 | ||
| 355 | bn_div64: | ||
| 356 | subu $sp, 64 | ||
| 357 | sw $31, 56($sp) | ||
| 358 | sw $16, 48($sp) | ||
| 359 | .mask 0x80010000, -56 | ||
| 360 | .frame $sp, 64, $31 | ||
| 361 | move $9, $4 | ||
| 362 | move $12, $5 | ||
| 363 | move $16, $6 | ||
| 364 | # 322 BN_ULONG dh,dl,q,ret=0,th,tl,t; | ||
| 365 | move $31, $0 | ||
| 366 | # 323 int i,count=2; | ||
| 367 | li $13, 2 | ||
| 368 | # 324 | ||
| 369 | # 325 if (d == 0) return(BN_MASK2); | ||
| 370 | bne $16, 0, $80 | ||
| 371 | li $2, -1 | ||
| 372 | b $93 | ||
| 373 | $80: | ||
| 374 | # 326 | ||
| 375 | # 327 i=BN_num_bits_word(d); | ||
| 376 | move $4, $16 | ||
| 377 | sw $31, 16($sp) | ||
| 378 | sw $9, 24($sp) | ||
| 379 | sw $12, 32($sp) | ||
| 380 | sw $13, 40($sp) | ||
| 381 | .livereg 0x800ff0e,0xfff | ||
| 382 | jal BN_num_bits_word | ||
| 383 | li $4, 32 | ||
| 384 | lw $31, 16($sp) | ||
| 385 | lw $9, 24($sp) | ||
| 386 | lw $12, 32($sp) | ||
| 387 | lw $13, 40($sp) | ||
| 388 | move $3, $2 | ||
| 389 | # 328 if ((i != BN_BITS2) && (h > (BN_ULONG)1<<i)) | ||
| 390 | beq $2, $4, $81 | ||
| 391 | li $14, 1 | ||
| 392 | sll $15, $14, $2 | ||
| 393 | bleu $9, $15, $81 | ||
| 394 | # 329 { | ||
| 395 | # 330 #if !defined(NO_STDIO) && !defined(WIN16) | ||
| 396 | # 331 fprintf(stderr,"Division would overflow (%d)\n",i); | ||
| 397 | # 332 #endif | ||
| 398 | # 333 abort(); | ||
| 399 | sw $3, 8($sp) | ||
| 400 | sw $9, 24($sp) | ||
| 401 | sw $12, 32($sp) | ||
| 402 | sw $13, 40($sp) | ||
| 403 | sw $31, 26($sp) | ||
| 404 | .livereg 0xff0e,0xfff | ||
| 405 | jal abort | ||
| 406 | lw $3, 8($sp) | ||
| 407 | li $4, 32 | ||
| 408 | lw $9, 24($sp) | ||
| 409 | lw $12, 32($sp) | ||
| 410 | lw $13, 40($sp) | ||
| 411 | lw $31, 26($sp) | ||
| 412 | # 334 } | ||
| 413 | $81: | ||
| 414 | # 335 i=BN_BITS2-i; | ||
| 415 | subu $3, $4, $3 | ||
| 416 | # 336 if (h >= d) h-=d; | ||
| 417 | bltu $9, $16, $82 | ||
| 418 | subu $9, $9, $16 | ||
| 419 | $82: | ||
| 420 | # 337 | ||
| 421 | # 338 if (i) | ||
| 422 | beq $3, 0, $83 | ||
| 423 | # 339 { | ||
| 424 | # 340 d<<=i; | ||
| 425 | sll $16, $16, $3 | ||
| 426 | # 341 h=(h<<i)|(l>>(BN_BITS2-i)); | ||
| 427 | sll $24, $9, $3 | ||
| 428 | subu $25, $4, $3 | ||
| 429 | srl $14, $12, $25 | ||
| 430 | or $9, $24, $14 | ||
| 431 | # 342 l<<=i; | ||
| 432 | sll $12, $12, $3 | ||
| 433 | # 343 } | ||
| 434 | $83: | ||
| 435 | # 344 dh=(d&BN_MASK2h)>>BN_BITS4; | ||
| 436 | # 345 dl=(d&BN_MASK2l); | ||
| 437 | and $8, $16, -65536 | ||
| 438 | srl $8, $8, 16 | ||
| 439 | and $10, $16, 65535 | ||
| 440 | li $6, -65536 | ||
| 441 | $84: | ||
| 442 | # 346 for (;;) | ||
| 443 | # 347 { | ||
| 444 | # 348 if ((h>>BN_BITS4) == dh) | ||
| 445 | srl $15, $9, 16 | ||
| 446 | bne $8, $15, $85 | ||
| 447 | # 349 q=BN_MASK2l; | ||
| 448 | li $5, 65535 | ||
| 449 | b $86 | ||
| 450 | $85: | ||
| 451 | # 350 else | ||
| 452 | # 351 q=h/dh; | ||
| 453 | divu $5, $9, $8 | ||
| 454 | $86: | ||
| 455 | # 352 | ||
| 456 | # 353 for (;;) | ||
| 457 | # 354 { | ||
| 458 | # 355 t=(h-q*dh); | ||
| 459 | mul $4, $5, $8 | ||
| 460 | subu $2, $9, $4 | ||
| 461 | move $3, $2 | ||
| 462 | # 356 if ((t&BN_MASK2h) || | ||
| 463 | # 357 ((dl*q) <= ( | ||
| 464 | # 358 (t<<BN_BITS4)+ | ||
| 465 | # 359 ((l&BN_MASK2h)>>BN_BITS4)))) | ||
| 466 | and $25, $2, $6 | ||
| 467 | bne $25, $0, $87 | ||
| 468 | mul $24, $10, $5 | ||
| 469 | sll $14, $3, 16 | ||
| 470 | and $15, $12, $6 | ||
| 471 | srl $25, $15, 16 | ||
| 472 | addu $15, $14, $25 | ||
| 473 | bgtu $24, $15, $88 | ||
| 474 | $87: | ||
| 475 | # 360 break; | ||
| 476 | mul $3, $10, $5 | ||
| 477 | b $89 | ||
| 478 | $88: | ||
| 479 | # 361 q--; | ||
| 480 | addu $5, $5, -1 | ||
| 481 | # 362 } | ||
| 482 | b $86 | ||
| 483 | $89: | ||
| 484 | # 363 th=q*dh; | ||
| 485 | # 364 tl=q*dl; | ||
| 486 | # 365 t=(tl>>BN_BITS4); | ||
| 487 | # 366 tl=(tl<<BN_BITS4)&BN_MASK2h; | ||
| 488 | sll $14, $3, 16 | ||
| 489 | and $2, $14, $6 | ||
| 490 | move $11, $2 | ||
| 491 | # 367 th+=t; | ||
| 492 | srl $25, $3, 16 | ||
| 493 | addu $7, $4, $25 | ||
| 494 | # 368 | ||
| 495 | # 369 if (l < tl) th++; | ||
| 496 | bgeu $12, $2, $90 | ||
| 497 | addu $7, $7, 1 | ||
| 498 | $90: | ||
| 499 | # 370 l-=tl; | ||
| 500 | subu $12, $12, $11 | ||
| 501 | # 371 if (h < th) | ||
| 502 | bgeu $9, $7, $91 | ||
| 503 | # 372 { | ||
| 504 | # 373 h+=d; | ||
| 505 | addu $9, $9, $16 | ||
| 506 | # 374 q--; | ||
| 507 | addu $5, $5, -1 | ||
| 508 | # 375 } | ||
| 509 | $91: | ||
| 510 | # 376 h-=th; | ||
| 511 | subu $9, $9, $7 | ||
| 512 | # 377 | ||
| 513 | # 378 if (--count == 0) break; | ||
| 514 | addu $13, $13, -1 | ||
| 515 | beq $13, 0, $92 | ||
| 516 | # 379 | ||
| 517 | # 380 ret=q<<BN_BITS4; | ||
| 518 | sll $31, $5, 16 | ||
| 519 | # 381 h=((h<<BN_BITS4)|(l>>BN_BITS4))&BN_MASK2; | ||
| 520 | sll $24, $9, 16 | ||
| 521 | srl $15, $12, 16 | ||
| 522 | or $9, $24, $15 | ||
| 523 | # 382 l=(l&BN_MASK2l)<<BN_BITS4; | ||
| 524 | and $12, $12, 65535 | ||
| 525 | sll $12, $12, 16 | ||
| 526 | # 383 } | ||
| 527 | b $84 | ||
| 528 | $92: | ||
| 529 | # 384 ret|=q; | ||
| 530 | or $31, $31, $5 | ||
| 531 | # 385 return(ret); | ||
| 532 | move $2, $31 | ||
| 533 | $93: | ||
| 534 | lw $16, 48($sp) | ||
| 535 | lw $31, 56($sp) | ||
| 536 | addu $sp, 64 | ||
| 537 | j $31 | ||
| 538 | .end bn_div64 | ||
| 539 | |||
diff --git a/src/lib/libcrypto/bn/asm/mo-586.pl b/src/lib/libcrypto/bn/asm/mo-586.pl deleted file mode 100644 index 0982293094..0000000000 --- a/src/lib/libcrypto/bn/asm/mo-586.pl +++ /dev/null | |||
| @@ -1,603 +0,0 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | # This is crypto/bn/asm/x86-mont.pl (with asciz from crypto/perlasm/x86asm.pl) | ||
| 4 | # from OpenSSL 0.9.9-dev | ||
| 5 | |||
| 6 | sub ::asciz | ||
| 7 | { my @str=unpack("C*",shift); | ||
| 8 | push @str,0; | ||
| 9 | while ($#str>15) { | ||
| 10 | &data_byte(@str[0..15]); | ||
| 11 | foreach (0..15) { shift @str; } | ||
| 12 | } | ||
| 13 | &data_byte(@str) if (@str); | ||
| 14 | } | ||
| 15 | |||
| 16 | # ==================================================================== | ||
| 17 | # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL | ||
| 18 | # project. The module is, however, dual licensed under OpenSSL and | ||
| 19 | # CRYPTOGAMS licenses depending on where you obtain it. For further | ||
| 20 | # details see http://www.openssl.org/~appro/cryptogams/. | ||
| 21 | # ==================================================================== | ||
| 22 | |||
| 23 | # October 2005 | ||
| 24 | # | ||
| 25 | # This is a "teaser" code, as it can be improved in several ways... | ||
| 26 | # First of all non-SSE2 path should be implemented (yes, for now it | ||
| 27 | # performs Montgomery multiplication/convolution only on SSE2-capable | ||
| 28 | # CPUs such as P4, others fall down to original code). Then inner loop | ||
| 29 | # can be unrolled and modulo-scheduled to improve ILP and possibly | ||
| 30 | # moved to 128-bit XMM register bank (though it would require input | ||
| 31 | # rearrangement and/or increase bus bandwidth utilization). Dedicated | ||
| 32 | # squaring procedure should give further performance improvement... | ||
| 33 | # Yet, for being draft, the code improves rsa512 *sign* benchmark by | ||
| 34 | # 110%(!), rsa1024 one - by 70% and rsa4096 - by 20%:-) | ||
| 35 | |||
| 36 | # December 2006 | ||
| 37 | # | ||
| 38 | # Modulo-scheduling SSE2 loops results in further 15-20% improvement. | ||
| 39 | # Integer-only code [being equipped with dedicated squaring procedure] | ||
| 40 | # gives ~40% on rsa512 sign benchmark... | ||
| 41 | |||
| 42 | push(@INC,"perlasm","../../perlasm"); | ||
| 43 | require "x86asm.pl"; | ||
| 44 | |||
| 45 | &asm_init($ARGV[0],$0); | ||
| 46 | |||
| 47 | $sse2=0; | ||
| 48 | for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } | ||
| 49 | |||
| 50 | &external_label("OPENSSL_ia32cap_P") if ($sse2); | ||
| 51 | |||
| 52 | &function_begin("bn_mul_mont"); | ||
| 53 | |||
| 54 | $i="edx"; | ||
| 55 | $j="ecx"; | ||
| 56 | $ap="esi"; $tp="esi"; # overlapping variables!!! | ||
| 57 | $rp="edi"; $bp="edi"; # overlapping variables!!! | ||
| 58 | $np="ebp"; | ||
| 59 | $num="ebx"; | ||
| 60 | |||
| 61 | $_num=&DWP(4*0,"esp"); # stack top layout | ||
| 62 | $_rp=&DWP(4*1,"esp"); | ||
| 63 | $_ap=&DWP(4*2,"esp"); | ||
| 64 | $_bp=&DWP(4*3,"esp"); | ||
| 65 | $_np=&DWP(4*4,"esp"); | ||
| 66 | $_n0=&DWP(4*5,"esp"); $_n0q=&QWP(4*5,"esp"); | ||
| 67 | $_sp=&DWP(4*6,"esp"); | ||
| 68 | $_bpend=&DWP(4*7,"esp"); | ||
| 69 | $frame=32; # size of above frame rounded up to 16n | ||
| 70 | |||
| 71 | &xor ("eax","eax"); | ||
| 72 | &mov ("edi",&wparam(5)); # int num | ||
| 73 | &cmp ("edi",4); | ||
| 74 | &jl (&label("just_leave")); | ||
| 75 | |||
| 76 | &lea ("esi",&wparam(0)); # put aside pointer to argument block | ||
| 77 | &lea ("edx",&wparam(1)); # load ap | ||
| 78 | &mov ("ebp","esp"); # saved stack pointer! | ||
| 79 | &add ("edi",2); # extra two words on top of tp | ||
| 80 | &neg ("edi"); | ||
| 81 | &lea ("esp",&DWP(-$frame,"esp","edi",4)); # alloca($frame+4*(num+2)) | ||
| 82 | &neg ("edi"); | ||
| 83 | |||
| 84 | # minimize cache contention by arraning 2K window between stack | ||
| 85 | # pointer and ap argument [np is also position sensitive vector, | ||
| 86 | # but it's assumed to be near ap, as it's allocated at ~same | ||
| 87 | # time]. | ||
| 88 | &mov ("eax","esp"); | ||
| 89 | &sub ("eax","edx"); | ||
| 90 | &and ("eax",2047); | ||
| 91 | &sub ("esp","eax"); # this aligns sp and ap modulo 2048 | ||
| 92 | |||
| 93 | &xor ("edx","esp"); | ||
| 94 | &and ("edx",2048); | ||
| 95 | &xor ("edx",2048); | ||
| 96 | &sub ("esp","edx"); # this splits them apart modulo 4096 | ||
| 97 | |||
| 98 | &and ("esp",-64); # align to cache line | ||
| 99 | |||
| 100 | ################################# load argument block... | ||
| 101 | &mov ("eax",&DWP(0*4,"esi"));# BN_ULONG *rp | ||
| 102 | &mov ("ebx",&DWP(1*4,"esi"));# const BN_ULONG *ap | ||
| 103 | &mov ("ecx",&DWP(2*4,"esi"));# const BN_ULONG *bp | ||
| 104 | &mov ("edx",&DWP(3*4,"esi"));# const BN_ULONG *np | ||
| 105 | &mov ("esi",&DWP(4*4,"esi"));# const BN_ULONG *n0 | ||
| 106 | #&mov ("edi",&DWP(5*4,"esi"));# int num | ||
| 107 | |||
| 108 | &mov ("esi",&DWP(0,"esi")); # pull n0[0] | ||
| 109 | &mov ($_rp,"eax"); # ... save a copy of argument block | ||
| 110 | &mov ($_ap,"ebx"); | ||
| 111 | &mov ($_bp,"ecx"); | ||
| 112 | &mov ($_np,"edx"); | ||
| 113 | &mov ($_n0,"esi"); | ||
| 114 | &lea ($num,&DWP(-3,"edi")); # num=num-1 to assist modulo-scheduling | ||
| 115 | #&mov ($_num,$num); # redundant as $num is not reused | ||
| 116 | &mov ($_sp,"ebp"); # saved stack pointer! | ||
| 117 | |||
| 118 | if($sse2) { | ||
| 119 | $acc0="mm0"; # mmx register bank layout | ||
| 120 | $acc1="mm1"; | ||
| 121 | $car0="mm2"; | ||
| 122 | $car1="mm3"; | ||
| 123 | $mul0="mm4"; | ||
| 124 | $mul1="mm5"; | ||
| 125 | $temp="mm6"; | ||
| 126 | $mask="mm7"; | ||
| 127 | |||
| 128 | &picmeup("eax","OPENSSL_ia32cap_P"); | ||
| 129 | &bt (&DWP(0,"eax"),26); | ||
| 130 | &jnc (&label("non_sse2")); | ||
| 131 | |||
| 132 | &mov ("eax",-1); | ||
| 133 | &movd ($mask,"eax"); # mask 32 lower bits | ||
| 134 | |||
| 135 | &mov ($ap,$_ap); # load input pointers | ||
| 136 | &mov ($bp,$_bp); | ||
| 137 | &mov ($np,$_np); | ||
| 138 | |||
| 139 | &xor ($i,$i); # i=0 | ||
| 140 | &xor ($j,$j); # j=0 | ||
| 141 | |||
| 142 | &movd ($mul0,&DWP(0,$bp)); # bp[0] | ||
| 143 | &movd ($mul1,&DWP(0,$ap)); # ap[0] | ||
| 144 | &movd ($car1,&DWP(0,$np)); # np[0] | ||
| 145 | |||
| 146 | &pmuludq($mul1,$mul0); # ap[0]*bp[0] | ||
| 147 | &movq ($car0,$mul1); | ||
| 148 | &movq ($acc0,$mul1); # I wish movd worked for | ||
| 149 | &pand ($acc0,$mask); # inter-register transfers | ||
| 150 | |||
| 151 | &pmuludq($mul1,$_n0q); # *=n0 | ||
| 152 | |||
| 153 | &pmuludq($car1,$mul1); # "t[0]"*np[0]*n0 | ||
| 154 | &paddq ($car1,$acc0); | ||
| 155 | |||
| 156 | &movd ($acc1,&DWP(4,$np)); # np[1] | ||
| 157 | &movd ($acc0,&DWP(4,$ap)); # ap[1] | ||
| 158 | |||
| 159 | &psrlq ($car0,32); | ||
| 160 | &psrlq ($car1,32); | ||
| 161 | |||
| 162 | &inc ($j); # j++ | ||
| 163 | &set_label("1st",16); | ||
| 164 | &pmuludq($acc0,$mul0); # ap[j]*bp[0] | ||
| 165 | &pmuludq($acc1,$mul1); # np[j]*m1 | ||
| 166 | &paddq ($car0,$acc0); # +=c0 | ||
| 167 | &paddq ($car1,$acc1); # +=c1 | ||
| 168 | |||
| 169 | &movq ($acc0,$car0); | ||
| 170 | &pand ($acc0,$mask); | ||
| 171 | &movd ($acc1,&DWP(4,$np,$j,4)); # np[j+1] | ||
| 172 | &paddq ($car1,$acc0); # +=ap[j]*bp[0]; | ||
| 173 | &movd ($acc0,&DWP(4,$ap,$j,4)); # ap[j+1] | ||
| 174 | &psrlq ($car0,32); | ||
| 175 | &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[j-1]= | ||
| 176 | &psrlq ($car1,32); | ||
| 177 | |||
| 178 | &lea ($j,&DWP(1,$j)); | ||
| 179 | &cmp ($j,$num); | ||
| 180 | &jl (&label("1st")); | ||
| 181 | |||
| 182 | &pmuludq($acc0,$mul0); # ap[num-1]*bp[0] | ||
| 183 | &pmuludq($acc1,$mul1); # np[num-1]*m1 | ||
| 184 | &paddq ($car0,$acc0); # +=c0 | ||
| 185 | &paddq ($car1,$acc1); # +=c1 | ||
| 186 | |||
| 187 | &movq ($acc0,$car0); | ||
| 188 | &pand ($acc0,$mask); | ||
| 189 | &paddq ($car1,$acc0); # +=ap[num-1]*bp[0]; | ||
| 190 | &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[num-2]= | ||
| 191 | |||
| 192 | &psrlq ($car0,32); | ||
| 193 | &psrlq ($car1,32); | ||
| 194 | |||
| 195 | &paddq ($car1,$car0); | ||
| 196 | &movq (&QWP($frame,"esp",$num,4),$car1); # tp[num].tp[num-1] | ||
| 197 | |||
| 198 | &inc ($i); # i++ | ||
| 199 | &set_label("outer"); | ||
| 200 | &xor ($j,$j); # j=0 | ||
| 201 | |||
| 202 | &movd ($mul0,&DWP(0,$bp,$i,4)); # bp[i] | ||
| 203 | &movd ($mul1,&DWP(0,$ap)); # ap[0] | ||
| 204 | &movd ($temp,&DWP($frame,"esp")); # tp[0] | ||
| 205 | &movd ($car1,&DWP(0,$np)); # np[0] | ||
| 206 | &pmuludq($mul1,$mul0); # ap[0]*bp[i] | ||
| 207 | |||
| 208 | &paddq ($mul1,$temp); # +=tp[0] | ||
| 209 | &movq ($acc0,$mul1); | ||
| 210 | &movq ($car0,$mul1); | ||
| 211 | &pand ($acc0,$mask); | ||
| 212 | |||
| 213 | &pmuludq($mul1,$_n0q); # *=n0 | ||
| 214 | |||
| 215 | &pmuludq($car1,$mul1); | ||
| 216 | &paddq ($car1,$acc0); | ||
| 217 | |||
| 218 | &movd ($temp,&DWP($frame+4,"esp")); # tp[1] | ||
| 219 | &movd ($acc1,&DWP(4,$np)); # np[1] | ||
| 220 | &movd ($acc0,&DWP(4,$ap)); # ap[1] | ||
| 221 | |||
| 222 | &psrlq ($car0,32); | ||
| 223 | &psrlq ($car1,32); | ||
| 224 | &paddq ($car0,$temp); # +=tp[1] | ||
| 225 | |||
| 226 | &inc ($j); # j++ | ||
| 227 | &dec ($num); | ||
| 228 | &set_label("inner"); | ||
| 229 | &pmuludq($acc0,$mul0); # ap[j]*bp[i] | ||
| 230 | &pmuludq($acc1,$mul1); # np[j]*m1 | ||
| 231 | &paddq ($car0,$acc0); # +=c0 | ||
| 232 | &paddq ($car1,$acc1); # +=c1 | ||
| 233 | |||
| 234 | &movq ($acc0,$car0); | ||
| 235 | &movd ($temp,&DWP($frame+4,"esp",$j,4));# tp[j+1] | ||
| 236 | &pand ($acc0,$mask); | ||
| 237 | &movd ($acc1,&DWP(4,$np,$j,4)); # np[j+1] | ||
| 238 | &paddq ($car1,$acc0); # +=ap[j]*bp[i]+tp[j] | ||
| 239 | &movd ($acc0,&DWP(4,$ap,$j,4)); # ap[j+1] | ||
| 240 | &psrlq ($car0,32); | ||
| 241 | &movd (&DWP($frame-4,"esp",$j,4),$car1);# tp[j-1]= | ||
| 242 | &psrlq ($car1,32); | ||
| 243 | &paddq ($car0,$temp); # +=tp[j+1] | ||
| 244 | |||
| 245 | &dec ($num); | ||
| 246 | &lea ($j,&DWP(1,$j)); # j++ | ||
| 247 | &jnz (&label("inner")); | ||
| 248 | |||
| 249 | &mov ($num,$j); | ||
| 250 | &pmuludq($acc0,$mul0); # ap[num-1]*bp[i] | ||
| 251 | &pmuludq($acc1,$mul1); # np[num-1]*m1 | ||
| 252 | &paddq ($car0,$acc0); # +=c0 | ||
| 253 | &paddq ($car1,$acc1); # +=c1 | ||
| 254 | |||
| 255 | &movq ($acc0,$car0); | ||
| 256 | &pand ($acc0,$mask); | ||
| 257 | &paddq ($car1,$acc0); # +=ap[num-1]*bp[i]+tp[num-1] | ||
| 258 | &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[num-2]= | ||
| 259 | &psrlq ($car0,32); | ||
| 260 | &psrlq ($car1,32); | ||
| 261 | |||
| 262 | &movd ($temp,&DWP($frame+4,"esp",$num,4)); # += tp[num] | ||
| 263 | &paddq ($car1,$car0); | ||
| 264 | &paddq ($car1,$temp); | ||
| 265 | &movq (&QWP($frame,"esp",$num,4),$car1); # tp[num].tp[num-1] | ||
| 266 | |||
| 267 | &lea ($i,&DWP(1,$i)); # i++ | ||
| 268 | &cmp ($i,$num); | ||
| 269 | &jle (&label("outer")); | ||
| 270 | |||
| 271 | &emms (); # done with mmx bank | ||
| 272 | &jmp (&label("common_tail")); | ||
| 273 | |||
| 274 | &set_label("non_sse2",16); | ||
| 275 | } | ||
| 276 | |||
| 277 | if (0) { | ||
| 278 | &mov ("esp",$_sp); | ||
| 279 | &xor ("eax","eax"); # signal "not fast enough [yet]" | ||
| 280 | &jmp (&label("just_leave")); | ||
| 281 | # While the below code provides competitive performance for | ||
| 282 | # all key lengthes on modern Intel cores, it's still more | ||
| 283 | # than 10% slower for 4096-bit key elsewhere:-( "Competitive" | ||
| 284 | # means compared to the original integer-only assembler. | ||
| 285 | # 512-bit RSA sign is better by ~40%, but that's about all | ||
| 286 | # one can say about all CPUs... | ||
| 287 | } else { | ||
| 288 | $inp="esi"; # integer path uses these registers differently | ||
| 289 | $word="edi"; | ||
| 290 | $carry="ebp"; | ||
| 291 | |||
| 292 | &mov ($inp,$_ap); | ||
| 293 | &lea ($carry,&DWP(1,$num)); | ||
| 294 | &mov ($word,$_bp); | ||
| 295 | &xor ($j,$j); # j=0 | ||
| 296 | &mov ("edx",$inp); | ||
| 297 | &and ($carry,1); # see if num is even | ||
| 298 | &sub ("edx",$word); # see if ap==bp | ||
| 299 | &lea ("eax",&DWP(4,$word,$num,4)); # &bp[num] | ||
| 300 | &or ($carry,"edx"); | ||
| 301 | &mov ($word,&DWP(0,$word)); # bp[0] | ||
| 302 | &jz (&label("bn_sqr_mont")); | ||
| 303 | &mov ($_bpend,"eax"); | ||
| 304 | &mov ("eax",&DWP(0,$inp)); | ||
| 305 | &xor ("edx","edx"); | ||
| 306 | |||
| 307 | &set_label("mull",16); | ||
| 308 | &mov ($carry,"edx"); | ||
| 309 | &mul ($word); # ap[j]*bp[0] | ||
| 310 | &add ($carry,"eax"); | ||
| 311 | &lea ($j,&DWP(1,$j)); | ||
| 312 | &adc ("edx",0); | ||
| 313 | &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j+1] | ||
| 314 | &cmp ($j,$num); | ||
| 315 | &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]= | ||
| 316 | &jl (&label("mull")); | ||
| 317 | |||
| 318 | &mov ($carry,"edx"); | ||
| 319 | &mul ($word); # ap[num-1]*bp[0] | ||
| 320 | &mov ($word,$_n0); | ||
| 321 | &add ("eax",$carry); | ||
| 322 | &mov ($inp,$_np); | ||
| 323 | &adc ("edx",0); | ||
| 324 | &imul ($word,&DWP($frame,"esp")); # n0*tp[0] | ||
| 325 | |||
| 326 | &mov (&DWP($frame,"esp",$num,4),"eax"); # tp[num-1]= | ||
| 327 | &xor ($j,$j); | ||
| 328 | &mov (&DWP($frame+4,"esp",$num,4),"edx"); # tp[num]= | ||
| 329 | &mov (&DWP($frame+8,"esp",$num,4),$j); # tp[num+1]= | ||
| 330 | |||
| 331 | &mov ("eax",&DWP(0,$inp)); # np[0] | ||
| 332 | &mul ($word); # np[0]*m | ||
| 333 | &add ("eax",&DWP($frame,"esp")); # +=tp[0] | ||
| 334 | &mov ("eax",&DWP(4,$inp)); # np[1] | ||
| 335 | &adc ("edx",0); | ||
| 336 | &inc ($j); | ||
| 337 | |||
| 338 | &jmp (&label("2ndmadd")); | ||
| 339 | |||
| 340 | &set_label("1stmadd",16); | ||
| 341 | &mov ($carry,"edx"); | ||
| 342 | &mul ($word); # ap[j]*bp[i] | ||
| 343 | &add ($carry,&DWP($frame,"esp",$j,4)); # +=tp[j] | ||
| 344 | &lea ($j,&DWP(1,$j)); | ||
| 345 | &adc ("edx",0); | ||
| 346 | &add ($carry,"eax"); | ||
| 347 | &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j+1] | ||
| 348 | &adc ("edx",0); | ||
| 349 | &cmp ($j,$num); | ||
| 350 | &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]= | ||
| 351 | &jl (&label("1stmadd")); | ||
| 352 | |||
| 353 | &mov ($carry,"edx"); | ||
| 354 | &mul ($word); # ap[num-1]*bp[i] | ||
| 355 | &add ("eax",&DWP($frame,"esp",$num,4)); # +=tp[num-1] | ||
| 356 | &mov ($word,$_n0); | ||
| 357 | &adc ("edx",0); | ||
| 358 | &mov ($inp,$_np); | ||
| 359 | &add ($carry,"eax"); | ||
| 360 | &adc ("edx",0); | ||
| 361 | &imul ($word,&DWP($frame,"esp")); # n0*tp[0] | ||
| 362 | |||
| 363 | &xor ($j,$j); | ||
| 364 | &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=tp[num] | ||
| 365 | &mov (&DWP($frame,"esp",$num,4),$carry); # tp[num-1]= | ||
| 366 | &adc ($j,0); | ||
| 367 | &mov ("eax",&DWP(0,$inp)); # np[0] | ||
| 368 | &mov (&DWP($frame+4,"esp",$num,4),"edx"); # tp[num]= | ||
| 369 | &mov (&DWP($frame+8,"esp",$num,4),$j); # tp[num+1]= | ||
| 370 | |||
| 371 | &mul ($word); # np[0]*m | ||
| 372 | &add ("eax",&DWP($frame,"esp")); # +=tp[0] | ||
| 373 | &mov ("eax",&DWP(4,$inp)); # np[1] | ||
| 374 | &adc ("edx",0); | ||
| 375 | &mov ($j,1); | ||
| 376 | |||
| 377 | &set_label("2ndmadd",16); | ||
| 378 | &mov ($carry,"edx"); | ||
| 379 | &mul ($word); # np[j]*m | ||
| 380 | &add ($carry,&DWP($frame,"esp",$j,4)); # +=tp[j] | ||
| 381 | &lea ($j,&DWP(1,$j)); | ||
| 382 | &adc ("edx",0); | ||
| 383 | &add ($carry,"eax"); | ||
| 384 | &mov ("eax",&DWP(0,$inp,$j,4)); # np[j+1] | ||
| 385 | &adc ("edx",0); | ||
| 386 | &cmp ($j,$num); | ||
| 387 | &mov (&DWP($frame-8,"esp",$j,4),$carry); # tp[j-1]= | ||
| 388 | &jl (&label("2ndmadd")); | ||
| 389 | |||
| 390 | &mov ($carry,"edx"); | ||
| 391 | &mul ($word); # np[j]*m | ||
| 392 | &add ($carry,&DWP($frame,"esp",$num,4)); # +=tp[num-1] | ||
| 393 | &adc ("edx",0); | ||
| 394 | &add ($carry,"eax"); | ||
| 395 | &adc ("edx",0); | ||
| 396 | &mov (&DWP($frame-4,"esp",$num,4),$carry); # tp[num-2]= | ||
| 397 | |||
| 398 | &xor ("eax","eax"); | ||
| 399 | &mov ($j,$_bp); # &bp[i] | ||
| 400 | &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=tp[num] | ||
| 401 | &adc ("eax",&DWP($frame+8,"esp",$num,4)); # +=tp[num+1] | ||
| 402 | &lea ($j,&DWP(4,$j)); | ||
| 403 | &mov (&DWP($frame,"esp",$num,4),"edx"); # tp[num-1]= | ||
| 404 | &cmp ($j,$_bpend); | ||
| 405 | &mov (&DWP($frame+4,"esp",$num,4),"eax"); # tp[num]= | ||
| 406 | &je (&label("common_tail")); | ||
| 407 | |||
| 408 | &mov ($word,&DWP(0,$j)); # bp[i+1] | ||
| 409 | &mov ($inp,$_ap); | ||
| 410 | &mov ($_bp,$j); # &bp[++i] | ||
| 411 | &xor ($j,$j); | ||
| 412 | &xor ("edx","edx"); | ||
| 413 | &mov ("eax",&DWP(0,$inp)); | ||
| 414 | &jmp (&label("1stmadd")); | ||
| 415 | |||
| 416 | &set_label("bn_sqr_mont",16); | ||
| 417 | $sbit=$num; | ||
| 418 | &mov ($_num,$num); | ||
| 419 | &mov ($_bp,$j); # i=0 | ||
| 420 | |||
| 421 | &mov ("eax",$word); # ap[0] | ||
| 422 | &mul ($word); # ap[0]*ap[0] | ||
| 423 | &mov (&DWP($frame,"esp"),"eax"); # tp[0]= | ||
| 424 | &mov ($sbit,"edx"); | ||
| 425 | &shr ("edx",1); | ||
| 426 | &and ($sbit,1); | ||
| 427 | &inc ($j); | ||
| 428 | &set_label("sqr",16); | ||
| 429 | &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j] | ||
| 430 | &mov ($carry,"edx"); | ||
| 431 | &mul ($word); # ap[j]*ap[0] | ||
| 432 | &add ("eax",$carry); | ||
| 433 | &lea ($j,&DWP(1,$j)); | ||
| 434 | &adc ("edx",0); | ||
| 435 | &lea ($carry,&DWP(0,$sbit,"eax",2)); | ||
| 436 | &shr ("eax",31); | ||
| 437 | &cmp ($j,$_num); | ||
| 438 | &mov ($sbit,"eax"); | ||
| 439 | &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]= | ||
| 440 | &jl (&label("sqr")); | ||
| 441 | |||
| 442 | &mov ("eax",&DWP(0,$inp,$j,4)); # ap[num-1] | ||
| 443 | &mov ($carry,"edx"); | ||
| 444 | &mul ($word); # ap[num-1]*ap[0] | ||
| 445 | &add ("eax",$carry); | ||
| 446 | &mov ($word,$_n0); | ||
| 447 | &adc ("edx",0); | ||
| 448 | &mov ($inp,$_np); | ||
| 449 | &lea ($carry,&DWP(0,$sbit,"eax",2)); | ||
| 450 | &imul ($word,&DWP($frame,"esp")); # n0*tp[0] | ||
| 451 | &shr ("eax",31); | ||
| 452 | &mov (&DWP($frame,"esp",$j,4),$carry); # tp[num-1]= | ||
| 453 | |||
| 454 | &lea ($carry,&DWP(0,"eax","edx",2)); | ||
| 455 | &mov ("eax",&DWP(0,$inp)); # np[0] | ||
| 456 | &shr ("edx",31); | ||
| 457 | &mov (&DWP($frame+4,"esp",$j,4),$carry); # tp[num]= | ||
| 458 | &mov (&DWP($frame+8,"esp",$j,4),"edx"); # tp[num+1]= | ||
| 459 | |||
| 460 | &mul ($word); # np[0]*m | ||
| 461 | &add ("eax",&DWP($frame,"esp")); # +=tp[0] | ||
| 462 | &mov ($num,$j); | ||
| 463 | &adc ("edx",0); | ||
| 464 | &mov ("eax",&DWP(4,$inp)); # np[1] | ||
| 465 | &mov ($j,1); | ||
| 466 | |||
| 467 | &set_label("3rdmadd",16); | ||
| 468 | &mov ($carry,"edx"); | ||
| 469 | &mul ($word); # np[j]*m | ||
| 470 | &add ($carry,&DWP($frame,"esp",$j,4)); # +=tp[j] | ||
| 471 | &adc ("edx",0); | ||
| 472 | &add ($carry,"eax"); | ||
| 473 | &mov ("eax",&DWP(4,$inp,$j,4)); # np[j+1] | ||
| 474 | &adc ("edx",0); | ||
| 475 | &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j-1]= | ||
| 476 | |||
| 477 | &mov ($carry,"edx"); | ||
| 478 | &mul ($word); # np[j+1]*m | ||
| 479 | &add ($carry,&DWP($frame+4,"esp",$j,4)); # +=tp[j+1] | ||
| 480 | &lea ($j,&DWP(2,$j)); | ||
| 481 | &adc ("edx",0); | ||
| 482 | &add ($carry,"eax"); | ||
| 483 | &mov ("eax",&DWP(0,$inp,$j,4)); # np[j+2] | ||
| 484 | &adc ("edx",0); | ||
| 485 | &cmp ($j,$num); | ||
| 486 | &mov (&DWP($frame-8,"esp",$j,4),$carry); # tp[j]= | ||
| 487 | &jl (&label("3rdmadd")); | ||
| 488 | |||
| 489 | &mov ($carry,"edx"); | ||
| 490 | &mul ($word); # np[j]*m | ||
| 491 | &add ($carry,&DWP($frame,"esp",$num,4)); # +=tp[num-1] | ||
| 492 | &adc ("edx",0); | ||
| 493 | &add ($carry,"eax"); | ||
| 494 | &adc ("edx",0); | ||
| 495 | &mov (&DWP($frame-4,"esp",$num,4),$carry); # tp[num-2]= | ||
| 496 | |||
| 497 | &mov ($j,$_bp); # i | ||
| 498 | &xor ("eax","eax"); | ||
| 499 | &mov ($inp,$_ap); | ||
| 500 | &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=tp[num] | ||
| 501 | &adc ("eax",&DWP($frame+8,"esp",$num,4)); # +=tp[num+1] | ||
| 502 | &mov (&DWP($frame,"esp",$num,4),"edx"); # tp[num-1]= | ||
| 503 | &cmp ($j,$num); | ||
| 504 | &mov (&DWP($frame+4,"esp",$num,4),"eax"); # tp[num]= | ||
| 505 | &je (&label("common_tail")); | ||
| 506 | |||
| 507 | &mov ($word,&DWP(4,$inp,$j,4)); # ap[i] | ||
| 508 | &lea ($j,&DWP(1,$j)); | ||
| 509 | &mov ("eax",$word); | ||
| 510 | &mov ($_bp,$j); # ++i | ||
| 511 | &mul ($word); # ap[i]*ap[i] | ||
| 512 | &add ("eax",&DWP($frame,"esp",$j,4)); # +=tp[i] | ||
| 513 | &adc ("edx",0); | ||
| 514 | &mov (&DWP($frame,"esp",$j,4),"eax"); # tp[i]= | ||
| 515 | &xor ($carry,$carry); | ||
| 516 | &cmp ($j,$num); | ||
| 517 | &lea ($j,&DWP(1,$j)); | ||
| 518 | &je (&label("sqrlast")); | ||
| 519 | |||
| 520 | &mov ($sbit,"edx"); # zaps $num | ||
| 521 | &shr ("edx",1); | ||
| 522 | &and ($sbit,1); | ||
| 523 | &set_label("sqradd",16); | ||
| 524 | &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j] | ||
| 525 | &mov ($carry,"edx"); | ||
| 526 | &mul ($word); # ap[j]*ap[i] | ||
| 527 | &add ("eax",$carry); | ||
| 528 | &lea ($carry,&DWP(0,"eax","eax")); | ||
| 529 | &adc ("edx",0); | ||
| 530 | &shr ("eax",31); | ||
| 531 | &add ($carry,&DWP($frame,"esp",$j,4)); # +=tp[j] | ||
| 532 | &lea ($j,&DWP(1,$j)); | ||
| 533 | &adc ("eax",0); | ||
| 534 | &add ($carry,$sbit); | ||
| 535 | &adc ("eax",0); | ||
| 536 | &cmp ($j,$_num); | ||
| 537 | &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]= | ||
| 538 | &mov ($sbit,"eax"); | ||
| 539 | &jle (&label("sqradd")); | ||
| 540 | |||
| 541 | &mov ($carry,"edx"); | ||
| 542 | &lea ("edx",&DWP(0,$sbit,"edx",2)); | ||
| 543 | &shr ($carry,31); | ||
| 544 | &set_label("sqrlast"); | ||
| 545 | &mov ($word,$_n0); | ||
| 546 | &mov ($inp,$_np); | ||
| 547 | &imul ($word,&DWP($frame,"esp")); # n0*tp[0] | ||
| 548 | |||
| 549 | &add ("edx",&DWP($frame,"esp",$j,4)); # +=tp[num] | ||
| 550 | &mov ("eax",&DWP(0,$inp)); # np[0] | ||
| 551 | &adc ($carry,0); | ||
| 552 | &mov (&DWP($frame,"esp",$j,4),"edx"); # tp[num]= | ||
| 553 | &mov (&DWP($frame+4,"esp",$j,4),$carry); # tp[num+1]= | ||
| 554 | |||
| 555 | &mul ($word); # np[0]*m | ||
| 556 | &add ("eax",&DWP($frame,"esp")); # +=tp[0] | ||
| 557 | &lea ($num,&DWP(-1,$j)); | ||
| 558 | &adc ("edx",0); | ||
| 559 | &mov ($j,1); | ||
| 560 | &mov ("eax",&DWP(4,$inp)); # np[1] | ||
| 561 | |||
| 562 | &jmp (&label("3rdmadd")); | ||
| 563 | } | ||
| 564 | |||
| 565 | &set_label("common_tail",16); | ||
| 566 | &mov ($np,$_np); # load modulus pointer | ||
| 567 | &mov ($rp,$_rp); # load result pointer | ||
| 568 | &lea ($tp,&DWP($frame,"esp")); # [$ap and $bp are zapped] | ||
| 569 | |||
| 570 | &mov ("eax",&DWP(0,$tp)); # tp[0] | ||
| 571 | &mov ($j,$num); # j=num-1 | ||
| 572 | &xor ($i,$i); # i=0 and clear CF! | ||
| 573 | |||
| 574 | &set_label("sub",16); | ||
| 575 | &sbb ("eax",&DWP(0,$np,$i,4)); | ||
| 576 | &mov (&DWP(0,$rp,$i,4),"eax"); # rp[i]=tp[i]-np[i] | ||
| 577 | &dec ($j); # doesn't affect CF! | ||
| 578 | &mov ("eax",&DWP(4,$tp,$i,4)); # tp[i+1] | ||
| 579 | &lea ($i,&DWP(1,$i)); # i++ | ||
| 580 | &jge (&label("sub")); | ||
| 581 | |||
| 582 | &sbb ("eax",0); # handle upmost overflow bit | ||
| 583 | &and ($tp,"eax"); | ||
| 584 | ¬ ("eax"); | ||
| 585 | &mov ($np,$rp); | ||
| 586 | &and ($np,"eax"); | ||
| 587 | &or ($tp,$np); # tp=carry?tp:rp | ||
| 588 | |||
| 589 | &set_label("copy",16); # copy or in-place refresh | ||
| 590 | &mov ("eax",&DWP(0,$tp,$num,4)); | ||
| 591 | &mov (&DWP(0,$rp,$num,4),"eax"); # rp[i]=tp[i] | ||
| 592 | &mov (&DWP($frame,"esp",$num,4),$j); # zap temporary vector | ||
| 593 | &dec ($num); | ||
| 594 | &jge (&label("copy")); | ||
| 595 | |||
| 596 | &mov ("esp",$_sp); # pull saved stack pointer | ||
| 597 | &mov ("eax",1); | ||
| 598 | &set_label("just_leave"); | ||
| 599 | &function_end("bn_mul_mont"); | ||
| 600 | |||
| 601 | &asciz("Montgomery Multiplication for x86, CRYPTOGAMS by <appro\@openssl.org>"); | ||
| 602 | |||
| 603 | &asm_finish(); | ||
diff --git a/src/lib/libcrypto/bn/asm/pa-risc.s b/src/lib/libcrypto/bn/asm/pa-risc.s deleted file mode 100644 index 775130a191..0000000000 --- a/src/lib/libcrypto/bn/asm/pa-risc.s +++ /dev/null | |||
| @@ -1,710 +0,0 @@ | |||
| 1 | .SPACE $PRIVATE$ | ||
| 2 | .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31 | ||
| 3 | .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82 | ||
| 4 | .SPACE $TEXT$ | ||
| 5 | .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44 | ||
| 6 | .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY | ||
| 7 | .IMPORT $global$,DATA | ||
| 8 | .IMPORT $$dyncall,MILLICODE | ||
| 9 | ; gcc_compiled.: | ||
| 10 | .SPACE $TEXT$ | ||
| 11 | .SUBSPA $CODE$ | ||
| 12 | |||
| 13 | .align 4 | ||
| 14 | .EXPORT bn_mul_add_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR | ||
| 15 | bn_mul_add_words | ||
| 16 | .PROC | ||
| 17 | .CALLINFO FRAME=0,CALLS,SAVE_RP | ||
| 18 | .ENTRY | ||
| 19 | stw %r2,-20(0,%r30) | ||
| 20 | ldi 0,%r28 | ||
| 21 | extru %r23,31,16,%r2 | ||
| 22 | stw %r2,-16(0,%r30) | ||
| 23 | extru %r23,15,16,%r23 | ||
| 24 | ldil L'65536,%r31 | ||
| 25 | fldws -16(0,%r30),%fr11R | ||
| 26 | stw %r23,-16(0,%r30) | ||
| 27 | ldo 12(%r25),%r29 | ||
| 28 | ldo 12(%r26),%r23 | ||
| 29 | fldws -16(0,%r30),%fr11L | ||
| 30 | L$0002 | ||
| 31 | ldw 0(0,%r25),%r19 | ||
| 32 | extru %r19,31,16,%r20 | ||
| 33 | stw %r20,-16(0,%r30) | ||
| 34 | extru %r19,15,16,%r19 | ||
| 35 | fldws -16(0,%r30),%fr22L | ||
| 36 | stw %r19,-16(0,%r30) | ||
| 37 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 38 | fldws -16(0,%r30),%fr22L | ||
| 39 | fstws %fr8R,-16(0,%r30) | ||
| 40 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 41 | ldw -16(0,%r30),%r2 | ||
| 42 | stw %r20,-16(0,%r30) | ||
| 43 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 44 | fldws -16(0,%r30),%fr22L | ||
| 45 | fstws %fr10R,-16(0,%r30) | ||
| 46 | copy %r2,%r22 | ||
| 47 | ldw -16(0,%r30),%r2 | ||
| 48 | fstws %fr9R,-16(0,%r30) | ||
| 49 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 50 | copy %r2,%r19 | ||
| 51 | ldw -16(0,%r30),%r2 | ||
| 52 | fstws %fr8R,-16(0,%r30) | ||
| 53 | copy %r2,%r20 | ||
| 54 | ldw -16(0,%r30),%r2 | ||
| 55 | addl %r2,%r19,%r21 | ||
| 56 | comclr,<<= %r19,%r21,0 | ||
| 57 | addl %r20,%r31,%r20 | ||
| 58 | L$0005 | ||
| 59 | extru %r21,15,16,%r19 | ||
| 60 | addl %r20,%r19,%r20 | ||
| 61 | zdep %r21,15,16,%r19 | ||
| 62 | addl %r22,%r19,%r22 | ||
| 63 | comclr,<<= %r19,%r22,0 | ||
| 64 | addi,tr 1,%r20,%r19 | ||
| 65 | copy %r20,%r19 | ||
| 66 | addl %r22,%r28,%r20 | ||
| 67 | comclr,<<= %r28,%r20,0 | ||
| 68 | addi 1,%r19,%r19 | ||
| 69 | ldw 0(0,%r26),%r28 | ||
| 70 | addl %r20,%r28,%r20 | ||
| 71 | comclr,<<= %r28,%r20,0 | ||
| 72 | addi,tr 1,%r19,%r28 | ||
| 73 | copy %r19,%r28 | ||
| 74 | addib,= -1,%r24,L$0003 | ||
| 75 | stw %r20,0(0,%r26) | ||
| 76 | ldw -8(0,%r29),%r19 | ||
| 77 | extru %r19,31,16,%r20 | ||
| 78 | stw %r20,-16(0,%r30) | ||
| 79 | extru %r19,15,16,%r19 | ||
| 80 | fldws -16(0,%r30),%fr22L | ||
| 81 | stw %r19,-16(0,%r30) | ||
| 82 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 83 | fldws -16(0,%r30),%fr22L | ||
| 84 | fstws %fr8R,-16(0,%r30) | ||
| 85 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 86 | ldw -16(0,%r30),%r2 | ||
| 87 | stw %r20,-16(0,%r30) | ||
| 88 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 89 | fldws -16(0,%r30),%fr22L | ||
| 90 | fstws %fr10R,-16(0,%r30) | ||
| 91 | copy %r2,%r22 | ||
| 92 | ldw -16(0,%r30),%r2 | ||
| 93 | fstws %fr9R,-16(0,%r30) | ||
| 94 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 95 | copy %r2,%r19 | ||
| 96 | ldw -16(0,%r30),%r2 | ||
| 97 | fstws %fr8R,-16(0,%r30) | ||
| 98 | copy %r2,%r20 | ||
| 99 | ldw -16(0,%r30),%r2 | ||
| 100 | addl %r2,%r19,%r21 | ||
| 101 | comclr,<<= %r19,%r21,0 | ||
| 102 | addl %r20,%r31,%r20 | ||
| 103 | L$0010 | ||
| 104 | extru %r21,15,16,%r19 | ||
| 105 | addl %r20,%r19,%r20 | ||
| 106 | zdep %r21,15,16,%r19 | ||
| 107 | addl %r22,%r19,%r22 | ||
| 108 | comclr,<<= %r19,%r22,0 | ||
| 109 | addi,tr 1,%r20,%r19 | ||
| 110 | copy %r20,%r19 | ||
| 111 | addl %r22,%r28,%r20 | ||
| 112 | comclr,<<= %r28,%r20,0 | ||
| 113 | addi 1,%r19,%r19 | ||
| 114 | ldw -8(0,%r23),%r28 | ||
| 115 | addl %r20,%r28,%r20 | ||
| 116 | comclr,<<= %r28,%r20,0 | ||
| 117 | addi,tr 1,%r19,%r28 | ||
| 118 | copy %r19,%r28 | ||
| 119 | addib,= -1,%r24,L$0003 | ||
| 120 | stw %r20,-8(0,%r23) | ||
| 121 | ldw -4(0,%r29),%r19 | ||
| 122 | extru %r19,31,16,%r20 | ||
| 123 | stw %r20,-16(0,%r30) | ||
| 124 | extru %r19,15,16,%r19 | ||
| 125 | fldws -16(0,%r30),%fr22L | ||
| 126 | stw %r19,-16(0,%r30) | ||
| 127 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 128 | fldws -16(0,%r30),%fr22L | ||
| 129 | fstws %fr8R,-16(0,%r30) | ||
| 130 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 131 | ldw -16(0,%r30),%r2 | ||
| 132 | stw %r20,-16(0,%r30) | ||
| 133 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 134 | fldws -16(0,%r30),%fr22L | ||
| 135 | fstws %fr10R,-16(0,%r30) | ||
| 136 | copy %r2,%r22 | ||
| 137 | ldw -16(0,%r30),%r2 | ||
| 138 | fstws %fr9R,-16(0,%r30) | ||
| 139 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 140 | copy %r2,%r19 | ||
| 141 | ldw -16(0,%r30),%r2 | ||
| 142 | fstws %fr8R,-16(0,%r30) | ||
| 143 | copy %r2,%r20 | ||
| 144 | ldw -16(0,%r30),%r2 | ||
| 145 | addl %r2,%r19,%r21 | ||
| 146 | comclr,<<= %r19,%r21,0 | ||
| 147 | addl %r20,%r31,%r20 | ||
| 148 | L$0015 | ||
| 149 | extru %r21,15,16,%r19 | ||
| 150 | addl %r20,%r19,%r20 | ||
| 151 | zdep %r21,15,16,%r19 | ||
| 152 | addl %r22,%r19,%r22 | ||
| 153 | comclr,<<= %r19,%r22,0 | ||
| 154 | addi,tr 1,%r20,%r19 | ||
| 155 | copy %r20,%r19 | ||
| 156 | addl %r22,%r28,%r20 | ||
| 157 | comclr,<<= %r28,%r20,0 | ||
| 158 | addi 1,%r19,%r19 | ||
| 159 | ldw -4(0,%r23),%r28 | ||
| 160 | addl %r20,%r28,%r20 | ||
| 161 | comclr,<<= %r28,%r20,0 | ||
| 162 | addi,tr 1,%r19,%r28 | ||
| 163 | copy %r19,%r28 | ||
| 164 | addib,= -1,%r24,L$0003 | ||
| 165 | stw %r20,-4(0,%r23) | ||
| 166 | ldw 0(0,%r29),%r19 | ||
| 167 | extru %r19,31,16,%r20 | ||
| 168 | stw %r20,-16(0,%r30) | ||
| 169 | extru %r19,15,16,%r19 | ||
| 170 | fldws -16(0,%r30),%fr22L | ||
| 171 | stw %r19,-16(0,%r30) | ||
| 172 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 173 | fldws -16(0,%r30),%fr22L | ||
| 174 | fstws %fr8R,-16(0,%r30) | ||
| 175 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 176 | ldw -16(0,%r30),%r2 | ||
| 177 | stw %r20,-16(0,%r30) | ||
| 178 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 179 | fldws -16(0,%r30),%fr22L | ||
| 180 | fstws %fr10R,-16(0,%r30) | ||
| 181 | copy %r2,%r22 | ||
| 182 | ldw -16(0,%r30),%r2 | ||
| 183 | fstws %fr9R,-16(0,%r30) | ||
| 184 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 185 | copy %r2,%r19 | ||
| 186 | ldw -16(0,%r30),%r2 | ||
| 187 | fstws %fr8R,-16(0,%r30) | ||
| 188 | copy %r2,%r20 | ||
| 189 | ldw -16(0,%r30),%r2 | ||
| 190 | addl %r2,%r19,%r21 | ||
| 191 | comclr,<<= %r19,%r21,0 | ||
| 192 | addl %r20,%r31,%r20 | ||
| 193 | L$0020 | ||
| 194 | extru %r21,15,16,%r19 | ||
| 195 | addl %r20,%r19,%r20 | ||
| 196 | zdep %r21,15,16,%r19 | ||
| 197 | addl %r22,%r19,%r22 | ||
| 198 | comclr,<<= %r19,%r22,0 | ||
| 199 | addi,tr 1,%r20,%r19 | ||
| 200 | copy %r20,%r19 | ||
| 201 | addl %r22,%r28,%r20 | ||
| 202 | comclr,<<= %r28,%r20,0 | ||
| 203 | addi 1,%r19,%r19 | ||
| 204 | ldw 0(0,%r23),%r28 | ||
| 205 | addl %r20,%r28,%r20 | ||
| 206 | comclr,<<= %r28,%r20,0 | ||
| 207 | addi,tr 1,%r19,%r28 | ||
| 208 | copy %r19,%r28 | ||
| 209 | addib,= -1,%r24,L$0003 | ||
| 210 | stw %r20,0(0,%r23) | ||
| 211 | ldo 16(%r29),%r29 | ||
| 212 | ldo 16(%r25),%r25 | ||
| 213 | ldo 16(%r23),%r23 | ||
| 214 | bl L$0002,0 | ||
| 215 | ldo 16(%r26),%r26 | ||
| 216 | L$0003 | ||
| 217 | ldw -20(0,%r30),%r2 | ||
| 218 | bv,n 0(%r2) | ||
| 219 | .EXIT | ||
| 220 | .PROCEND | ||
| 221 | .align 4 | ||
| 222 | .EXPORT bn_mul_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR | ||
| 223 | bn_mul_words | ||
| 224 | .PROC | ||
| 225 | .CALLINFO FRAME=0,CALLS,SAVE_RP | ||
| 226 | .ENTRY | ||
| 227 | stw %r2,-20(0,%r30) | ||
| 228 | ldi 0,%r28 | ||
| 229 | extru %r23,31,16,%r2 | ||
| 230 | stw %r2,-16(0,%r30) | ||
| 231 | extru %r23,15,16,%r23 | ||
| 232 | ldil L'65536,%r31 | ||
| 233 | fldws -16(0,%r30),%fr11R | ||
| 234 | stw %r23,-16(0,%r30) | ||
| 235 | ldo 12(%r26),%r29 | ||
| 236 | ldo 12(%r25),%r23 | ||
| 237 | fldws -16(0,%r30),%fr11L | ||
| 238 | L$0026 | ||
| 239 | ldw 0(0,%r25),%r19 | ||
| 240 | extru %r19,31,16,%r20 | ||
| 241 | stw %r20,-16(0,%r30) | ||
| 242 | extru %r19,15,16,%r19 | ||
| 243 | fldws -16(0,%r30),%fr22L | ||
| 244 | stw %r19,-16(0,%r30) | ||
| 245 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 246 | fldws -16(0,%r30),%fr22L | ||
| 247 | fstws %fr8R,-16(0,%r30) | ||
| 248 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 249 | ldw -16(0,%r30),%r2 | ||
| 250 | stw %r20,-16(0,%r30) | ||
| 251 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 252 | fldws -16(0,%r30),%fr22L | ||
| 253 | fstws %fr10R,-16(0,%r30) | ||
| 254 | copy %r2,%r22 | ||
| 255 | ldw -16(0,%r30),%r2 | ||
| 256 | fstws %fr9R,-16(0,%r30) | ||
| 257 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 258 | copy %r2,%r19 | ||
| 259 | ldw -16(0,%r30),%r2 | ||
| 260 | fstws %fr8R,-16(0,%r30) | ||
| 261 | copy %r2,%r20 | ||
| 262 | ldw -16(0,%r30),%r2 | ||
| 263 | addl %r2,%r19,%r21 | ||
| 264 | comclr,<<= %r19,%r21,0 | ||
| 265 | addl %r20,%r31,%r20 | ||
| 266 | L$0029 | ||
| 267 | extru %r21,15,16,%r19 | ||
| 268 | addl %r20,%r19,%r20 | ||
| 269 | zdep %r21,15,16,%r19 | ||
| 270 | addl %r22,%r19,%r22 | ||
| 271 | comclr,<<= %r19,%r22,0 | ||
| 272 | addi,tr 1,%r20,%r19 | ||
| 273 | copy %r20,%r19 | ||
| 274 | addl %r22,%r28,%r20 | ||
| 275 | comclr,<<= %r28,%r20,0 | ||
| 276 | addi,tr 1,%r19,%r28 | ||
| 277 | copy %r19,%r28 | ||
| 278 | addib,= -1,%r24,L$0027 | ||
| 279 | stw %r20,0(0,%r26) | ||
| 280 | ldw -8(0,%r23),%r19 | ||
| 281 | extru %r19,31,16,%r20 | ||
| 282 | stw %r20,-16(0,%r30) | ||
| 283 | extru %r19,15,16,%r19 | ||
| 284 | fldws -16(0,%r30),%fr22L | ||
| 285 | stw %r19,-16(0,%r30) | ||
| 286 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 287 | fldws -16(0,%r30),%fr22L | ||
| 288 | fstws %fr8R,-16(0,%r30) | ||
| 289 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 290 | ldw -16(0,%r30),%r2 | ||
| 291 | stw %r20,-16(0,%r30) | ||
| 292 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 293 | fldws -16(0,%r30),%fr22L | ||
| 294 | fstws %fr10R,-16(0,%r30) | ||
| 295 | copy %r2,%r22 | ||
| 296 | ldw -16(0,%r30),%r2 | ||
| 297 | fstws %fr9R,-16(0,%r30) | ||
| 298 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 299 | copy %r2,%r19 | ||
| 300 | ldw -16(0,%r30),%r2 | ||
| 301 | fstws %fr8R,-16(0,%r30) | ||
| 302 | copy %r2,%r20 | ||
| 303 | ldw -16(0,%r30),%r2 | ||
| 304 | addl %r2,%r19,%r21 | ||
| 305 | comclr,<<= %r19,%r21,0 | ||
| 306 | addl %r20,%r31,%r20 | ||
| 307 | L$0033 | ||
| 308 | extru %r21,15,16,%r19 | ||
| 309 | addl %r20,%r19,%r20 | ||
| 310 | zdep %r21,15,16,%r19 | ||
| 311 | addl %r22,%r19,%r22 | ||
| 312 | comclr,<<= %r19,%r22,0 | ||
| 313 | addi,tr 1,%r20,%r19 | ||
| 314 | copy %r20,%r19 | ||
| 315 | addl %r22,%r28,%r20 | ||
| 316 | comclr,<<= %r28,%r20,0 | ||
| 317 | addi,tr 1,%r19,%r28 | ||
| 318 | copy %r19,%r28 | ||
| 319 | addib,= -1,%r24,L$0027 | ||
| 320 | stw %r20,-8(0,%r29) | ||
| 321 | ldw -4(0,%r23),%r19 | ||
| 322 | extru %r19,31,16,%r20 | ||
| 323 | stw %r20,-16(0,%r30) | ||
| 324 | extru %r19,15,16,%r19 | ||
| 325 | fldws -16(0,%r30),%fr22L | ||
| 326 | stw %r19,-16(0,%r30) | ||
| 327 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 328 | fldws -16(0,%r30),%fr22L | ||
| 329 | fstws %fr8R,-16(0,%r30) | ||
| 330 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 331 | ldw -16(0,%r30),%r2 | ||
| 332 | stw %r20,-16(0,%r30) | ||
| 333 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 334 | fldws -16(0,%r30),%fr22L | ||
| 335 | fstws %fr10R,-16(0,%r30) | ||
| 336 | copy %r2,%r22 | ||
| 337 | ldw -16(0,%r30),%r2 | ||
| 338 | fstws %fr9R,-16(0,%r30) | ||
| 339 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 340 | copy %r2,%r19 | ||
| 341 | ldw -16(0,%r30),%r2 | ||
| 342 | fstws %fr8R,-16(0,%r30) | ||
| 343 | copy %r2,%r20 | ||
| 344 | ldw -16(0,%r30),%r2 | ||
| 345 | addl %r2,%r19,%r21 | ||
| 346 | comclr,<<= %r19,%r21,0 | ||
| 347 | addl %r20,%r31,%r20 | ||
| 348 | L$0037 | ||
| 349 | extru %r21,15,16,%r19 | ||
| 350 | addl %r20,%r19,%r20 | ||
| 351 | zdep %r21,15,16,%r19 | ||
| 352 | addl %r22,%r19,%r22 | ||
| 353 | comclr,<<= %r19,%r22,0 | ||
| 354 | addi,tr 1,%r20,%r19 | ||
| 355 | copy %r20,%r19 | ||
| 356 | addl %r22,%r28,%r20 | ||
| 357 | comclr,<<= %r28,%r20,0 | ||
| 358 | addi,tr 1,%r19,%r28 | ||
| 359 | copy %r19,%r28 | ||
| 360 | addib,= -1,%r24,L$0027 | ||
| 361 | stw %r20,-4(0,%r29) | ||
| 362 | ldw 0(0,%r23),%r19 | ||
| 363 | extru %r19,31,16,%r20 | ||
| 364 | stw %r20,-16(0,%r30) | ||
| 365 | extru %r19,15,16,%r19 | ||
| 366 | fldws -16(0,%r30),%fr22L | ||
| 367 | stw %r19,-16(0,%r30) | ||
| 368 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 369 | fldws -16(0,%r30),%fr22L | ||
| 370 | fstws %fr8R,-16(0,%r30) | ||
| 371 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 372 | ldw -16(0,%r30),%r2 | ||
| 373 | stw %r20,-16(0,%r30) | ||
| 374 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 375 | fldws -16(0,%r30),%fr22L | ||
| 376 | fstws %fr10R,-16(0,%r30) | ||
| 377 | copy %r2,%r22 | ||
| 378 | ldw -16(0,%r30),%r2 | ||
| 379 | fstws %fr9R,-16(0,%r30) | ||
| 380 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 381 | copy %r2,%r19 | ||
| 382 | ldw -16(0,%r30),%r2 | ||
| 383 | fstws %fr8R,-16(0,%r30) | ||
| 384 | copy %r2,%r20 | ||
| 385 | ldw -16(0,%r30),%r2 | ||
| 386 | addl %r2,%r19,%r21 | ||
| 387 | comclr,<<= %r19,%r21,0 | ||
| 388 | addl %r20,%r31,%r20 | ||
| 389 | L$0041 | ||
| 390 | extru %r21,15,16,%r19 | ||
| 391 | addl %r20,%r19,%r20 | ||
| 392 | zdep %r21,15,16,%r19 | ||
| 393 | addl %r22,%r19,%r22 | ||
| 394 | comclr,<<= %r19,%r22,0 | ||
| 395 | addi,tr 1,%r20,%r19 | ||
| 396 | copy %r20,%r19 | ||
| 397 | addl %r22,%r28,%r20 | ||
| 398 | comclr,<<= %r28,%r20,0 | ||
| 399 | addi,tr 1,%r19,%r28 | ||
| 400 | copy %r19,%r28 | ||
| 401 | addib,= -1,%r24,L$0027 | ||
| 402 | stw %r20,0(0,%r29) | ||
| 403 | ldo 16(%r23),%r23 | ||
| 404 | ldo 16(%r25),%r25 | ||
| 405 | ldo 16(%r29),%r29 | ||
| 406 | bl L$0026,0 | ||
| 407 | ldo 16(%r26),%r26 | ||
| 408 | L$0027 | ||
| 409 | ldw -20(0,%r30),%r2 | ||
| 410 | bv,n 0(%r2) | ||
| 411 | .EXIT | ||
| 412 | .PROCEND | ||
| 413 | .align 4 | ||
| 414 | .EXPORT bn_sqr_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR | ||
| 415 | bn_sqr_words | ||
| 416 | .PROC | ||
| 417 | .CALLINFO FRAME=0,NO_CALLS | ||
| 418 | .ENTRY | ||
| 419 | ldo 28(%r26),%r23 | ||
| 420 | ldo 12(%r25),%r28 | ||
| 421 | L$0046 | ||
| 422 | ldw 0(0,%r25),%r21 | ||
| 423 | extru %r21,31,16,%r22 | ||
| 424 | stw %r22,-16(0,%r30) | ||
| 425 | extru %r21,15,16,%r21 | ||
| 426 | fldws -16(0,%r30),%fr10L | ||
| 427 | stw %r21,-16(0,%r30) | ||
| 428 | fldws -16(0,%r30),%fr10R | ||
| 429 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 430 | fstws %fr8R,-16(0,%r30) | ||
| 431 | ldw -16(0,%r30),%r29 | ||
| 432 | stw %r22,-16(0,%r30) | ||
| 433 | fldws -16(0,%r30),%fr10R | ||
| 434 | stw %r21,-16(0,%r30) | ||
| 435 | copy %r29,%r19 | ||
| 436 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 437 | fldws -16(0,%r30),%fr10L | ||
| 438 | stw %r21,-16(0,%r30) | ||
| 439 | fldws -16(0,%r30),%fr10R | ||
| 440 | fstws %fr8R,-16(0,%r30) | ||
| 441 | extru %r19,16,17,%r20 | ||
| 442 | zdep %r19,14,15,%r19 | ||
| 443 | ldw -16(0,%r30),%r29 | ||
| 444 | xmpyu %fr10L,%fr10R,%fr9 | ||
| 445 | addl %r29,%r19,%r22 | ||
| 446 | stw %r22,0(0,%r26) | ||
| 447 | fstws %fr9R,-16(0,%r30) | ||
| 448 | ldw -16(0,%r30),%r29 | ||
| 449 | addl %r29,%r20,%r21 | ||
| 450 | comclr,<<= %r19,%r22,0 | ||
| 451 | addi 1,%r21,%r21 | ||
| 452 | addib,= -1,%r24,L$0057 | ||
| 453 | stw %r21,-24(0,%r23) | ||
| 454 | ldw -8(0,%r28),%r21 | ||
| 455 | extru %r21,31,16,%r22 | ||
| 456 | stw %r22,-16(0,%r30) | ||
| 457 | extru %r21,15,16,%r21 | ||
| 458 | fldws -16(0,%r30),%fr10L | ||
| 459 | stw %r21,-16(0,%r30) | ||
| 460 | fldws -16(0,%r30),%fr10R | ||
| 461 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 462 | fstws %fr8R,-16(0,%r30) | ||
| 463 | ldw -16(0,%r30),%r29 | ||
| 464 | stw %r22,-16(0,%r30) | ||
| 465 | fldws -16(0,%r30),%fr10R | ||
| 466 | stw %r21,-16(0,%r30) | ||
| 467 | copy %r29,%r19 | ||
| 468 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 469 | fldws -16(0,%r30),%fr10L | ||
| 470 | stw %r21,-16(0,%r30) | ||
| 471 | fldws -16(0,%r30),%fr10R | ||
| 472 | fstws %fr8R,-16(0,%r30) | ||
| 473 | extru %r19,16,17,%r20 | ||
| 474 | zdep %r19,14,15,%r19 | ||
| 475 | ldw -16(0,%r30),%r29 | ||
| 476 | xmpyu %fr10L,%fr10R,%fr9 | ||
| 477 | addl %r29,%r19,%r22 | ||
| 478 | stw %r22,-20(0,%r23) | ||
| 479 | fstws %fr9R,-16(0,%r30) | ||
| 480 | ldw -16(0,%r30),%r29 | ||
| 481 | addl %r29,%r20,%r21 | ||
| 482 | comclr,<<= %r19,%r22,0 | ||
| 483 | addi 1,%r21,%r21 | ||
| 484 | addib,= -1,%r24,L$0057 | ||
| 485 | stw %r21,-16(0,%r23) | ||
| 486 | ldw -4(0,%r28),%r21 | ||
| 487 | extru %r21,31,16,%r22 | ||
| 488 | stw %r22,-16(0,%r30) | ||
| 489 | extru %r21,15,16,%r21 | ||
| 490 | fldws -16(0,%r30),%fr10L | ||
| 491 | stw %r21,-16(0,%r30) | ||
| 492 | fldws -16(0,%r30),%fr10R | ||
| 493 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 494 | fstws %fr8R,-16(0,%r30) | ||
| 495 | ldw -16(0,%r30),%r29 | ||
| 496 | stw %r22,-16(0,%r30) | ||
| 497 | fldws -16(0,%r30),%fr10R | ||
| 498 | stw %r21,-16(0,%r30) | ||
| 499 | copy %r29,%r19 | ||
| 500 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 501 | fldws -16(0,%r30),%fr10L | ||
| 502 | stw %r21,-16(0,%r30) | ||
| 503 | fldws -16(0,%r30),%fr10R | ||
| 504 | fstws %fr8R,-16(0,%r30) | ||
| 505 | extru %r19,16,17,%r20 | ||
| 506 | zdep %r19,14,15,%r19 | ||
| 507 | ldw -16(0,%r30),%r29 | ||
| 508 | xmpyu %fr10L,%fr10R,%fr9 | ||
| 509 | addl %r29,%r19,%r22 | ||
| 510 | stw %r22,-12(0,%r23) | ||
| 511 | fstws %fr9R,-16(0,%r30) | ||
| 512 | ldw -16(0,%r30),%r29 | ||
| 513 | addl %r29,%r20,%r21 | ||
| 514 | comclr,<<= %r19,%r22,0 | ||
| 515 | addi 1,%r21,%r21 | ||
| 516 | addib,= -1,%r24,L$0057 | ||
| 517 | stw %r21,-8(0,%r23) | ||
| 518 | ldw 0(0,%r28),%r21 | ||
| 519 | extru %r21,31,16,%r22 | ||
| 520 | stw %r22,-16(0,%r30) | ||
| 521 | extru %r21,15,16,%r21 | ||
| 522 | fldws -16(0,%r30),%fr10L | ||
| 523 | stw %r21,-16(0,%r30) | ||
| 524 | fldws -16(0,%r30),%fr10R | ||
| 525 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 526 | fstws %fr8R,-16(0,%r30) | ||
| 527 | ldw -16(0,%r30),%r29 | ||
| 528 | stw %r22,-16(0,%r30) | ||
| 529 | fldws -16(0,%r30),%fr10R | ||
| 530 | stw %r21,-16(0,%r30) | ||
| 531 | copy %r29,%r19 | ||
| 532 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 533 | fldws -16(0,%r30),%fr10L | ||
| 534 | stw %r21,-16(0,%r30) | ||
| 535 | fldws -16(0,%r30),%fr10R | ||
| 536 | fstws %fr8R,-16(0,%r30) | ||
| 537 | extru %r19,16,17,%r20 | ||
| 538 | zdep %r19,14,15,%r19 | ||
| 539 | ldw -16(0,%r30),%r29 | ||
| 540 | xmpyu %fr10L,%fr10R,%fr9 | ||
| 541 | addl %r29,%r19,%r22 | ||
| 542 | stw %r22,-4(0,%r23) | ||
| 543 | fstws %fr9R,-16(0,%r30) | ||
| 544 | ldw -16(0,%r30),%r29 | ||
| 545 | addl %r29,%r20,%r21 | ||
| 546 | comclr,<<= %r19,%r22,0 | ||
| 547 | addi 1,%r21,%r21 | ||
| 548 | addib,= -1,%r24,L$0057 | ||
| 549 | stw %r21,0(0,%r23) | ||
| 550 | ldo 16(%r28),%r28 | ||
| 551 | ldo 16(%r25),%r25 | ||
| 552 | ldo 32(%r23),%r23 | ||
| 553 | bl L$0046,0 | ||
| 554 | ldo 32(%r26),%r26 | ||
| 555 | L$0057 | ||
| 556 | bv,n 0(%r2) | ||
| 557 | .EXIT | ||
| 558 | .PROCEND | ||
| 559 | .IMPORT BN_num_bits_word,CODE | ||
| 560 | .IMPORT fprintf,CODE | ||
| 561 | .IMPORT __iob,DATA | ||
| 562 | .SPACE $TEXT$ | ||
| 563 | .SUBSPA $LIT$ | ||
| 564 | |||
| 565 | .align 4 | ||
| 566 | L$C0000 | ||
| 567 | .STRING "Division would overflow\x0a\x00" | ||
| 568 | .IMPORT abort,CODE | ||
| 569 | .SPACE $TEXT$ | ||
| 570 | .SUBSPA $CODE$ | ||
| 571 | |||
| 572 | .align 4 | ||
| 573 | .EXPORT bn_div64,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,RTNVAL=GR | ||
| 574 | bn_div64 | ||
| 575 | .PROC | ||
| 576 | .CALLINFO FRAME=128,CALLS,SAVE_RP,ENTRY_GR=8 | ||
| 577 | .ENTRY | ||
| 578 | stw %r2,-20(0,%r30) | ||
| 579 | stwm %r8,128(0,%r30) | ||
| 580 | stw %r7,-124(0,%r30) | ||
| 581 | stw %r4,-112(0,%r30) | ||
| 582 | stw %r3,-108(0,%r30) | ||
| 583 | copy %r26,%r3 | ||
| 584 | copy %r25,%r4 | ||
| 585 | stw %r6,-120(0,%r30) | ||
| 586 | ldi 0,%r7 | ||
| 587 | stw %r5,-116(0,%r30) | ||
| 588 | movb,<> %r24,%r5,L$0059 | ||
| 589 | ldi 2,%r6 | ||
| 590 | bl L$0076,0 | ||
| 591 | ldi -1,%r28 | ||
| 592 | L$0059 | ||
| 593 | .CALL ARGW0=GR | ||
| 594 | bl BN_num_bits_word,%r2 | ||
| 595 | copy %r5,%r26 | ||
| 596 | ldi 32,%r19 | ||
| 597 | comb,= %r19,%r28,L$0060 | ||
| 598 | subi 31,%r28,%r19 | ||
| 599 | mtsar %r19 | ||
| 600 | zvdepi 1,32,%r19 | ||
| 601 | comb,>>= %r19,%r3,L$0060 | ||
| 602 | addil LR'__iob-$global$+32,%r27 | ||
| 603 | ldo RR'__iob-$global$+32(%r1),%r26 | ||
| 604 | ldil LR'L$C0000,%r25 | ||
| 605 | .CALL ARGW0=GR,ARGW1=GR | ||
| 606 | bl fprintf,%r2 | ||
| 607 | ldo RR'L$C0000(%r25),%r25 | ||
| 608 | .CALL | ||
| 609 | bl abort,%r2 | ||
| 610 | nop | ||
| 611 | L$0060 | ||
| 612 | comb,>> %r5,%r3,L$0061 | ||
| 613 | subi 32,%r28,%r28 | ||
| 614 | sub %r3,%r5,%r3 | ||
| 615 | L$0061 | ||
| 616 | comib,= 0,%r28,L$0062 | ||
| 617 | subi 31,%r28,%r19 | ||
| 618 | mtsar %r19 | ||
| 619 | zvdep %r5,32,%r5 | ||
| 620 | zvdep %r3,32,%r21 | ||
| 621 | subi 32,%r28,%r20 | ||
| 622 | mtsar %r20 | ||
| 623 | vshd 0,%r4,%r20 | ||
| 624 | or %r21,%r20,%r3 | ||
| 625 | mtsar %r19 | ||
| 626 | zvdep %r4,32,%r4 | ||
| 627 | L$0062 | ||
| 628 | extru %r5,15,16,%r23 | ||
| 629 | extru %r5,31,16,%r28 | ||
| 630 | L$0063 | ||
| 631 | extru %r3,15,16,%r19 | ||
| 632 | comb,<> %r23,%r19,L$0066 | ||
| 633 | copy %r3,%r26 | ||
| 634 | bl L$0067,0 | ||
| 635 | zdepi -1,31,16,%r29 | ||
| 636 | L$0066 | ||
| 637 | .IMPORT $$divU,MILLICODE | ||
| 638 | bl $$divU,%r31 | ||
| 639 | copy %r23,%r25 | ||
| 640 | L$0067 | ||
| 641 | stw %r29,-16(0,%r30) | ||
| 642 | fldws -16(0,%r30),%fr10L | ||
| 643 | stw %r28,-16(0,%r30) | ||
| 644 | fldws -16(0,%r30),%fr10R | ||
| 645 | stw %r23,-16(0,%r30) | ||
| 646 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 647 | fldws -16(0,%r30),%fr10R | ||
| 648 | fstws %fr8R,-16(0,%r30) | ||
| 649 | xmpyu %fr10L,%fr10R,%fr9 | ||
| 650 | ldw -16(0,%r30),%r8 | ||
| 651 | fstws %fr9R,-16(0,%r30) | ||
| 652 | copy %r8,%r22 | ||
| 653 | ldw -16(0,%r30),%r8 | ||
| 654 | extru %r4,15,16,%r24 | ||
| 655 | copy %r8,%r21 | ||
| 656 | L$0068 | ||
| 657 | sub %r3,%r21,%r20 | ||
| 658 | copy %r20,%r19 | ||
| 659 | depi 0,31,16,%r19 | ||
| 660 | comib,<> 0,%r19,L$0069 | ||
| 661 | zdep %r20,15,16,%r19 | ||
| 662 | addl %r19,%r24,%r19 | ||
| 663 | comb,>>= %r19,%r22,L$0069 | ||
| 664 | sub %r22,%r28,%r22 | ||
| 665 | sub %r21,%r23,%r21 | ||
| 666 | bl L$0068,0 | ||
| 667 | ldo -1(%r29),%r29 | ||
| 668 | L$0069 | ||
| 669 | stw %r29,-16(0,%r30) | ||
| 670 | fldws -16(0,%r30),%fr10L | ||
| 671 | stw %r28,-16(0,%r30) | ||
| 672 | fldws -16(0,%r30),%fr10R | ||
| 673 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 674 | fstws %fr8R,-16(0,%r30) | ||
| 675 | ldw -16(0,%r30),%r8 | ||
| 676 | stw %r23,-16(0,%r30) | ||
| 677 | fldws -16(0,%r30),%fr10R | ||
| 678 | copy %r8,%r19 | ||
| 679 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 680 | fstws %fr8R,-16(0,%r30) | ||
| 681 | extru %r19,15,16,%r20 | ||
| 682 | ldw -16(0,%r30),%r8 | ||
| 683 | zdep %r19,15,16,%r19 | ||
| 684 | addl %r8,%r20,%r20 | ||
| 685 | comclr,<<= %r19,%r4,0 | ||
| 686 | addi 1,%r20,%r20 | ||
| 687 | comb,<<= %r20,%r3,L$0074 | ||
| 688 | sub %r4,%r19,%r4 | ||
| 689 | addl %r3,%r5,%r3 | ||
| 690 | ldo -1(%r29),%r29 | ||
| 691 | L$0074 | ||
| 692 | addib,= -1,%r6,L$0064 | ||
| 693 | sub %r3,%r20,%r3 | ||
| 694 | zdep %r29,15,16,%r7 | ||
| 695 | shd %r3,%r4,16,%r3 | ||
| 696 | bl L$0063,0 | ||
| 697 | zdep %r4,15,16,%r4 | ||
| 698 | L$0064 | ||
| 699 | or %r7,%r29,%r28 | ||
| 700 | L$0076 | ||
| 701 | ldw -148(0,%r30),%r2 | ||
| 702 | ldw -124(0,%r30),%r7 | ||
| 703 | ldw -120(0,%r30),%r6 | ||
| 704 | ldw -116(0,%r30),%r5 | ||
| 705 | ldw -112(0,%r30),%r4 | ||
| 706 | ldw -108(0,%r30),%r3 | ||
| 707 | bv 0(%r2) | ||
| 708 | ldwm -128(0,%r30),%r8 | ||
| 709 | .EXIT | ||
| 710 | .PROCEND | ||
diff --git a/src/lib/libcrypto/bn/asm/r3000.s b/src/lib/libcrypto/bn/asm/r3000.s deleted file mode 100644 index e95269afa3..0000000000 --- a/src/lib/libcrypto/bn/asm/r3000.s +++ /dev/null | |||
| @@ -1,646 +0,0 @@ | |||
| 1 | .file 1 "../bn_mulw.c" | ||
| 2 | .set nobopt | ||
| 3 | .option pic2 | ||
| 4 | |||
| 5 | # GNU C 2.6.3 [AL 1.1, MM 40] SGI running IRIX 5.0 compiled by GNU C | ||
| 6 | |||
| 7 | # Cc1 defaults: | ||
| 8 | # -mabicalls | ||
| 9 | |||
| 10 | # Cc1 arguments (-G value = 0, Cpu = 3000, ISA = 1): | ||
| 11 | # -quiet -dumpbase -O2 -o | ||
| 12 | |||
| 13 | gcc2_compiled.: | ||
| 14 | __gnu_compiled_c: | ||
| 15 | .rdata | ||
| 16 | |||
| 17 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 18 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x34,0x39,0x20 | ||
| 19 | .byte 0x24,0x0 | ||
| 20 | |||
| 21 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 22 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x33,0x34,0x20 | ||
| 23 | .byte 0x24,0x0 | ||
| 24 | |||
| 25 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 26 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x35,0x20,0x24 | ||
| 27 | .byte 0x0 | ||
| 28 | |||
| 29 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 30 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x38,0x20,0x24 | ||
| 31 | .byte 0x0 | ||
| 32 | |||
| 33 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 34 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x32,0x33,0x20 | ||
| 35 | .byte 0x24,0x0 | ||
| 36 | |||
| 37 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 38 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x37,0x38,0x20 | ||
| 39 | .byte 0x24,0x0 | ||
| 40 | |||
| 41 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 42 | .byte 0x6e,0x3a,0x20,0x33,0x2e,0x37,0x30,0x20 | ||
| 43 | .byte 0x24,0x0 | ||
| 44 | |||
| 45 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 46 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x32,0x20,0x24 | ||
| 47 | .byte 0x0 | ||
| 48 | |||
| 49 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 50 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x34,0x20,0x24 | ||
| 51 | .byte 0x0 | ||
| 52 | |||
| 53 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 54 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x38,0x20,0x24 | ||
| 55 | .byte 0x0 | ||
| 56 | .text | ||
| 57 | .align 2 | ||
| 58 | .globl bn_mul_add_words | ||
| 59 | .ent bn_mul_add_words | ||
| 60 | bn_mul_add_words: | ||
| 61 | .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0 | ||
| 62 | .mask 0x00000000,0 | ||
| 63 | .fmask 0x00000000,0 | ||
| 64 | .set noreorder | ||
| 65 | .cpload $25 | ||
| 66 | .set reorder | ||
| 67 | move $12,$4 | ||
| 68 | move $14,$5 | ||
| 69 | move $9,$6 | ||
| 70 | move $13,$7 | ||
| 71 | move $8,$0 | ||
| 72 | addu $10,$12,12 | ||
| 73 | addu $11,$14,12 | ||
| 74 | $L2: | ||
| 75 | lw $6,0($14) | ||
| 76 | #nop | ||
| 77 | multu $13,$6 | ||
| 78 | mfhi $6 | ||
| 79 | mflo $7 | ||
| 80 | #nop | ||
| 81 | move $5,$8 | ||
| 82 | move $4,$0 | ||
| 83 | lw $3,0($12) | ||
| 84 | addu $9,$9,-1 | ||
| 85 | move $2,$0 | ||
| 86 | addu $7,$7,$3 | ||
| 87 | sltu $8,$7,$3 | ||
| 88 | addu $6,$6,$2 | ||
| 89 | addu $6,$6,$8 | ||
| 90 | addu $7,$7,$5 | ||
| 91 | sltu $2,$7,$5 | ||
| 92 | addu $6,$6,$4 | ||
| 93 | addu $6,$6,$2 | ||
| 94 | srl $3,$6,0 | ||
| 95 | move $2,$0 | ||
| 96 | move $8,$3 | ||
| 97 | .set noreorder | ||
| 98 | .set nomacro | ||
| 99 | beq $9,$0,$L3 | ||
| 100 | sw $7,0($12) | ||
| 101 | .set macro | ||
| 102 | .set reorder | ||
| 103 | |||
| 104 | lw $6,-8($11) | ||
| 105 | #nop | ||
| 106 | multu $13,$6 | ||
| 107 | mfhi $6 | ||
| 108 | mflo $7 | ||
| 109 | #nop | ||
| 110 | move $5,$8 | ||
| 111 | move $4,$0 | ||
| 112 | lw $3,-8($10) | ||
| 113 | addu $9,$9,-1 | ||
| 114 | move $2,$0 | ||
| 115 | addu $7,$7,$3 | ||
| 116 | sltu $8,$7,$3 | ||
| 117 | addu $6,$6,$2 | ||
| 118 | addu $6,$6,$8 | ||
| 119 | addu $7,$7,$5 | ||
| 120 | sltu $2,$7,$5 | ||
| 121 | addu $6,$6,$4 | ||
| 122 | addu $6,$6,$2 | ||
| 123 | srl $3,$6,0 | ||
| 124 | move $2,$0 | ||
| 125 | move $8,$3 | ||
| 126 | .set noreorder | ||
| 127 | .set nomacro | ||
| 128 | beq $9,$0,$L3 | ||
| 129 | sw $7,-8($10) | ||
| 130 | .set macro | ||
| 131 | .set reorder | ||
| 132 | |||
| 133 | lw $6,-4($11) | ||
| 134 | #nop | ||
| 135 | multu $13,$6 | ||
| 136 | mfhi $6 | ||
| 137 | mflo $7 | ||
| 138 | #nop | ||
| 139 | move $5,$8 | ||
| 140 | move $4,$0 | ||
| 141 | lw $3,-4($10) | ||
| 142 | addu $9,$9,-1 | ||
| 143 | move $2,$0 | ||
| 144 | addu $7,$7,$3 | ||
| 145 | sltu $8,$7,$3 | ||
| 146 | addu $6,$6,$2 | ||
| 147 | addu $6,$6,$8 | ||
| 148 | addu $7,$7,$5 | ||
| 149 | sltu $2,$7,$5 | ||
| 150 | addu $6,$6,$4 | ||
| 151 | addu $6,$6,$2 | ||
| 152 | srl $3,$6,0 | ||
| 153 | move $2,$0 | ||
| 154 | move $8,$3 | ||
| 155 | .set noreorder | ||
| 156 | .set nomacro | ||
| 157 | beq $9,$0,$L3 | ||
| 158 | sw $7,-4($10) | ||
| 159 | .set macro | ||
| 160 | .set reorder | ||
| 161 | |||
| 162 | lw $6,0($11) | ||
| 163 | #nop | ||
| 164 | multu $13,$6 | ||
| 165 | mfhi $6 | ||
| 166 | mflo $7 | ||
| 167 | #nop | ||
| 168 | move $5,$8 | ||
| 169 | move $4,$0 | ||
| 170 | lw $3,0($10) | ||
| 171 | addu $9,$9,-1 | ||
| 172 | move $2,$0 | ||
| 173 | addu $7,$7,$3 | ||
| 174 | sltu $8,$7,$3 | ||
| 175 | addu $6,$6,$2 | ||
| 176 | addu $6,$6,$8 | ||
| 177 | addu $7,$7,$5 | ||
| 178 | sltu $2,$7,$5 | ||
| 179 | addu $6,$6,$4 | ||
| 180 | addu $6,$6,$2 | ||
| 181 | srl $3,$6,0 | ||
| 182 | move $2,$0 | ||
| 183 | move $8,$3 | ||
| 184 | .set noreorder | ||
| 185 | .set nomacro | ||
| 186 | beq $9,$0,$L3 | ||
| 187 | sw $7,0($10) | ||
| 188 | .set macro | ||
| 189 | .set reorder | ||
| 190 | |||
| 191 | addu $11,$11,16 | ||
| 192 | addu $14,$14,16 | ||
| 193 | addu $10,$10,16 | ||
| 194 | .set noreorder | ||
| 195 | .set nomacro | ||
| 196 | j $L2 | ||
| 197 | addu $12,$12,16 | ||
| 198 | .set macro | ||
| 199 | .set reorder | ||
| 200 | |||
| 201 | $L3: | ||
| 202 | .set noreorder | ||
| 203 | .set nomacro | ||
| 204 | j $31 | ||
| 205 | move $2,$8 | ||
| 206 | .set macro | ||
| 207 | .set reorder | ||
| 208 | |||
| 209 | .end bn_mul_add_words | ||
| 210 | .align 2 | ||
| 211 | .globl bn_mul_words | ||
| 212 | .ent bn_mul_words | ||
| 213 | bn_mul_words: | ||
| 214 | .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0 | ||
| 215 | .mask 0x00000000,0 | ||
| 216 | .fmask 0x00000000,0 | ||
| 217 | .set noreorder | ||
| 218 | .cpload $25 | ||
| 219 | .set reorder | ||
| 220 | move $11,$4 | ||
| 221 | move $12,$5 | ||
| 222 | move $8,$6 | ||
| 223 | move $6,$0 | ||
| 224 | addu $10,$11,12 | ||
| 225 | addu $9,$12,12 | ||
| 226 | $L10: | ||
| 227 | lw $4,0($12) | ||
| 228 | #nop | ||
| 229 | multu $7,$4 | ||
| 230 | mfhi $4 | ||
| 231 | mflo $5 | ||
| 232 | #nop | ||
| 233 | move $3,$6 | ||
| 234 | move $2,$0 | ||
| 235 | addu $8,$8,-1 | ||
| 236 | addu $5,$5,$3 | ||
| 237 | sltu $6,$5,$3 | ||
| 238 | addu $4,$4,$2 | ||
| 239 | addu $4,$4,$6 | ||
| 240 | srl $3,$4,0 | ||
| 241 | move $2,$0 | ||
| 242 | move $6,$3 | ||
| 243 | .set noreorder | ||
| 244 | .set nomacro | ||
| 245 | beq $8,$0,$L11 | ||
| 246 | sw $5,0($11) | ||
| 247 | .set macro | ||
| 248 | .set reorder | ||
| 249 | |||
| 250 | lw $4,-8($9) | ||
| 251 | #nop | ||
| 252 | multu $7,$4 | ||
| 253 | mfhi $4 | ||
| 254 | mflo $5 | ||
| 255 | #nop | ||
| 256 | move $3,$6 | ||
| 257 | move $2,$0 | ||
| 258 | addu $8,$8,-1 | ||
| 259 | addu $5,$5,$3 | ||
| 260 | sltu $6,$5,$3 | ||
| 261 | addu $4,$4,$2 | ||
| 262 | addu $4,$4,$6 | ||
| 263 | srl $3,$4,0 | ||
| 264 | move $2,$0 | ||
| 265 | move $6,$3 | ||
| 266 | .set noreorder | ||
| 267 | .set nomacro | ||
| 268 | beq $8,$0,$L11 | ||
| 269 | sw $5,-8($10) | ||
| 270 | .set macro | ||
| 271 | .set reorder | ||
| 272 | |||
| 273 | lw $4,-4($9) | ||
| 274 | #nop | ||
| 275 | multu $7,$4 | ||
| 276 | mfhi $4 | ||
| 277 | mflo $5 | ||
| 278 | #nop | ||
| 279 | move $3,$6 | ||
| 280 | move $2,$0 | ||
| 281 | addu $8,$8,-1 | ||
| 282 | addu $5,$5,$3 | ||
| 283 | sltu $6,$5,$3 | ||
| 284 | addu $4,$4,$2 | ||
| 285 | addu $4,$4,$6 | ||
| 286 | srl $3,$4,0 | ||
| 287 | move $2,$0 | ||
| 288 | move $6,$3 | ||
| 289 | .set noreorder | ||
| 290 | .set nomacro | ||
| 291 | beq $8,$0,$L11 | ||
| 292 | sw $5,-4($10) | ||
| 293 | .set macro | ||
| 294 | .set reorder | ||
| 295 | |||
| 296 | lw $4,0($9) | ||
| 297 | #nop | ||
| 298 | multu $7,$4 | ||
| 299 | mfhi $4 | ||
| 300 | mflo $5 | ||
| 301 | #nop | ||
| 302 | move $3,$6 | ||
| 303 | move $2,$0 | ||
| 304 | addu $8,$8,-1 | ||
| 305 | addu $5,$5,$3 | ||
| 306 | sltu $6,$5,$3 | ||
| 307 | addu $4,$4,$2 | ||
| 308 | addu $4,$4,$6 | ||
| 309 | srl $3,$4,0 | ||
| 310 | move $2,$0 | ||
| 311 | move $6,$3 | ||
| 312 | .set noreorder | ||
| 313 | .set nomacro | ||
| 314 | beq $8,$0,$L11 | ||
| 315 | sw $5,0($10) | ||
| 316 | .set macro | ||
| 317 | .set reorder | ||
| 318 | |||
| 319 | addu $9,$9,16 | ||
| 320 | addu $12,$12,16 | ||
| 321 | addu $10,$10,16 | ||
| 322 | .set noreorder | ||
| 323 | .set nomacro | ||
| 324 | j $L10 | ||
| 325 | addu $11,$11,16 | ||
| 326 | .set macro | ||
| 327 | .set reorder | ||
| 328 | |||
| 329 | $L11: | ||
| 330 | .set noreorder | ||
| 331 | .set nomacro | ||
| 332 | j $31 | ||
| 333 | move $2,$6 | ||
| 334 | .set macro | ||
| 335 | .set reorder | ||
| 336 | |||
| 337 | .end bn_mul_words | ||
| 338 | .align 2 | ||
| 339 | .globl bn_sqr_words | ||
| 340 | .ent bn_sqr_words | ||
| 341 | bn_sqr_words: | ||
| 342 | .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0 | ||
| 343 | .mask 0x00000000,0 | ||
| 344 | .fmask 0x00000000,0 | ||
| 345 | .set noreorder | ||
| 346 | .cpload $25 | ||
| 347 | .set reorder | ||
| 348 | move $9,$4 | ||
| 349 | addu $7,$9,28 | ||
| 350 | addu $8,$5,12 | ||
| 351 | $L18: | ||
| 352 | lw $2,0($5) | ||
| 353 | #nop | ||
| 354 | multu $2,$2 | ||
| 355 | mfhi $2 | ||
| 356 | mflo $3 | ||
| 357 | #nop | ||
| 358 | addu $6,$6,-1 | ||
| 359 | sw $3,0($9) | ||
| 360 | srl $3,$2,0 | ||
| 361 | move $2,$0 | ||
| 362 | .set noreorder | ||
| 363 | .set nomacro | ||
| 364 | beq $6,$0,$L19 | ||
| 365 | sw $3,-24($7) | ||
| 366 | .set macro | ||
| 367 | .set reorder | ||
| 368 | |||
| 369 | lw $2,-8($8) | ||
| 370 | #nop | ||
| 371 | multu $2,$2 | ||
| 372 | mfhi $2 | ||
| 373 | mflo $3 | ||
| 374 | #nop | ||
| 375 | addu $6,$6,-1 | ||
| 376 | sw $3,-20($7) | ||
| 377 | srl $3,$2,0 | ||
| 378 | move $2,$0 | ||
| 379 | .set noreorder | ||
| 380 | .set nomacro | ||
| 381 | beq $6,$0,$L19 | ||
| 382 | sw $3,-16($7) | ||
| 383 | .set macro | ||
| 384 | .set reorder | ||
| 385 | |||
| 386 | lw $2,-4($8) | ||
| 387 | #nop | ||
| 388 | multu $2,$2 | ||
| 389 | mfhi $2 | ||
| 390 | mflo $3 | ||
| 391 | #nop | ||
| 392 | addu $6,$6,-1 | ||
| 393 | sw $3,-12($7) | ||
| 394 | srl $3,$2,0 | ||
| 395 | move $2,$0 | ||
| 396 | .set noreorder | ||
| 397 | .set nomacro | ||
| 398 | beq $6,$0,$L19 | ||
| 399 | sw $3,-8($7) | ||
| 400 | .set macro | ||
| 401 | .set reorder | ||
| 402 | |||
| 403 | lw $2,0($8) | ||
| 404 | #nop | ||
| 405 | multu $2,$2 | ||
| 406 | mfhi $2 | ||
| 407 | mflo $3 | ||
| 408 | #nop | ||
| 409 | addu $6,$6,-1 | ||
| 410 | sw $3,-4($7) | ||
| 411 | srl $3,$2,0 | ||
| 412 | move $2,$0 | ||
| 413 | .set noreorder | ||
| 414 | .set nomacro | ||
| 415 | beq $6,$0,$L19 | ||
| 416 | sw $3,0($7) | ||
| 417 | .set macro | ||
| 418 | .set reorder | ||
| 419 | |||
| 420 | addu $8,$8,16 | ||
| 421 | addu $5,$5,16 | ||
| 422 | addu $7,$7,32 | ||
| 423 | .set noreorder | ||
| 424 | .set nomacro | ||
| 425 | j $L18 | ||
| 426 | addu $9,$9,32 | ||
| 427 | .set macro | ||
| 428 | .set reorder | ||
| 429 | |||
| 430 | $L19: | ||
| 431 | j $31 | ||
| 432 | .end bn_sqr_words | ||
| 433 | .rdata | ||
| 434 | .align 2 | ||
| 435 | $LC0: | ||
| 436 | |||
| 437 | .byte 0x44,0x69,0x76,0x69,0x73,0x69,0x6f,0x6e | ||
| 438 | .byte 0x20,0x77,0x6f,0x75,0x6c,0x64,0x20,0x6f | ||
| 439 | .byte 0x76,0x65,0x72,0x66,0x6c,0x6f,0x77,0xa | ||
| 440 | .byte 0x0 | ||
| 441 | .text | ||
| 442 | .align 2 | ||
| 443 | .globl bn_div64 | ||
| 444 | .ent bn_div64 | ||
| 445 | bn_div64: | ||
| 446 | .frame $sp,56,$31 # vars= 0, regs= 7/0, args= 16, extra= 8 | ||
| 447 | .mask 0x901f0000,-8 | ||
| 448 | .fmask 0x00000000,0 | ||
| 449 | .set noreorder | ||
| 450 | .cpload $25 | ||
| 451 | .set reorder | ||
| 452 | subu $sp,$sp,56 | ||
| 453 | .cprestore 16 | ||
| 454 | sw $16,24($sp) | ||
| 455 | move $16,$4 | ||
| 456 | sw $17,28($sp) | ||
| 457 | move $17,$5 | ||
| 458 | sw $18,32($sp) | ||
| 459 | move $18,$6 | ||
| 460 | sw $20,40($sp) | ||
| 461 | move $20,$0 | ||
| 462 | sw $19,36($sp) | ||
| 463 | li $19,0x00000002 # 2 | ||
| 464 | sw $31,48($sp) | ||
| 465 | .set noreorder | ||
| 466 | .set nomacro | ||
| 467 | bne $18,$0,$L26 | ||
| 468 | sw $28,44($sp) | ||
| 469 | .set macro | ||
| 470 | .set reorder | ||
| 471 | |||
| 472 | .set noreorder | ||
| 473 | .set nomacro | ||
| 474 | j $L43 | ||
| 475 | li $2,-1 # 0xffffffff | ||
| 476 | .set macro | ||
| 477 | .set reorder | ||
| 478 | |||
| 479 | $L26: | ||
| 480 | move $4,$18 | ||
| 481 | jal BN_num_bits_word | ||
| 482 | move $4,$2 | ||
| 483 | li $2,0x00000020 # 32 | ||
| 484 | .set noreorder | ||
| 485 | .set nomacro | ||
| 486 | beq $4,$2,$L27 | ||
| 487 | li $2,0x00000001 # 1 | ||
| 488 | .set macro | ||
| 489 | .set reorder | ||
| 490 | |||
| 491 | sll $2,$2,$4 | ||
| 492 | sltu $2,$2,$16 | ||
| 493 | .set noreorder | ||
| 494 | .set nomacro | ||
| 495 | beq $2,$0,$L44 | ||
| 496 | li $5,0x00000020 # 32 | ||
| 497 | .set macro | ||
| 498 | .set reorder | ||
| 499 | |||
| 500 | la $4,__iob+32 | ||
| 501 | la $5,$LC0 | ||
| 502 | jal fprintf | ||
| 503 | jal abort | ||
| 504 | $L27: | ||
| 505 | li $5,0x00000020 # 32 | ||
| 506 | $L44: | ||
| 507 | sltu $2,$16,$18 | ||
| 508 | .set noreorder | ||
| 509 | .set nomacro | ||
| 510 | bne $2,$0,$L28 | ||
| 511 | subu $4,$5,$4 | ||
| 512 | .set macro | ||
| 513 | .set reorder | ||
| 514 | |||
| 515 | subu $16,$16,$18 | ||
| 516 | $L28: | ||
| 517 | .set noreorder | ||
| 518 | .set nomacro | ||
| 519 | beq $4,$0,$L29 | ||
| 520 | li $10,-65536 # 0xffff0000 | ||
| 521 | .set macro | ||
| 522 | .set reorder | ||
| 523 | |||
| 524 | sll $18,$18,$4 | ||
| 525 | sll $3,$16,$4 | ||
| 526 | subu $2,$5,$4 | ||
| 527 | srl $2,$17,$2 | ||
| 528 | or $16,$3,$2 | ||
| 529 | sll $17,$17,$4 | ||
| 530 | $L29: | ||
| 531 | srl $7,$18,16 | ||
| 532 | andi $9,$18,0xffff | ||
| 533 | $L30: | ||
| 534 | srl $2,$16,16 | ||
| 535 | .set noreorder | ||
| 536 | .set nomacro | ||
| 537 | beq $2,$7,$L34 | ||
| 538 | li $6,0x0000ffff # 65535 | ||
| 539 | .set macro | ||
| 540 | .set reorder | ||
| 541 | |||
| 542 | divu $6,$16,$7 | ||
| 543 | $L34: | ||
| 544 | mult $6,$9 | ||
| 545 | mflo $5 | ||
| 546 | #nop | ||
| 547 | #nop | ||
| 548 | mult $6,$7 | ||
| 549 | and $2,$17,$10 | ||
| 550 | srl $8,$2,16 | ||
| 551 | mflo $4 | ||
| 552 | $L35: | ||
| 553 | subu $3,$16,$4 | ||
| 554 | and $2,$3,$10 | ||
| 555 | .set noreorder | ||
| 556 | .set nomacro | ||
| 557 | bne $2,$0,$L36 | ||
| 558 | sll $2,$3,16 | ||
| 559 | .set macro | ||
| 560 | .set reorder | ||
| 561 | |||
| 562 | addu $2,$2,$8 | ||
| 563 | sltu $2,$2,$5 | ||
| 564 | .set noreorder | ||
| 565 | .set nomacro | ||
| 566 | beq $2,$0,$L36 | ||
| 567 | subu $5,$5,$9 | ||
| 568 | .set macro | ||
| 569 | .set reorder | ||
| 570 | |||
| 571 | subu $4,$4,$7 | ||
| 572 | .set noreorder | ||
| 573 | .set nomacro | ||
| 574 | j $L35 | ||
| 575 | addu $6,$6,-1 | ||
| 576 | .set macro | ||
| 577 | .set reorder | ||
| 578 | |||
| 579 | $L36: | ||
| 580 | mult $6,$7 | ||
| 581 | mflo $5 | ||
| 582 | #nop | ||
| 583 | #nop | ||
| 584 | mult $6,$9 | ||
| 585 | mflo $4 | ||
| 586 | #nop | ||
| 587 | #nop | ||
| 588 | srl $3,$4,16 | ||
| 589 | sll $2,$4,16 | ||
| 590 | and $4,$2,$10 | ||
| 591 | sltu $2,$17,$4 | ||
| 592 | .set noreorder | ||
| 593 | .set nomacro | ||
| 594 | beq $2,$0,$L40 | ||
| 595 | addu $5,$5,$3 | ||
| 596 | .set macro | ||
| 597 | .set reorder | ||
| 598 | |||
| 599 | addu $5,$5,1 | ||
| 600 | $L40: | ||
| 601 | sltu $2,$16,$5 | ||
| 602 | .set noreorder | ||
| 603 | .set nomacro | ||
| 604 | beq $2,$0,$L41 | ||
| 605 | subu $17,$17,$4 | ||
| 606 | .set macro | ||
| 607 | .set reorder | ||
| 608 | |||
| 609 | addu $16,$16,$18 | ||
| 610 | addu $6,$6,-1 | ||
| 611 | $L41: | ||
| 612 | addu $19,$19,-1 | ||
| 613 | .set noreorder | ||
| 614 | .set nomacro | ||
| 615 | beq $19,$0,$L31 | ||
| 616 | subu $16,$16,$5 | ||
| 617 | .set macro | ||
| 618 | .set reorder | ||
| 619 | |||
| 620 | sll $20,$6,16 | ||
| 621 | sll $3,$16,16 | ||
| 622 | srl $2,$17,16 | ||
| 623 | or $16,$3,$2 | ||
| 624 | .set noreorder | ||
| 625 | .set nomacro | ||
| 626 | j $L30 | ||
| 627 | sll $17,$17,16 | ||
| 628 | .set macro | ||
| 629 | .set reorder | ||
| 630 | |||
| 631 | $L31: | ||
| 632 | or $2,$20,$6 | ||
| 633 | $L43: | ||
| 634 | lw $31,48($sp) | ||
| 635 | lw $20,40($sp) | ||
| 636 | lw $19,36($sp) | ||
| 637 | lw $18,32($sp) | ||
| 638 | lw $17,28($sp) | ||
| 639 | lw $16,24($sp) | ||
| 640 | addu $sp,$sp,56 | ||
| 641 | j $31 | ||
| 642 | .end bn_div64 | ||
| 643 | |||
| 644 | .globl abort .text | ||
| 645 | .globl fprintf .text | ||
| 646 | .globl BN_num_bits_word .text | ||
diff --git a/src/lib/libcrypto/bn/asm/sparcv8plus.S b/src/lib/libcrypto/bn/asm/sparcv8plus.S index 8c56e2e7e7..63de1860f2 100644 --- a/src/lib/libcrypto/bn/asm/sparcv8plus.S +++ b/src/lib/libcrypto/bn/asm/sparcv8plus.S | |||
| @@ -144,6 +144,19 @@ | |||
| 144 | * } | 144 | * } |
| 145 | */ | 145 | */ |
| 146 | 146 | ||
| 147 | #if defined(__SUNPRO_C) && defined(__sparcv9) | ||
| 148 | /* They've said -xarch=v9 at command line */ | ||
| 149 | .register %g2,#scratch | ||
| 150 | .register %g3,#scratch | ||
| 151 | # define FRAME_SIZE -192 | ||
| 152 | #elif defined(__GNUC__) && defined(__arch64__) | ||
| 153 | /* They've said -m64 at command line */ | ||
| 154 | .register %g2,#scratch | ||
| 155 | .register %g3,#scratch | ||
| 156 | # define FRAME_SIZE -192 | ||
| 157 | #else | ||
| 158 | # define FRAME_SIZE -96 | ||
| 159 | #endif | ||
| 147 | /* | 160 | /* |
| 148 | * GNU assembler can't stand stuw:-( | 161 | * GNU assembler can't stand stuw:-( |
| 149 | */ | 162 | */ |
| @@ -619,8 +632,6 @@ bn_sub_words: | |||
| 619 | * Andy. | 632 | * Andy. |
| 620 | */ | 633 | */ |
| 621 | 634 | ||
| 622 | #define FRAME_SIZE -96 | ||
| 623 | |||
| 624 | /* | 635 | /* |
| 625 | * Here is register usage map for *all* routines below. | 636 | * Here is register usage map for *all* routines below. |
| 626 | */ | 637 | */ |
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index f1719a5877..e484b7fc11 100644 --- a/src/lib/libcrypto/bn/bn.h +++ b/src/lib/libcrypto/bn/bn.h | |||
| @@ -56,6 +56,59 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | /* ==================================================================== | 58 | /* ==================================================================== |
| 59 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. | ||
| 60 | * | ||
| 61 | * Redistribution and use in source and binary forms, with or without | ||
| 62 | * modification, are permitted provided that the following conditions | ||
| 63 | * are met: | ||
| 64 | * | ||
| 65 | * 1. Redistributions of source code must retain the above copyright | ||
| 66 | * notice, this list of conditions and the following disclaimer. | ||
| 67 | * | ||
| 68 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 69 | * notice, this list of conditions and the following disclaimer in | ||
| 70 | * the documentation and/or other materials provided with the | ||
| 71 | * distribution. | ||
| 72 | * | ||
| 73 | * 3. All advertising materials mentioning features or use of this | ||
| 74 | * software must display the following acknowledgment: | ||
| 75 | * "This product includes software developed by the OpenSSL Project | ||
| 76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 77 | * | ||
| 78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 79 | * endorse or promote products derived from this software without | ||
| 80 | * prior written permission. For written permission, please contact | ||
| 81 | * openssl-core@openssl.org. | ||
| 82 | * | ||
| 83 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 84 | * nor may "OpenSSL" appear in their names without prior written | ||
| 85 | * permission of the OpenSSL Project. | ||
| 86 | * | ||
| 87 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 88 | * acknowledgment: | ||
| 89 | * "This product includes software developed by the OpenSSL Project | ||
| 90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 91 | * | ||
| 92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 103 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 104 | * ==================================================================== | ||
| 105 | * | ||
| 106 | * This product includes cryptographic software written by Eric Young | ||
| 107 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 108 | * Hudson (tjh@cryptsoft.com). | ||
| 109 | * | ||
| 110 | */ | ||
| 111 | /* ==================================================================== | ||
| 59 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 112 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 60 | * | 113 | * |
| 61 | * Portions of the attached software ("Contribution") are developed by | 114 | * Portions of the attached software ("Contribution") are developed by |
| @@ -77,6 +130,7 @@ | |||
| 77 | #include <stdio.h> /* FILE */ | 130 | #include <stdio.h> /* FILE */ |
| 78 | #endif | 131 | #endif |
| 79 | #include <openssl/ossl_typ.h> | 132 | #include <openssl/ossl_typ.h> |
| 133 | #include <openssl/crypto.h> | ||
| 80 | 134 | ||
| 81 | #ifdef __cplusplus | 135 | #ifdef __cplusplus |
| 82 | extern "C" { | 136 | extern "C" { |
| @@ -94,9 +148,11 @@ extern "C" { | |||
| 94 | /* #define BN_DEBUG */ | 148 | /* #define BN_DEBUG */ |
| 95 | /* #define BN_DEBUG_RAND */ | 149 | /* #define BN_DEBUG_RAND */ |
| 96 | 150 | ||
| 151 | #ifndef OPENSSL_SMALL_FOOTPRINT | ||
| 97 | #define BN_MUL_COMBA | 152 | #define BN_MUL_COMBA |
| 98 | #define BN_SQR_COMBA | 153 | #define BN_SQR_COMBA |
| 99 | #define BN_RECURSION | 154 | #define BN_RECURSION |
| 155 | #endif | ||
| 100 | 156 | ||
| 101 | /* This next option uses the C libraries (2 word)/(1 word) function. | 157 | /* This next option uses the C libraries (2 word)/(1 word) function. |
| 102 | * If it is not defined, I use my C version (which is slower). | 158 | * If it is not defined, I use my C version (which is slower). |
| @@ -137,6 +193,8 @@ extern "C" { | |||
| 137 | #define BN_DEC_FMT1 "%lu" | 193 | #define BN_DEC_FMT1 "%lu" |
| 138 | #define BN_DEC_FMT2 "%019lu" | 194 | #define BN_DEC_FMT2 "%019lu" |
| 139 | #define BN_DEC_NUM 19 | 195 | #define BN_DEC_NUM 19 |
| 196 | #define BN_HEX_FMT1 "%lX" | ||
| 197 | #define BN_HEX_FMT2 "%016lX" | ||
| 140 | #endif | 198 | #endif |
| 141 | 199 | ||
| 142 | /* This is where the long long data type is 64 bits, but long is 32. | 200 | /* This is where the long long data type is 64 bits, but long is 32. |
| @@ -162,83 +220,37 @@ extern "C" { | |||
| 162 | #define BN_DEC_FMT1 "%llu" | 220 | #define BN_DEC_FMT1 "%llu" |
| 163 | #define BN_DEC_FMT2 "%019llu" | 221 | #define BN_DEC_FMT2 "%019llu" |
| 164 | #define BN_DEC_NUM 19 | 222 | #define BN_DEC_NUM 19 |
| 223 | #define BN_HEX_FMT1 "%llX" | ||
| 224 | #define BN_HEX_FMT2 "%016llX" | ||
| 165 | #endif | 225 | #endif |
| 166 | 226 | ||
| 167 | #ifdef THIRTY_TWO_BIT | 227 | #ifdef THIRTY_TWO_BIT |
| 168 | #ifdef BN_LLONG | 228 | #ifdef BN_LLONG |
| 169 | # if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__) | 229 | # if defined(_WIN32) && !defined(__GNUC__) |
| 170 | # define BN_ULLONG unsigned __int64 | 230 | # define BN_ULLONG unsigned __int64 |
| 231 | # define BN_MASK (0xffffffffffffffffI64) | ||
| 171 | # else | 232 | # else |
| 172 | # define BN_ULLONG unsigned long long | 233 | # define BN_ULLONG unsigned long long |
| 234 | # define BN_MASK (0xffffffffffffffffLL) | ||
| 173 | # endif | 235 | # endif |
| 174 | #endif | 236 | #endif |
| 175 | #define BN_ULONG unsigned long | 237 | #define BN_ULONG unsigned int |
| 176 | #define BN_LONG long | 238 | #define BN_LONG int |
| 177 | #define BN_BITS 64 | 239 | #define BN_BITS 64 |
| 178 | #define BN_BYTES 4 | 240 | #define BN_BYTES 4 |
| 179 | #define BN_BITS2 32 | 241 | #define BN_BITS2 32 |
| 180 | #define BN_BITS4 16 | 242 | #define BN_BITS4 16 |
| 181 | #ifdef OPENSSL_SYS_WIN32 | ||
| 182 | /* VC++ doesn't like the LL suffix */ | ||
| 183 | #define BN_MASK (0xffffffffffffffffL) | ||
| 184 | #else | ||
| 185 | #define BN_MASK (0xffffffffffffffffLL) | ||
| 186 | #endif | ||
| 187 | #define BN_MASK2 (0xffffffffL) | 243 | #define BN_MASK2 (0xffffffffL) |
| 188 | #define BN_MASK2l (0xffff) | 244 | #define BN_MASK2l (0xffff) |
| 189 | #define BN_MASK2h1 (0xffff8000L) | 245 | #define BN_MASK2h1 (0xffff8000L) |
| 190 | #define BN_MASK2h (0xffff0000L) | 246 | #define BN_MASK2h (0xffff0000L) |
| 191 | #define BN_TBIT (0x80000000L) | 247 | #define BN_TBIT (0x80000000L) |
| 192 | #define BN_DEC_CONV (1000000000L) | 248 | #define BN_DEC_CONV (1000000000L) |
| 193 | #define BN_DEC_FMT1 "%lu" | ||
| 194 | #define BN_DEC_FMT2 "%09lu" | ||
| 195 | #define BN_DEC_NUM 9 | ||
| 196 | #endif | ||
| 197 | |||
| 198 | #ifdef SIXTEEN_BIT | ||
| 199 | #ifndef BN_DIV2W | ||
| 200 | #define BN_DIV2W | ||
| 201 | #endif | ||
| 202 | #define BN_ULLONG unsigned long | ||
| 203 | #define BN_ULONG unsigned short | ||
| 204 | #define BN_LONG short | ||
| 205 | #define BN_BITS 32 | ||
| 206 | #define BN_BYTES 2 | ||
| 207 | #define BN_BITS2 16 | ||
| 208 | #define BN_BITS4 8 | ||
| 209 | #define BN_MASK (0xffffffff) | ||
| 210 | #define BN_MASK2 (0xffff) | ||
| 211 | #define BN_MASK2l (0xff) | ||
| 212 | #define BN_MASK2h1 (0xff80) | ||
| 213 | #define BN_MASK2h (0xff00) | ||
| 214 | #define BN_TBIT (0x8000) | ||
| 215 | #define BN_DEC_CONV (100000) | ||
| 216 | #define BN_DEC_FMT1 "%u" | 249 | #define BN_DEC_FMT1 "%u" |
| 217 | #define BN_DEC_FMT2 "%05u" | 250 | #define BN_DEC_FMT2 "%09u" |
| 218 | #define BN_DEC_NUM 5 | 251 | #define BN_DEC_NUM 9 |
| 219 | #endif | 252 | #define BN_HEX_FMT1 "%X" |
| 220 | 253 | #define BN_HEX_FMT2 "%08X" | |
| 221 | #ifdef EIGHT_BIT | ||
| 222 | #ifndef BN_DIV2W | ||
| 223 | #define BN_DIV2W | ||
| 224 | #endif | ||
| 225 | #define BN_ULLONG unsigned short | ||
| 226 | #define BN_ULONG unsigned char | ||
| 227 | #define BN_LONG char | ||
| 228 | #define BN_BITS 16 | ||
| 229 | #define BN_BYTES 1 | ||
| 230 | #define BN_BITS2 8 | ||
| 231 | #define BN_BITS4 4 | ||
| 232 | #define BN_MASK (0xffff) | ||
| 233 | #define BN_MASK2 (0xff) | ||
| 234 | #define BN_MASK2l (0xf) | ||
| 235 | #define BN_MASK2h1 (0xf8) | ||
| 236 | #define BN_MASK2h (0xf0) | ||
| 237 | #define BN_TBIT (0x80) | ||
| 238 | #define BN_DEC_CONV (100) | ||
| 239 | #define BN_DEC_FMT1 "%u" | ||
| 240 | #define BN_DEC_FMT2 "%02u" | ||
| 241 | #define BN_DEC_NUM 2 | ||
| 242 | #endif | 254 | #endif |
| 243 | 255 | ||
| 244 | #define BN_DEFAULT_BITS 1280 | 256 | #define BN_DEFAULT_BITS 1280 |
| @@ -303,12 +315,8 @@ struct bn_mont_ctx_st | |||
| 303 | BIGNUM N; /* The modulus */ | 315 | BIGNUM N; /* The modulus */ |
| 304 | BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 | 316 | BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 |
| 305 | * (Ni is only stored for bignum algorithm) */ | 317 | * (Ni is only stored for bignum algorithm) */ |
| 306 | #if 0 | 318 | BN_ULONG n0[2];/* least significant word(s) of Ni; |
| 307 | /* OpenSSL 0.9.9 preview: */ | 319 | (type changed with 0.9.9, was "BN_ULONG n0;" before) */ |
| 308 | BN_ULONG n0[2];/* least significant word(s) of Ni */ | ||
| 309 | #else | ||
| 310 | BN_ULONG n0; /* least significant word of Ni */ | ||
| 311 | #endif | ||
| 312 | int flags; | 320 | int flags; |
| 313 | }; | 321 | }; |
| 314 | 322 | ||
| @@ -504,6 +512,7 @@ char * BN_bn2hex(const BIGNUM *a); | |||
| 504 | char * BN_bn2dec(const BIGNUM *a); | 512 | char * BN_bn2dec(const BIGNUM *a); |
| 505 | int BN_hex2bn(BIGNUM **a, const char *str); | 513 | int BN_hex2bn(BIGNUM **a, const char *str); |
| 506 | int BN_dec2bn(BIGNUM **a, const char *str); | 514 | int BN_dec2bn(BIGNUM **a, const char *str); |
| 515 | int BN_asc2bn(BIGNUM **a, const char *str); | ||
| 507 | int BN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); | 516 | int BN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); |
| 508 | int BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */ | 517 | int BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */ |
| 509 | BIGNUM *BN_mod_inverse(BIGNUM *ret, | 518 | BIGNUM *BN_mod_inverse(BIGNUM *ret, |
| @@ -531,17 +540,6 @@ int BN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb); | |||
| 531 | int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, | 540 | int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, |
| 532 | int do_trial_division, BN_GENCB *cb); | 541 | int do_trial_division, BN_GENCB *cb); |
| 533 | 542 | ||
| 534 | int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); | ||
| 535 | |||
| 536 | int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, | ||
| 537 | const BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2, | ||
| 538 | const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb); | ||
| 539 | int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, | ||
| 540 | BIGNUM *Xp1, BIGNUM *Xp2, | ||
| 541 | const BIGNUM *Xp, | ||
| 542 | const BIGNUM *e, BN_CTX *ctx, | ||
| 543 | BN_GENCB *cb); | ||
| 544 | |||
| 545 | BN_MONT_CTX *BN_MONT_CTX_new(void ); | 543 | BN_MONT_CTX *BN_MONT_CTX_new(void ); |
| 546 | void BN_MONT_CTX_init(BN_MONT_CTX *ctx); | 544 | void BN_MONT_CTX_init(BN_MONT_CTX *ctx); |
| 547 | int BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b, | 545 | int BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b, |
| @@ -560,19 +558,22 @@ BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, | |||
| 560 | #define BN_BLINDING_NO_UPDATE 0x00000001 | 558 | #define BN_BLINDING_NO_UPDATE 0x00000001 |
| 561 | #define BN_BLINDING_NO_RECREATE 0x00000002 | 559 | #define BN_BLINDING_NO_RECREATE 0x00000002 |
| 562 | 560 | ||
| 563 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGNUM *mod); | 561 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); |
| 564 | void BN_BLINDING_free(BN_BLINDING *b); | 562 | void BN_BLINDING_free(BN_BLINDING *b); |
| 565 | int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); | 563 | int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); |
| 566 | int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); | 564 | int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); |
| 567 | int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); | 565 | int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); |
| 568 | int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); | 566 | int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); |
| 569 | int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *); | 567 | int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *); |
| 568 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 570 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); | 569 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); |
| 571 | void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); | 570 | void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); |
| 571 | #endif | ||
| 572 | CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *); | ||
| 572 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); | 573 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); |
| 573 | void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); | 574 | void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); |
| 574 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, | 575 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, |
| 575 | const BIGNUM *e, /* const */ BIGNUM *m, BN_CTX *ctx, | 576 | const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, |
| 576 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 577 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
| 577 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), | 578 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), |
| 578 | BN_MONT_CTX *m_ctx); | 579 | BN_MONT_CTX *m_ctx); |
| @@ -625,24 +626,24 @@ int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | |||
| 625 | * t^p[0] + t^p[1] + ... + t^p[k] | 626 | * t^p[0] + t^p[1] + ... + t^p[k] |
| 626 | * where m = p[0] > p[1] > ... > p[k] = 0. | 627 | * where m = p[0] > p[1] > ... > p[k] = 0. |
| 627 | */ | 628 | */ |
| 628 | int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]); | 629 | int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]); |
| 629 | /* r = a mod p */ | 630 | /* r = a mod p */ |
| 630 | int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | 631 | int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, |
| 631 | const unsigned int p[], BN_CTX *ctx); /* r = (a * b) mod p */ | 632 | const int p[], BN_CTX *ctx); /* r = (a * b) mod p */ |
| 632 | int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[], | 633 | int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], |
| 633 | BN_CTX *ctx); /* r = (a * a) mod p */ | 634 | BN_CTX *ctx); /* r = (a * a) mod p */ |
| 634 | int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const unsigned int p[], | 635 | int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], |
| 635 | BN_CTX *ctx); /* r = (1 / b) mod p */ | 636 | BN_CTX *ctx); /* r = (1 / b) mod p */ |
| 636 | int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | 637 | int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, |
| 637 | const unsigned int p[], BN_CTX *ctx); /* r = (a / b) mod p */ | 638 | const int p[], BN_CTX *ctx); /* r = (a / b) mod p */ |
| 638 | int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | 639 | int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, |
| 639 | const unsigned int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */ | 640 | const int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */ |
| 640 | int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, | 641 | int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, |
| 641 | const unsigned int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */ | 642 | const int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */ |
| 642 | int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, | 643 | int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, |
| 643 | const unsigned int p[], BN_CTX *ctx); /* r^2 + r = a mod p */ | 644 | const int p[], BN_CTX *ctx); /* r^2 + r = a mod p */ |
| 644 | int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max); | 645 | int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); |
| 645 | int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a); | 646 | int BN_GF2m_arr2poly(const int p[], BIGNUM *a); |
| 646 | 647 | ||
| 647 | /* faster mod functions for the 'NIST primes' | 648 | /* faster mod functions for the 'NIST primes' |
| 648 | * 0 <= a < p^2 */ | 649 | * 0 <= a < p^2 */ |
| @@ -751,10 +752,12 @@ int RAND_pseudo_bytes(unsigned char *buf,int num); | |||
| 751 | #define bn_correct_top(a) \ | 752 | #define bn_correct_top(a) \ |
| 752 | { \ | 753 | { \ |
| 753 | BN_ULONG *ftl; \ | 754 | BN_ULONG *ftl; \ |
| 754 | if ((a)->top > 0) \ | 755 | int tmp_top = (a)->top; \ |
| 756 | if (tmp_top > 0) \ | ||
| 755 | { \ | 757 | { \ |
| 756 | for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \ | 758 | for (ftl= &((a)->d[tmp_top-1]); tmp_top > 0; tmp_top--) \ |
| 757 | if (*(ftl--)) break; \ | 759 | if (*(ftl--)) break; \ |
| 760 | (a)->top = tmp_top; \ | ||
| 758 | } \ | 761 | } \ |
| 759 | bn_pollute(a); \ | 762 | bn_pollute(a); \ |
| 760 | } | 763 | } |
diff --git a/src/lib/libcrypto/bn/bn_asm.c b/src/lib/libcrypto/bn/bn_asm.c index 99bc2de491..c43c91cc09 100644 --- a/src/lib/libcrypto/bn/bn_asm.c +++ b/src/lib/libcrypto/bn/bn_asm.c | |||
| @@ -75,6 +75,7 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 75 | assert(num >= 0); | 75 | assert(num >= 0); |
| 76 | if (num <= 0) return(c1); | 76 | if (num <= 0) return(c1); |
| 77 | 77 | ||
| 78 | #ifndef OPENSSL_SMALL_FOOTPRINT | ||
| 78 | while (num&~3) | 79 | while (num&~3) |
| 79 | { | 80 | { |
| 80 | mul_add(rp[0],ap[0],w,c1); | 81 | mul_add(rp[0],ap[0],w,c1); |
| @@ -83,11 +84,11 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 83 | mul_add(rp[3],ap[3],w,c1); | 84 | mul_add(rp[3],ap[3],w,c1); |
| 84 | ap+=4; rp+=4; num-=4; | 85 | ap+=4; rp+=4; num-=4; |
| 85 | } | 86 | } |
| 86 | if (num) | 87 | #endif |
| 88 | while (num) | ||
| 87 | { | 89 | { |
| 88 | mul_add(rp[0],ap[0],w,c1); if (--num==0) return c1; | 90 | mul_add(rp[0],ap[0],w,c1); |
| 89 | mul_add(rp[1],ap[1],w,c1); if (--num==0) return c1; | 91 | ap++; rp++; num--; |
| 90 | mul_add(rp[2],ap[2],w,c1); return c1; | ||
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | return(c1); | 94 | return(c1); |
| @@ -100,6 +101,7 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 100 | assert(num >= 0); | 101 | assert(num >= 0); |
| 101 | if (num <= 0) return(c1); | 102 | if (num <= 0) return(c1); |
| 102 | 103 | ||
| 104 | #ifndef OPENSSL_SMALL_FOOTPRINT | ||
| 103 | while (num&~3) | 105 | while (num&~3) |
| 104 | { | 106 | { |
| 105 | mul(rp[0],ap[0],w,c1); | 107 | mul(rp[0],ap[0],w,c1); |
| @@ -108,11 +110,11 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 108 | mul(rp[3],ap[3],w,c1); | 110 | mul(rp[3],ap[3],w,c1); |
| 109 | ap+=4; rp+=4; num-=4; | 111 | ap+=4; rp+=4; num-=4; |
| 110 | } | 112 | } |
| 111 | if (num) | 113 | #endif |
| 114 | while (num) | ||
| 112 | { | 115 | { |
| 113 | mul(rp[0],ap[0],w,c1); if (--num == 0) return c1; | 116 | mul(rp[0],ap[0],w,c1); |
| 114 | mul(rp[1],ap[1],w,c1); if (--num == 0) return c1; | 117 | ap++; rp++; num--; |
| 115 | mul(rp[2],ap[2],w,c1); | ||
| 116 | } | 118 | } |
| 117 | return(c1); | 119 | return(c1); |
| 118 | } | 120 | } |
| @@ -121,6 +123,8 @@ void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int n) | |||
| 121 | { | 123 | { |
| 122 | assert(n >= 0); | 124 | assert(n >= 0); |
| 123 | if (n <= 0) return; | 125 | if (n <= 0) return; |
| 126 | |||
| 127 | #ifndef OPENSSL_SMALL_FOOTPRINT | ||
| 124 | while (n&~3) | 128 | while (n&~3) |
| 125 | { | 129 | { |
| 126 | sqr(r[0],r[1],a[0]); | 130 | sqr(r[0],r[1],a[0]); |
| @@ -129,11 +133,11 @@ void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int n) | |||
| 129 | sqr(r[6],r[7],a[3]); | 133 | sqr(r[6],r[7],a[3]); |
| 130 | a+=4; r+=8; n-=4; | 134 | a+=4; r+=8; n-=4; |
| 131 | } | 135 | } |
| 132 | if (n) | 136 | #endif |
| 137 | while (n) | ||
| 133 | { | 138 | { |
| 134 | sqr(r[0],r[1],a[0]); if (--n == 0) return; | 139 | sqr(r[0],r[1],a[0]); |
| 135 | sqr(r[2],r[3],a[1]); if (--n == 0) return; | 140 | a++; r+=2; n--; |
| 136 | sqr(r[4],r[5],a[2]); | ||
| 137 | } | 141 | } |
| 138 | } | 142 | } |
| 139 | 143 | ||
| @@ -150,18 +154,20 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 150 | bl=LBITS(w); | 154 | bl=LBITS(w); |
| 151 | bh=HBITS(w); | 155 | bh=HBITS(w); |
| 152 | 156 | ||
| 153 | for (;;) | 157 | #ifndef OPENSSL_SMALL_FOOTPRINT |
| 158 | while (num&~3) | ||
| 154 | { | 159 | { |
| 155 | mul_add(rp[0],ap[0],bl,bh,c); | 160 | mul_add(rp[0],ap[0],bl,bh,c); |
| 156 | if (--num == 0) break; | ||
| 157 | mul_add(rp[1],ap[1],bl,bh,c); | 161 | mul_add(rp[1],ap[1],bl,bh,c); |
| 158 | if (--num == 0) break; | ||
| 159 | mul_add(rp[2],ap[2],bl,bh,c); | 162 | mul_add(rp[2],ap[2],bl,bh,c); |
| 160 | if (--num == 0) break; | ||
| 161 | mul_add(rp[3],ap[3],bl,bh,c); | 163 | mul_add(rp[3],ap[3],bl,bh,c); |
| 162 | if (--num == 0) break; | 164 | ap+=4; rp+=4; num-=4; |
| 163 | ap+=4; | 165 | } |
| 164 | rp+=4; | 166 | #endif |
| 167 | while (num) | ||
| 168 | { | ||
| 169 | mul_add(rp[0],ap[0],bl,bh,c); | ||
| 170 | ap++; rp++; num--; | ||
| 165 | } | 171 | } |
| 166 | return(c); | 172 | return(c); |
| 167 | } | 173 | } |
| @@ -177,18 +183,20 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 177 | bl=LBITS(w); | 183 | bl=LBITS(w); |
| 178 | bh=HBITS(w); | 184 | bh=HBITS(w); |
| 179 | 185 | ||
| 180 | for (;;) | 186 | #ifndef OPENSSL_SMALL_FOOTPRINT |
| 187 | while (num&~3) | ||
| 181 | { | 188 | { |
| 182 | mul(rp[0],ap[0],bl,bh,carry); | 189 | mul(rp[0],ap[0],bl,bh,carry); |
| 183 | if (--num == 0) break; | ||
| 184 | mul(rp[1],ap[1],bl,bh,carry); | 190 | mul(rp[1],ap[1],bl,bh,carry); |
| 185 | if (--num == 0) break; | ||
| 186 | mul(rp[2],ap[2],bl,bh,carry); | 191 | mul(rp[2],ap[2],bl,bh,carry); |
| 187 | if (--num == 0) break; | ||
| 188 | mul(rp[3],ap[3],bl,bh,carry); | 192 | mul(rp[3],ap[3],bl,bh,carry); |
| 189 | if (--num == 0) break; | 193 | ap+=4; rp+=4; num-=4; |
| 190 | ap+=4; | 194 | } |
| 191 | rp+=4; | 195 | #endif |
| 196 | while (num) | ||
| 197 | { | ||
| 198 | mul(rp[0],ap[0],bl,bh,carry); | ||
| 199 | ap++; rp++; num--; | ||
| 192 | } | 200 | } |
| 193 | return(carry); | 201 | return(carry); |
| 194 | } | 202 | } |
| @@ -197,22 +205,21 @@ void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int n) | |||
| 197 | { | 205 | { |
| 198 | assert(n >= 0); | 206 | assert(n >= 0); |
| 199 | if (n <= 0) return; | 207 | if (n <= 0) return; |
| 200 | for (;;) | 208 | |
| 209 | #ifndef OPENSSL_SMALL_FOOTPRINT | ||
| 210 | while (n&~3) | ||
| 201 | { | 211 | { |
| 202 | sqr64(r[0],r[1],a[0]); | 212 | sqr64(r[0],r[1],a[0]); |
| 203 | if (--n == 0) break; | ||
| 204 | |||
| 205 | sqr64(r[2],r[3],a[1]); | 213 | sqr64(r[2],r[3],a[1]); |
| 206 | if (--n == 0) break; | ||
| 207 | |||
| 208 | sqr64(r[4],r[5],a[2]); | 214 | sqr64(r[4],r[5],a[2]); |
| 209 | if (--n == 0) break; | ||
| 210 | |||
| 211 | sqr64(r[6],r[7],a[3]); | 215 | sqr64(r[6],r[7],a[3]); |
| 212 | if (--n == 0) break; | 216 | a+=4; r+=8; n-=4; |
| 213 | 217 | } | |
| 214 | a+=4; | 218 | #endif |
| 215 | r+=8; | 219 | while (n) |
| 220 | { | ||
| 221 | sqr64(r[0],r[1],a[0]); | ||
| 222 | a++; r+=2; n--; | ||
| 216 | } | 223 | } |
| 217 | } | 224 | } |
| 218 | 225 | ||
| @@ -303,31 +310,30 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | |||
| 303 | assert(n >= 0); | 310 | assert(n >= 0); |
| 304 | if (n <= 0) return((BN_ULONG)0); | 311 | if (n <= 0) return((BN_ULONG)0); |
| 305 | 312 | ||
| 306 | for (;;) | 313 | #ifndef OPENSSL_SMALL_FOOTPRINT |
| 314 | while (n&~3) | ||
| 307 | { | 315 | { |
| 308 | ll+=(BN_ULLONG)a[0]+b[0]; | 316 | ll+=(BN_ULLONG)a[0]+b[0]; |
| 309 | r[0]=(BN_ULONG)ll&BN_MASK2; | 317 | r[0]=(BN_ULONG)ll&BN_MASK2; |
| 310 | ll>>=BN_BITS2; | 318 | ll>>=BN_BITS2; |
| 311 | if (--n <= 0) break; | ||
| 312 | |||
| 313 | ll+=(BN_ULLONG)a[1]+b[1]; | 319 | ll+=(BN_ULLONG)a[1]+b[1]; |
| 314 | r[1]=(BN_ULONG)ll&BN_MASK2; | 320 | r[1]=(BN_ULONG)ll&BN_MASK2; |
| 315 | ll>>=BN_BITS2; | 321 | ll>>=BN_BITS2; |
| 316 | if (--n <= 0) break; | ||
| 317 | |||
| 318 | ll+=(BN_ULLONG)a[2]+b[2]; | 322 | ll+=(BN_ULLONG)a[2]+b[2]; |
| 319 | r[2]=(BN_ULONG)ll&BN_MASK2; | 323 | r[2]=(BN_ULONG)ll&BN_MASK2; |
| 320 | ll>>=BN_BITS2; | 324 | ll>>=BN_BITS2; |
| 321 | if (--n <= 0) break; | ||
| 322 | |||
| 323 | ll+=(BN_ULLONG)a[3]+b[3]; | 325 | ll+=(BN_ULLONG)a[3]+b[3]; |
| 324 | r[3]=(BN_ULONG)ll&BN_MASK2; | 326 | r[3]=(BN_ULONG)ll&BN_MASK2; |
| 325 | ll>>=BN_BITS2; | 327 | ll>>=BN_BITS2; |
| 326 | if (--n <= 0) break; | 328 | a+=4; b+=4; r+=4; n-=4; |
| 327 | 329 | } | |
| 328 | a+=4; | 330 | #endif |
| 329 | b+=4; | 331 | while (n) |
| 330 | r+=4; | 332 | { |
| 333 | ll+=(BN_ULLONG)a[0]+b[0]; | ||
| 334 | r[0]=(BN_ULONG)ll&BN_MASK2; | ||
| 335 | ll>>=BN_BITS2; | ||
| 336 | a++; b++; r++; n--; | ||
| 331 | } | 337 | } |
| 332 | return((BN_ULONG)ll); | 338 | return((BN_ULONG)ll); |
| 333 | } | 339 | } |
| @@ -340,7 +346,8 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | |||
| 340 | if (n <= 0) return((BN_ULONG)0); | 346 | if (n <= 0) return((BN_ULONG)0); |
| 341 | 347 | ||
| 342 | c=0; | 348 | c=0; |
| 343 | for (;;) | 349 | #ifndef OPENSSL_SMALL_FOOTPRINT |
| 350 | while (n&~3) | ||
| 344 | { | 351 | { |
| 345 | t=a[0]; | 352 | t=a[0]; |
| 346 | t=(t+c)&BN_MASK2; | 353 | t=(t+c)&BN_MASK2; |
| @@ -348,35 +355,36 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | |||
| 348 | l=(t+b[0])&BN_MASK2; | 355 | l=(t+b[0])&BN_MASK2; |
| 349 | c+=(l < t); | 356 | c+=(l < t); |
| 350 | r[0]=l; | 357 | r[0]=l; |
| 351 | if (--n <= 0) break; | ||
| 352 | |||
| 353 | t=a[1]; | 358 | t=a[1]; |
| 354 | t=(t+c)&BN_MASK2; | 359 | t=(t+c)&BN_MASK2; |
| 355 | c=(t < c); | 360 | c=(t < c); |
| 356 | l=(t+b[1])&BN_MASK2; | 361 | l=(t+b[1])&BN_MASK2; |
| 357 | c+=(l < t); | 362 | c+=(l < t); |
| 358 | r[1]=l; | 363 | r[1]=l; |
| 359 | if (--n <= 0) break; | ||
| 360 | |||
| 361 | t=a[2]; | 364 | t=a[2]; |
| 362 | t=(t+c)&BN_MASK2; | 365 | t=(t+c)&BN_MASK2; |
| 363 | c=(t < c); | 366 | c=(t < c); |
| 364 | l=(t+b[2])&BN_MASK2; | 367 | l=(t+b[2])&BN_MASK2; |
| 365 | c+=(l < t); | 368 | c+=(l < t); |
| 366 | r[2]=l; | 369 | r[2]=l; |
| 367 | if (--n <= 0) break; | ||
| 368 | |||
| 369 | t=a[3]; | 370 | t=a[3]; |
| 370 | t=(t+c)&BN_MASK2; | 371 | t=(t+c)&BN_MASK2; |
| 371 | c=(t < c); | 372 | c=(t < c); |
| 372 | l=(t+b[3])&BN_MASK2; | 373 | l=(t+b[3])&BN_MASK2; |
| 373 | c+=(l < t); | 374 | c+=(l < t); |
| 374 | r[3]=l; | 375 | r[3]=l; |
| 375 | if (--n <= 0) break; | 376 | a+=4; b+=4; r+=4; n-=4; |
| 376 | 377 | } | |
| 377 | a+=4; | 378 | #endif |
| 378 | b+=4; | 379 | while(n) |
| 379 | r+=4; | 380 | { |
| 381 | t=a[0]; | ||
| 382 | t=(t+c)&BN_MASK2; | ||
| 383 | c=(t < c); | ||
| 384 | l=(t+b[0])&BN_MASK2; | ||
| 385 | c+=(l < t); | ||
| 386 | r[0]=l; | ||
| 387 | a++; b++; r++; n--; | ||
| 380 | } | 388 | } |
| 381 | return((BN_ULONG)c); | 389 | return((BN_ULONG)c); |
| 382 | } | 390 | } |
| @@ -390,36 +398,35 @@ BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | |||
| 390 | assert(n >= 0); | 398 | assert(n >= 0); |
| 391 | if (n <= 0) return((BN_ULONG)0); | 399 | if (n <= 0) return((BN_ULONG)0); |
| 392 | 400 | ||
| 393 | for (;;) | 401 | #ifndef OPENSSL_SMALL_FOOTPRINT |
| 402 | while (n&~3) | ||
| 394 | { | 403 | { |
| 395 | t1=a[0]; t2=b[0]; | 404 | t1=a[0]; t2=b[0]; |
| 396 | r[0]=(t1-t2-c)&BN_MASK2; | 405 | r[0]=(t1-t2-c)&BN_MASK2; |
| 397 | if (t1 != t2) c=(t1 < t2); | 406 | if (t1 != t2) c=(t1 < t2); |
| 398 | if (--n <= 0) break; | ||
| 399 | |||
| 400 | t1=a[1]; t2=b[1]; | 407 | t1=a[1]; t2=b[1]; |
| 401 | r[1]=(t1-t2-c)&BN_MASK2; | 408 | r[1]=(t1-t2-c)&BN_MASK2; |
| 402 | if (t1 != t2) c=(t1 < t2); | 409 | if (t1 != t2) c=(t1 < t2); |
| 403 | if (--n <= 0) break; | ||
| 404 | |||
| 405 | t1=a[2]; t2=b[2]; | 410 | t1=a[2]; t2=b[2]; |
| 406 | r[2]=(t1-t2-c)&BN_MASK2; | 411 | r[2]=(t1-t2-c)&BN_MASK2; |
| 407 | if (t1 != t2) c=(t1 < t2); | 412 | if (t1 != t2) c=(t1 < t2); |
| 408 | if (--n <= 0) break; | ||
| 409 | |||
| 410 | t1=a[3]; t2=b[3]; | 413 | t1=a[3]; t2=b[3]; |
| 411 | r[3]=(t1-t2-c)&BN_MASK2; | 414 | r[3]=(t1-t2-c)&BN_MASK2; |
| 412 | if (t1 != t2) c=(t1 < t2); | 415 | if (t1 != t2) c=(t1 < t2); |
| 413 | if (--n <= 0) break; | 416 | a+=4; b+=4; r+=4; n-=4; |
| 414 | 417 | } | |
| 415 | a+=4; | 418 | #endif |
| 416 | b+=4; | 419 | while (n) |
| 417 | r+=4; | 420 | { |
| 421 | t1=a[0]; t2=b[0]; | ||
| 422 | r[0]=(t1-t2-c)&BN_MASK2; | ||
| 423 | if (t1 != t2) c=(t1 < t2); | ||
| 424 | a++; b++; r++; n--; | ||
| 418 | } | 425 | } |
| 419 | return(c); | 426 | return(c); |
| 420 | } | 427 | } |
| 421 | 428 | ||
| 422 | #ifdef BN_MUL_COMBA | 429 | #if defined(BN_MUL_COMBA) && !defined(OPENSSL_SMALL_FOOTPRINT) |
| 423 | 430 | ||
| 424 | #undef bn_mul_comba8 | 431 | #undef bn_mul_comba8 |
| 425 | #undef bn_mul_comba4 | 432 | #undef bn_mul_comba4 |
| @@ -820,18 +827,134 @@ void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a) | |||
| 820 | r[6]=c1; | 827 | r[6]=c1; |
| 821 | r[7]=c2; | 828 | r[7]=c2; |
| 822 | } | 829 | } |
| 830 | |||
| 831 | #ifdef OPENSSL_NO_ASM | ||
| 832 | #ifdef OPENSSL_BN_ASM_MONT | ||
| 833 | #include <alloca.h> | ||
| 834 | /* | ||
| 835 | * This is essentially reference implementation, which may or may not | ||
| 836 | * result in performance improvement. E.g. on IA-32 this routine was | ||
| 837 | * observed to give 40% faster rsa1024 private key operations and 10% | ||
| 838 | * faster rsa4096 ones, while on AMD64 it improves rsa1024 sign only | ||
| 839 | * by 10% and *worsens* rsa4096 sign by 15%. Once again, it's a | ||
| 840 | * reference implementation, one to be used as starting point for | ||
| 841 | * platform-specific assembler. Mentioned numbers apply to compiler | ||
| 842 | * generated code compiled with and without -DOPENSSL_BN_ASM_MONT and | ||
| 843 | * can vary not only from platform to platform, but even for compiler | ||
| 844 | * versions. Assembler vs. assembler improvement coefficients can | ||
| 845 | * [and are known to] differ and are to be documented elsewhere. | ||
| 846 | */ | ||
| 847 | int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0p, int num) | ||
| 848 | { | ||
| 849 | BN_ULONG c0,c1,ml,*tp,n0; | ||
| 850 | #ifdef mul64 | ||
| 851 | BN_ULONG mh; | ||
| 852 | #endif | ||
| 853 | volatile BN_ULONG *vp; | ||
| 854 | int i=0,j; | ||
| 855 | |||
| 856 | #if 0 /* template for platform-specific implementation */ | ||
| 857 | if (ap==bp) return bn_sqr_mont(rp,ap,np,n0p,num); | ||
| 858 | #endif | ||
| 859 | vp = tp = alloca((num+2)*sizeof(BN_ULONG)); | ||
| 860 | |||
| 861 | n0 = *n0p; | ||
| 862 | |||
| 863 | c0 = 0; | ||
| 864 | ml = bp[0]; | ||
| 865 | #ifdef mul64 | ||
| 866 | mh = HBITS(ml); | ||
| 867 | ml = LBITS(ml); | ||
| 868 | for (j=0;j<num;++j) | ||
| 869 | mul(tp[j],ap[j],ml,mh,c0); | ||
| 870 | #else | ||
| 871 | for (j=0;j<num;++j) | ||
| 872 | mul(tp[j],ap[j],ml,c0); | ||
| 873 | #endif | ||
| 874 | |||
| 875 | tp[num] = c0; | ||
| 876 | tp[num+1] = 0; | ||
| 877 | goto enter; | ||
| 878 | |||
| 879 | for(i=0;i<num;i++) | ||
| 880 | { | ||
| 881 | c0 = 0; | ||
| 882 | ml = bp[i]; | ||
| 883 | #ifdef mul64 | ||
| 884 | mh = HBITS(ml); | ||
| 885 | ml = LBITS(ml); | ||
| 886 | for (j=0;j<num;++j) | ||
| 887 | mul_add(tp[j],ap[j],ml,mh,c0); | ||
| 888 | #else | ||
| 889 | for (j=0;j<num;++j) | ||
| 890 | mul_add(tp[j],ap[j],ml,c0); | ||
| 891 | #endif | ||
| 892 | c1 = (tp[num] + c0)&BN_MASK2; | ||
| 893 | tp[num] = c1; | ||
| 894 | tp[num+1] = (c1<c0?1:0); | ||
| 895 | enter: | ||
| 896 | c1 = tp[0]; | ||
| 897 | ml = (c1*n0)&BN_MASK2; | ||
| 898 | c0 = 0; | ||
| 899 | #ifdef mul64 | ||
| 900 | mh = HBITS(ml); | ||
| 901 | ml = LBITS(ml); | ||
| 902 | mul_add(c1,np[0],ml,mh,c0); | ||
| 903 | #else | ||
| 904 | mul_add(c1,ml,np[0],c0); | ||
| 905 | #endif | ||
| 906 | for(j=1;j<num;j++) | ||
| 907 | { | ||
| 908 | c1 = tp[j]; | ||
| 909 | #ifdef mul64 | ||
| 910 | mul_add(c1,np[j],ml,mh,c0); | ||
| 911 | #else | ||
| 912 | mul_add(c1,ml,np[j],c0); | ||
| 913 | #endif | ||
| 914 | tp[j-1] = c1&BN_MASK2; | ||
| 915 | } | ||
| 916 | c1 = (tp[num] + c0)&BN_MASK2; | ||
| 917 | tp[num-1] = c1; | ||
| 918 | tp[num] = tp[num+1] + (c1<c0?1:0); | ||
| 919 | } | ||
| 920 | |||
| 921 | if (tp[num]!=0 || tp[num-1]>=np[num-1]) | ||
| 922 | { | ||
| 923 | c0 = bn_sub_words(rp,tp,np,num); | ||
| 924 | if (tp[num]!=0 || c0==0) | ||
| 925 | { | ||
| 926 | for(i=0;i<num+2;i++) vp[i] = 0; | ||
| 927 | return 1; | ||
| 928 | } | ||
| 929 | } | ||
| 930 | for(i=0;i<num;i++) rp[i] = tp[i], vp[i] = 0; | ||
| 931 | vp[num] = 0; | ||
| 932 | vp[num+1] = 0; | ||
| 933 | return 1; | ||
| 934 | } | ||
| 935 | #else | ||
| 936 | /* | ||
| 937 | * Return value of 0 indicates that multiplication/convolution was not | ||
| 938 | * performed to signal the caller to fall down to alternative/original | ||
| 939 | * code-path. | ||
| 940 | */ | ||
| 941 | int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num) | ||
| 942 | { return 0; } | ||
| 943 | #endif /* OPENSSL_BN_ASM_MONT */ | ||
| 944 | #endif | ||
| 945 | |||
| 823 | #else /* !BN_MUL_COMBA */ | 946 | #else /* !BN_MUL_COMBA */ |
| 824 | 947 | ||
| 825 | /* hmm... is it faster just to do a multiply? */ | 948 | /* hmm... is it faster just to do a multiply? */ |
| 826 | #undef bn_sqr_comba4 | 949 | #undef bn_sqr_comba4 |
| 827 | void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a) | 950 | void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a) |
| 828 | { | 951 | { |
| 829 | BN_ULONG t[8]; | 952 | BN_ULONG t[8]; |
| 830 | bn_sqr_normal(r,a,4,t); | 953 | bn_sqr_normal(r,a,4,t); |
| 831 | } | 954 | } |
| 832 | 955 | ||
| 833 | #undef bn_sqr_comba8 | 956 | #undef bn_sqr_comba8 |
| 834 | void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a) | 957 | void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a) |
| 835 | { | 958 | { |
| 836 | BN_ULONG t[16]; | 959 | BN_ULONG t[16]; |
| 837 | bn_sqr_normal(r,a,8,t); | 960 | bn_sqr_normal(r,a,8,t); |
| @@ -857,4 +980,51 @@ void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b) | |||
| 857 | r[15]=bn_mul_add_words(&(r[7]),a,8,b[7]); | 980 | r[15]=bn_mul_add_words(&(r[7]),a,8,b[7]); |
| 858 | } | 981 | } |
| 859 | 982 | ||
| 983 | #ifdef OPENSSL_NO_ASM | ||
| 984 | #ifdef OPENSSL_BN_ASM_MONT | ||
| 985 | #include <alloca.h> | ||
| 986 | int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0p, int num) | ||
| 987 | { | ||
| 988 | BN_ULONG c0,c1,*tp,n0=*n0p; | ||
| 989 | volatile BN_ULONG *vp; | ||
| 990 | int i=0,j; | ||
| 991 | |||
| 992 | vp = tp = alloca((num+2)*sizeof(BN_ULONG)); | ||
| 993 | |||
| 994 | for(i=0;i<=num;i++) tp[i]=0; | ||
| 995 | |||
| 996 | for(i=0;i<num;i++) | ||
| 997 | { | ||
| 998 | c0 = bn_mul_add_words(tp,ap,num,bp[i]); | ||
| 999 | c1 = (tp[num] + c0)&BN_MASK2; | ||
| 1000 | tp[num] = c1; | ||
| 1001 | tp[num+1] = (c1<c0?1:0); | ||
| 1002 | |||
| 1003 | c0 = bn_mul_add_words(tp,np,num,tp[0]*n0); | ||
| 1004 | c1 = (tp[num] + c0)&BN_MASK2; | ||
| 1005 | tp[num] = c1; | ||
| 1006 | tp[num+1] += (c1<c0?1:0); | ||
| 1007 | for(j=0;j<=num;j++) tp[j]=tp[j+1]; | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | if (tp[num]!=0 || tp[num-1]>=np[num-1]) | ||
| 1011 | { | ||
| 1012 | c0 = bn_sub_words(rp,tp,np,num); | ||
| 1013 | if (tp[num]!=0 || c0==0) | ||
| 1014 | { | ||
| 1015 | for(i=0;i<num+2;i++) vp[i] = 0; | ||
| 1016 | return 1; | ||
| 1017 | } | ||
| 1018 | } | ||
| 1019 | for(i=0;i<num;i++) rp[i] = tp[i], vp[i] = 0; | ||
| 1020 | vp[num] = 0; | ||
| 1021 | vp[num+1] = 0; | ||
| 1022 | return 1; | ||
| 1023 | } | ||
| 1024 | #else | ||
| 1025 | int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num) | ||
| 1026 | { return 0; } | ||
| 1027 | #endif /* OPENSSL_BN_ASM_MONT */ | ||
| 1028 | #endif | ||
| 1029 | |||
| 860 | #endif /* !BN_MUL_COMBA */ | 1030 | #endif /* !BN_MUL_COMBA */ |
diff --git a/src/lib/libcrypto/bn/bn_blind.c b/src/lib/libcrypto/bn/bn_blind.c index c11fb4ccc2..e060592fdc 100644 --- a/src/lib/libcrypto/bn/bn_blind.c +++ b/src/lib/libcrypto/bn/bn_blind.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/bn/bn_blind.c */ | 1 | /* crypto/bn/bn_blind.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -121,8 +121,11 @@ struct bn_blinding_st | |||
| 121 | BIGNUM *Ai; | 121 | BIGNUM *Ai; |
| 122 | BIGNUM *e; | 122 | BIGNUM *e; |
| 123 | BIGNUM *mod; /* just a reference */ | 123 | BIGNUM *mod; /* just a reference */ |
| 124 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 124 | unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b; | 125 | unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b; |
| 125 | * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */ | 126 | * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */ |
| 127 | #endif | ||
| 128 | CRYPTO_THREADID tid; | ||
| 126 | unsigned int counter; | 129 | unsigned int counter; |
| 127 | unsigned long flags; | 130 | unsigned long flags; |
| 128 | BN_MONT_CTX *m_ctx; | 131 | BN_MONT_CTX *m_ctx; |
| @@ -131,7 +134,7 @@ struct bn_blinding_st | |||
| 131 | BN_MONT_CTX *m_ctx); | 134 | BN_MONT_CTX *m_ctx); |
| 132 | }; | 135 | }; |
| 133 | 136 | ||
| 134 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGNUM *mod) | 137 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) |
| 135 | { | 138 | { |
| 136 | BN_BLINDING *ret=NULL; | 139 | BN_BLINDING *ret=NULL; |
| 137 | 140 | ||
| @@ -158,6 +161,7 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGN | |||
| 158 | BN_set_flags(ret->mod, BN_FLG_CONSTTIME); | 161 | BN_set_flags(ret->mod, BN_FLG_CONSTTIME); |
| 159 | 162 | ||
| 160 | ret->counter = BN_BLINDING_COUNTER; | 163 | ret->counter = BN_BLINDING_COUNTER; |
| 164 | CRYPTO_THREADID_current(&ret->tid); | ||
| 161 | return(ret); | 165 | return(ret); |
| 162 | err: | 166 | err: |
| 163 | if (ret != NULL) BN_BLINDING_free(ret); | 167 | if (ret != NULL) BN_BLINDING_free(ret); |
| @@ -263,6 +267,7 @@ int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ct | |||
| 263 | return(ret); | 267 | return(ret); |
| 264 | } | 268 | } |
| 265 | 269 | ||
| 270 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 266 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *b) | 271 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *b) |
| 267 | { | 272 | { |
| 268 | return b->thread_id; | 273 | return b->thread_id; |
| @@ -272,6 +277,12 @@ void BN_BLINDING_set_thread_id(BN_BLINDING *b, unsigned long n) | |||
| 272 | { | 277 | { |
| 273 | b->thread_id = n; | 278 | b->thread_id = n; |
| 274 | } | 279 | } |
| 280 | #endif | ||
| 281 | |||
| 282 | CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *b) | ||
| 283 | { | ||
| 284 | return &b->tid; | ||
| 285 | } | ||
| 275 | 286 | ||
| 276 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b) | 287 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b) |
| 277 | { | 288 | { |
| @@ -284,7 +295,7 @@ void BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags) | |||
| 284 | } | 295 | } |
| 285 | 296 | ||
| 286 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, | 297 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, |
| 287 | const BIGNUM *e, /* const */ BIGNUM *m, BN_CTX *ctx, | 298 | const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, |
| 288 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 299 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
| 289 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), | 300 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), |
| 290 | BN_MONT_CTX *m_ctx) | 301 | BN_MONT_CTX *m_ctx) |
diff --git a/src/lib/libcrypto/bn/bn_ctx.c b/src/lib/libcrypto/bn/bn_ctx.c index b3452f1a91..3f2256f675 100644 --- a/src/lib/libcrypto/bn/bn_ctx.c +++ b/src/lib/libcrypto/bn/bn_ctx.c | |||
| @@ -161,7 +161,7 @@ static void ctxdbg(BN_CTX *ctx) | |||
| 161 | fprintf(stderr,"(%08x): ", (unsigned int)ctx); | 161 | fprintf(stderr,"(%08x): ", (unsigned int)ctx); |
| 162 | while(bnidx < ctx->used) | 162 | while(bnidx < ctx->used) |
| 163 | { | 163 | { |
| 164 | fprintf(stderr,"%02x ", item->vals[bnidx++ % BN_CTX_POOL_SIZE].dmax); | 164 | fprintf(stderr,"%03x ", item->vals[bnidx++ % BN_CTX_POOL_SIZE].dmax); |
| 165 | if(!(bnidx % BN_CTX_POOL_SIZE)) | 165 | if(!(bnidx % BN_CTX_POOL_SIZE)) |
| 166 | item = item->next; | 166 | item = item->next; |
| 167 | } | 167 | } |
| @@ -171,8 +171,8 @@ static void ctxdbg(BN_CTX *ctx) | |||
| 171 | while(fpidx < stack->depth) | 171 | while(fpidx < stack->depth) |
| 172 | { | 172 | { |
| 173 | while(bnidx++ < stack->indexes[fpidx]) | 173 | while(bnidx++ < stack->indexes[fpidx]) |
| 174 | fprintf(stderr," "); | 174 | fprintf(stderr," "); |
| 175 | fprintf(stderr,"^^ "); | 175 | fprintf(stderr,"^^^ "); |
| 176 | bnidx++; | 176 | bnidx++; |
| 177 | fpidx++; | 177 | fpidx++; |
| 178 | } | 178 | } |
diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c index d6ddc9cbe3..802a43d642 100644 --- a/src/lib/libcrypto/bn/bn_div.c +++ b/src/lib/libcrypto/bn/bn_div.c | |||
| @@ -229,7 +229,8 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, | |||
| 229 | if (dv == NULL) | 229 | if (dv == NULL) |
| 230 | res=BN_CTX_get(ctx); | 230 | res=BN_CTX_get(ctx); |
| 231 | else res=dv; | 231 | else res=dv; |
| 232 | if (sdiv == NULL || res == NULL) goto err; | 232 | if (sdiv == NULL || res == NULL || tmp == NULL || snum == NULL) |
| 233 | goto err; | ||
| 233 | 234 | ||
| 234 | /* First we normalise the numbers */ | 235 | /* First we normalise the numbers */ |
| 235 | norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); | 236 | norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); |
| @@ -336,7 +337,7 @@ X) -> 0x%08X\n", | |||
| 336 | t2 -= d1; | 337 | t2 -= d1; |
| 337 | } | 338 | } |
| 338 | #else /* !BN_LLONG */ | 339 | #else /* !BN_LLONG */ |
| 339 | BN_ULONG t2l,t2h,ql,qh; | 340 | BN_ULONG t2l,t2h; |
| 340 | 341 | ||
| 341 | q=bn_div_words(n0,n1,d0); | 342 | q=bn_div_words(n0,n1,d0); |
| 342 | #ifdef BN_DEBUG_LEVITTE | 343 | #ifdef BN_DEBUG_LEVITTE |
| @@ -354,9 +355,12 @@ X) -> 0x%08X\n", | |||
| 354 | t2l = d1 * q; | 355 | t2l = d1 * q; |
| 355 | t2h = BN_UMULT_HIGH(d1,q); | 356 | t2h = BN_UMULT_HIGH(d1,q); |
| 356 | #else | 357 | #else |
| 358 | { | ||
| 359 | BN_ULONG ql, qh; | ||
| 357 | t2l=LBITS(d1); t2h=HBITS(d1); | 360 | t2l=LBITS(d1); t2h=HBITS(d1); |
| 358 | ql =LBITS(q); qh =HBITS(q); | 361 | ql =LBITS(q); qh =HBITS(q); |
| 359 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ | 362 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ |
| 363 | } | ||
| 360 | #endif | 364 | #endif |
| 361 | 365 | ||
| 362 | for (;;) | 366 | for (;;) |
| @@ -560,7 +564,7 @@ X) -> 0x%08X\n", | |||
| 560 | t2 -= d1; | 564 | t2 -= d1; |
| 561 | } | 565 | } |
| 562 | #else /* !BN_LLONG */ | 566 | #else /* !BN_LLONG */ |
| 563 | BN_ULONG t2l,t2h,ql,qh; | 567 | BN_ULONG t2l,t2h; |
| 564 | 568 | ||
| 565 | q=bn_div_words(n0,n1,d0); | 569 | q=bn_div_words(n0,n1,d0); |
| 566 | #ifdef BN_DEBUG_LEVITTE | 570 | #ifdef BN_DEBUG_LEVITTE |
| @@ -578,9 +582,12 @@ X) -> 0x%08X\n", | |||
| 578 | t2l = d1 * q; | 582 | t2l = d1 * q; |
| 579 | t2h = BN_UMULT_HIGH(d1,q); | 583 | t2h = BN_UMULT_HIGH(d1,q); |
| 580 | #else | 584 | #else |
| 585 | { | ||
| 586 | BN_ULONG ql, qh; | ||
| 581 | t2l=LBITS(d1); t2h=HBITS(d1); | 587 | t2l=LBITS(d1); t2h=HBITS(d1); |
| 582 | ql =LBITS(q); qh =HBITS(q); | 588 | ql =LBITS(q); qh =HBITS(q); |
| 583 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ | 589 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ |
| 590 | } | ||
| 584 | #endif | 591 | #endif |
| 585 | 592 | ||
| 586 | for (;;) | 593 | for (;;) |
diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c index 70a33f0d93..d9b6c737fc 100644 --- a/src/lib/libcrypto/bn/bn_exp.c +++ b/src/lib/libcrypto/bn/bn_exp.c | |||
| @@ -134,7 +134,8 @@ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 134 | rr = BN_CTX_get(ctx); | 134 | rr = BN_CTX_get(ctx); |
| 135 | else | 135 | else |
| 136 | rr = r; | 136 | rr = r; |
| 137 | if ((v = BN_CTX_get(ctx)) == NULL) goto err; | 137 | v = BN_CTX_get(ctx); |
| 138 | if (rr == NULL || v == NULL) goto err; | ||
| 138 | 139 | ||
| 139 | if (BN_copy(v,a) == NULL) goto err; | 140 | if (BN_copy(v,a) == NULL) goto err; |
| 140 | bits=BN_num_bits(p); | 141 | bits=BN_num_bits(p); |
diff --git a/src/lib/libcrypto/bn/bn_gf2m.c b/src/lib/libcrypto/bn/bn_gf2m.c index ae642ccb39..527b0fa15b 100644 --- a/src/lib/libcrypto/bn/bn_gf2m.c +++ b/src/lib/libcrypto/bn/bn_gf2m.c | |||
| @@ -121,74 +121,12 @@ static const BN_ULONG SQR_tb[16] = | |||
| 121 | SQR_tb[(w) >> 12 & 0xF] << 24 | SQR_tb[(w) >> 8 & 0xF] << 16 | \ | 121 | SQR_tb[(w) >> 12 & 0xF] << 24 | SQR_tb[(w) >> 8 & 0xF] << 16 | \ |
| 122 | SQR_tb[(w) >> 4 & 0xF] << 8 | SQR_tb[(w) & 0xF] | 122 | SQR_tb[(w) >> 4 & 0xF] << 8 | SQR_tb[(w) & 0xF] |
| 123 | #endif | 123 | #endif |
| 124 | #ifdef SIXTEEN_BIT | ||
| 125 | #define SQR1(w) \ | ||
| 126 | SQR_tb[(w) >> 12 & 0xF] << 8 | SQR_tb[(w) >> 8 & 0xF] | ||
| 127 | #define SQR0(w) \ | ||
| 128 | SQR_tb[(w) >> 4 & 0xF] << 8 | SQR_tb[(w) & 0xF] | ||
| 129 | #endif | ||
| 130 | #ifdef EIGHT_BIT | ||
| 131 | #define SQR1(w) \ | ||
| 132 | SQR_tb[(w) >> 4 & 0xF] | ||
| 133 | #define SQR0(w) \ | ||
| 134 | SQR_tb[(w) & 15] | ||
| 135 | #endif | ||
| 136 | 124 | ||
| 137 | /* Product of two polynomials a, b each with degree < BN_BITS2 - 1, | 125 | /* Product of two polynomials a, b each with degree < BN_BITS2 - 1, |
| 138 | * result is a polynomial r with degree < 2 * BN_BITS - 1 | 126 | * result is a polynomial r with degree < 2 * BN_BITS - 1 |
| 139 | * The caller MUST ensure that the variables have the right amount | 127 | * The caller MUST ensure that the variables have the right amount |
| 140 | * of space allocated. | 128 | * of space allocated. |
| 141 | */ | 129 | */ |
| 142 | #ifdef EIGHT_BIT | ||
| 143 | static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, const BN_ULONG b) | ||
| 144 | { | ||
| 145 | register BN_ULONG h, l, s; | ||
| 146 | BN_ULONG tab[4], top1b = a >> 7; | ||
| 147 | register BN_ULONG a1, a2; | ||
| 148 | |||
| 149 | a1 = a & (0x7F); a2 = a1 << 1; | ||
| 150 | |||
| 151 | tab[0] = 0; tab[1] = a1; tab[2] = a2; tab[3] = a1^a2; | ||
| 152 | |||
| 153 | s = tab[b & 0x3]; l = s; | ||
| 154 | s = tab[b >> 2 & 0x3]; l ^= s << 2; h = s >> 6; | ||
| 155 | s = tab[b >> 4 & 0x3]; l ^= s << 4; h ^= s >> 4; | ||
| 156 | s = tab[b >> 6 ]; l ^= s << 6; h ^= s >> 2; | ||
| 157 | |||
| 158 | /* compensate for the top bit of a */ | ||
| 159 | |||
| 160 | if (top1b & 01) { l ^= b << 7; h ^= b >> 1; } | ||
| 161 | |||
| 162 | *r1 = h; *r0 = l; | ||
| 163 | } | ||
| 164 | #endif | ||
| 165 | #ifdef SIXTEEN_BIT | ||
| 166 | static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, const BN_ULONG b) | ||
| 167 | { | ||
| 168 | register BN_ULONG h, l, s; | ||
| 169 | BN_ULONG tab[4], top1b = a >> 15; | ||
| 170 | register BN_ULONG a1, a2; | ||
| 171 | |||
| 172 | a1 = a & (0x7FFF); a2 = a1 << 1; | ||
| 173 | |||
| 174 | tab[0] = 0; tab[1] = a1; tab[2] = a2; tab[3] = a1^a2; | ||
| 175 | |||
| 176 | s = tab[b & 0x3]; l = s; | ||
| 177 | s = tab[b >> 2 & 0x3]; l ^= s << 2; h = s >> 14; | ||
| 178 | s = tab[b >> 4 & 0x3]; l ^= s << 4; h ^= s >> 12; | ||
| 179 | s = tab[b >> 6 & 0x3]; l ^= s << 6; h ^= s >> 10; | ||
| 180 | s = tab[b >> 8 & 0x3]; l ^= s << 8; h ^= s >> 8; | ||
| 181 | s = tab[b >>10 & 0x3]; l ^= s << 10; h ^= s >> 6; | ||
| 182 | s = tab[b >>12 & 0x3]; l ^= s << 12; h ^= s >> 4; | ||
| 183 | s = tab[b >>14 ]; l ^= s << 14; h ^= s >> 2; | ||
| 184 | |||
| 185 | /* compensate for the top bit of a */ | ||
| 186 | |||
| 187 | if (top1b & 01) { l ^= b << 15; h ^= b >> 1; } | ||
| 188 | |||
| 189 | *r1 = h; *r0 = l; | ||
| 190 | } | ||
| 191 | #endif | ||
| 192 | #ifdef THIRTY_TWO_BIT | 130 | #ifdef THIRTY_TWO_BIT |
| 193 | static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, const BN_ULONG b) | 131 | static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, const BN_ULONG b) |
| 194 | { | 132 | { |
| @@ -321,7 +259,7 @@ int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) | |||
| 321 | 259 | ||
| 322 | 260 | ||
| 323 | /* Performs modular reduction of a and store result in r. r could be a. */ | 261 | /* Performs modular reduction of a and store result in r. r could be a. */ |
| 324 | int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]) | 262 | int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]) |
| 325 | { | 263 | { |
| 326 | int j, k; | 264 | int j, k; |
| 327 | int n, dN, d0, d1; | 265 | int n, dN, d0, d1; |
| @@ -422,11 +360,11 @@ int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]) | |||
| 422 | int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p) | 360 | int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p) |
| 423 | { | 361 | { |
| 424 | int ret = 0; | 362 | int ret = 0; |
| 425 | const int max = BN_num_bits(p); | 363 | const int max = BN_num_bits(p) + 1; |
| 426 | unsigned int *arr=NULL; | 364 | int *arr=NULL; |
| 427 | bn_check_top(a); | 365 | bn_check_top(a); |
| 428 | bn_check_top(p); | 366 | bn_check_top(p); |
| 429 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) == NULL) goto err; | 367 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; |
| 430 | ret = BN_GF2m_poly2arr(p, arr, max); | 368 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 431 | if (!ret || ret > max) | 369 | if (!ret || ret > max) |
| 432 | { | 370 | { |
| @@ -444,7 +382,7 @@ err: | |||
| 444 | /* Compute the product of two polynomials a and b, reduce modulo p, and store | 382 | /* Compute the product of two polynomials a and b, reduce modulo p, and store |
| 445 | * the result in r. r could be a or b; a could be b. | 383 | * the result in r. r could be a or b; a could be b. |
| 446 | */ | 384 | */ |
| 447 | int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const unsigned int p[], BN_CTX *ctx) | 385 | int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx) |
| 448 | { | 386 | { |
| 449 | int zlen, i, j, k, ret = 0; | 387 | int zlen, i, j, k, ret = 0; |
| 450 | BIGNUM *s; | 388 | BIGNUM *s; |
| @@ -500,12 +438,12 @@ err: | |||
| 500 | int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx) | 438 | int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx) |
| 501 | { | 439 | { |
| 502 | int ret = 0; | 440 | int ret = 0; |
| 503 | const int max = BN_num_bits(p); | 441 | const int max = BN_num_bits(p) + 1; |
| 504 | unsigned int *arr=NULL; | 442 | int *arr=NULL; |
| 505 | bn_check_top(a); | 443 | bn_check_top(a); |
| 506 | bn_check_top(b); | 444 | bn_check_top(b); |
| 507 | bn_check_top(p); | 445 | bn_check_top(p); |
| 508 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) == NULL) goto err; | 446 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; |
| 509 | ret = BN_GF2m_poly2arr(p, arr, max); | 447 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 510 | if (!ret || ret > max) | 448 | if (!ret || ret > max) |
| 511 | { | 449 | { |
| @@ -521,7 +459,7 @@ err: | |||
| 521 | 459 | ||
| 522 | 460 | ||
| 523 | /* Square a, reduce the result mod p, and store it in a. r could be a. */ | 461 | /* Square a, reduce the result mod p, and store it in a. r could be a. */ |
| 524 | int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[], BN_CTX *ctx) | 462 | int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx) |
| 525 | { | 463 | { |
| 526 | int i, ret = 0; | 464 | int i, ret = 0; |
| 527 | BIGNUM *s; | 465 | BIGNUM *s; |
| @@ -556,12 +494,12 @@ err: | |||
| 556 | int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | 494 | int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) |
| 557 | { | 495 | { |
| 558 | int ret = 0; | 496 | int ret = 0; |
| 559 | const int max = BN_num_bits(p); | 497 | const int max = BN_num_bits(p) + 1; |
| 560 | unsigned int *arr=NULL; | 498 | int *arr=NULL; |
| 561 | 499 | ||
| 562 | bn_check_top(a); | 500 | bn_check_top(a); |
| 563 | bn_check_top(p); | 501 | bn_check_top(p); |
| 564 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) == NULL) goto err; | 502 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; |
| 565 | ret = BN_GF2m_poly2arr(p, arr, max); | 503 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 566 | if (!ret || ret > max) | 504 | if (!ret || ret > max) |
| 567 | { | 505 | { |
| @@ -643,7 +581,7 @@ err: | |||
| 643 | * function is only provided for convenience; for best performance, use the | 581 | * function is only provided for convenience; for best performance, use the |
| 644 | * BN_GF2m_mod_inv function. | 582 | * BN_GF2m_mod_inv function. |
| 645 | */ | 583 | */ |
| 646 | int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const unsigned int p[], BN_CTX *ctx) | 584 | int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const int p[], BN_CTX *ctx) |
| 647 | { | 585 | { |
| 648 | BIGNUM *field; | 586 | BIGNUM *field; |
| 649 | int ret = 0; | 587 | int ret = 0; |
| @@ -769,7 +707,7 @@ err: | |||
| 769 | * function is only provided for convenience; for best performance, use the | 707 | * function is only provided for convenience; for best performance, use the |
| 770 | * BN_GF2m_mod_div function. | 708 | * BN_GF2m_mod_div function. |
| 771 | */ | 709 | */ |
| 772 | int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *yy, const BIGNUM *xx, const unsigned int p[], BN_CTX *ctx) | 710 | int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *yy, const BIGNUM *xx, const int p[], BN_CTX *ctx) |
| 773 | { | 711 | { |
| 774 | BIGNUM *field; | 712 | BIGNUM *field; |
| 775 | int ret = 0; | 713 | int ret = 0; |
| @@ -794,7 +732,7 @@ err: | |||
| 794 | * the result in r. r could be a. | 732 | * the result in r. r could be a. |
| 795 | * Uses simple square-and-multiply algorithm A.5.1 from IEEE P1363. | 733 | * Uses simple square-and-multiply algorithm A.5.1 from IEEE P1363. |
| 796 | */ | 734 | */ |
| 797 | int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const unsigned int p[], BN_CTX *ctx) | 735 | int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx) |
| 798 | { | 736 | { |
| 799 | int ret = 0, i, n; | 737 | int ret = 0, i, n; |
| 800 | BIGNUM *u; | 738 | BIGNUM *u; |
| @@ -840,12 +778,12 @@ err: | |||
| 840 | int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx) | 778 | int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx) |
| 841 | { | 779 | { |
| 842 | int ret = 0; | 780 | int ret = 0; |
| 843 | const int max = BN_num_bits(p); | 781 | const int max = BN_num_bits(p) + 1; |
| 844 | unsigned int *arr=NULL; | 782 | int *arr=NULL; |
| 845 | bn_check_top(a); | 783 | bn_check_top(a); |
| 846 | bn_check_top(b); | 784 | bn_check_top(b); |
| 847 | bn_check_top(p); | 785 | bn_check_top(p); |
| 848 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) == NULL) goto err; | 786 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; |
| 849 | ret = BN_GF2m_poly2arr(p, arr, max); | 787 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 850 | if (!ret || ret > max) | 788 | if (!ret || ret > max) |
| 851 | { | 789 | { |
| @@ -863,7 +801,7 @@ err: | |||
| 863 | * the result in r. r could be a. | 801 | * the result in r. r could be a. |
| 864 | * Uses exponentiation as in algorithm A.4.1 from IEEE P1363. | 802 | * Uses exponentiation as in algorithm A.4.1 from IEEE P1363. |
| 865 | */ | 803 | */ |
| 866 | int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[], BN_CTX *ctx) | 804 | int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx) |
| 867 | { | 805 | { |
| 868 | int ret = 0; | 806 | int ret = 0; |
| 869 | BIGNUM *u; | 807 | BIGNUM *u; |
| @@ -899,11 +837,11 @@ err: | |||
| 899 | int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | 837 | int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) |
| 900 | { | 838 | { |
| 901 | int ret = 0; | 839 | int ret = 0; |
| 902 | const int max = BN_num_bits(p); | 840 | const int max = BN_num_bits(p) + 1; |
| 903 | unsigned int *arr=NULL; | 841 | int *arr=NULL; |
| 904 | bn_check_top(a); | 842 | bn_check_top(a); |
| 905 | bn_check_top(p); | 843 | bn_check_top(p); |
| 906 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) == NULL) goto err; | 844 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; |
| 907 | ret = BN_GF2m_poly2arr(p, arr, max); | 845 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 908 | if (!ret || ret > max) | 846 | if (!ret || ret > max) |
| 909 | { | 847 | { |
| @@ -920,10 +858,9 @@ err: | |||
| 920 | /* Find r such that r^2 + r = a mod p. r could be a. If no r exists returns 0. | 858 | /* Find r such that r^2 + r = a mod p. r could be a. If no r exists returns 0. |
| 921 | * Uses algorithms A.4.7 and A.4.6 from IEEE P1363. | 859 | * Uses algorithms A.4.7 and A.4.6 from IEEE P1363. |
| 922 | */ | 860 | */ |
| 923 | int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const unsigned int p[], BN_CTX *ctx) | 861 | int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], BN_CTX *ctx) |
| 924 | { | 862 | { |
| 925 | int ret = 0, count = 0; | 863 | int ret = 0, count = 0, j; |
| 926 | unsigned int j; | ||
| 927 | BIGNUM *a, *z, *rho, *w, *w2, *tmp; | 864 | BIGNUM *a, *z, *rho, *w, *w2, *tmp; |
| 928 | 865 | ||
| 929 | bn_check_top(a_); | 866 | bn_check_top(a_); |
| @@ -1018,11 +955,11 @@ err: | |||
| 1018 | int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | 955 | int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) |
| 1019 | { | 956 | { |
| 1020 | int ret = 0; | 957 | int ret = 0; |
| 1021 | const int max = BN_num_bits(p); | 958 | const int max = BN_num_bits(p) + 1; |
| 1022 | unsigned int *arr=NULL; | 959 | int *arr=NULL; |
| 1023 | bn_check_top(a); | 960 | bn_check_top(a); |
| 1024 | bn_check_top(p); | 961 | bn_check_top(p); |
| 1025 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * | 962 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * |
| 1026 | max)) == NULL) goto err; | 963 | max)) == NULL) goto err; |
| 1027 | ret = BN_GF2m_poly2arr(p, arr, max); | 964 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 1028 | if (!ret || ret > max) | 965 | if (!ret || ret > max) |
| @@ -1038,20 +975,17 @@ err: | |||
| 1038 | } | 975 | } |
| 1039 | 976 | ||
| 1040 | /* Convert the bit-string representation of a polynomial | 977 | /* Convert the bit-string representation of a polynomial |
| 1041 | * ( \sum_{i=0}^n a_i * x^i , where a_0 is *not* zero) into an array | 978 | * ( \sum_{i=0}^n a_i * x^i) into an array of integers corresponding |
| 1042 | * of integers corresponding to the bits with non-zero coefficient. | 979 | * to the bits with non-zero coefficient. Array is terminated with -1. |
| 1043 | * Up to max elements of the array will be filled. Return value is total | 980 | * Up to max elements of the array will be filled. Return value is total |
| 1044 | * number of coefficients that would be extracted if array was large enough. | 981 | * number of array elements that would be filled if array was large enough. |
| 1045 | */ | 982 | */ |
| 1046 | int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max) | 983 | int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max) |
| 1047 | { | 984 | { |
| 1048 | int i, j, k = 0; | 985 | int i, j, k = 0; |
| 1049 | BN_ULONG mask; | 986 | BN_ULONG mask; |
| 1050 | 987 | ||
| 1051 | if (BN_is_zero(a) || !BN_is_bit_set(a, 0)) | 988 | if (BN_is_zero(a)) |
| 1052 | /* a_0 == 0 => return error (the unsigned int array | ||
| 1053 | * must be terminated by 0) | ||
| 1054 | */ | ||
| 1055 | return 0; | 989 | return 0; |
| 1056 | 990 | ||
| 1057 | for (i = a->top - 1; i >= 0; i--) | 991 | for (i = a->top - 1; i >= 0; i--) |
| @@ -1071,24 +1005,28 @@ int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max) | |||
| 1071 | } | 1005 | } |
| 1072 | } | 1006 | } |
| 1073 | 1007 | ||
| 1008 | if (k < max) { | ||
| 1009 | p[k] = -1; | ||
| 1010 | k++; | ||
| 1011 | } | ||
| 1012 | |||
| 1074 | return k; | 1013 | return k; |
| 1075 | } | 1014 | } |
| 1076 | 1015 | ||
| 1077 | /* Convert the coefficient array representation of a polynomial to a | 1016 | /* Convert the coefficient array representation of a polynomial to a |
| 1078 | * bit-string. The array must be terminated by 0. | 1017 | * bit-string. The array must be terminated by -1. |
| 1079 | */ | 1018 | */ |
| 1080 | int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a) | 1019 | int BN_GF2m_arr2poly(const int p[], BIGNUM *a) |
| 1081 | { | 1020 | { |
| 1082 | int i; | 1021 | int i; |
| 1083 | 1022 | ||
| 1084 | bn_check_top(a); | 1023 | bn_check_top(a); |
| 1085 | BN_zero(a); | 1024 | BN_zero(a); |
| 1086 | for (i = 0; p[i] != 0; i++) | 1025 | for (i = 0; p[i] != -1; i++) |
| 1087 | { | 1026 | { |
| 1088 | if (BN_set_bit(a, p[i]) == 0) | 1027 | if (BN_set_bit(a, p[i]) == 0) |
| 1089 | return 0; | 1028 | return 0; |
| 1090 | } | 1029 | } |
| 1091 | BN_set_bit(a, 0); | ||
| 1092 | bn_check_top(a); | 1030 | bn_check_top(a); |
| 1093 | 1031 | ||
| 1094 | return 1; | 1032 | return 1; |
diff --git a/src/lib/libcrypto/bn/bn_lcl.h b/src/lib/libcrypto/bn/bn_lcl.h index 27ac4397a1..8e5e98e3f2 100644 --- a/src/lib/libcrypto/bn/bn_lcl.h +++ b/src/lib/libcrypto/bn/bn_lcl.h | |||
| @@ -255,7 +255,8 @@ extern "C" { | |||
| 255 | : "r"(a), "r"(b)); \ | 255 | : "r"(a), "r"(b)); \ |
| 256 | ret; }) | 256 | ret; }) |
| 257 | # endif /* compiler */ | 257 | # endif /* compiler */ |
| 258 | # elif defined(__x86_64) && defined(SIXTY_FOUR_BIT_LONG) | 258 | # elif (defined(__x86_64) || defined(__x86_64__)) && \ |
| 259 | (defined(SIXTY_FOUR_BIT_LONG) || defined(SIXTY_FOUR_BIT)) | ||
| 259 | # if defined(__GNUC__) | 260 | # if defined(__GNUC__) |
| 260 | # define BN_UMULT_HIGH(a,b) ({ \ | 261 | # define BN_UMULT_HIGH(a,b) ({ \ |
| 261 | register BN_ULONG ret,discard; \ | 262 | register BN_ULONG ret,discard; \ |
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 32a8fbaf51..5470fbe6ef 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
| @@ -133,15 +133,34 @@ int BN_get_params(int which) | |||
| 133 | 133 | ||
| 134 | const BIGNUM *BN_value_one(void) | 134 | const BIGNUM *BN_value_one(void) |
| 135 | { | 135 | { |
| 136 | static BN_ULONG data_one=1L; | 136 | static const BN_ULONG data_one=1L; |
| 137 | static BIGNUM const_one={&data_one,1,1,0,BN_FLG_STATIC_DATA}; | 137 | static const BIGNUM const_one={(BN_ULONG *)&data_one,1,1,0,BN_FLG_STATIC_DATA}; |
| 138 | 138 | ||
| 139 | return(&const_one); | 139 | return(&const_one); |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | char *BN_options(void) | ||
| 143 | { | ||
| 144 | static int init=0; | ||
| 145 | static char data[16]; | ||
| 146 | |||
| 147 | if (!init) | ||
| 148 | { | ||
| 149 | init++; | ||
| 150 | #ifdef BN_LLONG | ||
| 151 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
| 152 | (int)sizeof(BN_ULLONG)*8,(int)sizeof(BN_ULONG)*8); | ||
| 153 | #else | ||
| 154 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
| 155 | (int)sizeof(BN_ULONG)*8,(int)sizeof(BN_ULONG)*8); | ||
| 156 | #endif | ||
| 157 | } | ||
| 158 | return(data); | ||
| 159 | } | ||
| 160 | |||
| 142 | int BN_num_bits_word(BN_ULONG l) | 161 | int BN_num_bits_word(BN_ULONG l) |
| 143 | { | 162 | { |
| 144 | static const char bits[256]={ | 163 | static const unsigned char bits[256]={ |
| 145 | 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, | 164 | 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, |
| 146 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | 165 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, |
| 147 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | 166 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, |
| @@ -216,7 +235,7 @@ int BN_num_bits_word(BN_ULONG l) | |||
| 216 | else | 235 | else |
| 217 | #endif | 236 | #endif |
| 218 | { | 237 | { |
| 219 | #if defined(SIXTEEN_BIT) || defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) | 238 | #if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) |
| 220 | if (l & 0xff00L) | 239 | if (l & 0xff00L) |
| 221 | return(bits[(int)(l>>8)]+8); | 240 | return(bits[(int)(l>>8)]+8); |
| 222 | else | 241 | else |
| @@ -744,7 +763,7 @@ int BN_is_bit_set(const BIGNUM *a, int n) | |||
| 744 | i=n/BN_BITS2; | 763 | i=n/BN_BITS2; |
| 745 | j=n%BN_BITS2; | 764 | j=n%BN_BITS2; |
| 746 | if (a->top <= i) return 0; | 765 | if (a->top <= i) return 0; |
| 747 | return(((a->d[i])>>j)&((BN_ULONG)1)); | 766 | return (int)(((a->d[i])>>j)&((BN_ULONG)1)); |
| 748 | } | 767 | } |
| 749 | 768 | ||
| 750 | int BN_mask_bits(BIGNUM *a, int n) | 769 | int BN_mask_bits(BIGNUM *a, int n) |
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c index 4799b152dd..7224637ab3 100644 --- a/src/lib/libcrypto/bn/bn_mont.c +++ b/src/lib/libcrypto/bn/bn_mont.c | |||
| @@ -122,26 +122,10 @@ | |||
| 122 | 122 | ||
| 123 | #define MONT_WORD /* use the faster word-based algorithm */ | 123 | #define MONT_WORD /* use the faster word-based algorithm */ |
| 124 | 124 | ||
| 125 | #if defined(MONT_WORD) && defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32) | 125 | #ifdef MONT_WORD |
| 126 | /* This condition means we have a specific non-default build: | ||
| 127 | * In the 0.9.8 branch, OPENSSL_BN_ASM_MONT is normally not set for any | ||
| 128 | * BN_BITS2<=32 platform; an explicit "enable-montasm" is required. | ||
| 129 | * I.e., if we are here, the user intentionally deviates from the | ||
| 130 | * normal stable build to get better Montgomery performance from | ||
| 131 | * the 0.9.9-dev backport. | ||
| 132 | * | ||
| 133 | * In this case only, we also enable BN_from_montgomery_word() | ||
| 134 | * (another non-stable feature from 0.9.9-dev). | ||
| 135 | */ | ||
| 136 | #define MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD | ||
| 137 | #endif | ||
| 138 | |||
| 139 | #ifdef MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD | ||
| 140 | static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont); | 126 | static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont); |
| 141 | #endif | 127 | #endif |
| 142 | 128 | ||
| 143 | |||
| 144 | |||
| 145 | int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | 129 | int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, |
| 146 | BN_MONT_CTX *mont, BN_CTX *ctx) | 130 | BN_MONT_CTX *mont, BN_CTX *ctx) |
| 147 | { | 131 | { |
| @@ -153,11 +137,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | |||
| 153 | if (num>1 && a->top==num && b->top==num) | 137 | if (num>1 && a->top==num && b->top==num) |
| 154 | { | 138 | { |
| 155 | if (bn_wexpand(r,num) == NULL) return(0); | 139 | if (bn_wexpand(r,num) == NULL) return(0); |
| 156 | #if 0 /* for OpenSSL 0.9.9 mont->n0 */ | ||
| 157 | if (bn_mul_mont(r->d,a->d,b->d,mont->N.d,mont->n0,num)) | 140 | if (bn_mul_mont(r->d,a->d,b->d,mont->N.d,mont->n0,num)) |
| 158 | #else | ||
| 159 | if (bn_mul_mont(r->d,a->d,b->d,mont->N.d,&mont->n0,num)) | ||
| 160 | #endif | ||
| 161 | { | 141 | { |
| 162 | r->neg = a->neg^b->neg; | 142 | r->neg = a->neg^b->neg; |
| 163 | r->top = num; | 143 | r->top = num; |
| @@ -181,7 +161,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | |||
| 181 | if (!BN_mul(tmp,a,b,ctx)) goto err; | 161 | if (!BN_mul(tmp,a,b,ctx)) goto err; |
| 182 | } | 162 | } |
| 183 | /* reduce from aRR to aR */ | 163 | /* reduce from aRR to aR */ |
| 184 | #ifdef MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD | 164 | #ifdef MONT_WORD |
| 185 | if (!BN_from_montgomery_word(r,tmp,mont)) goto err; | 165 | if (!BN_from_montgomery_word(r,tmp,mont)) goto err; |
| 186 | #else | 166 | #else |
| 187 | if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err; | 167 | if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err; |
| @@ -193,7 +173,7 @@ err: | |||
| 193 | return(ret); | 173 | return(ret); |
| 194 | } | 174 | } |
| 195 | 175 | ||
| 196 | #ifdef MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD | 176 | #ifdef MONT_WORD |
| 197 | static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) | 177 | static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) |
| 198 | { | 178 | { |
| 199 | BIGNUM *n; | 179 | BIGNUM *n; |
| @@ -217,15 +197,15 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) | |||
| 217 | nrp= &(r->d[nl]); | 197 | nrp= &(r->d[nl]); |
| 218 | 198 | ||
| 219 | /* clear the top words of T */ | 199 | /* clear the top words of T */ |
| 200 | #if 1 | ||
| 220 | for (i=r->top; i<max; i++) /* memset? XXX */ | 201 | for (i=r->top; i<max; i++) /* memset? XXX */ |
| 221 | r->d[i]=0; | 202 | r->d[i]=0; |
| 203 | #else | ||
| 204 | memset(&(r->d[r->top]),0,(max-r->top)*sizeof(BN_ULONG)); | ||
| 205 | #endif | ||
| 222 | 206 | ||
| 223 | r->top=max; | 207 | r->top=max; |
| 224 | #if 0 /* for OpenSSL 0.9.9 mont->n0 */ | ||
| 225 | n0=mont->n0[0]; | 208 | n0=mont->n0[0]; |
| 226 | #else | ||
| 227 | n0=mont->n0; | ||
| 228 | #endif | ||
| 229 | 209 | ||
| 230 | #ifdef BN_COUNT | 210 | #ifdef BN_COUNT |
| 231 | fprintf(stderr,"word BN_from_montgomery_word %d * %d\n",nl,nl); | 211 | fprintf(stderr,"word BN_from_montgomery_word %d * %d\n",nl,nl); |
| @@ -270,6 +250,8 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) | |||
| 270 | } | 250 | } |
| 271 | al=r->top-ri; | 251 | al=r->top-ri; |
| 272 | 252 | ||
| 253 | #define BRANCH_FREE 1 | ||
| 254 | #if BRANCH_FREE | ||
| 273 | if (bn_wexpand(ret,ri) == NULL) return(0); | 255 | if (bn_wexpand(ret,ri) == NULL) return(0); |
| 274 | x=0-(((al-ri)>>(sizeof(al)*8-1))&1); | 256 | x=0-(((al-ri)>>(sizeof(al)*8-1))&1); |
| 275 | ret->top=x=(ri&~x)|(al&x); /* min(ri,al) */ | 257 | ret->top=x=(ri&~x)|(al&x); /* min(ri,al) */ |
| @@ -317,164 +299,8 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) | |||
| 317 | rp[i]=nrp[i], ap[i]=0; | 299 | rp[i]=nrp[i], ap[i]=0; |
| 318 | bn_correct_top(r); | 300 | bn_correct_top(r); |
| 319 | bn_correct_top(ret); | 301 | bn_correct_top(ret); |
| 320 | bn_check_top(ret); | ||
| 321 | |||
| 322 | return(1); | ||
| 323 | } | ||
| 324 | |||
| 325 | int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | ||
| 326 | BN_CTX *ctx) | ||
| 327 | { | ||
| 328 | int retn=0; | ||
| 329 | BIGNUM *t; | ||
| 330 | |||
| 331 | BN_CTX_start(ctx); | ||
| 332 | if ((t = BN_CTX_get(ctx)) && BN_copy(t,a)) | ||
| 333 | retn = BN_from_montgomery_word(ret,t,mont); | ||
| 334 | BN_CTX_end(ctx); | ||
| 335 | return retn; | ||
| 336 | } | ||
| 337 | |||
| 338 | #else /* !MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD */ | ||
| 339 | |||
| 340 | int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | ||
| 341 | BN_CTX *ctx) | ||
| 342 | { | ||
| 343 | int retn=0; | ||
| 344 | |||
| 345 | #ifdef MONT_WORD | ||
| 346 | BIGNUM *n,*r; | ||
| 347 | BN_ULONG *ap,*np,*rp,n0,v,*nrp; | ||
| 348 | int al,nl,max,i,x,ri; | ||
| 349 | |||
| 350 | BN_CTX_start(ctx); | ||
| 351 | if ((r = BN_CTX_get(ctx)) == NULL) goto err; | ||
| 352 | |||
| 353 | if (!BN_copy(r,a)) goto err; | ||
| 354 | n= &(mont->N); | ||
| 355 | |||
| 356 | ap=a->d; | ||
| 357 | /* mont->ri is the size of mont->N in bits (rounded up | ||
| 358 | to the word size) */ | ||
| 359 | al=ri=mont->ri/BN_BITS2; | ||
| 360 | |||
| 361 | nl=n->top; | ||
| 362 | if ((al == 0) || (nl == 0)) { r->top=0; return(1); } | ||
| 363 | |||
| 364 | max=(nl+al+1); /* allow for overflow (no?) XXX */ | ||
| 365 | if (bn_wexpand(r,max) == NULL) goto err; | ||
| 366 | |||
| 367 | r->neg=a->neg^n->neg; | ||
| 368 | np=n->d; | ||
| 369 | rp=r->d; | ||
| 370 | nrp= &(r->d[nl]); | ||
| 371 | |||
| 372 | /* clear the top words of T */ | ||
| 373 | #if 1 | ||
| 374 | for (i=r->top; i<max; i++) /* memset? XXX */ | ||
| 375 | r->d[i]=0; | ||
| 376 | #else | 302 | #else |
| 377 | memset(&(r->d[r->top]),0,(max-r->top)*sizeof(BN_ULONG)); | 303 | if (bn_wexpand(ret,al) == NULL) return(0); |
| 378 | #endif | ||
| 379 | |||
| 380 | r->top=max; | ||
| 381 | n0=mont->n0; | ||
| 382 | |||
| 383 | #ifdef BN_COUNT | ||
| 384 | fprintf(stderr,"word BN_from_montgomery %d * %d\n",nl,nl); | ||
| 385 | #endif | ||
| 386 | for (i=0; i<nl; i++) | ||
| 387 | { | ||
| 388 | #ifdef __TANDEM | ||
| 389 | { | ||
| 390 | long long t1; | ||
| 391 | long long t2; | ||
| 392 | long long t3; | ||
| 393 | t1 = rp[0] * (n0 & 0177777); | ||
| 394 | t2 = 037777600000l; | ||
| 395 | t2 = n0 & t2; | ||
| 396 | t3 = rp[0] & 0177777; | ||
| 397 | t2 = (t3 * t2) & BN_MASK2; | ||
| 398 | t1 = t1 + t2; | ||
| 399 | v=bn_mul_add_words(rp,np,nl,(BN_ULONG) t1); | ||
| 400 | } | ||
| 401 | #else | ||
| 402 | v=bn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2); | ||
| 403 | #endif | ||
| 404 | nrp++; | ||
| 405 | rp++; | ||
| 406 | if (((nrp[-1]+=v)&BN_MASK2) >= v) | ||
| 407 | continue; | ||
| 408 | else | ||
| 409 | { | ||
| 410 | if (((++nrp[0])&BN_MASK2) != 0) continue; | ||
| 411 | if (((++nrp[1])&BN_MASK2) != 0) continue; | ||
| 412 | for (x=2; (((++nrp[x])&BN_MASK2) == 0); x++) ; | ||
| 413 | } | ||
| 414 | } | ||
| 415 | bn_correct_top(r); | ||
| 416 | |||
| 417 | /* mont->ri will be a multiple of the word size and below code | ||
| 418 | * is kind of BN_rshift(ret,r,mont->ri) equivalent */ | ||
| 419 | if (r->top <= ri) | ||
| 420 | { | ||
| 421 | ret->top=0; | ||
| 422 | retn=1; | ||
| 423 | goto err; | ||
| 424 | } | ||
| 425 | al=r->top-ri; | ||
| 426 | |||
| 427 | # define BRANCH_FREE 1 | ||
| 428 | # if BRANCH_FREE | ||
| 429 | if (bn_wexpand(ret,ri) == NULL) goto err; | ||
| 430 | x=0-(((al-ri)>>(sizeof(al)*8-1))&1); | ||
| 431 | ret->top=x=(ri&~x)|(al&x); /* min(ri,al) */ | ||
| 432 | ret->neg=r->neg; | ||
| 433 | |||
| 434 | rp=ret->d; | ||
| 435 | ap=&(r->d[ri]); | ||
| 436 | |||
| 437 | { | ||
| 438 | size_t m1,m2; | ||
| 439 | |||
| 440 | v=bn_sub_words(rp,ap,np,ri); | ||
| 441 | /* this ----------------^^ works even in al<ri case | ||
| 442 | * thanks to zealous zeroing of top of the vector in the | ||
| 443 | * beginning. */ | ||
| 444 | |||
| 445 | /* if (al==ri && !v) || al>ri) nrp=rp; else nrp=ap; */ | ||
| 446 | /* in other words if subtraction result is real, then | ||
| 447 | * trick unconditional memcpy below to perform in-place | ||
| 448 | * "refresh" instead of actual copy. */ | ||
| 449 | m1=0-(size_t)(((al-ri)>>(sizeof(al)*8-1))&1); /* al<ri */ | ||
| 450 | m2=0-(size_t)(((ri-al)>>(sizeof(al)*8-1))&1); /* al>ri */ | ||
| 451 | m1|=m2; /* (al!=ri) */ | ||
| 452 | m1|=(0-(size_t)v); /* (al!=ri || v) */ | ||
| 453 | m1&=~m2; /* (al!=ri || v) && !al>ri */ | ||
| 454 | nrp=(BN_ULONG *)(((size_t)rp&~m1)|((size_t)ap&m1)); | ||
| 455 | } | ||
| 456 | |||
| 457 | /* 'i<ri' is chosen to eliminate dependency on input data, even | ||
| 458 | * though it results in redundant copy in al<ri case. */ | ||
| 459 | for (i=0,ri-=4; i<ri; i+=4) | ||
| 460 | { | ||
| 461 | BN_ULONG t1,t2,t3,t4; | ||
| 462 | |||
| 463 | t1=nrp[i+0]; | ||
| 464 | t2=nrp[i+1]; | ||
| 465 | t3=nrp[i+2]; ap[i+0]=0; | ||
| 466 | t4=nrp[i+3]; ap[i+1]=0; | ||
| 467 | rp[i+0]=t1; ap[i+2]=0; | ||
| 468 | rp[i+1]=t2; ap[i+3]=0; | ||
| 469 | rp[i+2]=t3; | ||
| 470 | rp[i+3]=t4; | ||
| 471 | } | ||
| 472 | for (ri+=4; i<ri; i++) | ||
| 473 | rp[i]=nrp[i], ap[i]=0; | ||
| 474 | bn_correct_top(r); | ||
| 475 | bn_correct_top(ret); | ||
| 476 | # else | ||
| 477 | if (bn_wexpand(ret,al) == NULL) goto err; | ||
| 478 | ret->top=al; | 304 | ret->top=al; |
| 479 | ret->neg=r->neg; | 305 | ret->neg=r->neg; |
| 480 | 306 | ||
| @@ -497,8 +323,30 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | |||
| 497 | al+=4; | 323 | al+=4; |
| 498 | for (; i<al; i++) | 324 | for (; i<al; i++) |
| 499 | rp[i]=ap[i]; | 325 | rp[i]=ap[i]; |
| 500 | # endif | 326 | |
| 501 | #else /* !MONT_WORD */ | 327 | if (BN_ucmp(ret, &(mont->N)) >= 0) |
| 328 | { | ||
| 329 | if (!BN_usub(ret,ret,&(mont->N))) return(0); | ||
| 330 | } | ||
| 331 | #endif | ||
| 332 | bn_check_top(ret); | ||
| 333 | |||
| 334 | return(1); | ||
| 335 | } | ||
| 336 | #endif /* MONT_WORD */ | ||
| 337 | |||
| 338 | int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | ||
| 339 | BN_CTX *ctx) | ||
| 340 | { | ||
| 341 | int retn=0; | ||
| 342 | #ifdef MONT_WORD | ||
| 343 | BIGNUM *t; | ||
| 344 | |||
| 345 | BN_CTX_start(ctx); | ||
| 346 | if ((t = BN_CTX_get(ctx)) && BN_copy(t,a)) | ||
| 347 | retn = BN_from_montgomery_word(ret,t,mont); | ||
| 348 | BN_CTX_end(ctx); | ||
| 349 | #else /* !MONT_WORD */ | ||
| 502 | BIGNUM *t1,*t2; | 350 | BIGNUM *t1,*t2; |
| 503 | 351 | ||
| 504 | BN_CTX_start(ctx); | 352 | BN_CTX_start(ctx); |
| @@ -515,21 +363,18 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | |||
| 515 | if (!BN_mul(t1,t2,&mont->N,ctx)) goto err; | 363 | if (!BN_mul(t1,t2,&mont->N,ctx)) goto err; |
| 516 | if (!BN_add(t2,a,t1)) goto err; | 364 | if (!BN_add(t2,a,t1)) goto err; |
| 517 | if (!BN_rshift(ret,t2,mont->ri)) goto err; | 365 | if (!BN_rshift(ret,t2,mont->ri)) goto err; |
| 518 | #endif /* MONT_WORD */ | ||
| 519 | 366 | ||
| 520 | #if !defined(BRANCH_FREE) || BRANCH_FREE==0 | ||
| 521 | if (BN_ucmp(ret, &(mont->N)) >= 0) | 367 | if (BN_ucmp(ret, &(mont->N)) >= 0) |
| 522 | { | 368 | { |
| 523 | if (!BN_usub(ret,ret,&(mont->N))) goto err; | 369 | if (!BN_usub(ret,ret,&(mont->N))) goto err; |
| 524 | } | 370 | } |
| 525 | #endif | ||
| 526 | retn=1; | 371 | retn=1; |
| 527 | bn_check_top(ret); | 372 | bn_check_top(ret); |
| 528 | err: | 373 | err: |
| 529 | BN_CTX_end(ctx); | 374 | BN_CTX_end(ctx); |
| 375 | #endif /* MONT_WORD */ | ||
| 530 | return(retn); | 376 | return(retn); |
| 531 | } | 377 | } |
| 532 | #endif /* MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD */ | ||
| 533 | 378 | ||
| 534 | BN_MONT_CTX *BN_MONT_CTX_new(void) | 379 | BN_MONT_CTX *BN_MONT_CTX_new(void) |
| 535 | { | 380 | { |
| @@ -549,11 +394,7 @@ void BN_MONT_CTX_init(BN_MONT_CTX *ctx) | |||
| 549 | BN_init(&(ctx->RR)); | 394 | BN_init(&(ctx->RR)); |
| 550 | BN_init(&(ctx->N)); | 395 | BN_init(&(ctx->N)); |
| 551 | BN_init(&(ctx->Ni)); | 396 | BN_init(&(ctx->Ni)); |
| 552 | #if 0 /* for OpenSSL 0.9.9 mont->n0 */ | ||
| 553 | ctx->n0[0] = ctx->n0[1] = 0; | 397 | ctx->n0[0] = ctx->n0[1] = 0; |
| 554 | #else | ||
| 555 | ctx->n0 = 0; | ||
| 556 | #endif | ||
| 557 | ctx->flags=0; | 398 | ctx->flags=0; |
| 558 | } | 399 | } |
| 559 | 400 | ||
| @@ -585,26 +426,22 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | |||
| 585 | BIGNUM tmod; | 426 | BIGNUM tmod; |
| 586 | BN_ULONG buf[2]; | 427 | BN_ULONG buf[2]; |
| 587 | 428 | ||
| 588 | mont->ri=(BN_num_bits(mod)+(BN_BITS2-1))/BN_BITS2*BN_BITS2; | ||
| 589 | BN_zero(R); | ||
| 590 | #if 0 /* for OpenSSL 0.9.9 mont->n0, would be "#if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32)", | ||
| 591 | only certain BN_BITS2<=32 platforms actually need this */ | ||
| 592 | if (!(BN_set_bit(R,2*BN_BITS2))) goto err; /* R */ | ||
| 593 | #else | ||
| 594 | if (!(BN_set_bit(R,BN_BITS2))) goto err; /* R */ | ||
| 595 | #endif | ||
| 596 | |||
| 597 | buf[0]=mod->d[0]; /* tmod = N mod word size */ | ||
| 598 | buf[1]=0; | ||
| 599 | |||
| 600 | BN_init(&tmod); | 429 | BN_init(&tmod); |
| 601 | tmod.d=buf; | 430 | tmod.d=buf; |
| 602 | tmod.top = buf[0] != 0 ? 1 : 0; | ||
| 603 | tmod.dmax=2; | 431 | tmod.dmax=2; |
| 604 | tmod.neg=0; | 432 | tmod.neg=0; |
| 605 | 433 | ||
| 606 | #if 0 /* for OpenSSL 0.9.9 mont->n0, would be "#if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32)"; | 434 | mont->ri=(BN_num_bits(mod)+(BN_BITS2-1))/BN_BITS2*BN_BITS2; |
| 607 | only certain BN_BITS2<=32 platforms actually need this */ | 435 | |
| 436 | #if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32) | ||
| 437 | /* Only certain BN_BITS2<=32 platforms actually make use of | ||
| 438 | * n0[1], and we could use the #else case (with a shorter R | ||
| 439 | * value) for the others. However, currently only the assembler | ||
| 440 | * files do know which is which. */ | ||
| 441 | |||
| 442 | BN_zero(R); | ||
| 443 | if (!(BN_set_bit(R,2*BN_BITS2))) goto err; | ||
| 444 | |||
| 608 | tmod.top=0; | 445 | tmod.top=0; |
| 609 | if ((buf[0] = mod->d[0])) tmod.top=1; | 446 | if ((buf[0] = mod->d[0])) tmod.top=1; |
| 610 | if ((buf[1] = mod->top>1 ? mod->d[1] : 0)) tmod.top=2; | 447 | if ((buf[1] = mod->top>1 ? mod->d[1] : 0)) tmod.top=2; |
| @@ -632,6 +469,12 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | |||
| 632 | mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0; | 469 | mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0; |
| 633 | mont->n0[1] = (Ri->top > 1) ? Ri->d[1] : 0; | 470 | mont->n0[1] = (Ri->top > 1) ? Ri->d[1] : 0; |
| 634 | #else | 471 | #else |
| 472 | BN_zero(R); | ||
| 473 | if (!(BN_set_bit(R,BN_BITS2))) goto err; /* R */ | ||
| 474 | |||
| 475 | buf[0]=mod->d[0]; /* tmod = N mod word size */ | ||
| 476 | buf[1]=0; | ||
| 477 | tmod.top = buf[0] != 0 ? 1 : 0; | ||
| 635 | /* Ri = R^-1 mod N*/ | 478 | /* Ri = R^-1 mod N*/ |
| 636 | if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) | 479 | if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) |
| 637 | goto err; | 480 | goto err; |
| @@ -647,12 +490,8 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | |||
| 647 | if (!BN_div(Ri,NULL,Ri,&tmod,ctx)) goto err; | 490 | if (!BN_div(Ri,NULL,Ri,&tmod,ctx)) goto err; |
| 648 | /* Ni = (R*Ri-1)/N, | 491 | /* Ni = (R*Ri-1)/N, |
| 649 | * keep only least significant word: */ | 492 | * keep only least significant word: */ |
| 650 | # if 0 /* for OpenSSL 0.9.9 mont->n0 */ | ||
| 651 | mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0; | 493 | mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0; |
| 652 | mont->n0[1] = 0; | 494 | mont->n0[1] = 0; |
| 653 | # else | ||
| 654 | mont->n0 = (Ri->top > 0) ? Ri->d[0] : 0; | ||
| 655 | # endif | ||
| 656 | #endif | 495 | #endif |
| 657 | } | 496 | } |
| 658 | #else /* !MONT_WORD */ | 497 | #else /* !MONT_WORD */ |
| @@ -689,12 +528,8 @@ BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from) | |||
| 689 | if (!BN_copy(&(to->N),&(from->N))) return NULL; | 528 | if (!BN_copy(&(to->N),&(from->N))) return NULL; |
| 690 | if (!BN_copy(&(to->Ni),&(from->Ni))) return NULL; | 529 | if (!BN_copy(&(to->Ni),&(from->Ni))) return NULL; |
| 691 | to->ri=from->ri; | 530 | to->ri=from->ri; |
| 692 | #if 0 /* for OpenSSL 0.9.9 mont->n0 */ | ||
| 693 | to->n0[0]=from->n0[0]; | 531 | to->n0[0]=from->n0[0]; |
| 694 | to->n0[1]=from->n0[1]; | 532 | to->n0[1]=from->n0[1]; |
| 695 | #else | ||
| 696 | to->n0=from->n0; | ||
| 697 | #endif | ||
| 698 | return(to); | 533 | return(to); |
| 699 | } | 534 | } |
| 700 | 535 | ||
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c index b848c8cc60..a0e9ec3b46 100644 --- a/src/lib/libcrypto/bn/bn_mul.c +++ b/src/lib/libcrypto/bn/bn_mul.c | |||
| @@ -1028,17 +1028,19 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | |||
| 1028 | assert(j <= al || j <= bl); | 1028 | assert(j <= al || j <= bl); |
| 1029 | k = j+j; | 1029 | k = j+j; |
| 1030 | t = BN_CTX_get(ctx); | 1030 | t = BN_CTX_get(ctx); |
| 1031 | if (t == NULL) | ||
| 1032 | goto err; | ||
| 1031 | if (al > j || bl > j) | 1033 | if (al > j || bl > j) |
| 1032 | { | 1034 | { |
| 1033 | bn_wexpand(t,k*4); | 1035 | if (bn_wexpand(t,k*4) == NULL) goto err; |
| 1034 | bn_wexpand(rr,k*4); | 1036 | if (bn_wexpand(rr,k*4) == NULL) goto err; |
| 1035 | bn_mul_part_recursive(rr->d,a->d,b->d, | 1037 | bn_mul_part_recursive(rr->d,a->d,b->d, |
| 1036 | j,al-j,bl-j,t->d); | 1038 | j,al-j,bl-j,t->d); |
| 1037 | } | 1039 | } |
| 1038 | else /* al <= j || bl <= j */ | 1040 | else /* al <= j || bl <= j */ |
| 1039 | { | 1041 | { |
| 1040 | bn_wexpand(t,k*2); | 1042 | if (bn_wexpand(t,k*2) == NULL) goto err; |
| 1041 | bn_wexpand(rr,k*2); | 1043 | if (bn_wexpand(rr,k*2) == NULL) goto err; |
| 1042 | bn_mul_recursive(rr->d,a->d,b->d, | 1044 | bn_mul_recursive(rr->d,a->d,b->d, |
| 1043 | j,al-j,bl-j,t->d); | 1045 | j,al-j,bl-j,t->d); |
| 1044 | } | 1046 | } |
diff --git a/src/lib/libcrypto/bn/bn_opt.c b/src/lib/libcrypto/bn/bn_opt.c deleted file mode 100644 index 21cbb38f62..0000000000 --- a/src/lib/libcrypto/bn/bn_opt.c +++ /dev/null | |||
| @@ -1,87 +0,0 @@ | |||
| 1 | /* crypto/bn/bn_opt.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #ifndef BN_DEBUG | ||
| 60 | # undef NDEBUG /* avoid conflicting definitions */ | ||
| 61 | # define NDEBUG | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #include <assert.h> | ||
| 65 | #include <limits.h> | ||
| 66 | #include <stdio.h> | ||
| 67 | #include "cryptlib.h" | ||
| 68 | #include "bn_lcl.h" | ||
| 69 | |||
| 70 | char *BN_options(void) | ||
| 71 | { | ||
| 72 | static int init=0; | ||
| 73 | static char data[16]; | ||
| 74 | |||
| 75 | if (!init) | ||
| 76 | { | ||
| 77 | init++; | ||
| 78 | #ifdef BN_LLONG | ||
| 79 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
| 80 | (int)sizeof(BN_ULLONG)*8,(int)sizeof(BN_ULONG)*8); | ||
| 81 | #else | ||
| 82 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
| 83 | (int)sizeof(BN_ULONG)*8,(int)sizeof(BN_ULONG)*8); | ||
| 84 | #endif | ||
| 85 | } | ||
| 86 | return(data); | ||
| 87 | } | ||
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c index 810dde34e1..bebb466d08 100644 --- a/src/lib/libcrypto/bn/bn_print.c +++ b/src/lib/libcrypto/bn/bn_print.c | |||
| @@ -294,6 +294,27 @@ err: | |||
| 294 | return(0); | 294 | return(0); |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | int BN_asc2bn(BIGNUM **bn, const char *a) | ||
| 298 | { | ||
| 299 | const char *p = a; | ||
| 300 | if (*p == '-') | ||
| 301 | p++; | ||
| 302 | |||
| 303 | if (p[0] == '0' && (p[1] == 'X' || p[1] == 'x')) | ||
| 304 | { | ||
| 305 | if (!BN_hex2bn(bn, p + 2)) | ||
| 306 | return 0; | ||
| 307 | } | ||
| 308 | else | ||
| 309 | { | ||
| 310 | if (!BN_dec2bn(bn, p)) | ||
| 311 | return 0; | ||
| 312 | } | ||
| 313 | if (*a == '-') | ||
| 314 | (*bn)->neg = 1; | ||
| 315 | return 1; | ||
| 316 | } | ||
| 317 | |||
| 297 | #ifndef OPENSSL_NO_BIO | 318 | #ifndef OPENSSL_NO_BIO |
| 298 | #ifndef OPENSSL_NO_FP_API | 319 | #ifndef OPENSSL_NO_FP_API |
| 299 | int BN_print_fp(FILE *fp, const BIGNUM *a) | 320 | int BN_print_fp(FILE *fp, const BIGNUM *a) |
diff --git a/src/lib/libcrypto/bn/bn_x931p.c b/src/lib/libcrypto/bn/bn_x931p.c deleted file mode 100644 index 04c5c874ec..0000000000 --- a/src/lib/libcrypto/bn/bn_x931p.c +++ /dev/null | |||
| @@ -1,272 +0,0 @@ | |||
| 1 | /* bn_x931p.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project 2005. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2005 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <openssl/bn.h> | ||
| 61 | |||
| 62 | /* X9.31 routines for prime derivation */ | ||
| 63 | |||
| 64 | /* X9.31 prime derivation. This is used to generate the primes pi | ||
| 65 | * (p1, p2, q1, q2) from a parameter Xpi by checking successive odd | ||
| 66 | * integers. | ||
| 67 | */ | ||
| 68 | |||
| 69 | static int bn_x931_derive_pi(BIGNUM *pi, const BIGNUM *Xpi, BN_CTX *ctx, | ||
| 70 | BN_GENCB *cb) | ||
| 71 | { | ||
| 72 | int i = 0; | ||
| 73 | if (!BN_copy(pi, Xpi)) | ||
| 74 | return 0; | ||
| 75 | if (!BN_is_odd(pi) && !BN_add_word(pi, 1)) | ||
| 76 | return 0; | ||
| 77 | for(;;) | ||
| 78 | { | ||
| 79 | i++; | ||
| 80 | BN_GENCB_call(cb, 0, i); | ||
| 81 | /* NB 27 MR is specificed in X9.31 */ | ||
| 82 | if (BN_is_prime_fasttest_ex(pi, 27, ctx, 1, cb)) | ||
| 83 | break; | ||
| 84 | if (!BN_add_word(pi, 2)) | ||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | BN_GENCB_call(cb, 2, i); | ||
| 88 | return 1; | ||
| 89 | } | ||
| 90 | |||
| 91 | /* This is the main X9.31 prime derivation function. From parameters | ||
| 92 | * Xp1, Xp2 and Xp derive the prime p. If the parameters p1 or p2 are | ||
| 93 | * not NULL they will be returned too: this is needed for testing. | ||
| 94 | */ | ||
| 95 | |||
| 96 | int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, | ||
| 97 | const BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2, | ||
| 98 | const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb) | ||
| 99 | { | ||
| 100 | int ret = 0; | ||
| 101 | |||
| 102 | BIGNUM *t, *p1p2, *pm1; | ||
| 103 | |||
| 104 | /* Only even e supported */ | ||
| 105 | if (!BN_is_odd(e)) | ||
| 106 | return 0; | ||
| 107 | |||
| 108 | BN_CTX_start(ctx); | ||
| 109 | if (!p1) | ||
| 110 | p1 = BN_CTX_get(ctx); | ||
| 111 | |||
| 112 | if (!p2) | ||
| 113 | p2 = BN_CTX_get(ctx); | ||
| 114 | |||
| 115 | t = BN_CTX_get(ctx); | ||
| 116 | |||
| 117 | p1p2 = BN_CTX_get(ctx); | ||
| 118 | |||
| 119 | pm1 = BN_CTX_get(ctx); | ||
| 120 | |||
| 121 | if (!bn_x931_derive_pi(p1, Xp1, ctx, cb)) | ||
| 122 | goto err; | ||
| 123 | |||
| 124 | if (!bn_x931_derive_pi(p2, Xp2, ctx, cb)) | ||
| 125 | goto err; | ||
| 126 | |||
| 127 | if (!BN_mul(p1p2, p1, p2, ctx)) | ||
| 128 | goto err; | ||
| 129 | |||
| 130 | /* First set p to value of Rp */ | ||
| 131 | |||
| 132 | if (!BN_mod_inverse(p, p2, p1, ctx)) | ||
| 133 | goto err; | ||
| 134 | |||
| 135 | if (!BN_mul(p, p, p2, ctx)) | ||
| 136 | goto err; | ||
| 137 | |||
| 138 | if (!BN_mod_inverse(t, p1, p2, ctx)) | ||
| 139 | goto err; | ||
| 140 | |||
| 141 | if (!BN_mul(t, t, p1, ctx)) | ||
| 142 | goto err; | ||
| 143 | |||
| 144 | if (!BN_sub(p, p, t)) | ||
| 145 | goto err; | ||
| 146 | |||
| 147 | if (p->neg && !BN_add(p, p, p1p2)) | ||
| 148 | goto err; | ||
| 149 | |||
| 150 | /* p now equals Rp */ | ||
| 151 | |||
| 152 | if (!BN_mod_sub(p, p, Xp, p1p2, ctx)) | ||
| 153 | goto err; | ||
| 154 | |||
| 155 | if (!BN_add(p, p, Xp)) | ||
| 156 | goto err; | ||
| 157 | |||
| 158 | /* p now equals Yp0 */ | ||
| 159 | |||
| 160 | for (;;) | ||
| 161 | { | ||
| 162 | int i = 1; | ||
| 163 | BN_GENCB_call(cb, 0, i++); | ||
| 164 | if (!BN_copy(pm1, p)) | ||
| 165 | goto err; | ||
| 166 | if (!BN_sub_word(pm1, 1)) | ||
| 167 | goto err; | ||
| 168 | if (!BN_gcd(t, pm1, e, ctx)) | ||
| 169 | goto err; | ||
| 170 | if (BN_is_one(t) | ||
| 171 | /* X9.31 specifies 8 MR and 1 Lucas test or any prime test | ||
| 172 | * offering similar or better guarantees 50 MR is considerably | ||
| 173 | * better. | ||
| 174 | */ | ||
| 175 | && BN_is_prime_fasttest_ex(p, 50, ctx, 1, cb)) | ||
| 176 | break; | ||
| 177 | if (!BN_add(p, p, p1p2)) | ||
| 178 | goto err; | ||
| 179 | } | ||
| 180 | |||
| 181 | BN_GENCB_call(cb, 3, 0); | ||
| 182 | |||
| 183 | ret = 1; | ||
| 184 | |||
| 185 | err: | ||
| 186 | |||
| 187 | BN_CTX_end(ctx); | ||
| 188 | |||
| 189 | return ret; | ||
| 190 | } | ||
| 191 | |||
| 192 | /* Generate pair of paramters Xp, Xq for X9.31 prime generation. | ||
| 193 | * Note: nbits paramter is sum of number of bits in both. | ||
| 194 | */ | ||
| 195 | |||
| 196 | int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx) | ||
| 197 | { | ||
| 198 | BIGNUM *t; | ||
| 199 | int i; | ||
| 200 | /* Number of bits for each prime is of the form | ||
| 201 | * 512+128s for s = 0, 1, ... | ||
| 202 | */ | ||
| 203 | if ((nbits < 1024) || (nbits & 0xff)) | ||
| 204 | return 0; | ||
| 205 | nbits >>= 1; | ||
| 206 | /* The random value Xp must be between sqrt(2) * 2^(nbits-1) and | ||
| 207 | * 2^nbits - 1. By setting the top two bits we ensure that the lower | ||
| 208 | * bound is exceeded. | ||
| 209 | */ | ||
| 210 | if (!BN_rand(Xp, nbits, 1, 0)) | ||
| 211 | return 0; | ||
| 212 | |||
| 213 | BN_CTX_start(ctx); | ||
| 214 | t = BN_CTX_get(ctx); | ||
| 215 | |||
| 216 | for (i = 0; i < 1000; i++) | ||
| 217 | { | ||
| 218 | if (!BN_rand(Xq, nbits, 1, 0)) | ||
| 219 | return 0; | ||
| 220 | /* Check that |Xp - Xq| > 2^(nbits - 100) */ | ||
| 221 | BN_sub(t, Xp, Xq); | ||
| 222 | if (BN_num_bits(t) > (nbits - 100)) | ||
| 223 | break; | ||
| 224 | } | ||
| 225 | |||
| 226 | BN_CTX_end(ctx); | ||
| 227 | |||
| 228 | if (i < 1000) | ||
| 229 | return 1; | ||
| 230 | |||
| 231 | return 0; | ||
| 232 | |||
| 233 | } | ||
| 234 | |||
| 235 | /* Generate primes using X9.31 algorithm. Of the values p, p1, p2, Xp1 | ||
| 236 | * and Xp2 only 'p' needs to be non-NULL. If any of the others are not NULL | ||
| 237 | * the relevant parameter will be stored in it. | ||
| 238 | * | ||
| 239 | * Due to the fact that |Xp - Xq| > 2^(nbits - 100) must be satisfied Xp and Xq | ||
| 240 | * are generated using the previous function and supplied as input. | ||
| 241 | */ | ||
| 242 | |||
| 243 | int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, | ||
| 244 | BIGNUM *Xp1, BIGNUM *Xp2, | ||
| 245 | const BIGNUM *Xp, | ||
| 246 | const BIGNUM *e, BN_CTX *ctx, | ||
| 247 | BN_GENCB *cb) | ||
| 248 | { | ||
| 249 | int ret = 0; | ||
| 250 | |||
| 251 | BN_CTX_start(ctx); | ||
| 252 | if (!Xp1) | ||
| 253 | Xp1 = BN_CTX_get(ctx); | ||
| 254 | if (!Xp2) | ||
| 255 | Xp2 = BN_CTX_get(ctx); | ||
| 256 | |||
| 257 | if (!BN_rand(Xp1, 101, 0, 0)) | ||
| 258 | goto error; | ||
| 259 | if (!BN_rand(Xp2, 101, 0, 0)) | ||
| 260 | goto error; | ||
| 261 | if (!BN_X931_derive_prime_ex(p, p1, p2, Xp, Xp1, Xp2, e, ctx, cb)) | ||
| 262 | goto error; | ||
| 263 | |||
| 264 | ret = 1; | ||
| 265 | |||
| 266 | error: | ||
| 267 | BN_CTX_end(ctx); | ||
| 268 | |||
| 269 | return ret; | ||
| 270 | |||
| 271 | } | ||
| 272 | |||
diff --git a/src/lib/libcrypto/bn/bntest.c b/src/lib/libcrypto/bn/bntest.c index cf190380f5..0cd99c5b4b 100644 --- a/src/lib/libcrypto/bn/bntest.c +++ b/src/lib/libcrypto/bn/bntest.c | |||
| @@ -486,7 +486,7 @@ static void print_word(BIO *bp,BN_ULONG w) | |||
| 486 | return; | 486 | return; |
| 487 | } | 487 | } |
| 488 | #endif | 488 | #endif |
| 489 | BIO_printf(bp,"%lX",w); | 489 | BIO_printf(bp,BN_HEX_FMT1,w); |
| 490 | } | 490 | } |
| 491 | 491 | ||
| 492 | int test_div_word(BIO *bp) | 492 | int test_div_word(BIO *bp) |
| @@ -732,6 +732,8 @@ int test_mont(BIO *bp, BN_CTX *ctx) | |||
| 732 | BN_init(&n); | 732 | BN_init(&n); |
| 733 | 733 | ||
| 734 | mont=BN_MONT_CTX_new(); | 734 | mont=BN_MONT_CTX_new(); |
| 735 | if (mont == NULL) | ||
| 736 | return 0; | ||
| 735 | 737 | ||
| 736 | BN_bntest_rand(&a,100,0,0); /**/ | 738 | BN_bntest_rand(&a,100,0,0); /**/ |
| 737 | BN_bntest_rand(&b,100,0,0); /**/ | 739 | BN_bntest_rand(&b,100,0,0); /**/ |
| @@ -1027,7 +1029,7 @@ int test_exp(BIO *bp, BN_CTX *ctx) | |||
| 1027 | BN_bntest_rand(a,20+i*5,0,0); /**/ | 1029 | BN_bntest_rand(a,20+i*5,0,0); /**/ |
| 1028 | BN_bntest_rand(b,2+i,0,0); /**/ | 1030 | BN_bntest_rand(b,2+i,0,0); /**/ |
| 1029 | 1031 | ||
| 1030 | if (!BN_exp(d,a,b,ctx)) | 1032 | if (BN_exp(d,a,b,ctx) <= 0) |
| 1031 | return(0); | 1033 | return(0); |
| 1032 | 1034 | ||
| 1033 | if (bp != NULL) | 1035 | if (bp != NULL) |
| @@ -1116,8 +1118,8 @@ int test_gf2m_mod(BIO *bp) | |||
| 1116 | { | 1118 | { |
| 1117 | BIGNUM *a,*b[2],*c,*d,*e; | 1119 | BIGNUM *a,*b[2],*c,*d,*e; |
| 1118 | int i, j, ret = 0; | 1120 | int i, j, ret = 0; |
| 1119 | unsigned int p0[] = {163,7,6,3,0}; | 1121 | int p0[] = {163,7,6,3,0,-1}; |
| 1120 | unsigned int p1[] = {193,15,0}; | 1122 | int p1[] = {193,15,0,-1}; |
| 1121 | 1123 | ||
| 1122 | a=BN_new(); | 1124 | a=BN_new(); |
| 1123 | b[0]=BN_new(); | 1125 | b[0]=BN_new(); |
| @@ -1174,8 +1176,8 @@ int test_gf2m_mod_mul(BIO *bp,BN_CTX *ctx) | |||
| 1174 | { | 1176 | { |
| 1175 | BIGNUM *a,*b[2],*c,*d,*e,*f,*g,*h; | 1177 | BIGNUM *a,*b[2],*c,*d,*e,*f,*g,*h; |
| 1176 | int i, j, ret = 0; | 1178 | int i, j, ret = 0; |
| 1177 | unsigned int p0[] = {163,7,6,3,0}; | 1179 | int p0[] = {163,7,6,3,0,-1}; |
| 1178 | unsigned int p1[] = {193,15,0}; | 1180 | int p1[] = {193,15,0,-1}; |
| 1179 | 1181 | ||
| 1180 | a=BN_new(); | 1182 | a=BN_new(); |
| 1181 | b[0]=BN_new(); | 1183 | b[0]=BN_new(); |
| @@ -1245,8 +1247,8 @@ int test_gf2m_mod_sqr(BIO *bp,BN_CTX *ctx) | |||
| 1245 | { | 1247 | { |
| 1246 | BIGNUM *a,*b[2],*c,*d; | 1248 | BIGNUM *a,*b[2],*c,*d; |
| 1247 | int i, j, ret = 0; | 1249 | int i, j, ret = 0; |
| 1248 | unsigned int p0[] = {163,7,6,3,0}; | 1250 | int p0[] = {163,7,6,3,0,-1}; |
| 1249 | unsigned int p1[] = {193,15,0}; | 1251 | int p1[] = {193,15,0,-1}; |
| 1250 | 1252 | ||
| 1251 | a=BN_new(); | 1253 | a=BN_new(); |
| 1252 | b[0]=BN_new(); | 1254 | b[0]=BN_new(); |
| @@ -1304,8 +1306,8 @@ int test_gf2m_mod_inv(BIO *bp,BN_CTX *ctx) | |||
| 1304 | { | 1306 | { |
| 1305 | BIGNUM *a,*b[2],*c,*d; | 1307 | BIGNUM *a,*b[2],*c,*d; |
| 1306 | int i, j, ret = 0; | 1308 | int i, j, ret = 0; |
| 1307 | unsigned int p0[] = {163,7,6,3,0}; | 1309 | int p0[] = {163,7,6,3,0,-1}; |
| 1308 | unsigned int p1[] = {193,15,0}; | 1310 | int p1[] = {193,15,0,-1}; |
| 1309 | 1311 | ||
| 1310 | a=BN_new(); | 1312 | a=BN_new(); |
| 1311 | b[0]=BN_new(); | 1313 | b[0]=BN_new(); |
| @@ -1359,8 +1361,8 @@ int test_gf2m_mod_div(BIO *bp,BN_CTX *ctx) | |||
| 1359 | { | 1361 | { |
| 1360 | BIGNUM *a,*b[2],*c,*d,*e,*f; | 1362 | BIGNUM *a,*b[2],*c,*d,*e,*f; |
| 1361 | int i, j, ret = 0; | 1363 | int i, j, ret = 0; |
| 1362 | unsigned int p0[] = {163,7,6,3,0}; | 1364 | int p0[] = {163,7,6,3,0,-1}; |
| 1363 | unsigned int p1[] = {193,15,0}; | 1365 | int p1[] = {193,15,0,-1}; |
| 1364 | 1366 | ||
| 1365 | a=BN_new(); | 1367 | a=BN_new(); |
| 1366 | b[0]=BN_new(); | 1368 | b[0]=BN_new(); |
| @@ -1422,8 +1424,8 @@ int test_gf2m_mod_exp(BIO *bp,BN_CTX *ctx) | |||
| 1422 | { | 1424 | { |
| 1423 | BIGNUM *a,*b[2],*c,*d,*e,*f; | 1425 | BIGNUM *a,*b[2],*c,*d,*e,*f; |
| 1424 | int i, j, ret = 0; | 1426 | int i, j, ret = 0; |
| 1425 | unsigned int p0[] = {163,7,6,3,0}; | 1427 | int p0[] = {163,7,6,3,0,-1}; |
| 1426 | unsigned int p1[] = {193,15,0}; | 1428 | int p1[] = {193,15,0,-1}; |
| 1427 | 1429 | ||
| 1428 | a=BN_new(); | 1430 | a=BN_new(); |
| 1429 | b[0]=BN_new(); | 1431 | b[0]=BN_new(); |
| @@ -1493,8 +1495,8 @@ int test_gf2m_mod_sqrt(BIO *bp,BN_CTX *ctx) | |||
| 1493 | { | 1495 | { |
| 1494 | BIGNUM *a,*b[2],*c,*d,*e,*f; | 1496 | BIGNUM *a,*b[2],*c,*d,*e,*f; |
| 1495 | int i, j, ret = 0; | 1497 | int i, j, ret = 0; |
| 1496 | unsigned int p0[] = {163,7,6,3,0}; | 1498 | int p0[] = {163,7,6,3,0,-1}; |
| 1497 | unsigned int p1[] = {193,15,0}; | 1499 | int p1[] = {193,15,0,-1}; |
| 1498 | 1500 | ||
| 1499 | a=BN_new(); | 1501 | a=BN_new(); |
| 1500 | b[0]=BN_new(); | 1502 | b[0]=BN_new(); |
| @@ -1552,8 +1554,8 @@ int test_gf2m_mod_solve_quad(BIO *bp,BN_CTX *ctx) | |||
| 1552 | { | 1554 | { |
| 1553 | BIGNUM *a,*b[2],*c,*d,*e; | 1555 | BIGNUM *a,*b[2],*c,*d,*e; |
| 1554 | int i, j, s = 0, t, ret = 0; | 1556 | int i, j, s = 0, t, ret = 0; |
| 1555 | unsigned int p0[] = {163,7,6,3,0}; | 1557 | int p0[] = {163,7,6,3,0,-1}; |
| 1556 | unsigned int p1[] = {193,15,0}; | 1558 | int p1[] = {193,15,0,-1}; |
| 1557 | 1559 | ||
| 1558 | a=BN_new(); | 1560 | a=BN_new(); |
| 1559 | b[0]=BN_new(); | 1561 | b[0]=BN_new(); |
diff --git a/src/lib/libcrypto/bn/exptest.c b/src/lib/libcrypto/bn/exptest.c index f598a07cf5..074a8e882a 100644 --- a/src/lib/libcrypto/bn/exptest.c +++ b/src/lib/libcrypto/bn/exptest.c | |||
| @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) | |||
| 163 | { | 163 | { |
| 164 | if (BN_cmp(r_simple,r_mont) != 0) | 164 | if (BN_cmp(r_simple,r_mont) != 0) |
| 165 | printf("\nsimple and mont results differ\n"); | 165 | printf("\nsimple and mont results differ\n"); |
| 166 | if (BN_cmp(r_simple,r_mont) != 0) | 166 | if (BN_cmp(r_simple,r_mont_const) != 0) |
| 167 | printf("\nsimple and mont const time results differ\n"); | 167 | printf("\nsimple and mont const time results differ\n"); |
| 168 | if (BN_cmp(r_simple,r_recp) != 0) | 168 | if (BN_cmp(r_simple,r_recp) != 0) |
| 169 | printf("\nsimple and recp results differ\n"); | 169 | printf("\nsimple and recp results differ\n"); |
| @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) | |||
| 187 | BN_free(b); | 187 | BN_free(b); |
| 188 | BN_free(m); | 188 | BN_free(m); |
| 189 | BN_CTX_free(ctx); | 189 | BN_CTX_free(ctx); |
| 190 | ERR_remove_state(0); | 190 | ERR_remove_thread_state(NULL); |
| 191 | CRYPTO_mem_leaks(out); | 191 | CRYPTO_mem_leaks(out); |
| 192 | BIO_free(out); | 192 | BIO_free(out); |
| 193 | printf(" done\n"); | 193 | printf(" done\n"); |
