The unified diff between revisions [b676473c..] and [b27fffec..] is displayed below. It can also be downloaded as a raw diff.

#
#
# delete "bn.pdf"
#
# delete "bn_prime_sizes_tab.c"
#
# delete "demo/test.c"
#
# delete "etc/tuning"
#
# delete "etc/tuning/morwong.txt"
#
# delete "etc/tuning/plod.txt"
#
# delete "etc/tuning/sultana.txt"
#
# delete "logs/k7"
#
# delete "logs/k7/README"
#
# delete "logs/k7/add.log"
#
# delete "logs/k7/addsub.png"
#
# delete "logs/k7/expt.log"
#
# delete "logs/k7/expt.png"
#
# delete "logs/k7/expt_dr.log"
#
# delete "logs/k7/graphs.dem"
#
# delete "logs/k7/invmod.log"
#
# delete "logs/k7/invmod.png"
#
# delete "logs/k7/mult.log"
#
# delete "logs/k7/mult.png"
#
# delete "logs/k7/mult_kara.log"
#
# delete "logs/k7/sqr.log"
#
# delete "logs/k7/sqr_kara.log"
#
# delete "logs/k7/sub.log"
#
# delete "logs/p4"
#
# delete "logs/p4/README"
#
# delete "logs/p4/add.log"
#
# delete "logs/p4/addsub.png"
#
# delete "logs/p4/expt.log"
#
# delete "logs/p4/expt.png"
#
# delete "logs/p4/expt_dr.log"
#
# delete "logs/p4/graphs.dem"
#
# delete "logs/p4/invmod.log"
#
# delete "logs/p4/invmod.png"
#
# delete "logs/p4/mult.log"
#
# delete "logs/p4/mult.png"
#
# delete "logs/p4/mult_kara.log"
#
# delete "logs/p4/sqr.log"
#
# delete "logs/p4/sqr_kara.log"
#
# delete "logs/p4/sub.log"
#
# delete "makefile"
#
# delete "poster.pdf"
#
# delete "tommath.pdf"
#
# delete "tommath.tex"
#
# patch "Makefile.in"
#  from [2645e72f7375faa7e11cb061d37d03fcf887608a]
#    to [fe54127b8592b9921fd77e9c01fe4d60600df78d]
#
# patch "tommath_class.h"
#  from [d2d0596bd40615d49d7d9bdf8036e01e3d2e21a4]
#    to [5d4522dbe7261964739fb0a80d5b83b283c7d622]
#
============================================================
--- Makefile.in	2645e72f7375faa7e11cb061d37d03fcf887608a
+++ Makefile.in	fe54127b8592b9921fd77e9c01fe4d60600df78d
@@ -19,15 +19,18 @@ CFLAGS += -I$(srcdir)
 #x86 optimizations [should be valid for any GCC install though]
 #CFLAGS  += -fomit-frame-pointer

-VERSION=0.30
+#debug
+#CFLAGS += -g3

+VERSION=0.32
+
 default: libtommath.a

 #default files to install
 LIBNAME=libtommath.a
 HEADERS=tommath.h

-#LIBPATH-The directory for libtomcrypt to be installed to.
+#LIBPATH-The directory for libtommath to be installed to.
 #INCPATH-The directory to install the header files for libtommath.
 #DATAPATH-The directory to install the pdf docs.
 DESTDIR=
@@ -57,14 +60,38 @@ bn_mp_fread.o bn_mp_fwrite.o bn_mp_cnt_l
 bn_mp_reduce_2k.o bn_mp_reduce_is_2k.o bn_mp_reduce_2k_setup.o \
 bn_mp_radix_smap.o bn_mp_read_radix.o bn_mp_toradix.o bn_mp_radix_size.o \
 bn_mp_fread.o bn_mp_fwrite.o bn_mp_cnt_lsb.o bn_error.o \
-bn_mp_init_multi.o bn_mp_clear_multi.o bn_prime_sizes_tab.o bn_mp_exteuclid.o bn_mp_toradix_n.o \
+bn_mp_init_multi.o bn_mp_clear_multi.o bn_mp_exteuclid.o bn_mp_toradix_n.o \
 bn_mp_prime_random_ex.o bn_mp_get_int.o bn_mp_sqrt.o bn_mp_is_square.o bn_mp_init_set.o \
-bn_mp_init_set_int.o
+bn_mp_init_set_int.o bn_mp_invmod_slow.o bn_mp_prime_rabin_miller_trials.o

 libtommath.a:  $(OBJECTS)
 	$(AR) $(ARFLAGS) libtommath.a $(OBJECTS)
 	$(RANLIB) libtommath.a

+
+#make a profiled library (takes a while!!!)
+#
+# This will build the library with profile generation
+# then run the test demo and rebuild the library.
+#
+# So far I've seen improvements in the MP math
+profiled:
+	make CFLAGS="$(CFLAGS) -fprofile-arcs -DTESTING" timing
+	./ltmtest
+	rm -f *.a *.o ltmtest
+	make CFLAGS="$(CFLAGS) -fbranch-probabilities"
+
+#make a single object profiled library
+profiled_single:
+	perl gen.pl
+	$(CC) $(CFLAGS) -fprofile-arcs -DTESTING -c mpi.c -o mpi.o
+	$(CC) $(CFLAGS) -DTESTING -DTIMER demo/timing.c mpi.o -o ltmtest
+	./ltmtest
+	rm -f *.o ltmtest
+	$(CC) $(CFLAGS) -fbranch-probabilities -DTESTING -c mpi.c -o mpi.o
+	$(AR) $(ARFLAGS) libtommath.a mpi.o
+	ranlib libtommath.a
+
 install: libtommath.a
 	install -d -g root -o root $(DESTDIR)$(LIBPATH)
 	install -d -g root -o root $(DESTDIR)$(INCPATH)
@@ -78,7 +105,7 @@ timing: libtommath.a
 	cd mtest ; $(CC) $(CFLAGS) mtest.c -o mtest -s

 timing: libtommath.a
-	$(CC) $(CFLAGS) -DTIMER demo/demo.c libtommath.a -o ltmtest -s
+	$(CC) $(CFLAGS) -DTIMER demo/timing.c libtommath.a -o ltmtest -s

 # makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think]
 docdvi: tommath.src
@@ -113,10 +140,14 @@ manual:	mandvi
 manual:	mandvi
 	pdflatex bn >/dev/null
 	rm -f bn.aux bn.dvi bn.log bn.idx bn.lof bn.out bn.toc
-
+
+pretty:
+	perl pretty.build
+
 clean:
 	-rm -f *.bat *.pdf *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \
-        *.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log *.s mpi.c
+        *.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log *.s mpi.c *.da *.dyn *.dpi tommath.tex `find -type f | grep [~] | xargs` *.lo *.la
+	-rm -rf .libs
 	-cd etc && make clean
 	-cd pics && make clean

============================================================
--- tommath_class.h	d2d0596bd40615d49d7d9bdf8036e01e3d2e21a4
+++ tommath_class.h	5d4522dbe7261964739fb0a80d5b83b283c7d622
@@ -57,8 +57,10 @@
 #define BN_MP_INVMOD_SLOW_C
 #define BN_MP_IS_SQUARE_C
 #define BN_MP_JACOBI_C
+/* matt - dropbear doesn't need these
 #define BN_MP_KARATSUBA_MUL_C
 #define BN_MP_KARATSUBA_SQR_C
+*/
 #define BN_MP_LCM_C
 #define BN_MP_LSHD_C
 #define BN_MP_MOD_C
@@ -106,8 +108,10 @@
 #define BN_MP_SUBMOD_C
 #define BN_MP_TO_SIGNED_BIN_C
 #define BN_MP_TO_UNSIGNED_BIN_C
+/* matt - dropbear doesn't need these
 #define BN_MP_TOOM_MUL_C
 #define BN_MP_TOOM_SQR_C
+*/
 #define BN_MP_TORADIX_C
 #define BN_MP_TORADIX_N_C
 #define BN_MP_UNSIGNED_BIN_SIZE_C