Daniel Mendler
b4f7d8d4c8
test: use malloc/free
...
tests are library consumers, MP_MALLOC is an internal macro
2019-10-09 20:46:44 +02:00
Daniel Mendler
6e3dae5625
add MP_BUF error
2019-10-08 22:30:29 +02:00
czurnieden
b6813a4122
replace mp_export/import by mp_pack/unpack
2019-10-08 22:30:25 +02:00
czurnieden
71d1b7b9d8
make mp_to_radix return the count of characters of the converted number
2019-10-06 21:26:49 +02:00
czurnieden
d68e28771d
bugfix for an edgecase
2019-10-06 21:12:04 +02:00
czurnieden
abdb033402
Refactored functions to read and write binaries and added "maxlen"
2019-10-06 03:38:16 +02:00
Steffen Jaeckel
4ebdaca223
"fix" warnings
2019-10-05 19:47:24 +02:00
Steffen Jaeckel
baff51e9f2
allow to run specific timing tests
2019-10-05 19:47:24 +02:00
Steffen Jaeckel
47ab9c60d8
fix printf
2019-10-05 19:47:24 +02:00
Steffen Jaeckel
f8d64c645a
create mtest_opponent
instead of alt version of test
2019-09-30 23:44:49 +02:00
Steffen Jaeckel
234d474fe6
only run tests if the module is available
2019-09-07 17:28:16 +02:00
Steffen Jaeckel
75c52a893b
be nice and tell when it's hex output
...
did you know that 0x35 is equal to 53? ... ;-)
2019-09-07 17:28:16 +02:00
Steffen Jaeckel
54661db6a4
allow RSA superclass to be built with tests
2019-09-07 17:28:16 +02:00
Steffen Jaeckel
9eecab7b49
print jenkins seed on startup
...
I just had a case around where the `mp_prime_rand()` testcase failed
but I couldn't reproduce.
I'm pretty sure that was caused by all my changes and partial rebuilds
but anyways it'll give us in the future the possibility to debug such
a case.
2019-09-07 17:28:16 +02:00
Steffen Jaeckel
72f9251939
fix last occurrences of mp_toradix()
2019-09-03 11:08:56 +02:00
czurnieden
8bb11ded99
included tests for mp_prime_next_prime
2019-09-02 21:25:22 +02:00
Steffen Jaeckel
6cd570d08b
use mp_to_radix
etc.
2019-09-02 18:25:44 +02:00
Daniel Mendler
8c1b296e86
add feature detection macro MP_HAS
2019-07-24 11:09:42 +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
ea3353b673
Simplify test-cases, by using mp_set_l. Also fix use of types in 2 other files
2019-06-13 15:44:00 +02:00
Daniel Mendler
5302b907ff
use MP_SIZEOF_BITS
2019-06-07 08:28:32 +02:00
nijtmans
dfbb5ecd56
MSVC compile: higher warning-level -Wall, but warning-free
2019-06-06 16:22:54 +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
Steffen Jaeckel
0e1a0e6529
also test mp_shrink()
2019-05-27 15:34:53 +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
0a9f5e9bc1
use u32 i64 suffix
2019-05-24 10:21:54 +02:00
Daniel Mendler
d7e1cb4a09
another proposal: use _ul and _l for the long macros
2019-05-24 00:15:57 +02:00
Daniel Mendler
b58c996686
use int32 and uint32 instead of sint and uint
2019-05-24 00:15:57 +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
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
czurnieden
03ca7bcdae
added tests for Karatsuba and Toom-Cook 3-way
2019-05-21 15:21:39 +02:00
Steffen Jaeckel
51cda5b82b
use correct amount of MR trials in tests
2019-05-21 09:48:48 +02:00
Steffen Jaeckel
cb3ff8c28d
improve coverage
2019-05-21 09:45:22 +02:00
Francois Perrad
150c47cce2
refactor literal suffix with u lowercase
2019-05-20 05:36:24 +02:00
Daniel Mendler
f55f0a9ef5
fix some usages of enum types
2019-05-18 10:03:47 +02:00
Daniel Mendler
56e7a40123
deprecate mp_jacobi
2019-05-18 10:03:46 +02:00
Daniel Mendler
198418ba5e
bugfix: don't revert to platform rand source, but to jenkins source!
2019-05-18 10:00:07 +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
Daniel Mendler
f85bd31e4e
fix undefined behavior in labs
2019-05-12 23:45:36 +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
8d71a9e33b
travis: add -fsanitize=undefined
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
adf9605d6c
add warn_unused_result, found one missing check!
2019-05-11 19:26:58 +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
Steffen Jaeckel
1a12486d4b
add mp_rand test
2019-05-09 10:47:35 +02:00
Steffen Jaeckel
eedf1624f0
allow filtering of tests executed
2019-05-09 10:47:35 +02:00
Daniel Mendler
44d03a6f8b
deprecate LTM_PRIME_* macros in favor of MP_PRIME_*
2019-05-07 09:45:38 +02:00