|
@@ -1,5 +1,4 @@
|
|
|
/* Start: bn_fast_mp_invmod.c */
|
|
|
-#line 0 "bn_fast_mp_invmod.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -14,8 +13,7 @@
|
|
|
*
|
|
|
* Tom St Denis, [email protected], http://math.libtomcrypt.org
|
|
|
*/
|
|
|
-#include "mycrypt.h"
|
|
|
-#include <tommath.h>
|
|
|
+#include "mycrypt.h"
|
|
|
|
|
|
/* computes the modular inverse via binary extended euclidean algorithm,
|
|
|
* that is c = 1/a mod b
|
|
@@ -152,7 +150,6 @@ __ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL);
|
|
|
/* End: bn_fast_mp_invmod.c */
|
|
|
|
|
|
/* Start: bn_fast_mp_montgomery_reduce.c */
|
|
|
-#line 0 "bn_fast_mp_montgomery_reduce.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -279,7 +276,7 @@ fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
|
|
_W = W + n->used;
|
|
|
|
|
|
for (ix = 0; ix < n->used + 1; ix++) {
|
|
|
- *tmpx++ = *_W++ & ((mp_word) MP_MASK);
|
|
|
+ *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK));
|
|
|
}
|
|
|
|
|
|
/* zero oldused digits, if the input a was larger than
|
|
@@ -303,7 +300,6 @@ fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
|
|
/* End: bn_fast_mp_montgomery_reduce.c */
|
|
|
|
|
|
/* Start: bn_fast_s_mp_mul_digs.c */
|
|
|
-#line 0 "bn_fast_s_mp_mul_digs.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -431,7 +427,6 @@ fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
|
|
/* End: bn_fast_s_mp_mul_digs.c */
|
|
|
|
|
|
/* Start: bn_fast_s_mp_mul_high_digs.c */
|
|
|
-#line 0 "bn_fast_s_mp_mul_high_digs.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -531,7 +526,6 @@ fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
|
|
/* End: bn_fast_s_mp_mul_high_digs.c */
|
|
|
|
|
|
/* Start: bn_fast_s_mp_sqr.c */
|
|
|
-#line 0 "bn_fast_s_mp_sqr.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -665,7 +659,6 @@ fast_s_mp_sqr (mp_int * a, mp_int * b)
|
|
|
/* End: bn_fast_s_mp_sqr.c */
|
|
|
|
|
|
/* Start: bn_mp_2expt.c */
|
|
|
-#line 0 "bn_mp_2expt.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -705,7 +698,6 @@ mp_2expt (mp_int * a, int b)
|
|
|
/* End: bn_mp_2expt.c */
|
|
|
|
|
|
/* Start: bn_mp_abs.c */
|
|
|
-#line 0 "bn_mp_abs.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -740,7 +732,6 @@ mp_abs (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_abs.c */
|
|
|
|
|
|
/* Start: bn_mp_add.c */
|
|
|
-#line 0 "bn_mp_add.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -793,7 +784,6 @@ mp_add (mp_int * a, mp_int * b, mp_int * c)
|
|
|
/* End: bn_mp_add.c */
|
|
|
|
|
|
/* Start: bn_mp_add_d.c */
|
|
|
-#line 0 "bn_mp_add_d.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -830,7 +820,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c)
|
|
|
/* End: bn_mp_add_d.c */
|
|
|
|
|
|
/* Start: bn_mp_addmod.c */
|
|
|
-#line 0 "bn_mp_addmod.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -870,7 +859,6 @@ mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
|
|
/* End: bn_mp_addmod.c */
|
|
|
|
|
|
/* Start: bn_mp_and.c */
|
|
|
-#line 0 "bn_mp_and.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -926,7 +914,6 @@ mp_and (mp_int * a, mp_int * b, mp_int * c)
|
|
|
/* End: bn_mp_and.c */
|
|
|
|
|
|
/* Start: bn_mp_clamp.c */
|
|
|
-#line 0 "bn_mp_clamp.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -964,7 +951,6 @@ mp_clamp (mp_int * a)
|
|
|
/* End: bn_mp_clamp.c */
|
|
|
|
|
|
/* Start: bn_mp_clear.c */
|
|
|
-#line 0 "bn_mp_clear.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1002,7 +988,6 @@ mp_clear (mp_int * a)
|
|
|
/* End: bn_mp_clear.c */
|
|
|
|
|
|
/* Start: bn_mp_cmp.c */
|
|
|
-#line 0 "bn_mp_cmp.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1044,7 +1029,6 @@ mp_cmp (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_cmp.c */
|
|
|
|
|
|
/* Start: bn_mp_cmp_d.c */
|
|
|
-#line 0 "bn_mp_cmp_d.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1086,7 +1070,6 @@ mp_cmp_d (mp_int * a, mp_digit b)
|
|
|
/* End: bn_mp_cmp_d.c */
|
|
|
|
|
|
/* Start: bn_mp_cmp_mag.c */
|
|
|
-#line 0 "bn_mp_cmp_mag.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1134,7 +1117,6 @@ mp_cmp_mag (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_cmp_mag.c */
|
|
|
|
|
|
/* Start: bn_mp_copy.c */
|
|
|
-#line 0 "bn_mp_copy.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1193,7 +1175,6 @@ mp_copy (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_copy.c */
|
|
|
|
|
|
/* Start: bn_mp_count_bits.c */
|
|
|
-#line 0 "bn_mp_count_bits.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1237,7 +1218,6 @@ mp_count_bits (mp_int * a)
|
|
|
/* End: bn_mp_count_bits.c */
|
|
|
|
|
|
/* Start: bn_mp_div.c */
|
|
|
-#line 0 "bn_mp_div.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1442,7 +1422,6 @@ __Q:mp_clear (&q);
|
|
|
/* End: bn_mp_div.c */
|
|
|
|
|
|
/* Start: bn_mp_div_2.c */
|
|
|
-#line 0 "bn_mp_div_2.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1510,7 +1489,6 @@ mp_div_2 (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_div_2.c */
|
|
|
|
|
|
/* Start: bn_mp_div_2d.c */
|
|
|
-#line 0 "bn_mp_div_2d.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1604,7 +1582,6 @@ mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d)
|
|
|
/* End: bn_mp_div_2d.c */
|
|
|
|
|
|
/* Start: bn_mp_div_3.c */
|
|
|
-#line 0 "bn_mp_div_3.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1653,11 +1630,11 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digit * d)
|
|
|
} else {
|
|
|
t = 0;
|
|
|
}
|
|
|
- q.dp[ix] = t;
|
|
|
+ q.dp[ix] = (mp_digit)t;
|
|
|
}
|
|
|
|
|
|
if (d != NULL) {
|
|
|
- *d = w;
|
|
|
+ *d = (mp_digit)w;
|
|
|
}
|
|
|
|
|
|
if (c != NULL) {
|
|
@@ -1673,7 +1650,6 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digit * d)
|
|
|
/* End: bn_mp_div_3.c */
|
|
|
|
|
|
/* Start: bn_mp_div_d.c */
|
|
|
-#line 0 "bn_mp_div_d.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1722,11 +1698,11 @@ mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
|
|
|
} else {
|
|
|
t = 0;
|
|
|
}
|
|
|
- q.dp[ix] = t;
|
|
|
+ q.dp[ix] = (mp_digit)t;
|
|
|
}
|
|
|
|
|
|
if (d != NULL) {
|
|
|
- *d = w;
|
|
|
+ *d = (mp_digit)w;
|
|
|
}
|
|
|
|
|
|
if (c != NULL) {
|
|
@@ -1742,7 +1718,6 @@ mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
|
|
|
/* End: bn_mp_div_d.c */
|
|
|
|
|
|
/* Start: bn_mp_dr_is_modulus.c */
|
|
|
-#line 0 "bn_mp_dr_is_modulus.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1781,7 +1756,6 @@ int mp_dr_is_modulus(mp_int *a)
|
|
|
/* End: bn_mp_dr_is_modulus.c */
|
|
|
|
|
|
/* Start: bn_mp_dr_reduce.c */
|
|
|
-#line 0 "bn_mp_dr_reduce.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1844,8 +1818,8 @@ top:
|
|
|
/* compute (x mod B**m) + mp * [x/B**m] inline and inplace */
|
|
|
for (i = 0; i < m; i++) {
|
|
|
r = ((mp_word)*tmpx2++) * ((mp_word)k) + *tmpx1 + mu;
|
|
|
- *tmpx1++ = r & MP_MASK;
|
|
|
- mu = r >> ((mp_word)DIGIT_BIT);
|
|
|
+ *tmpx1++ = (mp_digit)(r & MP_MASK);
|
|
|
+ mu = (mp_digit)(r >> ((mp_word)DIGIT_BIT));
|
|
|
}
|
|
|
|
|
|
/* set final carry */
|
|
@@ -1872,7 +1846,6 @@ top:
|
|
|
/* End: bn_mp_dr_reduce.c */
|
|
|
|
|
|
/* Start: bn_mp_dr_setup.c */
|
|
|
-#line 0 "bn_mp_dr_setup.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1903,7 +1876,6 @@ void mp_dr_setup(mp_int *a, mp_digit *d)
|
|
|
/* End: bn_mp_dr_setup.c */
|
|
|
|
|
|
/* Start: bn_mp_exch.c */
|
|
|
-#line 0 "bn_mp_exch.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1936,7 +1908,6 @@ mp_exch (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_exch.c */
|
|
|
|
|
|
/* Start: bn_mp_expt_d.c */
|
|
|
-#line 0 "bn_mp_expt_d.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -1993,7 +1964,6 @@ mp_expt_d (mp_int * a, mp_digit b, mp_int * c)
|
|
|
/* End: bn_mp_expt_d.c */
|
|
|
|
|
|
/* Start: bn_mp_exptmod.c */
|
|
|
-#line 0 "bn_mp_exptmod.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -2073,7 +2043,6 @@ mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
|
|
|
/* End: bn_mp_exptmod.c */
|
|
|
|
|
|
/* Start: bn_mp_exptmod_fast.c */
|
|
|
-#line 0 "bn_mp_exptmod_fast.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -2156,7 +2125,6 @@ mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode)
|
|
|
if (((P->used * 2 + 1) < MP_WARRAY) &&
|
|
|
P->used < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {
|
|
|
redux = fast_mp_montgomery_reduce;
|
|
|
-
|
|
|
} else {
|
|
|
/* use slower baselien method */
|
|
|
redux = mp_montgomery_reduce;
|
|
@@ -2343,7 +2311,6 @@ __M:
|
|
|
/* End: bn_mp_exptmod_fast.c */
|
|
|
|
|
|
/* Start: bn_mp_gcd.c */
|
|
|
-#line 0 "bn_mp_gcd.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -2467,7 +2434,6 @@ __U:mp_clear (&v);
|
|
|
/* End: bn_mp_gcd.c */
|
|
|
|
|
|
/* Start: bn_mp_grow.c */
|
|
|
-#line 0 "bn_mp_grow.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -2513,7 +2479,6 @@ mp_grow (mp_int * a, int size)
|
|
|
/* End: bn_mp_grow.c */
|
|
|
|
|
|
/* Start: bn_mp_init.c */
|
|
|
-#line 0 "bn_mp_init.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -2552,7 +2517,6 @@ mp_init (mp_int * a)
|
|
|
/* End: bn_mp_init.c */
|
|
|
|
|
|
/* Start: bn_mp_init_copy.c */
|
|
|
-#line 0 "bn_mp_init_copy.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -2584,7 +2548,6 @@ mp_init_copy (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_init_copy.c */
|
|
|
|
|
|
/* Start: bn_mp_init_size.c */
|
|
|
-#line 0 "bn_mp_init_size.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -2624,7 +2587,6 @@ mp_init_size (mp_int * a, int size)
|
|
|
/* End: bn_mp_init_size.c */
|
|
|
|
|
|
/* Start: bn_mp_invmod.c */
|
|
|
-#line 0 "bn_mp_invmod.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -2795,7 +2757,6 @@ __ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL);
|
|
|
/* End: bn_mp_invmod.c */
|
|
|
|
|
|
/* Start: bn_mp_jacobi.c */
|
|
|
-#line 0 "bn_mp_jacobi.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -2914,7 +2875,6 @@ __A1:mp_clear (&a1);
|
|
|
/* End: bn_mp_jacobi.c */
|
|
|
|
|
|
/* Start: bn_mp_karatsuba_mul.c */
|
|
|
-#line 0 "bn_mp_karatsuba_mul.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3084,7 +3044,6 @@ ERR:
|
|
|
/* End: bn_mp_karatsuba_mul.c */
|
|
|
|
|
|
/* Start: bn_mp_karatsuba_sqr.c */
|
|
|
-#line 0 "bn_mp_karatsuba_sqr.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3205,7 +3164,6 @@ ERR:
|
|
|
/* End: bn_mp_karatsuba_sqr.c */
|
|
|
|
|
|
/* Start: bn_mp_lcm.c */
|
|
|
-#line 0 "bn_mp_lcm.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3252,7 +3210,6 @@ mp_lcm (mp_int * a, mp_int * b, mp_int * c)
|
|
|
/* End: bn_mp_lcm.c */
|
|
|
|
|
|
/* Start: bn_mp_lshd.c */
|
|
|
-#line 0 "bn_mp_lshd.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3319,7 +3276,6 @@ mp_lshd (mp_int * a, int b)
|
|
|
/* End: bn_mp_lshd.c */
|
|
|
|
|
|
/* Start: bn_mp_mod.c */
|
|
|
-#line 0 "bn_mp_mod.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3367,7 +3323,6 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c)
|
|
|
/* End: bn_mp_mod.c */
|
|
|
|
|
|
/* Start: bn_mp_mod_2d.c */
|
|
|
-#line 0 "bn_mp_mod_2d.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3422,7 +3377,6 @@ mp_mod_2d (mp_int * a, int b, mp_int * c)
|
|
|
/* End: bn_mp_mod_2d.c */
|
|
|
|
|
|
/* Start: bn_mp_mod_d.c */
|
|
|
-#line 0 "bn_mp_mod_d.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3448,7 +3402,6 @@ mp_mod_d (mp_int * a, mp_digit b, mp_digit * c)
|
|
|
/* End: bn_mp_mod_d.c */
|
|
|
|
|
|
/* Start: bn_mp_montgomery_calc_normalization.c */
|
|
|
-#line 0 "bn_mp_montgomery_calc_normalization.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3506,7 +3459,6 @@ mp_montgomery_calc_normalization (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_montgomery_calc_normalization.c */
|
|
|
|
|
|
/* Start: bn_mp_montgomery_reduce.c */
|
|
|
-#line 0 "bn_mp_montgomery_reduce.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3570,10 +3522,10 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
|
|
|
|
|
/* Multiply and add in place */
|
|
|
for (iy = 0; iy < n->used; iy++) {
|
|
|
- r = ((mp_word) mu) * ((mp_word) * tmpn++) +
|
|
|
- ((mp_word) u) + ((mp_word) * tmpx);
|
|
|
- u = (r >> ((mp_word) DIGIT_BIT));
|
|
|
- *tmpx++ = (r & ((mp_word) MP_MASK));
|
|
|
+ r = ((mp_word) mu) * ((mp_word) * tmpn++) +
|
|
|
+ ((mp_word) u) + ((mp_word) * tmpx);
|
|
|
+ u = (mp_digit)(r >> ((mp_word) DIGIT_BIT));
|
|
|
+ *tmpx++ = (mp_digit)(r & ((mp_word) MP_MASK));
|
|
|
}
|
|
|
/* propagate carries */
|
|
|
while (u) {
|
|
@@ -3599,7 +3551,6 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
|
|
/* End: bn_mp_montgomery_reduce.c */
|
|
|
|
|
|
/* Start: bn_mp_montgomery_setup.c */
|
|
|
-#line 0 "bn_mp_montgomery_setup.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3657,7 +3608,6 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho)
|
|
|
/* End: bn_mp_montgomery_setup.c */
|
|
|
|
|
|
/* Start: bn_mp_mul.c */
|
|
|
-#line 0 "bn_mp_mul.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3711,7 +3661,6 @@ mp_mul (mp_int * a, mp_int * b, mp_int * c)
|
|
|
/* End: bn_mp_mul.c */
|
|
|
|
|
|
/* Start: bn_mp_mul_2.c */
|
|
|
-#line 0 "bn_mp_mul_2.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3793,7 +3742,6 @@ mp_mul_2 (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_mul_2.c */
|
|
|
|
|
|
/* Start: bn_mp_mul_2d.c */
|
|
|
-#line 0 "bn_mp_mul_2d.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3877,7 +3825,6 @@ mp_mul_2d (mp_int * a, int b, mp_int * c)
|
|
|
/* End: bn_mp_mul_2d.c */
|
|
|
|
|
|
/* Start: bn_mp_mul_d.c */
|
|
|
-#line 0 "bn_mp_mul_d.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3953,7 +3900,6 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c)
|
|
|
/* End: bn_mp_mul_d.c */
|
|
|
|
|
|
/* Start: bn_mp_mulmod.c */
|
|
|
-#line 0 "bn_mp_mulmod.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -3994,7 +3940,6 @@ mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
|
|
/* End: bn_mp_mulmod.c */
|
|
|
|
|
|
/* Start: bn_mp_multi.c */
|
|
|
-#line 0 "bn_mp_multi.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4063,7 +4008,6 @@ void mp_clear_multi(mp_int *mp, ...)
|
|
|
/* End: bn_mp_multi.c */
|
|
|
|
|
|
/* Start: bn_mp_n_root.c */
|
|
|
-#line 0 "bn_mp_n_root.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4187,7 +4131,6 @@ __T1:mp_clear (&t1);
|
|
|
/* End: bn_mp_n_root.c */
|
|
|
|
|
|
/* Start: bn_mp_neg.c */
|
|
|
-#line 0 "bn_mp_neg.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4219,7 +4162,6 @@ mp_neg (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_neg.c */
|
|
|
|
|
|
/* Start: bn_mp_or.c */
|
|
|
-#line 0 "bn_mp_or.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4269,7 +4211,6 @@ mp_or (mp_int * a, mp_int * b, mp_int * c)
|
|
|
/* End: bn_mp_or.c */
|
|
|
|
|
|
/* Start: bn_mp_prime_fermat.c */
|
|
|
-#line 0 "bn_mp_prime_fermat.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4326,7 +4267,6 @@ __T:mp_clear (&t);
|
|
|
/* End: bn_mp_prime_fermat.c */
|
|
|
|
|
|
/* Start: bn_mp_prime_is_divisible.c */
|
|
|
-#line 0 "bn_mp_prime_is_divisible.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4381,7 +4321,6 @@ mp_prime_is_divisible (mp_int * a, int *result)
|
|
|
/* End: bn_mp_prime_is_divisible.c */
|
|
|
|
|
|
/* Start: bn_mp_prime_is_prime.c */
|
|
|
-#line 0 "bn_mp_prime_is_prime.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4462,7 +4401,6 @@ __B:mp_clear (&b);
|
|
|
/* End: bn_mp_prime_is_prime.c */
|
|
|
|
|
|
/* Start: bn_mp_prime_miller_rabin.c */
|
|
|
-#line 0 "bn_mp_prime_miller_rabin.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4557,7 +4495,6 @@ __N1:mp_clear (&n1);
|
|
|
/* End: bn_mp_prime_miller_rabin.c */
|
|
|
|
|
|
/* Start: bn_mp_prime_next_prime.c */
|
|
|
-#line 0 "bn_mp_prime_next_prime.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4616,7 +4553,6 @@ int mp_prime_next_prime(mp_int *a, int t)
|
|
|
/* End: bn_mp_prime_next_prime.c */
|
|
|
|
|
|
/* Start: bn_mp_rand.c */
|
|
|
-#line 0 "bn_mp_rand.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4670,7 +4606,6 @@ mp_rand (mp_int * a, int digits)
|
|
|
/* End: bn_mp_rand.c */
|
|
|
|
|
|
/* Start: bn_mp_read_signed_bin.c */
|
|
|
-#line 0 "bn_mp_read_signed_bin.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4703,7 +4638,6 @@ mp_read_signed_bin (mp_int * a, unsigned char *b, int c)
|
|
|
/* End: bn_mp_read_signed_bin.c */
|
|
|
|
|
|
/* Start: bn_mp_read_unsigned_bin.c */
|
|
|
-#line 0 "bn_mp_read_unsigned_bin.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4747,7 +4681,6 @@ mp_read_unsigned_bin (mp_int * a, unsigned char *b, int c)
|
|
|
/* End: bn_mp_read_unsigned_bin.c */
|
|
|
|
|
|
/* Start: bn_mp_reduce.c */
|
|
|
-#line 0 "bn_mp_reduce.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4782,8 +4715,8 @@ mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
|
|
|
/* q1 = x / b**(k-1) */
|
|
|
mp_rshd (&q, um - 1);
|
|
|
|
|
|
- /* according to HAC this is optimization is ok */
|
|
|
- if (((unsigned long) m->used) > (((mp_digit)1) << (DIGIT_BIT - 1))) {
|
|
|
+ /* according to HAC this optimization is ok */
|
|
|
+ if (((unsigned long) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) {
|
|
|
if ((res = mp_mul (&q, mu, &q)) != MP_OKAY) {
|
|
|
goto CLEANUP;
|
|
|
}
|
|
@@ -4823,7 +4756,7 @@ mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
|
|
|
/* Back off if it's too big */
|
|
|
while (mp_cmp (x, m) != MP_LT) {
|
|
|
if ((res = s_mp_sub (x, m, x)) != MP_OKAY) {
|
|
|
- break;
|
|
|
+ goto CLEANUP;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -4836,7 +4769,6 @@ CLEANUP:
|
|
|
/* End: bn_mp_reduce.c */
|
|
|
|
|
|
/* Start: bn_mp_reduce_2k.c */
|
|
|
-#line 0 "bn_mp_reduce_2k.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4897,7 +4829,6 @@ ERR:
|
|
|
/* End: bn_mp_reduce_2k.c */
|
|
|
|
|
|
/* Start: bn_mp_reduce_2k_setup.c */
|
|
|
-#line 0 "bn_mp_reduce_2k_setup.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4944,7 +4875,6 @@ mp_reduce_2k_setup(mp_int *a, mp_digit *d)
|
|
|
/* End: bn_mp_reduce_2k_setup.c */
|
|
|
|
|
|
/* Start: bn_mp_reduce_is_2k.c */
|
|
|
-#line 0 "bn_mp_reduce_is_2k.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -4987,7 +4917,6 @@ mp_reduce_is_2k(mp_int *a)
|
|
|
/* End: bn_mp_reduce_is_2k.c */
|
|
|
|
|
|
/* Start: bn_mp_reduce_setup.c */
|
|
|
-#line 0 "bn_mp_reduce_setup.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5021,7 +4950,6 @@ mp_reduce_setup (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_reduce_setup.c */
|
|
|
|
|
|
/* Start: bn_mp_rshd.c */
|
|
|
-#line 0 "bn_mp_rshd.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5093,7 +5021,6 @@ mp_rshd (mp_int * a, int b)
|
|
|
/* End: bn_mp_rshd.c */
|
|
|
|
|
|
/* Start: bn_mp_set.c */
|
|
|
-#line 0 "bn_mp_set.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5122,7 +5049,6 @@ mp_set (mp_int * a, mp_digit b)
|
|
|
/* End: bn_mp_set.c */
|
|
|
|
|
|
/* Start: bn_mp_set_int.c */
|
|
|
-#line 0 "bn_mp_set_int.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5169,7 +5095,6 @@ mp_set_int (mp_int * a, unsigned int b)
|
|
|
/* End: bn_mp_set_int.c */
|
|
|
|
|
|
/* Start: bn_mp_shrink.c */
|
|
|
-#line 0 "bn_mp_shrink.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5202,7 +5127,6 @@ mp_shrink (mp_int * a)
|
|
|
/* End: bn_mp_shrink.c */
|
|
|
|
|
|
/* Start: bn_mp_signed_bin_size.c */
|
|
|
-#line 0 "bn_mp_signed_bin_size.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5229,7 +5153,6 @@ mp_signed_bin_size (mp_int * a)
|
|
|
/* End: bn_mp_signed_bin_size.c */
|
|
|
|
|
|
/* Start: bn_mp_sqr.c */
|
|
|
-#line 0 "bn_mp_sqr.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5273,7 +5196,6 @@ mp_sqr (mp_int * a, mp_int * b)
|
|
|
/* End: bn_mp_sqr.c */
|
|
|
|
|
|
/* Start: bn_mp_sqrmod.c */
|
|
|
-#line 0 "bn_mp_sqrmod.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5314,7 +5236,6 @@ mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
|
|
|
/* End: bn_mp_sqrmod.c */
|
|
|
|
|
|
/* Start: bn_mp_sub.c */
|
|
|
-#line 0 "bn_mp_sub.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5372,7 +5293,6 @@ mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
|
|
/* End: bn_mp_sub.c */
|
|
|
|
|
|
/* Start: bn_mp_sub_d.c */
|
|
|
-#line 0 "bn_mp_sub_d.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5410,7 +5330,6 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c)
|
|
|
/* End: bn_mp_sub_d.c */
|
|
|
|
|
|
/* Start: bn_mp_submod.c */
|
|
|
-#line 0 "bn_mp_submod.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5451,7 +5370,6 @@ mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
|
|
/* End: bn_mp_submod.c */
|
|
|
|
|
|
/* Start: bn_mp_to_signed_bin.c */
|
|
|
-#line 0 "bn_mp_to_signed_bin.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5484,7 +5402,6 @@ mp_to_signed_bin (mp_int * a, unsigned char *b)
|
|
|
/* End: bn_mp_to_signed_bin.c */
|
|
|
|
|
|
/* Start: bn_mp_to_unsigned_bin.c */
|
|
|
-#line 0 "bn_mp_to_unsigned_bin.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5532,7 +5449,6 @@ mp_to_unsigned_bin (mp_int * a, unsigned char *b)
|
|
|
/* End: bn_mp_to_unsigned_bin.c */
|
|
|
|
|
|
/* Start: bn_mp_toom_mul.c */
|
|
|
-#line 0 "bn_mp_toom_mul.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -5810,7 +5726,6 @@ ERR:
|
|
|
/* End: bn_mp_toom_mul.c */
|
|
|
|
|
|
/* Start: bn_mp_toom_sqr.c */
|
|
|
-#line 0 "bn_mp_toom_sqr.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -6035,7 +5950,6 @@ ERR:
|
|
|
/* End: bn_mp_toom_sqr.c */
|
|
|
|
|
|
/* Start: bn_mp_unsigned_bin_size.c */
|
|
|
-#line 0 "bn_mp_unsigned_bin_size.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -6063,7 +5977,6 @@ mp_unsigned_bin_size (mp_int * a)
|
|
|
/* End: bn_mp_unsigned_bin_size.c */
|
|
|
|
|
|
/* Start: bn_mp_xor.c */
|
|
|
-#line 0 "bn_mp_xor.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -6113,7 +6026,6 @@ mp_xor (mp_int * a, mp_int * b, mp_int * c)
|
|
|
/* End: bn_mp_xor.c */
|
|
|
|
|
|
/* Start: bn_mp_zero.c */
|
|
|
-#line 0 "bn_mp_zero.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -6142,7 +6054,6 @@ mp_zero (mp_int * a)
|
|
|
/* End: bn_mp_zero.c */
|
|
|
|
|
|
/* Start: bn_prime_tab.c */
|
|
|
-#line 0 "bn_prime_tab.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -6202,7 +6113,6 @@ const mp_digit __prime_tab[] = {
|
|
|
/* End: bn_prime_tab.c */
|
|
|
|
|
|
/* Start: bn_radix.c */
|
|
|
-#line 0 "bn_radix.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -6429,7 +6339,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream)
|
|
|
/* End: bn_radix.c */
|
|
|
|
|
|
/* Start: bn_reverse.c */
|
|
|
-#line 0 "bn_reverse.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -6467,7 +6376,6 @@ bn_reverse (unsigned char *s, int len)
|
|
|
/* End: bn_reverse.c */
|
|
|
|
|
|
/* Start: bn_s_mp_add.c */
|
|
|
-#line 0 "bn_s_mp_add.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -6575,7 +6483,6 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c)
|
|
|
/* End: bn_s_mp_add.c */
|
|
|
|
|
|
/* Start: bn_s_mp_exptmod.c */
|
|
|
-#line 0 "bn_s_mp_exptmod.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -6796,7 +6703,6 @@ __M:
|
|
|
/* End: bn_s_mp_exptmod.c */
|
|
|
|
|
|
/* Start: bn_s_mp_mul_digs.c */
|
|
|
-#line 0 "bn_s_mp_mul_digs.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -6886,7 +6792,6 @@ s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
|
|
/* End: bn_s_mp_mul_digs.c */
|
|
|
|
|
|
/* Start: bn_s_mp_mul_high_digs.c */
|
|
|
-#line 0 "bn_s_mp_mul_high_digs.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -6963,7 +6868,6 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
|
|
/* End: bn_s_mp_mul_high_digs.c */
|
|
|
|
|
|
/* Start: bn_s_mp_sqr.c */
|
|
|
-#line 0 "bn_s_mp_sqr.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -7005,7 +6909,7 @@ s_mp_sqr (mp_int * a, mp_int * b)
|
|
|
t.dp[2*ix] = (mp_digit) (r & ((mp_word) MP_MASK));
|
|
|
|
|
|
/* get the carry */
|
|
|
- u = (r >> ((mp_word) DIGIT_BIT));
|
|
|
+ u = (mp_digit)(r >> ((mp_word) DIGIT_BIT));
|
|
|
|
|
|
/* left hand side of A[ix] * A[iy] */
|
|
|
tmpx = a->dp[ix];
|
|
@@ -7026,13 +6930,13 @@ s_mp_sqr (mp_int * a, mp_int * b)
|
|
|
*tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK));
|
|
|
|
|
|
/* get carry */
|
|
|
- u = (r >> ((mp_word) DIGIT_BIT));
|
|
|
+ u = (mp_digit)(r >> ((mp_word) DIGIT_BIT));
|
|
|
}
|
|
|
/* propagate upwards */
|
|
|
while (u != ((mp_digit) 0)) {
|
|
|
r = ((mp_word) * tmpt) + ((mp_word) u);
|
|
|
*tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK));
|
|
|
- u = (r >> ((mp_word) DIGIT_BIT));
|
|
|
+ u = (mp_digit)(r >> ((mp_word) DIGIT_BIT));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -7045,7 +6949,6 @@ s_mp_sqr (mp_int * a, mp_int * b)
|
|
|
/* End: bn_s_mp_sqr.c */
|
|
|
|
|
|
/* Start: bn_s_mp_sub.c */
|
|
|
-#line 0 "bn_s_mp_sub.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|
|
@@ -7133,7 +7036,6 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
|
|
/* End: bn_s_mp_sub.c */
|
|
|
|
|
|
/* Start: bncore.c */
|
|
|
-#line 0 "bncore.c"
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
|
|
*
|
|
|
* LibTomMath is library that provides for multiple-precision
|