Initial commit

This commit is contained in:
WolverinDEV 2018-02-28 15:40:21 +01:00
parent fd81ac754a
commit fe6cc64884
194 changed files with 27152 additions and 135 deletions

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="EndlessLoop" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>

2
.idea/libtommath.iml Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

27
.idea/misc.xml Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
<State>
<id>CSS</id>
</State>
<State>
<id>General</id>
</State>
<State>
<id>Invalid elementsCSS</id>
</State>
<State>
<id>XPath</id>
</State>
</expanded-state>
</profile-state>
</entry>
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/libtommath.iml" filepath="$PROJECT_DIR$/.idea/libtommath.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

1061
.idea/workspace.xml Normal file

File diff suppressed because it is too large Load Diff

167
CMakeLists.txt Normal file
View File

@ -0,0 +1,167 @@
cmake_minimum_required(VERSION 3.6)
project(libtommath)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -shared")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(SOURCE_FILES
# demo/demo.c
# demo/timing.c
# etc/2kprime.c
# etc/drprime.c
# etc/makefile.icc
# etc/mersenne.c
# etc/mont.c
# etc/pprime.c
# etc/tune.c
# mtest/logtab.h
# mtest/mpi-config.h
# mtest/mpi-types.h
# mtest/mpi.c
# mtest/mpi.h
# mtest/mtest.c
# pre_gen/mpi.c
bn_error.c
bn_fast_mp_invmod.c
bn_fast_mp_montgomery_reduce.c
bn_fast_s_mp_mul_digs.c
bn_fast_s_mp_mul_high_digs.c
bn_fast_s_mp_sqr.c
bn_mp_2expt.c
bn_mp_abs.c
bn_mp_add.c
bn_mp_add_d.c
bn_mp_addmod.c
bn_mp_and.c
bn_mp_clamp.c
bn_mp_clear.c
bn_mp_clear_multi.c
bn_mp_cmp.c
bn_mp_cmp_d.c
bn_mp_cmp_mag.c
bn_mp_cnt_lsb.c
bn_mp_copy.c
bn_mp_count_bits.c
bn_mp_div.c
bn_mp_div_2.c
bn_mp_div_2d.c
bn_mp_div_3.c
bn_mp_div_d.c
bn_mp_dr_is_modulus.c
bn_mp_dr_reduce.c
bn_mp_dr_setup.c
bn_mp_exch.c
bn_mp_export.c
bn_mp_expt_d.c
bn_mp_expt_d_ex.c
bn_mp_exptmod.c
bn_mp_exptmod_fast.c
bn_mp_exteuclid.c
bn_mp_fread.c
bn_mp_fwrite.c
bn_mp_gcd.c
bn_mp_get_int.c
bn_mp_get_long.c
bn_mp_get_long_long.c
bn_mp_grow.c
bn_mp_import.c
bn_mp_init.c
bn_mp_init_copy.c
bn_mp_init_multi.c
bn_mp_init_set.c
bn_mp_init_set_int.c
bn_mp_init_size.c
bn_mp_invmod.c
bn_mp_invmod_slow.c
bn_mp_is_square.c
bn_mp_jacobi.c
bn_mp_karatsuba_mul.c
bn_mp_karatsuba_sqr.c
bn_mp_lcm.c
bn_mp_lshd.c
bn_mp_mod.c
bn_mp_mod_2d.c
bn_mp_mod_d.c
bn_mp_montgomery_calc_normalization.c
bn_mp_montgomery_reduce.c
bn_mp_montgomery_setup.c
bn_mp_mul.c
bn_mp_mul_2.c
bn_mp_mul_2d.c
bn_mp_mul_d.c
bn_mp_mulmod.c
bn_mp_n_root.c
bn_mp_n_root_ex.c
bn_mp_neg.c
bn_mp_or.c
bn_mp_prime_fermat.c
bn_mp_prime_is_divisible.c
bn_mp_prime_is_prime.c
bn_mp_prime_miller_rabin.c
bn_mp_prime_next_prime.c
bn_mp_prime_rabin_miller_trials.c
bn_mp_prime_random_ex.c
bn_mp_radix_size.c
bn_mp_radix_smap.c
bn_mp_rand.c
bn_mp_read_radix.c
bn_mp_read_signed_bin.c
bn_mp_read_unsigned_bin.c
bn_mp_reduce.c
bn_mp_reduce_2k.c
bn_mp_reduce_2k_l.c
bn_mp_reduce_2k_setup.c
bn_mp_reduce_2k_setup_l.c
bn_mp_reduce_is_2k.c
bn_mp_reduce_is_2k_l.c
bn_mp_reduce_setup.c
bn_mp_rshd.c
bn_mp_set.c
bn_mp_set_int.c
bn_mp_set_long.c
bn_mp_set_long_long.c
bn_mp_shrink.c
bn_mp_signed_bin_size.c
bn_mp_sqr.c
bn_mp_sqrmod.c
bn_mp_sqrt.c
bn_mp_sqrtmod_prime.c
bn_mp_sub.c
bn_mp_sub_d.c
bn_mp_submod.c
bn_mp_to_signed_bin.c
bn_mp_to_signed_bin_n.c
bn_mp_to_unsigned_bin.c
bn_mp_to_unsigned_bin_n.c
bn_mp_toom_mul.c
bn_mp_toom_sqr.c
bn_mp_toradix.c
bn_mp_toradix_n.c
bn_mp_unsigned_bin_size.c
bn_mp_xor.c
bn_mp_zero.c
bn_prime_tab.c
bn_reverse.c
bn_s_mp_add.c
bn_s_mp_exptmod.c
bn_s_mp_mul_digs.c
bn_s_mp_mul_high_digs.c
bn_s_mp_sqr.c
bn_s_mp_sub.c
bncore.c
makefile.icc
tommath.h
tommath_class.h
tommath_private.h
tommath_superclass.h)
add_definitions(-DALL_FUNCTIONS)
add_library(tommathShared SHARED ${SOURCE_FILES})
add_library(tommathStatic STATIC ${SOURCE_FILES})
# Install library
install(TARGETS tommathShared DESTINATION lib/)
# Install library headers
file(GLOB HEADERS *.h)
install(FILES ${HEADERS} DESTINATION include/)

View File

@ -1,5 +1,6 @@
#include <tommath_private.h>
#ifdef BN_ERROR_C
#if defined(ALL_FUNCTIONS) || defined(BN_ERROR_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,6 @@
#include <tommath_private.h>
#ifdef BN_FAST_MP_INVMOD_C
#if defined(ALL_FUNCTIONS) || defined(BN_FAST_MP_INVMOD_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C
#if defined(ALL_FUNCTIONS) || defined(BN_FAST_MP_MONTGOMERY_REDUCE_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,6 @@
#include <tommath_private.h>
#ifdef BN_FAST_S_MP_MUL_DIGS_C
#if defined(ALL_FUNCTIONS) || defined(BN_FAST_S_MP_MUL_DIGS_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,6 @@
#include <tommath_private.h>
#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C
#if defined(ALL_FUNCTIONS) || defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,6 @@
#include <tommath_private.h>
#ifdef BN_FAST_S_MP_SQR_C
#if defined(ALL_FUNCTIONS) || defined(BN_FAST_S_MP_SQR_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,6 @@
#include <tommath_private.h>
#ifdef BN_MP_2EXPT_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_2EXPT_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_ABS_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_ABS_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,6 @@
#include <tommath_private.h>
#ifdef BN_MP_ADD_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_ADD_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_ADD_D_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_ADD_D_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_ADDMOD_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_ADDMOD_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_AND_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_AND_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_CLAMP_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_CLAMP_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_CLEAR_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_CLEAR_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_CLEAR_MULTI_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_CLEAR_MULTI_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_CMP_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_CMP_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_CMP_D_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_CMP_D_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_CMP_MAG_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_CMP_MAG_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_CNT_LSB_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_CNT_LSB_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_COPY_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_COPY_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_COUNT_BITS_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_COUNT_BITS_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_DIV_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_DIV_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_DIV_2_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_DIV_2_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_DIV_2D_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_DIV_2D_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_DIV_3_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_DIV_3_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_DIV_D_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_DIV_D_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_DR_IS_MODULUS_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_DR_IS_MODULUS_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_DR_REDUCE_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_DR_REDUCE_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_DR_SETUP_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_DR_SETUP_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_EXCH_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_EXCH_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_EXPORT_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_EXPORT_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_EXPT_D_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_EXPT_D_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_EXPT_D_EX_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_EXPT_D_EX_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_EXPTMOD_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_EXPTMOD_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
@ -21,6 +21,15 @@
* embedded in the normal function but that wasted alot of stack space
* for nothing (since 99% of the time the Montgomery code would be called)
*/
#define BN_MP_REDUCE_IS_2K_L_C
#define BN_MP_REDUCE_2K_L_C
#define BN_S_MP_EXPTMOD_C
#define BN_MP_DR_IS_MODULUS_C
#define BN_MP_REDUCE_IS_2K_C
#define BN_MP_EXPTMOD_FAST_C
#define BN_MP_INVMOD_C
int mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y)
{
int dr;

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_EXPTMOD_FAST_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_EXPTMOD_FAST_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
@ -29,6 +29,14 @@
# define TAB_SIZE 256
#endif
#define BN_MP_MONTGOMERY_SETUP_C
#define BN_FAST_MP_MONTGOMERY_REDUCE_C
#define BN_MP_MONTGOMERY_REDUCE_C
#define BN_MP_DR_SETUP_C
#define BN_MP_DR_REDUCE_C
#define BN_MP_REDUCE_2K_SETUP_C
#define BN_MP_REDUCE_2K_C
#define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C
int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode)
{
mp_int M[TAB_SIZE], res;

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_EXTEUCLID_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_EXTEUCLID_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_FREAD_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_FREAD_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_FWRITE_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_FWRITE_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_GCD_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_GCD_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_GET_INT_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_GET_INT_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_GET_LONG_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_GET_LONG_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_GET_LONG_LONG_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_GET_LONG_LONG_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_GROW_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_GROW_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_IMPORT_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_IMPORT_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,6 @@
#include <tommath_private.h>
#ifdef BN_MP_INIT_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_INIT_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,6 @@
#include <tommath_private.h>
#ifdef BN_MP_INIT_COPY_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_INIT_COPY_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_INIT_MULTI_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_INIT_MULTI_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_INIT_SET_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_INIT_SET_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_INIT_SET_INT_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_INIT_SET_INT_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_INIT_SIZE_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_INIT_SIZE_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_INVMOD_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_INVMOD_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
@ -16,6 +16,9 @@
*/
/* hac 14.61, pp608 */
#define BN_FAST_MP_INVMOD_C
#define BN_MP_INVMOD_SLOW_C
int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c)
{
/* b cannot be negative */

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_INVMOD_SLOW_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_INVMOD_SLOW_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_IS_SQUARE_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_IS_SQUARE_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_JACOBI_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_JACOBI_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_KARATSUBA_MUL_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_KARATSUBA_MUL_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_KARATSUBA_SQR_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_KARATSUBA_SQR_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_LCM_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_LCM_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_LSHD_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_LSHD_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_MOD_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_MOD_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_MOD_2D_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_MOD_2D_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_MOD_D_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_MOD_D_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_MONTGOMERY_CALC_NORMALIZATION_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_MONTGOMERY_REDUCE_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_MONTGOMERY_REDUCE_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_MONTGOMERY_SETUP_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_MONTGOMERY_SETUP_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_MUL_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_MUL_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
@ -16,6 +16,11 @@
*/
/* high level multiplication (handles sign) */
#define BN_MP_TOOM_MUL_C
#define BN_MP_KARATSUBA_MUL_C
#define BN_FAST_S_MP_MUL_DIGS_C
#define BN_S_MP_MUL_DIGS_C
int mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
{
int res, neg;

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_MUL_2_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_MUL_2_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_MUL_2D_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_MUL_2D_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_MUL_D_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_MUL_D_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_MULMOD_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_MULMOD_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_N_ROOT_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_N_ROOT_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_N_ROOT_EX_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_N_ROOT_EX_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_NEG_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_NEG_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_OR_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_OR_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_PRIME_FERMAT_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_PRIME_FERMAT_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_PRIME_IS_DIVISIBLE_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_PRIME_IS_DIVISIBLE_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_PRIME_IS_PRIME_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_PRIME_IS_PRIME_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_PRIME_MILLER_RABIN_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_PRIME_MILLER_RABIN_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_PRIME_NEXT_PRIME_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_PRIME_NEXT_PRIME_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_PRIME_RABIN_MILLER_TRIALS_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_PRIME_RABIN_MILLER_TRIALS_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_PRIME_RANDOM_EX_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_PRIME_RANDOM_EX_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_RADIX_SIZE_C
#if defined(ALL_FUNCTIONS) || defined( BN_MP_RADIX_SIZE_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_RADIX_SMAP_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_RADIX_SMAP_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_RAND_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_RAND_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_READ_RADIX_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_READ_RADIX_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_READ_SIGNED_BIN_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_READ_SIGNED_BIN_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_READ_UNSIGNED_BIN_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_READ_UNSIGNED_BIN_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_REDUCE_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_2K_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_REDUCE_2K_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_2K_L_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_REDUCE_2K_L_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_2K_SETUP_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_REDUCE_2K_SETUP_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_2K_SETUP_L_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_REDUCE_2K_SETUP_L_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

View File

@ -1,5 +1,5 @@
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_IS_2K_C
#if defined(ALL_FUNCTIONS) || defined(BN_MP_REDUCE_IS_2K_C)
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision

Some files were not shown because too many files have changed in this diff Show More