comparison libtommath/Makefile.in @ 1655:f52919ffd3b1

update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79) * make key-generation compliant to FIPS 186.4 * fix includes in tommath_class.h * update fuzzcorpus instead of error-out * fixup fuzzing make-targets * update Makefile.in * apply necessary patches to ltm sources * clean-up not required ltm files * update to vanilla ltm 1.1.0 this already only contains the required files * remove set/get double
author Steffen Jaeckel <s_jaeckel@gmx.de>
date Mon, 16 Sep 2019 15:50:38 +0200
parents 47fcbdd12d9b
children 1051e4eea25a
comparison
equal deleted inserted replaced
1654:cc0fc5131c5c 1655:f52919ffd3b1
30 ${silent} ${CC} -c ${CFLAGS} $< -o $@ 30 ${silent} ${CC} -c ${CFLAGS} $< -o $@
31 31
32 LCOV_ARGS=--directory . 32 LCOV_ARGS=--directory .
33 33
34 #START_INS 34 #START_INS
35 OBJECTS=bncore.o bn_error.o bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \ 35 OBJECTS=bn_error.o bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \
36 bn_fast_s_mp_mul_high_digs.o bn_fast_s_mp_sqr.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o \ 36 bn_fast_s_mp_mul_high_digs.o bn_fast_s_mp_sqr.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o \
37 bn_mp_addmod.o bn_mp_and.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o bn_mp_cmp_d.o \ 37 bn_mp_addmod.o bn_mp_and.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o bn_mp_cmp_d.o \
38 bn_mp_cmp_mag.o bn_mp_cnt_lsb.o bn_mp_copy.o bn_mp_count_bits.o bn_mp_div_2.o bn_mp_div_2d.o bn_mp_div_3.o \ 38 bn_mp_cmp_mag.o bn_mp_cnt_lsb.o bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o bn_mp_div.o \
39 bn_mp_div.o bn_mp_div_d.o bn_mp_dr_is_modulus.o bn_mp_dr_reduce.o bn_mp_dr_setup.o bn_mp_exch.o \ 39 bn_mp_div_2.o bn_mp_div_2d.o bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o bn_mp_dr_reduce.o \
40 bn_mp_export.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_exptmod.o bn_mp_exptmod_fast.o bn_mp_exteuclid.o \ 40 bn_mp_dr_setup.o bn_mp_exch.o bn_mp_export.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_exptmod.o \
41 bn_mp_fread.o bn_mp_fwrite.o bn_mp_gcd.o bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o \ 41 bn_mp_exptmod_fast.o bn_mp_exteuclid.o bn_mp_fread.o bn_mp_fwrite.o bn_mp_gcd.o bn_mp_get_bit.o \
42 bn_mp_grow.o bn_mp_import.o bn_mp_init.o bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o \ 42 bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_import.o bn_mp_init.o \
43 bn_mp_init_set_int.o bn_mp_init_size.o bn_mp_invmod.o bn_mp_invmod_slow.o bn_mp_is_square.o \ 43 bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o bn_mp_init_set_int.o bn_mp_init_size.o \
44 bn_mp_jacobi.o bn_mp_karatsuba_mul.o bn_mp_karatsuba_sqr.o bn_mp_lcm.o bn_mp_lshd.o bn_mp_mod_2d.o \ 44 bn_mp_invmod.o bn_mp_invmod_slow.o bn_mp_is_square.o bn_mp_jacobi.o bn_mp_karatsuba_mul.o \
45 bn_mp_mod.o bn_mp_mod_d.o bn_mp_montgomery_calc_normalization.o bn_mp_montgomery_reduce.o \ 45 bn_mp_karatsuba_sqr.o bn_mp_kronecker.o bn_mp_lcm.o bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mod_d.o \
46 bn_mp_montgomery_setup.o bn_mp_mul_2.o bn_mp_mul_2d.o bn_mp_mul.o bn_mp_mul_d.o bn_mp_mulmod.o bn_mp_neg.o \ 46 bn_mp_montgomery_calc_normalization.o bn_mp_montgomery_reduce.o bn_mp_montgomery_setup.o bn_mp_mul.o \
47 bn_mp_n_root.o bn_mp_n_root_ex.o bn_mp_or.o bn_mp_prime_fermat.o bn_mp_prime_is_divisible.o \ 47 bn_mp_mul_2.o bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_mulmod.o bn_mp_n_root.o bn_mp_n_root_ex.o bn_mp_neg.o \
48 bn_mp_or.o bn_mp_prime_fermat.o bn_mp_prime_frobenius_underwood.o bn_mp_prime_is_divisible.o \
48 bn_mp_prime_is_prime.o bn_mp_prime_miller_rabin.o bn_mp_prime_next_prime.o \ 49 bn_mp_prime_is_prime.o bn_mp_prime_miller_rabin.o bn_mp_prime_next_prime.o \
49 bn_mp_prime_rabin_miller_trials.o bn_mp_prime_random_ex.o bn_mp_radix_size.o bn_mp_radix_smap.o \ 50 bn_mp_prime_rabin_miller_trials.o bn_mp_prime_random_ex.o bn_mp_prime_strong_lucas_selfridge.o \
50 bn_mp_rand.o bn_mp_read_radix.o bn_mp_read_signed_bin.o bn_mp_read_unsigned_bin.o bn_mp_reduce_2k.o \ 51 bn_mp_radix_size.o bn_mp_radix_smap.o bn_mp_rand.o bn_mp_read_radix.o bn_mp_read_signed_bin.o \
51 bn_mp_reduce_2k_l.o bn_mp_reduce_2k_setup.o bn_mp_reduce_2k_setup_l.o bn_mp_reduce.o \ 52 bn_mp_read_unsigned_bin.o bn_mp_reduce.o bn_mp_reduce_2k.o bn_mp_reduce_2k_l.o bn_mp_reduce_2k_setup.o \
52 bn_mp_reduce_is_2k.o bn_mp_reduce_is_2k_l.o bn_mp_reduce_setup.o bn_mp_rshd.o bn_mp_set.o bn_mp_set_int.o \ 53 bn_mp_reduce_2k_setup_l.o bn_mp_reduce_is_2k.o bn_mp_reduce_is_2k_l.o bn_mp_reduce_setup.o bn_mp_rshd.o \
53 bn_mp_set_long.o bn_mp_set_long_long.o bn_mp_shrink.o bn_mp_signed_bin_size.o bn_mp_sqr.o bn_mp_sqrmod.o \ 54 bn_mp_set.o bn_mp_set_int.o bn_mp_set_long.o bn_mp_set_long_long.o bn_mp_shrink.o bn_mp_signed_bin_size.o \
54 bn_mp_sqrt.o bn_mp_sqrtmod_prime.o bn_mp_sub.o bn_mp_sub_d.o bn_mp_submod.o bn_mp_toom_mul.o \ 55 bn_mp_sqr.o bn_mp_sqrmod.o bn_mp_sqrt.o bn_mp_sqrtmod_prime.o bn_mp_sub.o bn_mp_sub_d.o bn_mp_submod.o \
55 bn_mp_toom_sqr.o bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_to_signed_bin.o bn_mp_to_signed_bin_n.o \ 56 bn_mp_tc_and.o bn_mp_tc_div_2d.o bn_mp_tc_or.o bn_mp_tc_xor.o bn_mp_to_signed_bin.o \
56 bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o \ 57 bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o bn_mp_toom_mul.o \
58 bn_mp_toom_sqr.o bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o \
57 bn_prime_tab.o bn_reverse.o bn_s_mp_add.o bn_s_mp_exptmod.o bn_s_mp_mul_digs.o bn_s_mp_mul_high_digs.o \ 59 bn_prime_tab.o bn_reverse.o bn_s_mp_add.o bn_s_mp_exptmod.o bn_s_mp_mul_digs.o bn_s_mp_mul_high_digs.o \
58 bn_s_mp_sqr.o bn_s_mp_sub.o 60 bn_s_mp_sqr.o bn_s_mp_sub.o bncore.o
59 61
60 #END_INS 62 #END_INS
61 63
62 $(OBJECTS): $(HEADERS) 64 $(OBJECTS): $(HEADERS)
63 65
71 # then run the test demo and rebuild the library. 73 # then run the test demo and rebuild the library.
72 # 74 #
73 # So far I've seen improvements in the MP math 75 # So far I've seen improvements in the MP math
74 profiled: 76 profiled:
75 make CFLAGS="$(CFLAGS) -fprofile-arcs -DTESTING" timing 77 make CFLAGS="$(CFLAGS) -fprofile-arcs -DTESTING" timing
76 ./ltmtest 78 ./timing
77 rm -f *.a *.o ltmtest 79 rm -f *.a *.o timing
78 make CFLAGS="$(CFLAGS) -fbranch-probabilities" 80 make CFLAGS="$(CFLAGS) -fbranch-probabilities"
79 81
80 #make a single object profiled library 82 #make a single object profiled library
81 profiled_single: 83 profiled_single:
82 perl gen.pl 84 perl gen.pl
83 $(CC) $(CFLAGS) -fprofile-arcs -DTESTING -c mpi.c -o mpi.o 85 $(CC) $(CFLAGS) -fprofile-arcs -DTESTING -c mpi.c -o mpi.o
84 $(CC) $(CFLAGS) -DTESTING -DTIMER demo/timing.c mpi.o -lgcov -o ltmtest 86 $(CC) $(CFLAGS) -DTESTING -DTIMER demo/timing.c mpi.o -lgcov -o timing
85 ./ltmtest 87 ./timing
86 rm -f *.o ltmtest 88 rm -f *.o timing
87 $(CC) $(CFLAGS) -fbranch-probabilities -DTESTING -c mpi.c -o mpi.o 89 $(CC) $(CFLAGS) -fbranch-probabilities -DTESTING -c mpi.c -o mpi.o
88 $(AR) $(ARFLAGS) $(LIBNAME) mpi.o 90 $(AR) $(ARFLAGS) $(LIBNAME) mpi.o
89 $(RANLIB) $(LIBNAME) 91 ranlib $(LIBNAME)
90 92
91 install: $(LIBNAME) 93 install: $(LIBNAME)
92 install -d $(DESTDIR)$(LIBPATH) 94 install -d $(DESTDIR)$(LIBPATH)
93 install -d $(DESTDIR)$(INCPATH) 95 install -d $(DESTDIR)$(INCPATH)
94 install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH) 96 install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH)
106 108
107 .PHONY: mtest 109 .PHONY: mtest
108 mtest: 110 mtest:
109 cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LFLAGS) -o mtest 111 cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LFLAGS) -o mtest
110 112
111 travis_mtest: test mtest 113 timing: $(LIBNAME) demo/timing.c
112 @ for i in `seq 1 10` ; do sleep 500 && echo alive; done & 114 $(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) $(LFLAGS) -o timing
113 ./mtest/mtest 666666 | ./test > test.log
114
115 timing: $(LIBNAME)
116 $(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) $(LFLAGS) -o ltmtest
117 115
118 # You have to create a file .coveralls.yml with the content "repo_token: <the token>" 116 # You have to create a file .coveralls.yml with the content "repo_token: <the token>"
119 # in the base folder to be able to submit to coveralls 117 # in the base folder to be able to submit to coveralls
120 coveralls: lcov 118 coveralls: lcov
121 coveralls-lcov 119 coveralls-lcov
126 pretty: 124 pretty:
127 perl pretty.build 125 perl pretty.build
128 126
129 .PHONY: pre_gen 127 .PHONY: pre_gen
130 pre_gen: 128 pre_gen:
129 mkdir -p pre_gen
131 perl gen.pl 130 perl gen.pl
132 sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c 131 sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
133 rm mpi.c 132 rm mpi.c
134 133
135 zipup: clean pre_gen new_file manual poster docs 134 zipup: clean astyle new_file manual poster docs
136 @# Update the index, so diff-index won't fail in case the pdf has been created. 135 @# Update the index, so diff-index won't fail in case the pdf has been created.
137 @# As the pdf creation modifies the tex files, git sometimes detects the 136 @# As the pdf creation modifies the tex files, git sometimes detects the
138 @# modified files, but misses that it's put back to its original version. 137 @# modified files, but misses that it's put back to its original version.
139 @git update-index --refresh 138 @git update-index --refresh
140 @git diff-index --quiet HEAD -- || ( echo "FAILURE: uncommited changes or not a git" && exit 1 ) 139 @git diff-index --quiet HEAD -- || ( echo "FAILURE: uncommited changes or not a git" && exit 1 )
141 rm -rf libtommath-$(VERSION) ltm-$(VERSION).* 140 rm -rf libtommath-$(VERSION) ltm-$(VERSION).*
142 @# files/dirs excluded from "git archive" are defined in .gitattributes 141 @# files/dirs excluded from "git archive" are defined in .gitattributes
143 git archive --format=tar --prefix=libtommath-$(VERSION)/ HEAD | tar x 142 git archive --format=tar --prefix=libtommath-$(VERSION)/ HEAD | tar x
143 @echo 'fixme check'
144 -@(find libtommath-$(VERSION)/ -type f | xargs grep 'FIXM[E]') && echo '############## BEWARE: the "fixme" marker was found !!! ##############' || true
144 mkdir -p libtommath-$(VERSION)/doc 145 mkdir -p libtommath-$(VERSION)/doc
145 cp doc/bn.pdf doc/tommath.pdf doc/poster.pdf libtommath-$(VERSION)/doc/ 146 cp doc/bn.pdf doc/tommath.pdf doc/poster.pdf libtommath-$(VERSION)/doc/
147 $(MAKE) -C libtommath-$(VERSION)/ pre_gen
146 tar -c libtommath-$(VERSION)/ | xz -6e -c - > ltm-$(VERSION).tar.xz 148 tar -c libtommath-$(VERSION)/ | xz -6e -c - > ltm-$(VERSION).tar.xz
147 zip -9rq ltm-$(VERSION).zip libtommath-$(VERSION) 149 zip -9rq ltm-$(VERSION).zip libtommath-$(VERSION)
150 cp doc/bn.pdf bn-$(VERSION).pdf
151 cp doc/tommath.pdf tommath-$(VERSION).pdf
148 rm -rf libtommath-$(VERSION) 152 rm -rf libtommath-$(VERSION)
149 gpg -b -a ltm-$(VERSION).tar.xz 153 gpg -b -a ltm-$(VERSION).tar.xz
150 gpg -b -a ltm-$(VERSION).zip 154 gpg -b -a ltm-$(VERSION).zip
151 155
152 new_file: 156 new_file:
153 bash updatemakes.sh 157 bash updatemakes.sh
154 perl dep.pl 158 perl dep.pl
155 159
156 perlcritic: 160 perlcritic:
157 perlcritic *.pl 161 perlcritic *.pl doc/*.pl
162
163 astyle:
164 astyle --options=astylerc $(OBJECTS:.o=.c) tommath*.h demo/*.c etc/*.c mtest/mtest.c