Commit Graph

167 Commits

Author SHA1 Message Date
Steffen Jaeckel
cc77fadb85
Merge pull request #444 from minad/lto
add COMPILE_LTO to test link time optimization
2019-11-05 23:11:36 +01:00
Daniel Mendler
91d88ce3db
fix generate_def, rename some internal files 2019-11-05 21:11:58 +01:00
Daniel Mendler
74d828d526
don't use ranlib, ar s is equivalent 2019-11-05 20:28:59 +01:00
Daniel Mendler
e8e65119d1
add COMPILE_LTO to test link time optimization
the library performs best with lto since many small functions
can be inlined across objects.
2019-11-05 20:28:59 +01:00
Daniel Mendler
410bf49385
apply a series of simplifications
* this is the final commit of a series of simplifications,
  containing only the regenerated files and the explanation in the
  commit message

* This is in preparation of the size_t change/a potential representation change to use
  full width as in tfm, if a (partial?) merge with tfm is desired.
  These changes have their own merits however.

* Remove obfuscating tmpx digit pointers (fewer variables, it is more obvious what is
  being manipulated)

* Reduce scope of variables where possible

* Stricter error handling/checking (for example handling in karatsuba
  was broken)

* In some cases the result was written even in the case of an error
  (e.g. s_mp_is_divisible). This will hide bugs, since the user should
  check the return value (enforced by MP_WUR). Furthermore if the user
  accesses the non-initialized result, valgrind will complain for
  example. Global static analysis like coverity will also detect the issue.
  Therefore this improves the status quo.

* Introduce generic, private MP_EXCH macro which can be used to swap values.

* Introduce s_mp_copy_digs/s_mp_zero_digs/s_mp_zero_buf

* Some control flow simplifications, e.g, loops instead of goto

* Renamings of variables/labels for consistency

* Renamings of mul/sqr functions for more consistency, e.g., comba
  instead of fast suffix

* I didn't read through some very complex functions.
  They are so complex, I am too afraid and lazy to touch them.
  Maybe someone resposible wants to simplify them if possible. Hint... Hint...
  - mp_prime_strong_lucas_selfridge.c
  - s_mp_exptmod.c
  - s_mp_exptmod_fast.c
2019-11-04 15:41:33 +01:00
Steffen Jaeckel
a598e61b90 rename to tommath_amalgam.c 2019-10-28 15:42:23 +01:00
Steffen Jaeckel
02f4ee114c compare logs before and after single-object profiling 2019-10-28 15:31:36 +01:00
Steffen Jaeckel
8e3a440464
use pre_gen/mp_all.c for profiled_single
+ clean-up defines
2019-10-28 15:29:54 +01:00
Daniel Mendler
1ece193af2
replace gen.pl by cat, rename mpi.c to mp_all.c 2019-10-28 15:29:54 +01:00
Daniel Mendler
7afecabd9d
regen files 2019-10-27 19:19:47 +01:00
Daniel Mendler
f662e1f7e1
fix c89 issues 2019-10-27 19:19:47 +01:00
Daniel Mendler
4376913928
remove inttypes.h includes in c89 mode 2019-10-27 18:41:59 +01:00
Daniel Mendler
17d59c2c0f
replace PRIx64 by MP_PRIx64 for c89 mode 2019-10-27 18:36:57 +01:00
Daniel Mendler
17a846f2bc
add "make c99" to convert back 2019-10-27 18:36:56 +01:00
Daniel Mendler
9f01ba14bc
add "testme.sh --c89" and "make c89"
* replace int*_t and bool by custom typedefs
* the result is tested in CI
2019-10-27 18:36:56 +01:00
Daniel Mendler
87b4e51794
move out s_mp_log_pow2, fix limitation of base 2019-10-23 19:18:15 +02:00
czurnieden
9edd185f66 Addition of fast division (recursive divrem only) 2019-10-22 21:02:18 +02:00
Steffen Jaeckel
d06e2986ca v1.2.0
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 Comment: Gnu Privacy Tools
 
 iF4EABEIAAYFAl2uz5oACgkQrwyxdiHtrXLIngD/WoeRRt9sYkjNiSmiKYuBvgAi
 pF0Sdfe7vAAhY3jpRX0A/2rJdJFGiFiuAB72qWiGJZg0Rr+kbOGwKfvYgE6jROw6
 =EL7p
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 Comment: Gnu Privacy Tools
 
 iF4EABEIAAYFAl2u0EEACgkQrwyxdiHtrXIQkQD+I8Z6IYTtVmG0patanpT1EFyA
 SZUKP2z50owej4uF3QAA/32m1dmpG6MSYhfu9zu4435PwaI+RgCaUrZ1YaoWroXJ
 =agqw
 -----END PGP SIGNATURE-----

Merge tag 'v1.2.0' into develop

v1.2.0
2019-10-22 11:47:42 +02:00
Steffen Jaeckel
ddef44e7d3 update changes, bump version, fixup c917f3c
[skip ci]
2019-10-21 10:49:10 +02:00
Steffen Jaeckel
c917f3c391 also remove poster 2019-10-20 18:27:56 +02:00
Steffen Jaeckel
17ca193fa7 remove LTM book
reuse `docs` make-target to build poster and manual

fixes #383
2019-10-20 17:20:30 +02:00
Daniel Mendler
f0c83aea6c split mp_log_u32 for more configurability 2019-10-20 15:48:55 +02:00
Steffen Jaeckel
7a68f12873 Execute move.sh - Rename files from bn_* to match the function names.
* git blame <renamed-file> is not affected
* git log --follow <renamed-file> can be used to show log across renames
2019-10-19 16:24:39 +02:00
Daniel Mendler
b4099e1ed2
remove empty bn_deprecated.c file 2019-10-17 16:56:30 +02:00
Daniel Mendler
45a3bf7694
remove deprecated functions 2019-10-17 16:56:27 +02:00
Steffen Jaeckel
5c799e88ef don't build docs, manual is enough 2019-10-15 21:12:20 +02:00
Steffen Jaeckel
4bbe2cde9c
fix build of demos 2019-10-15 14:47:43 +02:00
Steffen Jaeckel
c9d41fba73
rename mp_ilogb() to mp_log_u32() 2019-10-15 14:47:43 +02:00
czurnieden
b6813a4122
replace mp_export/import by mp_pack/unpack 2019-10-08 22:30:25 +02:00
czurnieden
abdb033402 Refactored functions to read and write binaries and added "maxlen" 2019-10-06 03:38:16 +02:00
Steffen Jaeckel
f8d64c645a create mtest_opponent instead of alt version of test 2019-09-30 23:44:49 +02:00
Steffen Jaeckel
1687b15249 allow the user to override {C,L,LD}FLAGS 2019-09-07 17:28:16 +02:00
Steffen Jaeckel
f38a65e637 simplify some of the build rules 2019-09-07 17:28:16 +02:00
Steffen Jaeckel
f0e6ae59ab add mp_to_radix()
...a 100% copy&paste of `mp_toradix_n()` besides the changed API signature
2019-09-02 18:25:44 +02:00
Daniel Mendler
ca89e9c0ef
rename mp_root/mp_expt to mp_*_u32 2019-07-17 15:45:04 +02:00
Daniel Mendler
71696549a8
deprecate mp_expt_d and mp_n_root in favor of mp_expt and mp_root 2019-07-17 15:45:04 +02:00
nijtmans
0db64fc83c Rename bn_get_magxx -> bn_get_mag_uxx. Documentation updated too 2019-07-03 14:45:14 +02:00
nijtmans
fde8524945 @minad 's suggestions 2019-07-03 12:49:19 +02:00
nijtmans
db4afb3d5e Provide explicit symbols for bn_xxx_l and bn_xxx_ll functions. 2019-07-03 12:49:19 +02:00
Steffen Jaeckel
30e8fbbc8e
Update makefiles etc 2019-06-07 08:28:32 +02:00
Daniel Mendler
f00cc99f8c
replace generate_def.sh with perl function 2019-06-07 08:27:09 +02:00
Daniel Mendler
c7314fa400
deprecate mp_n_root_ex and mp_expt_d_ex
These functions were introduced to give some timing guarantees.
However the guarantees are too weak to be useful.
The functions seem to be unused essentially by downstream users.
2019-05-27 15:59:40 +02:00
Daniel Mendler
712919f337
[WIP] start to make dep.pl part of helper.pl 2019-05-27 15:54:45 +02:00
Daniel Mendler
d45a80ec1c
remove updatemakes script, it is just an indirection calling helper.pl 2019-05-27 15:54:45 +02:00
Daniel Mendler
bcec605af5
deprecate mp_prime_is_divisible and ltm_prime_tab
* it is an implementation detail used for prime testing
* there is upcoming work by @czurnieden regarding a generalised prime sieve
* furthermore remove jacobi test (replaced by kronecker)
2019-05-24 12:30:55 +02:00
Daniel Mendler
3289c9590b
introduce various mp_set_sint/mp_set_uint functions with precise types 2019-05-24 00:15:57 +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
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
2a2e2716c2
move jenkins prng to bn_s_mp_rand_jenkins.c 2019-05-12 23:45:36 +02:00