Go to file
Daniel Mendler 61d9e528a4
hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS
* (!) Always zero buffer before freeing if MP_NO_ZERO_ON_FREE is not defined
* Add MP_NO_ZERO_ON_FREE to disable hardening
* Add MP_ZERO_BUFFER, MP_ZERO_DIGITS, MP_FREE_BUFFFER, MP_FREE_DIGITS
* Never use MP_FREE directly, use MP_FREE_DIGITS or MP_FREE_BUFFER
* Add MP_USE_MEMSET to use memset instead of loop
* Disable astyle backups which are annonying in the times of git
2019-05-12 01:01:03 +02:00
demo add warn_unused_result, found one missing check! 2019-05-11 19:26:58 +02:00
doc deprecate mp_prime_random_ex in favor of mp_prime_rand 2019-05-11 00:48:48 +02:00
etc support custom random data source via mp_rand_source 2019-05-08 11:21:10 +02:00
logs update results when running the timing demo 2018-02-27 23:30:43 +01:00
mtest Merge pull request #146 from libtom/relicense_mtest 2019-01-08 12:00:45 +01:00
.gitattributes improve build 2018-04-11 23:35:43 +02:00
.gitignore just use one .gitignore for simplicity 2019-05-07 12:36:11 +02:00
.travis.yml added autotuning functionality for the Toom-Cook cut-offs 2019-05-06 23:29:08 +02:00
astylerc hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_cutoffs.c Rework handling of tunable cutoffs 2019-05-04 13:08:37 +02:00
bn_deprecated.c apply rename 2019-04-12 14:56:29 +02:00
bn_mp_2expt.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_abs.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_add_d.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_add.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_addmod.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_and.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_clamp.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_clear_multi.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_clear.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_cmp_d.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_cmp_mag.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_cmp.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_cnt_lsb.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_complement.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_copy.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_count_bits.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_decr.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_div_2.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_div_2d.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_div_3.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_div_d.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_div.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_dr_is_modulus.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_dr_reduce.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_dr_setup.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_error_to_string.c add MP_ERR to mp_error_to_string 2019-05-09 04:16:24 +02:00
bn_mp_exch.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_export.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_expt_d_ex.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_expt_d.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_exptmod.c apply rename 2019-04-12 14:56:29 +02:00
bn_mp_exteuclid.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_fread.c rename LTM_NO_FILE to MP_NO_FILE 2019-05-07 09:33:56 +02:00
bn_mp_fwrite.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_gcd.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_get_bit.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_get_double.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_get_int.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_get_long_long.c refactor with new private macro MP_SIZEOF_BITS 2019-05-11 12:05:38 +02:00
bn_mp_get_long.c refactor with new private macro MP_SIZEOF_BITS 2019-05-11 12:05:38 +02:00
bn_mp_grow.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_ilogb.c resolving #218 2019-04-18 08:33:03 +02:00
bn_mp_import.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_incr.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_init_copy.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_init_multi.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_init_set_int.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_init_set.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_init_size.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_init.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_invmod.c apply rename 2019-04-12 14:56:29 +02:00
bn_mp_is_square.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_iseven.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_isodd.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_jacobi.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_kronecker.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_lcm.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_lshd.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_mod_2d.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_mod_d.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_mod.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_montgomery_calc_normalization.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_montgomery_reduce.c refactor with new private macro MP_MAXFAST 2019-05-11 12:05:38 +02:00
bn_mp_montgomery_setup.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_mul_2.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_mul_2d.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_mul_d.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_mul.c refactor with new private macro MP_MAXFAST 2019-05-11 12:05:38 +02:00
bn_mp_mulmod.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_n_root_ex.c sanitize comments in helper.pl 2019-05-07 10:56:13 +02:00
bn_mp_n_root.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_neg.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_or.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_prime_fermat.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_prime_frobenius_underwood.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_prime_is_divisible.c deprecate PRIME_SIZE in favor of MP_PRIME_SIZE 2019-05-07 09:49:26 +02:00
bn_mp_prime_is_prime.c refactor with new private macro MP_SIZEOF_BITS 2019-05-11 12:05:38 +02:00
bn_mp_prime_miller_rabin.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_prime_next_prime.c deprecate PRIME_SIZE in favor of MP_PRIME_SIZE 2019-05-07 09:49:26 +02:00
bn_mp_prime_rabin_miller_trials.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_prime_rand.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_prime_strong_lucas_selfridge.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_radix_size.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_radix_smap.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_rand.c explicit operator precedence 2019-05-11 16:57:04 +02:00
bn_mp_read_radix.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_read_signed_bin.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_read_unsigned_bin.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_reduce_2k_l.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_reduce_2k_setup_l.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_reduce_2k_setup.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_reduce_2k.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_reduce_is_2k_l.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_reduce_is_2k.c remove useless cast 2019-05-11 16:57:04 +02:00
bn_mp_reduce_setup.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_reduce.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_mp_rshd.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_set_double.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_set_int.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_set_long_long.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_set_long.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_set.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_shrink.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_signed_bin_size.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_sqr.c refactor with new private macro MP_MAXFAST 2019-05-11 12:05:38 +02:00
bn_mp_sqrmod.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_sqrt.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_sqrtmod_prime.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_sub_d.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_mp_sub.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_submod.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_tc_and.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_tc_div_2d.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_tc_or.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_tc_xor.c rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
bn_mp_to_signed_bin_n.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_to_signed_bin.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_to_unsigned_bin_n.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_to_unsigned_bin.c apply rename 2019-04-12 14:56:29 +02:00
bn_mp_toradix_n.c apply rename 2019-04-12 14:56:29 +02:00
bn_mp_toradix.c apply rename 2019-04-12 14:56:29 +02:00
bn_mp_unsigned_bin_size.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_xor.c shorter headers 2019-04-07 17:26:31 +02:00
bn_mp_zero.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_prime_tab.c shorter headers 2019-04-07 17:26:31 +02:00
bn_s_mp_add.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_s_mp_balance_mul.c apply rename 2019-04-12 14:56:29 +02:00
bn_s_mp_exptmod_fast.c refactor with new private macro MP_MAXFAST 2019-05-11 12:05:38 +02:00
bn_s_mp_exptmod.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_s_mp_invmod_fast.c apply rename 2019-04-12 14:56:29 +02:00
bn_s_mp_invmod_slow.c apply rename 2019-04-12 14:56:29 +02:00
bn_s_mp_karatsuba_mul.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_s_mp_karatsuba_sqr.c apply rename 2019-04-12 14:56:29 +02:00
bn_s_mp_montgomery_reduce_fast.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_s_mp_mul_digs_fast.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_s_mp_mul_digs.c refactor with new private macro MP_MAXFAST 2019-05-11 12:05:38 +02:00
bn_s_mp_mul_high_digs_fast.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_s_mp_mul_high_digs.c refactor with new private macro MP_MAXFAST 2019-05-11 12:05:38 +02:00
bn_s_mp_reverse.c apply rename 2019-04-12 14:56:29 +02:00
bn_s_mp_sqr_fast.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_s_mp_sqr.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
bn_s_mp_sub.c hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
bn_s_mp_toom_mul.c add warn_unused_result, found one missing check! 2019-05-11 19:26:58 +02:00
bn_s_mp_toom_sqr.c deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
callgraph.txt deprecate mp_prime_random_ex in favor of mp_prime_rand 2019-05-11 00:48:48 +02:00
changes.txt update changes.txt 2019-01-28 20:21:04 +01:00
dep.pl dep.pl: strip comments 2019-05-07 10:42:47 +02:00
gen.pl sanitize some Perl scripts 2017-04-09 01:04:07 +02:00
helper.pl sanitize comments in helper.pl 2019-05-07 10:56:13 +02:00
libtommath_VS2008.sln make libtommath_VS2008 better upgradable to the newer visual studio 2018-12-08 11:56:08 +01:00
libtommath_VS2008.vcproj deprecate mp_prime_random_ex in favor of mp_prime_rand 2019-05-11 00:48:48 +02:00
libtommath.pc.in add pkg-config file for shared library 2017-05-09 14:25:11 +02:00
LICENSE Re-license 2018-12-27 15:41:16 +01:00
makefile remove some historical artifacts 2019-05-11 08:39:55 +02:00
makefile_include.mk set std=c89 2019-05-08 11:13:58 +02:00
makefile.mingw deprecate mp_prime_random_ex in favor of mp_prime_rand 2019-05-11 00:48:48 +02:00
makefile.msvc deprecate mp_prime_random_ex in favor of mp_prime_rand 2019-05-11 00:48:48 +02:00
makefile.shared deprecate mp_prime_random_ex in favor of mp_prime_rand 2019-05-11 00:48:48 +02:00
makefile.unix deprecate mp_prime_random_ex in favor of mp_prime_rand 2019-05-11 00:48:48 +02:00
README.md added building howto for OpenBSD 2019-02-28 21:43:37 +01:00
testme.sh added autotuning functionality for the Toom-Cook cut-offs 2019-05-06 23:29:08 +02:00
tommath_class.h deprecate mp_prime_random_ex in favor of mp_prime_rand 2019-05-11 00:48:48 +02:00
tommath_cutoffs.h update etc/tune_it.sh after merging #231 2019-05-06 23:29:08 +02:00
tommath_private.h hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS 2019-05-12 01:01:03 +02:00
tommath_superclass.h apply rename 2019-04-12 14:56:29 +02:00
tommath.h add warn_unused_result, found one missing check! 2019-05-11 19:26:58 +02:00
updatemakes.sh remove footers 2019-04-07 17:26:31 +02:00

libtommath

This is the git repository for LibTomMath, a free open source portable number theoretic multiple-precision integer (MPI) library written entirely in C.

Build Status

master: Build Status

develop: Build Status

API/ABI changes: check here

Summary

The develop branch contains the in-development version. Stable releases are tagged.

Documentation is built from the LaTeX file bn.tex. There is also limited documentation in tommath.h. There is also a document, tommath.pdf, which describes the goals of the project and many of the algorithms used.

The project can be build by using make. Along with the usual make, make clean and make install, there are several other build targets, see the makefile for details. There are also makefiles for certain specific platforms.

Testing

Tests are located in demo/ and can be built in two flavors.

  • make test creates a test binary that is intended to be run against mtest. mtest can be built with make mtest and test execution is done like ./mtest/mtest | ./test. mtest is creating test vectors using an alternative MPI library and test is consuming these vectors to verify correct behavior of ltm
  • make test_standalone creates a stand-alone test binary that executes several test routines.

Building and Installing

Building is straightforward for GNU Linux only, the section "Building LibTomMath" in the documentation in doc/bn.pdf has the details.