Commit Graph

77 Commits

Author SHA1 Message Date
Daniel Mendler
4b475aca03
fixes for msvc 2019-05-26 11:47:26 +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
c7a7bd47af
MP_PREC is an internal macro, it should be defined in tommath_private.h 2019-05-24 12:26:50 +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
18f6e4648b
add MP_STATIC_ASSERT 2019-05-23 16:00:31 +02:00
Francois Perrad
330b980d49 literal char 2019-05-21 20:23:16 +02:00
Francois Perrad
8d73e158df literal suffix 2019-05-21 20:23:16 +02:00
Francois Perrad
a4f9818b71 more cast 2019-05-21 20:23:16 +02:00
Daniel Mendler
bd8f7e55e6
introduce MP_PRIVATE to hide symbols (opt-in for now) 2019-05-21 18:08:02 +02:00
Daniel Mendler
0dfa9da5a6
make tommath_class.h and tommath_superclass.h private
These headers are used for configuration during build time.
Therefore they shouldn't be exposed as part of the public API.
2019-05-21 18:01:17 +02:00
Daniel Mendler
6631d42664
remove __cplusplus stuff from tommath_private.h
tommath_private.h is an internal header which won't be included
by a C++ source file.
2019-05-21 15:58:06 +02:00
Daniel Mendler
0b840b78a3
make mp_word private
mp_word is an internal type and it is problematic if it is exposed
in the public api. See for example #216 - MSVC does not support 128 bit
mp_words. But it is perfectly ok to use those internally in the library,
as long as the library is compiled with GCC.
2019-05-21 15:34:04 +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
668cda01e8
remove unnecessary duplication of multiplication 2019-05-13 19:18:09 +02:00
Daniel Mendler
334c32e034
fix signature 2019-05-13 19:15:59 +02:00
Daniel Mendler
0b73dab69f
MP_FREE_DIGITS: add missing cast 2019-05-13 19:15:14 +02:00
Daniel Mendler
4534056c28
use enums mp_err, mp_ord, mp_bool, mp_sign
* MP_USE_ENUMS enables enums
* Wc++-compat catches some implicit conversions if MP_USE_ENUMS is defined
* 100% backwards compatible API/ABI if MP_USE_ENUMS is not defined
2019-05-13 19:15:14 +02:00
Francois Perrad
38116079e4 literal suffix 2019-05-13 17:53:10 +02:00
Francois Perrad
3c5afa9115 add missing parameter name in prototype 2019-05-13 17:52:56 +02:00
Francois Perrad
fa2d86af95 explicit operator precedence 2019-05-13 17:52:34 +02:00
Francois Perrad
07aaa4c381 explicit condition 2019-05-13 17:52:34 +02:00
Francois Perrad
783e3cdf82 format block macros 2019-05-13 17:52:34 +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
7365442ace
No grow necessary in mp_set_int* functions
* mp_set_int* always return MP_OKAY
* remove return checks for mp_set_int*
* introduce MP_MIN_PREC
2019-05-12 13:04:45 +02:00
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
Daniel Mendler
adf9605d6c
add warn_unused_result, found one missing check! 2019-05-11 19:26:58 +02:00
Francois Perrad
cc703a849b add missing parameter name in prototype 2019-05-11 16:57:04 +02:00
Francois Perrad
7d4e8363e0 refactor with new private macro MP_MAXFAST 2019-05-11 12:05:38 +02:00
Francois Perrad
556219aa5b refactor with new private macro MP_SIZEOF_BITS
CHAR_BIT is no longer directly used
2019-05-11 12:05:38 +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
250751be46
tommath.h: do not expose stdlib.h 2019-05-07 09:32:59 +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
Daniel Mendler
90eccd5768
prefix private macros by PRIVATE_ 2019-04-25 15:36:35 +02:00
Daniel Mendler
632601f405
MP_WARRAY is an internal macro 2019-04-25 13:39:50 +02:00
Daniel Mendler
e45f75fddb
deprecate DIGIT_BIT, use MP_DIGIT_BIT 2019-04-25 13:39:50 +02:00
Daniel Mendler
a8c76138f9
deprecate macros in tommath.h
* move MP_DEPRECATED to tommath.h since we need it later
* add MP_DEPRECATED_PRAGMA
2019-04-25 13:39:50 +02:00
Daniel Mendler
fbfcb66184
apply rename 2019-04-12 14:56:29 +02:00
Daniel Mendler
7469e852f1
add rename script 2019-04-12 14:55:09 +02:00
Daniel Mendler
87292ed10a
move mp_balance_mul to tommath_private.h 2019-04-12 14:55:09 +02:00
Daniel Mendler
df8fcb0e4b
add MP_DEPRECATED macro 2019-04-12 14:55:09 +02:00
Daniel Mendler
e09a5c99bc
remove s_mp_mul which is only used once 2019-04-12 14:55:09 +02:00
Daniel Mendler
c4fb2241dc
rename macros in tommath_private to use MP_* prefix 2019-04-12 14:55:08 +02:00
Francois Perrad
42193f8914 explicit operator precedence 2019-04-09 20:26:08 +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
Steffen Jaeckel
a3651cbd79 apply modifications to XCALLOC according to #192 2019-04-06 23:41:24 +02:00
Steffen Jaeckel
d01b531897 Revert "Merge pull request #188 from libtom/unused_xcalloc"
This reverts commit 27417b85c7, reversing
changes made to d449bd44c0.
2019-04-06 23:41:24 +02:00