Commit Graph

58 Commits

Author SHA1 Message Date
Francois Perrad
991aea532f explicit condition 2019-05-22 08:23:37 +02:00
czurnieden
228e487bc4 faster Toom-Cook 3 algorithm 2019-05-21 23:44:13 +02:00
Daniel Mendler
1af0de1f91
deprecate mp_tc_(and|or|xor) in favor of mp_(and|or|xor)
* same behavior for positive numbers
* generalisation for negative numbers, treating them as two complement
* improve algorithm, iterate once over the digits, manually perform two complement
* simplify mp_add_d, mp_sub_d
* functions are safe in case of a==c or b==c
* renamed mp_tc_div_2d to mp_signed_rsh (signed right shift)
2019-05-21 18:28:11 +02:00
Daniel Mendler
6552f55f78
handle EOF condition in mp_fread, fix #163 2019-05-21 18:23:43 +02:00
Francois Perrad
c1f5b06d4b refactor with mp_init_multi 2019-05-20 05:36:08 +02:00
Daniel Mendler
f55f0a9ef5
fix some usages of enum types 2019-05-18 10:03:47 +02:00
Daniel Mendler
a8239c2465
deprecate mp_get_bit
The return type of mp_get_bit was imprecise (either mp_err or mp_bool),
therefore this function is deprecated in favor of s_mp_get_bit for now.

If we need s_mp_get_bit to be public, we should add it under a different
name. However since mp_set_bit is not available, I don't think there any
downstream users (ab)using mp_int as bitsets.
2019-05-18 10:03:47 +02:00
Daniel Mendler
56e7a40123
deprecate mp_jacobi 2019-05-18 10:03:46 +02:00
Daniel Mendler
75e85a7341
move mp_prime_random_ex to bn_deprecated.c 2019-05-18 10:03:46 +02:00
Daniel Mendler
2a2e2716c2
move jenkins prng to bn_s_mp_rand_jenkins.c 2019-05-12 23:45:36 +02:00
Daniel Mendler
c8cc3657e7
mov s_mp_rand_source_platform to separate file 2019-05-12 23:45:36 +02:00
Daniel Mendler
0669e92e78
deprecate mp_prime_random_ex in favor of mp_prime_rand
We can use the internal mp_rand generator now, since it generates
numbers which are safe for crypto purposes.
2019-05-11 00:48:48 +02:00
Daniel Mendler
2a0021a447
mp_rand: remove superflous mp_clamp 2019-05-08 14:57:49 +02:00
Daniel Mendler
9ddf1e5838
support custom random data source via mp_rand_source
* deprecate MP_PRNG_ENABLE_LTM_RNG
* custom mp_rand_source is used always if set, which should be more aligned with user expectations
* use custom source in tune.c
* don't call random number generator once per digit, which is slow
2019-05-08 11:21:10 +02:00
Daniel Mendler
2ea04fb782
dep.pl: strip comments 2019-05-07 10:42:47 +02:00
Daniel Mendler
c7596983ae
fix dep.pl - use lookahead to only generated dependencies for 'mp_*(' 2019-05-07 10:28:32 +02:00
Daniel Mendler
818d8fb7f5
Rework handling of tunable cutoffs
* In the default settings, a cutoff X can be modified at runtime
   by adjusting the corresponding X_CUTOFF variable.

 * Tunability of the library can be disabled at compile time
   by defining the MP_FIXED_CUTOFFS macro.

 * There is an additional file tommath_cutoffs.h, which defines
   the default cutoffs. These can be adjusted manually or by the
   autotuner.
2019-05-04 13:08:37 +02:00
Steffen Jaeckel
e05b1e181b fix includes
as of @czurnieden "there's always leftovers" and he's right

that's a leftover of #127
2019-04-12 19:07:08 +02:00
Daniel Mendler
fbfcb66184
apply rename 2019-04-12 14:56:29 +02:00
nijtmans
3afec571e7 Re-generate callgraph and tommath_class.h 2019-04-10 15:19:23 +02:00
czurnieden
35311aea49 added function mp_ilogb 2019-04-09 21:59:59 +02:00
czurnieden
27ca25cb82 added multiplcation balancing for the Toom-Cook algorithms 2019-04-07 22:15:09 +02:00
Daniel Mendler
ff56140462
shorter headers 2019-04-07 17:26:31 +02:00
Daniel Mendler
70a30ae7a7
remove footers 2019-04-07 17:26:31 +02:00
czurnieden
984d3ff679 changed seed to make nth-root usable 2019-04-06 22:51:10 +02:00
Steffen Jaeckel
58e9084e1a run make new_file 2019-04-06 17:45:15 +02:00
czurnieden
769218ccc7 additional functions mp_incr and mp_decr 2019-04-04 07:58:19 +02:00
Steffen Jaeckel
646ac8802f update callgraph and tommath_class 2019-04-04 07:55:02 +02:00
Francois Perrad
6ce271c4db mp_iseven & mp_isodd becomes C functions 2019-02-02 07:39:23 +01:00
Francois Perrad
b879bd495a refactor with new macros IS_* 2019-02-02 07:39:23 +01:00
Francois Perrad
487cbba03c refactor without macro mp_isneg 2019-02-02 07:39:23 +01:00
Steffen Jaeckel
c93afda118 run make new_file 2019-01-15 17:05:39 +01:00
czurnieden
08eb995d01 implemented Steffen Jaeckels superior suggestion regarding MoarVM's problem 2019-01-15 16:59:57 +01:00
Steffen Jaeckel
18355de625 Update file headers
[skip ci]
2018-12-29 17:56:20 +01:00
czurnieden
3ec93dab9e bugfix in bn_mp_kronecker.c, cleanup and formatting in div. files 2018-12-25 15:17:12 +01:00
Steffen Jaeckel
4f245b0476 Update makefiles etc. 2018-12-25 15:17:12 +01:00
Karel Miko
0493739d2b add missing comments 2018-12-02 13:10:09 +01:00
Mikhail Novosyolov
adbadc70f4 Fix includes
Header files which are located in the same directory that the file from where it is included must be included using `" "`, not `< >`.
Otherwise the compiler (gcc 5) cannot understand `#include <tommath_class.h>` in `/usr/include/tommath/tommath.h`.
2018-12-01 15:27:40 +01:00
Daniel Mendler
81cdb9aca2
regenerate files 2018-11-22 12:05:16 +01:00
Daniel Mendler
109bfa57bf
regenerate files 2018-09-10 18:49:10 +02:00
Francois Perrad
82a2d385db refactor indentation of preprocessor directives 2017-08-30 20:09:16 +02:00
Steffen Jaeckel
49e5432060 update tommath_class.h 2017-08-28 17:04:18 +02:00
Steffen Jaeckel
3ab918e7ea update tommath_class.h 2017-04-09 01:04:07 +02:00
Steffen Jaeckel
1f8894790b update makefiles etc. 2015-10-30 18:04:33 -04:00
Steffen Jaeckel
d4cccd52d1 udpate makefiles etc. 2014-12-10 18:59:56 +01:00
Steffen Jaeckel
cf04521695 update makefiles etc. 2014-12-10 17:21:14 +01:00
Steffen Jaeckel
d71719853a update after removing balance multiplication 2014-10-18 18:56:56 +02:00
Steffen Jaeckel
b425b0ea1f Revert "balancing multiplication like that in Ruby 1.9"
This reverts commit e68439aae1.

Conflicts:
	bn_mp_balance_mul.c
	makefile
2014-10-18 18:54:06 +02:00
Steffen Jaeckel
52cfd5ff0a mp_n_root: add mp_n_root_ex() with parameter 'fast' for mp_expt_d_ex()
This change is introduced to be able to choose the underlying
implementation of mp_expt_d_ex()

The implementation of the root_n functionality is now implemented in the
mp_n_root_ex() function.

The parameter 'fast' is just passed over to mp_expt_d_ex().

mp_n_root() defaults to the pre 921be35779
implementation
2014-09-28 13:33:59 +02:00
Steffen Jaeckel
e9b1837c8c mp_expt_d: bring back pre 921be35779 state
The implementation of the expt_d functionality is now implemented in the
mp_expt_d_ex() function.

The user can now choose between the old (more timing resistant) version
and the new version by modification of the parameter 'fast'.

mp_expt_d() defaults to the old version
2014-09-28 13:33:59 +02:00