2019-04-07 13:29:11 +00:00
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
|
|
|
/* SPDX-License-Identifier: Unlicense */
|
2019-04-04 05:55:02 +00:00
|
|
|
|
2004-10-29 22:07:18 +00:00
|
|
|
#if !(defined(LTM1) && defined(LTM2) && defined(LTM3))
|
2019-06-06 10:44:36 +00:00
|
|
|
#define LTM_INSIDE
|
2004-10-29 22:07:18 +00:00
|
|
|
#if defined(LTM2)
|
2017-08-30 03:56:38 +00:00
|
|
|
# define LTM3
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
#if defined(LTM1)
|
2017-08-30 03:56:38 +00:00
|
|
|
# define LTM2
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
#define LTM1
|
|
|
|
#if defined(LTM_ALL)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_2EXPT_C
|
|
|
|
# define MP_ABS_C
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_ADD_D_C
|
|
|
|
# define MP_ADDMOD_C
|
|
|
|
# define MP_AND_C
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_CNT_LSB_C
|
|
|
|
# define MP_COMPLEMENT_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_CUTOFFS_C
|
|
|
|
# define MP_DIV_C
|
|
|
|
# define MP_DIV_2_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_DIV_D_C
|
|
|
|
# define MP_DR_IS_MODULUS_C
|
|
|
|
# define MP_DR_REDUCE_C
|
|
|
|
# define MP_DR_SETUP_C
|
|
|
|
# define MP_ERROR_TO_STRING_C
|
|
|
|
# define MP_EXCH_C
|
2019-11-05 23:13:39 +00:00
|
|
|
# define MP_EXPT_N_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_EXPTMOD_C
|
|
|
|
# define MP_EXTEUCLID_C
|
|
|
|
# define MP_FREAD_C
|
|
|
|
# define MP_FROM_SBIN_C
|
|
|
|
# define MP_FROM_UBIN_C
|
|
|
|
# define MP_FWRITE_C
|
|
|
|
# define MP_GCD_C
|
|
|
|
# define MP_GET_DOUBLE_C
|
|
|
|
# define MP_GET_I32_C
|
|
|
|
# define MP_GET_I64_C
|
|
|
|
# define MP_GET_L_C
|
|
|
|
# define MP_GET_MAG_U32_C
|
|
|
|
# define MP_GET_MAG_U64_C
|
|
|
|
# define MP_GET_MAG_UL_C
|
|
|
|
# define MP_GROW_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_INIT_COPY_C
|
|
|
|
# define MP_INIT_I32_C
|
|
|
|
# define MP_INIT_I64_C
|
|
|
|
# define MP_INIT_L_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_INIT_SET_C
|
|
|
|
# define MP_INIT_SIZE_C
|
|
|
|
# define MP_INIT_U32_C
|
|
|
|
# define MP_INIT_U64_C
|
|
|
|
# define MP_INIT_UL_C
|
|
|
|
# define MP_INVMOD_C
|
|
|
|
# define MP_IS_SQUARE_C
|
|
|
|
# define MP_KRONECKER_C
|
|
|
|
# define MP_LCM_C
|
2019-11-05 23:13:39 +00:00
|
|
|
# define MP_LOG_N_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_LSHD_C
|
|
|
|
# define MP_MOD_C
|
|
|
|
# define MP_MOD_2D_C
|
|
|
|
# define MP_MONTGOMERY_CALC_NORMALIZATION_C
|
|
|
|
# define MP_MONTGOMERY_REDUCE_C
|
|
|
|
# define MP_MONTGOMERY_SETUP_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_MUL_2_C
|
|
|
|
# define MP_MUL_2D_C
|
|
|
|
# define MP_MUL_D_C
|
|
|
|
# define MP_MULMOD_C
|
|
|
|
# define MP_NEG_C
|
|
|
|
# define MP_OR_C
|
|
|
|
# define MP_PACK_C
|
|
|
|
# define MP_PACK_COUNT_C
|
|
|
|
# define MP_PRIME_FERMAT_C
|
|
|
|
# define MP_PRIME_FROBENIUS_UNDERWOOD_C
|
|
|
|
# define MP_PRIME_IS_PRIME_C
|
|
|
|
# define MP_PRIME_MILLER_RABIN_C
|
|
|
|
# define MP_PRIME_NEXT_PRIME_C
|
|
|
|
# define MP_PRIME_RABIN_MILLER_TRIALS_C
|
|
|
|
# define MP_PRIME_RAND_C
|
|
|
|
# define MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
|
|
|
|
# define MP_RADIX_SIZE_C
|
|
|
|
# define MP_RAND_C
|
|
|
|
# define MP_READ_RADIX_C
|
|
|
|
# define MP_REDUCE_C
|
|
|
|
# define MP_REDUCE_2K_C
|
|
|
|
# define MP_REDUCE_2K_L_C
|
|
|
|
# define MP_REDUCE_2K_SETUP_C
|
|
|
|
# define MP_REDUCE_2K_SETUP_L_C
|
|
|
|
# define MP_REDUCE_IS_2K_C
|
|
|
|
# define MP_REDUCE_IS_2K_L_C
|
|
|
|
# define MP_REDUCE_SETUP_C
|
2019-11-05 23:13:39 +00:00
|
|
|
# define MP_ROOT_N_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_RSHD_C
|
|
|
|
# define MP_SBIN_SIZE_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define MP_SET_DOUBLE_C
|
|
|
|
# define MP_SET_I32_C
|
|
|
|
# define MP_SET_I64_C
|
|
|
|
# define MP_SET_L_C
|
|
|
|
# define MP_SET_U32_C
|
|
|
|
# define MP_SET_U64_C
|
|
|
|
# define MP_SET_UL_C
|
|
|
|
# define MP_SHRINK_C
|
|
|
|
# define MP_SIGNED_RSH_C
|
|
|
|
# define MP_SQRMOD_C
|
|
|
|
# define MP_SQRT_C
|
|
|
|
# define MP_SQRTMOD_PRIME_C
|
|
|
|
# define MP_SUB_C
|
|
|
|
# define MP_SUB_D_C
|
|
|
|
# define MP_SUBMOD_C
|
|
|
|
# define MP_TO_RADIX_C
|
|
|
|
# define MP_TO_SBIN_C
|
|
|
|
# define MP_TO_UBIN_C
|
|
|
|
# define MP_UBIN_SIZE_C
|
|
|
|
# define MP_UNPACK_C
|
|
|
|
# define MP_XOR_C
|
|
|
|
# define MP_ZERO_C
|
|
|
|
# define S_MP_ADD_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_COPY_DIGS_C
|
2019-11-06 15:50:31 +00:00
|
|
|
# define S_MP_DIV_3_C
|
2019-10-04 15:41:09 +00:00
|
|
|
# define S_MP_DIV_RECURSIVE_C
|
|
|
|
# define S_MP_DIV_SCHOOL_C
|
|
|
|
# define S_MP_DIV_SMALL_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define S_MP_EXPTMOD_C
|
|
|
|
# define S_MP_EXPTMOD_FAST_C
|
|
|
|
# define S_MP_GET_BIT_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_INVMOD_C
|
|
|
|
# define S_MP_INVMOD_ODD_C
|
2019-10-19 17:25:55 +00:00
|
|
|
# define S_MP_LOG_C
|
2019-11-05 23:13:39 +00:00
|
|
|
# define S_MP_LOG_2EXPT_C
|
2019-10-19 17:25:55 +00:00
|
|
|
# define S_MP_LOG_D_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_MONTGOMERY_REDUCE_COMBA_C
|
|
|
|
# define S_MP_MUL_C
|
|
|
|
# define S_MP_MUL_BALANCE_C
|
|
|
|
# define S_MP_MUL_COMBA_C
|
|
|
|
# define S_MP_MUL_HIGH_C
|
|
|
|
# define S_MP_MUL_HIGH_COMBA_C
|
|
|
|
# define S_MP_MUL_KARATSUBA_C
|
|
|
|
# define S_MP_MUL_TOOM_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define S_MP_PRIME_IS_DIVISIBLE_C
|
2019-11-05 19:35:19 +00:00
|
|
|
# define S_MP_PRIME_TAB_C
|
|
|
|
# define S_MP_RADIX_MAP_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define S_MP_RAND_JENKINS_C
|
|
|
|
# define S_MP_RAND_PLATFORM_C
|
|
|
|
# define S_MP_SQR_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_SQR_COMBA_C
|
|
|
|
# define S_MP_SQR_KARATSUBA_C
|
|
|
|
# define S_MP_SQR_TOOM_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define S_MP_SUB_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_BUF_C
|
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if defined(MP_2EXPT_C)
|
|
|
|
# define MP_GROW_C
|
|
|
|
# define MP_ZERO_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_ABS_C)
|
|
|
|
# define MP_COPY_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_ADD_C)
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define S_MP_ADD_C
|
|
|
|
# define S_MP_SUB_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_ADD_D_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
|
|
|
# define MP_SUB_D_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_ADDMOD_C)
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_MOD_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_AND_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_CLAMP_C)
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_CLEAR_C)
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_CLEAR_MULTI_C)
|
|
|
|
# define MP_CLEAR_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_CMP_C)
|
|
|
|
# define MP_CMP_MAG_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_CMP_D_C)
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_CMP_MAG_C)
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_CNT_LSB_C)
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_COMPLEMENT_C)
|
|
|
|
# define MP_SUB_D_C
|
2018-09-10 16:49:10 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_COPY_C)
|
|
|
|
# define MP_GROW_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_COPY_DIGS_C
|
|
|
|
# define S_MP_ZERO_DIGS_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_COUNT_BITS_C)
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_CUTOFFS_C)
|
2019-04-03 16:59:09 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_DIV_C)
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_ZERO_C
|
2019-10-04 15:41:09 +00:00
|
|
|
# define S_MP_DIV_RECURSIVE_C
|
|
|
|
# define S_MP_DIV_SCHOOL_C
|
|
|
|
# define S_MP_DIV_SMALL_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_DIV_2_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_DIV_2D_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_MOD_2D_C
|
|
|
|
# define MP_RSHD_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_DIV_D_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_DIV_2D_C
|
2019-11-06 15:50:31 +00:00
|
|
|
# define MP_DIV_2_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_SIZE_C
|
2019-11-06 15:50:31 +00:00
|
|
|
# define S_MP_DIV_3_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_DR_IS_MODULUS_C)
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_DR_REDUCE_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_GROW_C
|
|
|
|
# define S_MP_SUB_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_DR_SETUP_C)
|
2019-04-10 13:19:23 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_ERROR_TO_STRING_C)
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_EXCH_C)
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-11-05 23:13:39 +00:00
|
|
|
#if defined(MP_EXPT_N_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_INIT_COPY_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_SET_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_EXPTMOD_C)
|
|
|
|
# define MP_ABS_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_DR_IS_MODULUS_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_INVMOD_C
|
|
|
|
# define MP_REDUCE_IS_2K_C
|
|
|
|
# define MP_REDUCE_IS_2K_L_C
|
|
|
|
# define S_MP_EXPTMOD_C
|
|
|
|
# define S_MP_EXPTMOD_FAST_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_EXTEUCLID_C)
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_DIV_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_NEG_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define MP_SUB_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_FREAD_C)
|
|
|
|
# define MP_ADD_D_C
|
|
|
|
# define MP_MUL_D_C
|
|
|
|
# define MP_ZERO_C
|
2019-09-24 22:29:19 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_FROM_SBIN_C)
|
|
|
|
# define MP_FROM_UBIN_C
|
2019-09-24 22:29:19 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_FROM_UBIN_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
|
|
|
# define MP_MUL_2D_C
|
|
|
|
# define MP_ZERO_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_FWRITE_C)
|
|
|
|
# define MP_RADIX_SIZE_C
|
|
|
|
# define MP_TO_RADIX_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_BUF_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_GCD_C)
|
|
|
|
# define MP_ABS_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_CNT_LSB_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_COPY_C
|
|
|
|
# define MP_MUL_2D_C
|
|
|
|
# define S_MP_SUB_C
|
2018-09-10 16:52:29 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_GET_DOUBLE_C)
|
2019-06-06 10:09:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_GET_I32_C)
|
|
|
|
# define MP_GET_MAG_U32_C
|
2019-06-06 10:09:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_GET_I64_C)
|
|
|
|
# define MP_GET_MAG_U64_C
|
2019-06-12 11:11:58 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_GET_L_C)
|
|
|
|
# define MP_GET_MAG_UL_C
|
2019-06-12 11:11:58 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_GET_MAG_U32_C)
|
2019-06-06 10:09:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_GET_MAG_U64_C)
|
2019-06-12 11:11:58 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_GET_MAG_UL_C)
|
2019-06-12 11:11:58 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_GROW_C)
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-04-03 16:59:09 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INIT_C)
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INIT_COPY_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_INIT_SIZE_C
|
2019-06-06 10:09:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INIT_I32_C)
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_SET_I32_C
|
2019-06-06 10:09:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INIT_I64_C)
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_SET_I64_C
|
2019-06-13 14:58:06 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INIT_L_C)
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_SET_L_C
|
2019-06-13 14:58:06 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INIT_MULTI_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_INIT_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INIT_SET_C)
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_SET_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INIT_SIZE_C)
|
2019-06-06 10:09:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INIT_U32_C)
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_SET_U32_C
|
2019-06-06 10:09:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INIT_U64_C)
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_SET_U64_C
|
2019-06-13 14:58:06 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INIT_UL_C)
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_SET_UL_C
|
2019-06-13 14:58:06 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_INVMOD_C)
|
|
|
|
# define MP_CMP_D_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_INVMOD_C
|
|
|
|
# define S_MP_INVMOD_ODD_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_IS_SQUARE_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_MAG_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define MP_DIV_D_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_GET_I32_C
|
|
|
|
# define MP_INIT_U32_C
|
|
|
|
# define MP_MOD_C
|
2019-11-06 15:50:31 +00:00
|
|
|
# define MP_MUL_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_SQRT_C
|
2018-12-28 08:41:54 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_KRONECKER_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_CNT_LSB_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_INIT_COPY_C
|
|
|
|
# define MP_MOD_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_LCM_C)
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_DIV_C
|
|
|
|
# define MP_GCD_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_MUL_C
|
2019-10-15 08:40:40 +00:00
|
|
|
#endif
|
|
|
|
|
2019-11-05 23:13:39 +00:00
|
|
|
#if defined(MP_LOG_N_C)
|
|
|
|
# define S_MP_LOG_2EXPT_C
|
2019-10-19 17:25:55 +00:00
|
|
|
# define S_MP_LOG_C
|
|
|
|
# define S_MP_LOG_D_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_LSHD_C)
|
|
|
|
# define MP_GROW_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_MOD_C)
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_DIV_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_MOD_2D_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_ZERO_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-06-06 21:01:51 +00:00
|
|
|
#endif
|
2004-10-29 22:07:18 +00:00
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_MONTGOMERY_CALC_NORMALIZATION_C)
|
|
|
|
# define MP_2EXPT_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_MUL_2_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define S_MP_SUB_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_MONTGOMERY_REDUCE_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_GROW_C
|
|
|
|
# define MP_RSHD_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_MONTGOMERY_REDUCE_COMBA_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define S_MP_SUB_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_MONTGOMERY_SETUP_C)
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_MUL_C)
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_MUL_BALANCE_C
|
|
|
|
# define S_MP_MUL_C
|
|
|
|
# define S_MP_MUL_COMBA_C
|
|
|
|
# define S_MP_MUL_KARATSUBA_C
|
|
|
|
# define S_MP_MUL_TOOM_C
|
2019-11-06 15:50:31 +00:00
|
|
|
# define S_MP_SQR_C
|
|
|
|
# define S_MP_SQR_COMBA_C
|
|
|
|
# define S_MP_SQR_KARATSUBA_C
|
|
|
|
# define S_MP_SQR_TOOM_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_MUL_2_C)
|
|
|
|
# define MP_GROW_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_MUL_2D_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_GROW_C
|
|
|
|
# define MP_LSHD_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_MUL_D_C)
|
|
|
|
# define MP_CLAMP_C
|
2019-11-06 15:50:31 +00:00
|
|
|
# define MP_COPY_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_GROW_C
|
2019-11-06 15:50:31 +00:00
|
|
|
# define MP_MUL_2D_C
|
|
|
|
# define MP_MUL_2_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_MULMOD_C)
|
|
|
|
# define MP_MOD_C
|
|
|
|
# define MP_MUL_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_NEG_C)
|
|
|
|
# define MP_COPY_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_OR_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_PACK_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_INIT_COPY_C
|
|
|
|
# define MP_PACK_COUNT_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_PACK_COUNT_C)
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_PRIME_FERMAT_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_EXPTMOD_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_PRIME_FROBENIUS_UNDERWOOD_C)
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_ADD_D_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_GCD_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_KRONECKER_C
|
|
|
|
# define MP_MOD_C
|
|
|
|
# define MP_MUL_2_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_MUL_D_C
|
|
|
|
# define MP_SET_C
|
2019-10-19 17:39:29 +00:00
|
|
|
# define MP_SET_I32_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_SET_U32_C
|
|
|
|
# define MP_SUB_C
|
|
|
|
# define S_MP_GET_BIT_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_PRIME_IS_PRIME_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_INIT_SET_C
|
|
|
|
# define MP_IS_SQUARE_C
|
|
|
|
# define MP_PRIME_MILLER_RABIN_C
|
|
|
|
# define MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
|
|
|
|
# define MP_RAND_C
|
|
|
|
# define MP_READ_RADIX_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define S_MP_PRIME_IS_DIVISIBLE_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_PRIME_MILLER_RABIN_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_CNT_LSB_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_EXPTMOD_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_INIT_COPY_C
|
|
|
|
# define MP_SQRMOD_C
|
|
|
|
# define MP_SUB_D_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_PRIME_NEXT_PRIME_C)
|
|
|
|
# define MP_ADD_D_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_D_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define MP_DIV_D_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_PRIME_IS_PRIME_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define MP_SUB_D_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_PRIME_RABIN_MILLER_TRIALS_C)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_PRIME_RAND_C)
|
|
|
|
# define MP_ADD_D_C
|
|
|
|
# define MP_DIV_2_C
|
|
|
|
# define MP_FROM_UBIN_C
|
|
|
|
# define MP_MUL_2_C
|
|
|
|
# define MP_PRIME_IS_PRIME_C
|
|
|
|
# define MP_SUB_D_C
|
|
|
|
# define S_MP_RAND_SOURCE_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_BUF_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_PRIME_STRONG_LUCAS_SELFRIDGE_C)
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_ADD_D_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_CNT_LSB_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_DIV_2_C
|
|
|
|
# define MP_GCD_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_KRONECKER_C
|
|
|
|
# define MP_MOD_C
|
|
|
|
# define MP_MUL_2_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define MP_SET_I32_C
|
|
|
|
# define MP_SET_U32_C
|
|
|
|
# define MP_SUB_C
|
|
|
|
# define MP_SUB_D_C
|
|
|
|
# define S_MP_GET_BIT_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_RADIX_SIZE_C)
|
2019-11-05 23:13:39 +00:00
|
|
|
# define MP_LOG_N_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_RAND_C)
|
|
|
|
# define MP_GROW_C
|
|
|
|
# define MP_RAND_SOURCE_C
|
|
|
|
# define MP_ZERO_C
|
|
|
|
# define S_MP_RAND_PLATFORM_C
|
|
|
|
# define S_MP_RAND_SOURCE_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_READ_RADIX_C)
|
|
|
|
# define MP_ADD_D_C
|
|
|
|
# define MP_MUL_D_C
|
|
|
|
# define MP_ZERO_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_REDUCE_C)
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_INIT_COPY_C
|
|
|
|
# define MP_LSHD_C
|
|
|
|
# define MP_MOD_2D_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_RSHD_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define MP_SUB_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_MUL_C
|
|
|
|
# define S_MP_MUL_HIGH_C
|
|
|
|
# define S_MP_MUL_HIGH_COMBA_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define S_MP_SUB_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_REDUCE_2K_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_MUL_D_C
|
|
|
|
# define S_MP_ADD_C
|
|
|
|
# define S_MP_SUB_C
|
2005-02-12 08:40:15 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_REDUCE_2K_L_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define S_MP_ADD_C
|
|
|
|
# define S_MP_SUB_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_REDUCE_2K_SETUP_C)
|
|
|
|
# define MP_2EXPT_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define S_MP_SUB_C
|
2005-02-12 08:40:15 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_REDUCE_2K_SETUP_L_C)
|
|
|
|
# define MP_2EXPT_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define S_MP_SUB_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_REDUCE_IS_2K_C)
|
|
|
|
# define MP_COUNT_BITS_C
|
2005-02-12 08:40:15 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_REDUCE_IS_2K_L_C)
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_REDUCE_SETUP_C)
|
|
|
|
# define MP_2EXPT_C
|
|
|
|
# define MP_DIV_C
|
2019-05-29 18:36:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-11-05 23:13:39 +00:00
|
|
|
#if defined(MP_ROOT_N_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_2EXPT_C
|
|
|
|
# define MP_ADD_D_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_DIV_C
|
|
|
|
# define MP_EXCH_C
|
2019-11-05 23:13:39 +00:00
|
|
|
# define MP_EXPT_N_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_MUL_D_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define MP_SUB_C
|
|
|
|
# define MP_SUB_D_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_RSHD_C)
|
|
|
|
# define MP_ZERO_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-09-24 22:29:19 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SBIN_SIZE_C)
|
|
|
|
# define MP_UBIN_SIZE_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SET_C)
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2018-09-10 16:52:29 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SET_DOUBLE_C)
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_MUL_2D_C
|
|
|
|
# define MP_SET_U64_C
|
2019-06-06 10:09:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SET_I32_C)
|
|
|
|
# define MP_SET_U32_C
|
2019-06-06 10:09:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SET_I64_C)
|
|
|
|
# define MP_SET_U64_C
|
2019-06-12 11:11:58 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SET_L_C)
|
|
|
|
# define MP_SET_UL_C
|
2019-06-12 11:11:58 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SET_U32_C)
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-06-06 10:09:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SET_U64_C)
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-06-12 11:11:58 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SET_UL_C)
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-06-12 11:11:58 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SHRINK_C)
|
2019-05-20 17:11:25 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SIGNED_RSH_C)
|
|
|
|
# define MP_ADD_D_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_SUB_D_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SQRMOD_C)
|
|
|
|
# define MP_MOD_C
|
2019-11-06 15:50:31 +00:00
|
|
|
# define MP_MUL_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SQRT_C)
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_DIV_2_C
|
|
|
|
# define MP_DIV_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_INIT_COPY_C
|
|
|
|
# define MP_RSHD_C
|
|
|
|
# define MP_ZERO_C
|
2015-04-18 09:03:22 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SQRTMOD_PRIME_C)
|
|
|
|
# define MP_ADD_D_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_DIV_2_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define MP_DIV_D_C
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_EXPTMOD_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_KRONECKER_C
|
|
|
|
# define MP_MULMOD_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define MP_SQRMOD_C
|
|
|
|
# define MP_SUB_D_C
|
|
|
|
# define MP_ZERO_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SUB_C)
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define S_MP_ADD_C
|
|
|
|
# define S_MP_SUB_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SUB_D_C)
|
|
|
|
# define MP_ADD_D_C
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_SUBMOD_C)
|
|
|
|
# define MP_MOD_C
|
|
|
|
# define MP_SUB_C
|
2019-09-02 12:36:06 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_TO_RADIX_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_DIV_D_C
|
|
|
|
# define MP_INIT_COPY_C
|
2005-02-12 08:40:15 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_TO_SBIN_C)
|
|
|
|
# define MP_TO_UBIN_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_TO_UBIN_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_INIT_COPY_C
|
|
|
|
# define MP_UBIN_SIZE_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(MP_UBIN_SIZE_C)
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_UNPACK_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_MUL_2D_C
|
|
|
|
# define MP_ZERO_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_XOR_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(MP_ZERO_C)
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_ADD_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
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-10-29 19:26:50 +00:00
|
|
|
#if defined(S_MP_COPY_DIGS_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-11-06 15:50:31 +00:00
|
|
|
#if defined(S_MP_DIV_3_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_SIZE_C
|
|
|
|
#endif
|
|
|
|
|
2019-10-04 15:41:09 +00:00
|
|
|
#if defined(S_MP_DIV_RECURSIVE_C)
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_LSHD_C
|
|
|
|
# define MP_MUL_2D_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_SUB_C
|
2019-10-24 15:33:38 +00:00
|
|
|
# define MP_SUB_D_C
|
2019-10-04 15:41:09 +00:00
|
|
|
# define MP_ZERO_C
|
|
|
|
# define S_MP_DIV_SCHOOL_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_DIV_SCHOOL_C)
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_INIT_COPY_C
|
|
|
|
# define MP_INIT_SIZE_C
|
|
|
|
# define MP_LSHD_C
|
|
|
|
# define MP_MUL_2D_C
|
|
|
|
# define MP_MUL_D_C
|
|
|
|
# define MP_RSHD_C
|
|
|
|
# define MP_SUB_C
|
|
|
|
# define MP_ZERO_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_DIV_SMALL_C)
|
|
|
|
# define MP_ABS_C
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_DIV_2D_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_MUL_2D_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define MP_SUB_C
|
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(S_MP_EXPTMOD_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_MOD_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_REDUCE_2K_L_C
|
|
|
|
# define MP_REDUCE_2K_SETUP_L_C
|
|
|
|
# define MP_REDUCE_C
|
|
|
|
# define MP_REDUCE_SETUP_C
|
|
|
|
# define MP_SET_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_EXPTMOD_FAST_C)
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_COUNT_BITS_C
|
|
|
|
# define MP_DR_REDUCE_C
|
|
|
|
# define MP_DR_SETUP_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_SIZE_C
|
|
|
|
# define MP_MOD_C
|
|
|
|
# define MP_MONTGOMERY_CALC_NORMALIZATION_C
|
|
|
|
# define MP_MONTGOMERY_REDUCE_C
|
|
|
|
# define MP_MONTGOMERY_SETUP_C
|
|
|
|
# define MP_MULMOD_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_REDUCE_2K_C
|
|
|
|
# define MP_REDUCE_2K_SETUP_C
|
|
|
|
# define MP_SET_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_MONTGOMERY_REDUCE_COMBA_C
|
2019-04-12 12:56:29 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(S_MP_GET_BIT_C)
|
2019-05-13 09:32:42 +00:00
|
|
|
#endif
|
|
|
|
|
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-10-29 19:26:50 +00:00
|
|
|
#if defined(S_MP_INVMOD_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_DIV_2_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_MOD_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define MP_SUB_C
|
2019-06-06 21:01:51 +00:00
|
|
|
#endif
|
|
|
|
|
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-10-29 19:26:50 +00:00
|
|
|
#if defined(S_MP_INVMOD_ODD_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_DIV_2_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_MOD_C
|
|
|
|
# define MP_SET_C
|
|
|
|
# define MP_SUB_C
|
|
|
|
#endif
|
|
|
|
|
2019-10-19 17:25:55 +00:00
|
|
|
#if defined(S_MP_LOG_C)
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_CMP_C
|
|
|
|
# define MP_CMP_D_C
|
|
|
|
# define MP_COPY_C
|
|
|
|
# define MP_EXCH_C
|
2019-11-05 23:13:39 +00:00
|
|
|
# define MP_EXPT_N_C
|
2019-10-19 17:25:55 +00:00
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_SET_C
|
|
|
|
#endif
|
|
|
|
|
2019-11-05 23:13:39 +00:00
|
|
|
#if defined(S_MP_LOG_2EXPT_C)
|
|
|
|
# define MP_COUNT_BITS_C
|
2019-10-19 17:25:55 +00:00
|
|
|
#endif
|
|
|
|
|
2019-11-05 23:13:39 +00:00
|
|
|
#if defined(S_MP_LOG_D_C)
|
2019-10-23 07:06:04 +00:00
|
|
|
#endif
|
|
|
|
|
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-10-29 19:26:50 +00:00
|
|
|
#if defined(S_MP_MONTGOMERY_REDUCE_COMBA_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CMP_MAG_C
|
|
|
|
# define MP_GROW_C
|
|
|
|
# define S_MP_SUB_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_BUF_C
|
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
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-10-29 19:26:50 +00:00
|
|
|
#if defined(S_MP_MUL_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_SIZE_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_MUL_COMBA_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
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-10-29 19:26:50 +00:00
|
|
|
#if defined(S_MP_MUL_BALANCE_C)
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_INIT_SIZE_C
|
|
|
|
# define MP_LSHD_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define S_MP_COPY_DIGS_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_MUL_COMBA_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
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-10-29 19:26:50 +00:00
|
|
|
#if defined(S_MP_MUL_HIGH_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_SIZE_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_MUL_HIGH_COMBA_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
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-10-29 19:26:50 +00:00
|
|
|
#if defined(S_MP_MUL_HIGH_COMBA_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_MUL_KARATSUBA_C)
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_INIT_SIZE_C
|
|
|
|
# define MP_LSHD_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define S_MP_ADD_C
|
|
|
|
# define S_MP_COPY_DIGS_C
|
|
|
|
# define S_MP_SUB_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_MUL_TOOM_C)
|
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_CLEAR_MULTI_C
|
|
|
|
# define MP_DIV_2_C
|
|
|
|
# define MP_INIT_MULTI_C
|
|
|
|
# define MP_INIT_SIZE_C
|
|
|
|
# define MP_LSHD_C
|
|
|
|
# define MP_MUL_2_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_SUB_C
|
|
|
|
# define S_MP_COPY_DIGS_C
|
2019-11-06 15:50:31 +00:00
|
|
|
# define S_MP_DIV_3_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_PRIME_IS_DIVISIBLE_C)
|
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-10-29 19:26:50 +00:00
|
|
|
# define MP_DIV_D_C
|
2019-10-19 14:24:39 +00:00
|
|
|
#endif
|
2019-05-22 13:34:49 +00:00
|
|
|
|
2019-11-05 19:35:19 +00:00
|
|
|
#if defined(S_MP_PRIME_TAB_C)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_RADIX_MAP_C)
|
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(S_MP_RAND_JENKINS_C)
|
|
|
|
# define S_MP_RAND_JENKINS_INIT_C
|
2019-05-12 09:33:17 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(S_MP_RAND_PLATFORM_C)
|
2019-05-11 07:09:12 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:24:39 +00:00
|
|
|
#if defined(S_MP_SQR_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_EXCH_C
|
|
|
|
# define MP_INIT_SIZE_C
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
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-10-29 19:26:50 +00:00
|
|
|
#if defined(S_MP_SQR_COMBA_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ZERO_DIGS_C
|
2019-04-12 12:56:29 +00:00
|
|
|
#endif
|
|
|
|
|
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-10-29 19:26:50 +00:00
|
|
|
#if defined(S_MP_SQR_KARATSUBA_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_INIT_SIZE_C
|
|
|
|
# define MP_LSHD_C
|
2019-11-06 15:50:31 +00:00
|
|
|
# define MP_MUL_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_ADD_C
|
|
|
|
# define S_MP_COPY_DIGS_C
|
|
|
|
# define S_MP_SUB_C
|
2019-04-12 12:56:29 +00:00
|
|
|
#endif
|
|
|
|
|
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-10-29 19:26:50 +00:00
|
|
|
#if defined(S_MP_SQR_TOOM_C)
|
2019-10-19 14:24:39 +00:00
|
|
|
# define MP_ADD_C
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_CLEAR_C
|
|
|
|
# define MP_DIV_2_C
|
|
|
|
# define MP_INIT_C
|
|
|
|
# define MP_INIT_SIZE_C
|
|
|
|
# define MP_LSHD_C
|
|
|
|
# define MP_MUL_2_C
|
|
|
|
# define MP_MUL_C
|
|
|
|
# define MP_SUB_C
|
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-10-29 19:26:50 +00:00
|
|
|
# define S_MP_COPY_DIGS_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_SUB_C)
|
|
|
|
# define MP_CLAMP_C
|
|
|
|
# define MP_GROW_C
|
|
|
|
# define S_MP_ZERO_DIGS_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_ZERO_BUF_C)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(S_MP_ZERO_DIGS_C)
|
2019-04-12 12:56:29 +00:00
|
|
|
#endif
|
|
|
|
|
2019-06-06 10:44:36 +00:00
|
|
|
#ifdef LTM_INSIDE
|
|
|
|
#undef LTM_INSIDE
|
2004-10-29 22:07:18 +00:00
|
|
|
#ifdef LTM3
|
2017-08-30 03:56:38 +00:00
|
|
|
# define LTM_LAST
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|
2017-08-30 03:56:38 +00:00
|
|
|
|
2019-04-12 17:07:08 +00:00
|
|
|
#include "tommath_superclass.h"
|
|
|
|
#include "tommath_class.h"
|
2004-10-29 22:07:18 +00:00
|
|
|
#else
|
2017-08-30 03:56:38 +00:00
|
|
|
# define LTM_LAST
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|