Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bn_mp_tc_and.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
}
}

res = mp_and(a, b, c);
res = s_mp_and(a, b, c);

if ((sa == MP_NEG) && (sb == MP_NEG) && (res == MP_OKAY)) {
res = mp_sub(c, mx, c);
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_tc_or.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
}
}

res = mp_or(a, b, c);
res = s_mp_or(a, b, c);

if (((sa == MP_NEG) || (sb == MP_NEG)) && (res == MP_OKAY)) {
res = mp_sub(c, mx, c);
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_tc_xor.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
}
}

res = mp_xor(a, b, c);
res = s_mp_xor(a, b, c);

if ((((sa == MP_NEG) && (sb != MP_NEG)) || ((sa != MP_NEG) && (sb == MP_NEG))) && (res == MP_OKAY)) {
res = mp_sub(c, mx, c);
Expand Down
9 changes: 7 additions & 2 deletions bn_mp_and.c → bn_s_mp_and.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "tommath_private.h"
#ifdef BN_MP_AND_C
#ifdef BN_S_MP_AND_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */

/* AND two ints together */
int mp_and(const mp_int *a, const mp_int *b, mp_int *c)
int s_mp_and(const mp_int *a, const mp_int *b, mp_int *c)
{
int res, ix, px;
mp_int t;
Expand Down Expand Up @@ -38,4 +38,9 @@ int mp_and(const mp_int *a, const mp_int *b, mp_int *c)
mp_clear(&t);
return MP_OKAY;
}

int mp_and(const mp_int *a, const mp_int *b, mp_int *c)
{
return s_mp_and(a, b, c);
}
#endif
9 changes: 7 additions & 2 deletions bn_mp_or.c → bn_s_mp_or.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "tommath_private.h"
#ifdef BN_MP_OR_C
#ifdef BN_S_MP_OR_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */

/* OR two ints together */
int mp_or(const mp_int *a, const mp_int *b, mp_int *c)
int s_mp_or(const mp_int *a, const mp_int *b, mp_int *c)
{
int res, ix, px;
mp_int t;
Expand Down Expand Up @@ -32,4 +32,9 @@ int mp_or(const mp_int *a, const mp_int *b, mp_int *c)
mp_clear(&t);
return MP_OKAY;
}

int mp_or(const mp_int *a, const mp_int *b, mp_int *c)
{
return s_mp_or(a, b, c);
}
#endif
9 changes: 7 additions & 2 deletions bn_mp_xor.c → bn_s_mp_xor.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "tommath_private.h"
#ifdef BN_MP_XOR_C
#ifdef BN_S_MP_XOR_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */

/* XOR two ints together */
int mp_xor(const mp_int *a, const mp_int *b, mp_int *c)
int s_mp_xor(const mp_int *a, const mp_int *b, mp_int *c)
{
int res, ix, px;
mp_int t;
Expand Down Expand Up @@ -32,4 +32,9 @@ int mp_xor(const mp_int *a, const mp_int *b, mp_int *c)
mp_clear(&t);
return MP_OKAY;
}

int mp_xor(const mp_int *a, const mp_int *b, mp_int *c)
{
return s_mp_xor(a, b, c);
}
#endif
72 changes: 36 additions & 36 deletions callgraph.txt
Original file line number Diff line number Diff line change
Expand Up @@ -899,17 +899,6 @@ BN_MP_ADD_D_C
+--->BN_MP_CLAMP_C


BN_MP_AND_C
+--->BN_MP_INIT_COPY_C
| +--->BN_MP_INIT_SIZE_C
| +--->BN_MP_COPY_C
| | +--->BN_MP_GROW_C
| +--->BN_MP_CLEAR_C
+--->BN_MP_CLAMP_C
+--->BN_MP_EXCH_C
+--->BN_MP_CLEAR_C


BN_MP_CLAMP_C


Expand Down Expand Up @@ -4497,17 +4486,6 @@ BN_MP_N_ROOT_EX_C
+--->BN_MP_CLEAR_C


BN_MP_OR_C
+--->BN_MP_INIT_COPY_C
| +--->BN_MP_INIT_SIZE_C
| +--->BN_MP_COPY_C
| | +--->BN_MP_GROW_C
| +--->BN_MP_CLEAR_C
+--->BN_MP_CLAMP_C
+--->BN_MP_EXCH_C
+--->BN_MP_CLEAR_C


BN_MP_PRIME_FERMAT_C
+--->BN_MP_CMP_D_C
+--->BN_MP_INIT_C
Expand Down Expand Up @@ -14027,7 +14005,7 @@ BN_MP_TC_AND_C
| | +--->BN_MP_GROW_C
| | +--->BN_MP_CLAMP_C
+--->BN_MP_CLEAR_C
+--->BN_MP_AND_C
+--->BN_S_MP_AND_C
| +--->BN_MP_INIT_COPY_C
| | +--->BN_MP_INIT_SIZE_C
| | +--->BN_MP_COPY_C
Expand Down Expand Up @@ -14085,7 +14063,7 @@ BN_MP_TC_OR_C
| | +--->BN_MP_GROW_C
| | +--->BN_MP_CLAMP_C
+--->BN_MP_CLEAR_C
+--->BN_MP_OR_C
+--->BN_S_MP_OR_C
| +--->BN_MP_INIT_COPY_C
| | +--->BN_MP_INIT_SIZE_C
| | +--->BN_MP_COPY_C
Expand Down Expand Up @@ -14124,7 +14102,7 @@ BN_MP_TC_XOR_C
| | +--->BN_MP_GROW_C
| | +--->BN_MP_CLAMP_C
+--->BN_MP_CLEAR_C
+--->BN_MP_XOR_C
+--->BN_S_MP_XOR_C
| +--->BN_MP_INIT_COPY_C
| | +--->BN_MP_INIT_SIZE_C
| | +--->BN_MP_COPY_C
Expand Down Expand Up @@ -14282,17 +14260,6 @@ BN_MP_UNSIGNED_BIN_SIZE_C
+--->BN_MP_COUNT_BITS_C


BN_MP_XOR_C
+--->BN_MP_INIT_COPY_C
| +--->BN_MP_INIT_SIZE_C
| +--->BN_MP_COPY_C
| | +--->BN_MP_GROW_C
| +--->BN_MP_CLEAR_C
+--->BN_MP_CLAMP_C
+--->BN_MP_EXCH_C
+--->BN_MP_CLEAR_C


BN_MP_ZERO_C


Expand All @@ -14304,6 +14271,17 @@ BN_S_MP_ADD_C
+--->BN_MP_CLAMP_C


BN_S_MP_AND_C
+--->BN_MP_INIT_COPY_C
| +--->BN_MP_INIT_SIZE_C
| +--->BN_MP_COPY_C
| | +--->BN_MP_GROW_C
| +--->BN_MP_CLEAR_C
+--->BN_MP_CLAMP_C
+--->BN_MP_EXCH_C
+--->BN_MP_CLEAR_C


BN_S_MP_BALANCE_MUL_C
+--->BN_MP_INIT_SIZE_C
+--->BN_MP_INIT_MULTI_C
Expand Down Expand Up @@ -15360,6 +15338,17 @@ BN_S_MP_MUL_HIGH_DIGS_FAST_C
+--->BN_MP_CLAMP_C


BN_S_MP_OR_C
+--->BN_MP_INIT_COPY_C
| +--->BN_MP_INIT_SIZE_C
| +--->BN_MP_COPY_C
| | +--->BN_MP_GROW_C
| +--->BN_MP_CLEAR_C
+--->BN_MP_CLAMP_C
+--->BN_MP_EXCH_C
+--->BN_MP_CLEAR_C


BN_S_MP_REVERSE_C


Expand Down Expand Up @@ -15543,3 +15532,14 @@ BN_S_MP_TOOM_SQR_C
| +--->BN_MP_CLEAR_C


BN_S_MP_XOR_C
+--->BN_MP_INIT_COPY_C
| +--->BN_MP_INIT_SIZE_C
| +--->BN_MP_COPY_C
| | +--->BN_MP_GROW_C
| +--->BN_MP_CLEAR_C
+--->BN_MP_CLAMP_C
+--->BN_MP_EXCH_C
+--->BN_MP_CLEAR_C


24 changes: 12 additions & 12 deletions libtommath_VS2008.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,6 @@
RelativePath="bn_mp_addmod.c"
>
</File>
<File
RelativePath="bn_mp_and.c"
>
</File>
<File
RelativePath="bn_mp_clamp.c"
>
Expand Down Expand Up @@ -608,10 +604,6 @@
RelativePath="bn_mp_neg.c"
>
</File>
<File
RelativePath="bn_mp_or.c"
>
</File>
<File
RelativePath="bn_mp_prime_fermat.c"
>
Expand Down Expand Up @@ -808,10 +800,6 @@
RelativePath="bn_mp_unsigned_bin_size.c"
>
</File>
<File
RelativePath="bn_mp_xor.c"
>
</File>
<File
RelativePath="bn_mp_zero.c"
>
Expand All @@ -824,6 +812,10 @@
RelativePath="bn_s_mp_add.c"
>
</File>
<File
RelativePath="bn_s_mp_and.c"
>
</File>
<File
RelativePath="bn_s_mp_balance_mul.c"
>
Expand Down Expand Up @@ -872,6 +864,10 @@
RelativePath="bn_s_mp_mul_high_digs_fast.c"
>
</File>
<File
RelativePath="bn_s_mp_or.c"
>
</File>
<File
RelativePath="bn_s_mp_reverse.c"
>
Expand All @@ -896,6 +892,10 @@
RelativePath="bn_s_mp_toom_sqr.c"
>
</File>
<File
RelativePath="bn_s_mp_xor.c"
>
</File>
<File
RelativePath="tommath.h"
>
Expand Down
15 changes: 8 additions & 7 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ LCOV_ARGS=--directory .

#START_INS
OBJECTS=bn_cutoffs.o bn_deprecated.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o bn_mp_addmod.o \
bn_mp_and.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o bn_mp_cmp_d.o bn_mp_cmp_mag.o \
bn_mp_cnt_lsb.o bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o \
bn_mp_div_2d.o bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o bn_mp_dr_reduce.o bn_mp_dr_setup.o \
bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o bn_mp_cmp_d.o bn_mp_cmp_mag.o bn_mp_cnt_lsb.o \
bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o bn_mp_div_2d.o \
bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o bn_mp_dr_reduce.o bn_mp_dr_setup.o \
bn_mp_error_to_string.o bn_mp_exch.o bn_mp_export.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_exptmod.o \
bn_mp_exteuclid.o bn_mp_fread.o bn_mp_fwrite.o bn_mp_gcd.o bn_mp_get_bit.o bn_mp_get_double.o \
bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_ilogb.o bn_mp_import.o \
Expand All @@ -38,7 +38,7 @@ bn_mp_init_size.o bn_mp_invmod.o bn_mp_is_square.o bn_mp_iseven.o bn_mp_isodd.o
bn_mp_kronecker.o bn_mp_lcm.o bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mod_d.o \
bn_mp_montgomery_calc_normalization.o bn_mp_montgomery_reduce.o bn_mp_montgomery_setup.o bn_mp_mul.o \
bn_mp_mul_2.o bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_mulmod.o bn_mp_n_root.o bn_mp_n_root_ex.o bn_mp_neg.o \
bn_mp_or.o bn_mp_prime_fermat.o bn_mp_prime_frobenius_underwood.o bn_mp_prime_is_divisible.o \
bn_mp_prime_fermat.o bn_mp_prime_frobenius_underwood.o bn_mp_prime_is_divisible.o \
bn_mp_prime_is_prime.o bn_mp_prime_miller_rabin.o bn_mp_prime_next_prime.o \
bn_mp_prime_rabin_miller_trials.o bn_mp_prime_random_ex.o bn_mp_prime_strong_lucas_selfridge.o \
bn_mp_radix_size.o bn_mp_radix_smap.o bn_mp_rand.o bn_mp_read_radix.o bn_mp_read_signed_bin.o \
Expand All @@ -48,11 +48,12 @@ bn_mp_set.o bn_mp_set_double.o bn_mp_set_int.o bn_mp_set_long.o bn_mp_set_long_l
bn_mp_signed_bin_size.o bn_mp_sqr.o bn_mp_sqrmod.o bn_mp_sqrt.o bn_mp_sqrtmod_prime.o bn_mp_sub.o \
bn_mp_sub_d.o bn_mp_submod.o bn_mp_tc_and.o bn_mp_tc_div_2d.o bn_mp_tc_or.o bn_mp_tc_xor.o \
bn_mp_to_signed_bin.o bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o \
bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o bn_prime_tab.o \
bn_s_mp_add.o bn_s_mp_balance_mul.o bn_s_mp_exptmod.o bn_s_mp_exptmod_fast.o bn_s_mp_invmod_fast.o \
bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_zero.o bn_prime_tab.o bn_s_mp_add.o \
bn_s_mp_and.o bn_s_mp_balance_mul.o bn_s_mp_exptmod.o bn_s_mp_exptmod_fast.o bn_s_mp_invmod_fast.o \
bn_s_mp_invmod_slow.o bn_s_mp_karatsuba_mul.o bn_s_mp_karatsuba_sqr.o bn_s_mp_montgomery_reduce_fast.o \
bn_s_mp_mul_digs.o bn_s_mp_mul_digs_fast.o bn_s_mp_mul_high_digs.o bn_s_mp_mul_high_digs_fast.o \
bn_s_mp_reverse.o bn_s_mp_sqr.o bn_s_mp_sqr_fast.o bn_s_mp_sub.o bn_s_mp_toom_mul.o bn_s_mp_toom_sqr.o
bn_s_mp_or.o bn_s_mp_reverse.o bn_s_mp_sqr.o bn_s_mp_sqr_fast.o bn_s_mp_sub.o bn_s_mp_toom_mul.o \
bn_s_mp_toom_sqr.o bn_s_mp_xor.o

#END_INS

Expand Down
15 changes: 8 additions & 7 deletions makefile.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ LIBMAIN_D =libtommath.dll

#List of objects to compile (all goes to libtommath.a)
OBJECTS=bn_cutoffs.o bn_deprecated.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o bn_mp_addmod.o \
bn_mp_and.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o bn_mp_cmp_d.o bn_mp_cmp_mag.o \
bn_mp_cnt_lsb.o bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o \
bn_mp_div_2d.o bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o bn_mp_dr_reduce.o bn_mp_dr_setup.o \
bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o bn_mp_cmp_d.o bn_mp_cmp_mag.o bn_mp_cnt_lsb.o \
bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o bn_mp_div_2d.o \
bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o bn_mp_dr_reduce.o bn_mp_dr_setup.o \
bn_mp_error_to_string.o bn_mp_exch.o bn_mp_export.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_exptmod.o \
bn_mp_exteuclid.o bn_mp_fread.o bn_mp_fwrite.o bn_mp_gcd.o bn_mp_get_bit.o bn_mp_get_double.o \
bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_ilogb.o bn_mp_import.o \
Expand All @@ -41,7 +41,7 @@ bn_mp_init_size.o bn_mp_invmod.o bn_mp_is_square.o bn_mp_iseven.o bn_mp_isodd.o
bn_mp_kronecker.o bn_mp_lcm.o bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mod_d.o \
bn_mp_montgomery_calc_normalization.o bn_mp_montgomery_reduce.o bn_mp_montgomery_setup.o bn_mp_mul.o \
bn_mp_mul_2.o bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_mulmod.o bn_mp_n_root.o bn_mp_n_root_ex.o bn_mp_neg.o \
bn_mp_or.o bn_mp_prime_fermat.o bn_mp_prime_frobenius_underwood.o bn_mp_prime_is_divisible.o \
bn_mp_prime_fermat.o bn_mp_prime_frobenius_underwood.o bn_mp_prime_is_divisible.o \
bn_mp_prime_is_prime.o bn_mp_prime_miller_rabin.o bn_mp_prime_next_prime.o \
bn_mp_prime_rabin_miller_trials.o bn_mp_prime_random_ex.o bn_mp_prime_strong_lucas_selfridge.o \
bn_mp_radix_size.o bn_mp_radix_smap.o bn_mp_rand.o bn_mp_read_radix.o bn_mp_read_signed_bin.o \
Expand All @@ -51,11 +51,12 @@ bn_mp_set.o bn_mp_set_double.o bn_mp_set_int.o bn_mp_set_long.o bn_mp_set_long_l
bn_mp_signed_bin_size.o bn_mp_sqr.o bn_mp_sqrmod.o bn_mp_sqrt.o bn_mp_sqrtmod_prime.o bn_mp_sub.o \
bn_mp_sub_d.o bn_mp_submod.o bn_mp_tc_and.o bn_mp_tc_div_2d.o bn_mp_tc_or.o bn_mp_tc_xor.o \
bn_mp_to_signed_bin.o bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o \
bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o bn_prime_tab.o \
bn_s_mp_add.o bn_s_mp_balance_mul.o bn_s_mp_exptmod.o bn_s_mp_exptmod_fast.o bn_s_mp_invmod_fast.o \
bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_zero.o bn_prime_tab.o bn_s_mp_add.o \
bn_s_mp_and.o bn_s_mp_balance_mul.o bn_s_mp_exptmod.o bn_s_mp_exptmod_fast.o bn_s_mp_invmod_fast.o \
bn_s_mp_invmod_slow.o bn_s_mp_karatsuba_mul.o bn_s_mp_karatsuba_sqr.o bn_s_mp_montgomery_reduce_fast.o \
bn_s_mp_mul_digs.o bn_s_mp_mul_digs_fast.o bn_s_mp_mul_high_digs.o bn_s_mp_mul_high_digs_fast.o \
bn_s_mp_reverse.o bn_s_mp_sqr.o bn_s_mp_sqr_fast.o bn_s_mp_sub.o bn_s_mp_toom_mul.o bn_s_mp_toom_sqr.o
bn_s_mp_or.o bn_s_mp_reverse.o bn_s_mp_sqr.o bn_s_mp_sqr_fast.o bn_s_mp_sub.o bn_s_mp_toom_mul.o \
bn_s_mp_toom_sqr.o bn_s_mp_xor.o

HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h

Expand Down
Loading