diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-05-10 07:46:32 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-05-10 07:46:32 (GMT) |
| commit | 7b90ffbb489e5b0b09f23a6296f69f070127fd57 (patch) | |
| tree | b4b8b874d4101f811de99438daa6d037daa506f1 /generic/tclTomMath.h | |
| parent | f9eb1833d2785265d8dc52992750ef10d9cc1c19 (diff) | |
| parent | b1139d3d2099aad8ad1981deaa0f689e1b4c322a (diff) | |
| download | tcl-7b90ffbb489e5b0b09f23a6296f69f070127fd57.zip tcl-7b90ffbb489e5b0b09f23a6296f69f070127fd57.tar.gz tcl-7b90ffbb489e5b0b09f23a6296f69f070127fd57.tar.bz2 | |
merge 8.7
Diffstat (limited to 'generic/tclTomMath.h')
| -rw-r--r-- | generic/tclTomMath.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 3f23fd6..26eef26 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -7,8 +7,7 @@ * Michael Fromberger but has been written from scratch with * additional optimizations in place. * - * The library is free for all purposes without any express - * guarantee it works. + * SPDX-License-Identifier: Unlicense */ #ifndef BN_H_ #define BN_H_ @@ -128,6 +127,7 @@ typedef unsigned long long mp_word; #define MP_MEM -2 /* out of mem */ #define MP_VAL -3 /* invalid input */ #define MP_RANGE MP_VAL +#define MP_ITER -4 /* Max. iterations reached */ #define MP_YES 1 /* yes response */ #define MP_NO 0 /* no response */ @@ -346,15 +346,20 @@ int mp_cnt_lsb(const mp_int *a); /* I Love Earth! */ -/* makes a pseudo-random int of a given size */ +/* makes a pseudo-random mp_int of a given size */ /* int mp_rand(mp_int *a, int digits); */ +/* makes a pseudo-random small int of a given size */ +/* +int mp_rand_digit(mp_digit *r); +*/ #ifdef MP_PRNG_ENABLE_LTM_RNG -/* as last resort we will fall back to libtomcrypt's rng_get_bytes() - * in case you don't use libtomcrypt or use it w/o rng_get_bytes() - * you have to implement it somewhere else, as it's required */ +/* A last resort to provide random data on systems without any of the other + * implemented ways to gather entropy. + * It is compatible with `rng_get_bytes()` from libtomcrypt so you could + * provide that one and then set `ltm_rng = rng_get_bytes;` */ extern unsigned long (*ltm_rng)(unsigned char *out, unsigned long outlen, void (*callback)(void)); extern void (*ltm_rng_callback)(void); #endif @@ -691,10 +696,17 @@ int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result); int mp_prime_rabin_miller_trials(int size); */ -/* performs t rounds of Miller-Rabin on "a" using the first - * t prime bases. Also performs an initial sieve of trial +/* performs t random rounds of Miller-Rabin on "a" additional to + * bases 2 and 3. Also performs an initial sieve of trial * division. Determines if "a" is prime with probability * of error no more than (1/4)**t. + * Both a strong Lucas-Selfridge to complete the BPSW test + * and a separate Frobenius test are available at compile time. + * With t<0 a deterministic test is run for primes up to + * 318665857834031151167461. With t<13 (abs(t)-13) additional + * tests with sequential small primes are run starting at 43. + * Is Fips 186.4 compliant if called with t as computed by + * mp_prime_rabin_miller_trials(); * * Sets result to 1 if probably prime, 0 otherwise */ |
