added libtommath-0.36

This commit is contained in:
Tom St Denis 2005-08-01 16:37:28 +00:00 committed by Steffen Jaeckel
parent fdfa2f4f50
commit 9294e79150
159 changed files with 1588 additions and 475 deletions

16
TODO
View File

@ -1,16 +0,0 @@
things for book in order of importance...
- Fix up pseudo-code [only] for combas that are not consistent with source
- Start in chapter 3 [basics] and work up...
- re-write to prose [less abrupt]
- clean up pseudo code [spacing]
- more examples where appropriate and figures
Goal:
- Get sync done by mid January [roughly 8-12 hours work]
- Finish ch3-6 by end of January [roughly 12-16 hours of work]
- Finish ch7-end by mid Feb [roughly 20-24 hours of work].
Goal isn't "first edition" but merely cleaner to read.

BIN
bn.pdf

Binary file not shown.

2
bn.tex
View File

@ -49,7 +49,7 @@
\begin{document} \begin{document}
\frontmatter \frontmatter
\pagestyle{empty} \pagestyle{empty}
\title{LibTomMath User Manual \\ v0.35} \title{LibTomMath User Manual \\ v0.36}
\author{Tom St Denis \\ tomstdenis@iahu.ca} \author{Tom St Denis \\ tomstdenis@iahu.ca}
\maketitle \maketitle
This text, the library and the accompanying textbook are all hereby placed in the public domain. This book has been This text, the library and the accompanying textbook are all hereby placed in the public domain. This book has been

View File

@ -41,3 +41,7 @@ char *mp_error_to_string(int code)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -142,3 +142,7 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL);
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -166,3 +166,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -70,6 +70,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
/* execute loop */ /* execute loop */
for (iz = 0; iz < iy; ++iz) { for (iz = 0; iz < iy; ++iz) {
_W += ((mp_word)*tmpx++)*((mp_word)*tmpy--); _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--);
} }
/* store term */ /* store term */
@ -103,3 +104,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -95,3 +95,7 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -108,3 +108,7 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -42,3 +42,7 @@ mp_2expt (mp_int * a, int b)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -37,3 +37,7 @@ mp_abs (mp_int * a, mp_int * b)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -47,3 +47,7 @@ int mp_add (mp_int * a, mp_int * b, mp_int * c)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -103,3 +103,7 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -35,3 +35,7 @@ mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -51,3 +51,7 @@ mp_and (mp_int * a, mp_int * b, mp_int * c)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -38,3 +38,7 @@ mp_clamp (mp_int * a)
} }
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -38,3 +38,7 @@ mp_clear (mp_int * a)
} }
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -28,3 +28,7 @@ void mp_clear_multi(mp_int *mp, ...)
va_end(args); va_end(args);
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -37,3 +37,7 @@ mp_cmp (mp_int * a, mp_int * b)
} }
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -38,3 +38,7 @@ int mp_cmp_d(mp_int * a, mp_digit b)
} }
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -49,3 +49,7 @@ int mp_cmp_mag (mp_int * a, mp_int * b)
return MP_EQ; return MP_EQ;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -47,3 +47,7 @@ int mp_cnt_lsb(mp_int *a)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -62,3 +62,7 @@ mp_copy (mp_int * a, mp_int * b)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -39,3 +39,7 @@ mp_count_bits (mp_int * a)
return r; return r;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -286,3 +286,7 @@ LBL_Q:mp_clear (&q);
#endif #endif
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -62,3 +62,7 @@ int mp_div_2(mp_int * a, mp_int * b)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -91,3 +91,7 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -73,3 +73,7 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digit * d)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -104,3 +104,7 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -37,3 +37,7 @@ int mp_dr_is_modulus(mp_int *a)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -88,3 +88,7 @@ top:
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -26,3 +26,7 @@ void mp_dr_setup(mp_int *a, mp_digit *d)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -28,3 +28,7 @@ mp_exch (mp_int * a, mp_int * b)
*b = t; *b = t;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -51,3 +51,7 @@ int mp_expt_d (mp_int * a, mp_digit b, mp_int * c)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -66,7 +66,7 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
} }
/* modified diminished radix reduction */ /* modified diminished radix reduction */
#if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) #if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) && defined(BN_S_MP_EXPTMOD_C)
if (mp_reduce_is_2k_l(P) == MP_YES) { if (mp_reduce_is_2k_l(P) == MP_YES) {
return s_mp_exptmod(G, X, P, Y, 1); return s_mp_exptmod(G, X, P, Y, 1);
} }
@ -106,3 +106,7 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -315,3 +315,7 @@ LBL_M:
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -76,3 +76,7 @@ _ERR: mp_clear_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL
return err; return err;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -61,3 +61,7 @@ int mp_fread(mp_int *a, int radix, FILE *stream)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -46,3 +46,7 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -107,3 +107,7 @@ LBL_U:mp_clear (&v);
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -39,3 +39,7 @@ unsigned long mp_get_int(mp_int * a)
return res & 0xFFFFFFFFUL; return res & 0xFFFFFFFFUL;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -51,3 +51,7 @@ int mp_grow (mp_int * a, int size)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -40,3 +40,7 @@ int mp_init (mp_int * a)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -26,3 +26,7 @@ int mp_init_copy (mp_int * a, mp_int * b)
return mp_copy (b, a); return mp_copy (b, a);
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -53,3 +53,7 @@ int mp_init_multi(mp_int *mp, ...)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -26,3 +26,7 @@ int mp_init_set (mp_int * a, mp_digit b)
return err; return err;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -25,3 +25,7 @@ int mp_init_set_int (mp_int * a, unsigned long b)
return mp_set_int(a, b); return mp_set_int(a, b);
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -42,3 +42,7 @@ int mp_init_size (mp_int * a, int size)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -37,3 +37,7 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c)
return MP_VAL; return MP_VAL;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -169,3 +169,7 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL);
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -103,3 +103,7 @@ ERR:mp_clear(&t);
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -99,3 +99,7 @@ LBL_A1:mp_clear (&a1);
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -26,12 +26,12 @@
* b = b1 * B**n + b0 * b = b1 * B**n + b0
* *
* Then, a * b => * Then, a * b =>
a1b1 * B**2n + ((a1 - a0)(b1 - b0) + a0b0 + a1b1) * B + a0b0 a1b1 * B**2n + ((a1 + a0)(b1 + b0) - (a0b0 + a1b1)) * B + a0b0
* *
* Note that a1b1 and a0b0 are used twice and only need to be * Note that a1b1 and a0b0 are used twice and only need to be
* computed once. So in total three half size (half # of * computed once. So in total three half size (half # of
* digit) multiplications are performed, a0b0, a1b1 and * digit) multiplications are performed, a0b0, a1b1 and
* (a1-b1)(a0-b0) * (a1+b1)(a0+b0)
* *
* Note that a multiplication of half the digits requires * Note that a multiplication of half the digits requires
* 1/4th the number of single precision multiplications so in * 1/4th the number of single precision multiplications so in
@ -122,19 +122,19 @@ int mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c)
if (mp_mul (&x1, &y1, &x1y1) != MP_OKAY) if (mp_mul (&x1, &y1, &x1y1) != MP_OKAY)
goto X1Y1; /* x1y1 = x1*y1 */ goto X1Y1; /* x1y1 = x1*y1 */
/* now calc x1-x0 and y1-y0 */ /* now calc x1+x0 and y1+y0 */
if (mp_sub (&x1, &x0, &t1) != MP_OKAY) if (s_mp_add (&x1, &x0, &t1) != MP_OKAY)
goto X1Y1; /* t1 = x1 - x0 */ goto X1Y1; /* t1 = x1 - x0 */
if (mp_sub (&y1, &y0, &x0) != MP_OKAY) if (s_mp_add (&y1, &y0, &x0) != MP_OKAY)
goto X1Y1; /* t2 = y1 - y0 */ goto X1Y1; /* t2 = y1 - y0 */
if (mp_mul (&t1, &x0, &t1) != MP_OKAY) if (mp_mul (&t1, &x0, &t1) != MP_OKAY)
goto X1Y1; /* t1 = (x1 - x0) * (y1 - y0) */ goto X1Y1; /* t1 = (x1 + x0) * (y1 + y0) */
/* add x0y0 */ /* add x0y0 */
if (mp_add (&x0y0, &x1y1, &x0) != MP_OKAY) if (mp_add (&x0y0, &x1y1, &x0) != MP_OKAY)
goto X1Y1; /* t2 = x0y0 + x1y1 */ goto X1Y1; /* t2 = x0y0 + x1y1 */
if (mp_sub (&x0, &t1, &t1) != MP_OKAY) if (s_mp_sub (&t1, &x0, &t1) != MP_OKAY)
goto X1Y1; /* t1 = x0y0 + x1y1 - (x1-x0)*(y1-y0) */ goto X1Y1; /* t1 = (x1+x0)*(y1+y0) - (x1y1 + x0y0) */
/* shift by B */ /* shift by B */
if (mp_lshd (&t1, B) != MP_OKAY) if (mp_lshd (&t1, B) != MP_OKAY)
@ -161,3 +161,7 @@ ERR:
return err; return err;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -80,8 +80,8 @@ int mp_karatsuba_sqr (mp_int * a, mp_int * b)
if (mp_sqr (&x1, &x1x1) != MP_OKAY) if (mp_sqr (&x1, &x1x1) != MP_OKAY)
goto X1X1; /* x1x1 = x1*x1 */ goto X1X1; /* x1x1 = x1*x1 */
/* now calc (x1-x0)**2 */ /* now calc (x1+x0)**2 */
if (mp_sub (&x1, &x0, &t1) != MP_OKAY) if (s_mp_add (&x1, &x0, &t1) != MP_OKAY)
goto X1X1; /* t1 = x1 - x0 */ goto X1X1; /* t1 = x1 - x0 */
if (mp_sqr (&t1, &t1) != MP_OKAY) if (mp_sqr (&t1, &t1) != MP_OKAY)
goto X1X1; /* t1 = (x1 - x0) * (x1 - x0) */ goto X1X1; /* t1 = (x1 - x0) * (x1 - x0) */
@ -89,8 +89,8 @@ int mp_karatsuba_sqr (mp_int * a, mp_int * b)
/* add x0y0 */ /* add x0y0 */
if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY) if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY)
goto X1X1; /* t2 = x0x0 + x1x1 */ goto X1X1; /* t2 = x0x0 + x1x1 */
if (mp_sub (&t2, &t1, &t1) != MP_OKAY) if (s_mp_sub (&t1, &t2, &t1) != MP_OKAY)
goto X1X1; /* t1 = x0x0 + x1x1 - (x1-x0)*(x1-x0) */ goto X1X1; /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */
/* shift by B */ /* shift by B */
if (mp_lshd (&t1, B) != MP_OKAY) if (mp_lshd (&t1, B) != MP_OKAY)
@ -115,3 +115,7 @@ ERR:
return err; return err;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -54,3 +54,7 @@ LBL_T:
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -61,3 +61,7 @@ int mp_lshd (mp_int * a, int b)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -42,3 +42,7 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c)
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -49,3 +49,7 @@ mp_mod_2d (mp_int * a, int b, mp_int * c)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -21,3 +21,7 @@ mp_mod_d (mp_int * a, mp_digit b, mp_digit * c)
return mp_div_d(a, b, NULL, c); return mp_div_d(a, b, NULL, c);
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -53,3 +53,7 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -112,3 +112,7 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -53,3 +53,7 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -60,3 +60,7 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c)
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -76,3 +76,7 @@ int mp_mul_2(mp_int * a, mp_int * b)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -79,3 +79,7 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -73,3 +73,7 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -16,8 +16,7 @@
*/ */
/* d = a * b (mod c) */ /* d = a * b (mod c) */
int int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
{ {
int res; int res;
mp_int t; mp_int t;
@ -35,3 +34,7 @@ mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -126,3 +126,7 @@ LBL_T1:mp_clear (&t1);
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -34,3 +34,7 @@ int mp_neg (mp_int * a, mp_int * b)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -44,3 +44,7 @@ int mp_or (mp_int * a, mp_int * b, mp_int * c)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -56,3 +56,7 @@ LBL_T:mp_clear (&t);
return err; return err;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -44,3 +44,7 @@ int mp_prime_is_divisible (mp_int * a, int *result)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -77,3 +77,7 @@ LBL_B:mp_clear (&b);
return err; return err;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -97,3 +97,7 @@ LBL_N1:mp_clear (&n1);
return err; return err;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -164,3 +164,7 @@ LBL_ERR:
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -46,3 +46,7 @@ int mp_prime_rabin_miller_trials(int size)
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -62,9 +62,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback
maskOR_msb = 0; maskOR_msb = 0;
maskOR_msb_offset = ((size & 7) == 1) ? 1 : 0; maskOR_msb_offset = ((size & 7) == 1) ? 1 : 0;
if (flags & LTM_PRIME_2MSB_ON) { if (flags & LTM_PRIME_2MSB_ON) {
maskOR_msb |= 1 << ((size - 2) & 7); maskOR_msb |= 0x80 >> ((9 - size) & 7);
} else if (flags & LTM_PRIME_2MSB_OFF) {
maskAND &= ~(1 << ((size - 2) & 7));
} }
/* get the maskOR_lsb */ /* get the maskOR_lsb */
@ -121,3 +119,7 @@ error:
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -72,3 +72,7 @@ int mp_radix_size (mp_int * a, int radix, int *size)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -18,3 +18,7 @@
/* chars used in radix conversions */ /* chars used in radix conversions */
const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -49,3 +49,7 @@ mp_rand (mp_int * a, int digits)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -76,3 +76,7 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -16,8 +16,7 @@
*/ */
/* read signed bin, big endian, first byte is 0==positive or 1==negative */ /* read signed bin, big endian, first byte is 0==positive or 1==negative */
int int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c)
mp_read_signed_bin (mp_int * a, unsigned char *b, int c)
{ {
int res; int res;
@ -36,3 +35,7 @@ mp_read_signed_bin (mp_int * a, unsigned char *b, int c)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -16,8 +16,7 @@
*/ */
/* reads a unsigned char array, assumes the msb is stored first [big endian] */ /* reads a unsigned char array, assumes the msb is stored first [big endian] */
int int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c)
mp_read_unsigned_bin (mp_int * a, unsigned char *b, int c)
{ {
int res; int res;
@ -50,3 +49,7 @@ mp_read_unsigned_bin (mp_int * a, unsigned char *b, int c)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -94,3 +94,7 @@ CLEANUP:
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -55,3 +55,7 @@ ERR:
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -56,3 +56,7 @@ ERR:
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -41,3 +41,7 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -38,3 +38,7 @@ ERR:
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -46,3 +46,7 @@ int mp_reduce_is_2k(mp_int *a)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -38,3 +38,7 @@ int mp_reduce_is_2k_l(mp_int *a)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -28,3 +28,7 @@ int mp_reduce_setup (mp_int * a, mp_int * b)
return mp_div (a, b, a, NULL); return mp_div (a, b, a, NULL);
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -66,3 +66,7 @@ void mp_rshd (mp_int * a, int b)
a->used -= b; a->used -= b;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -23,3 +23,7 @@ void mp_set (mp_int * a, mp_digit b)
a->used = (a->dp[0] != 0) ? 1 : 0; a->used = (a->dp[0] != 0) ? 1 : 0;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -42,3 +42,7 @@ int mp_set_int (mp_int * a, unsigned long b)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -29,3 +29,7 @@ int mp_shrink (mp_int * a)
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -21,3 +21,7 @@ int mp_signed_bin_size (mp_int * a)
return 1 + mp_unsigned_bin_size (a); return 1 + mp_unsigned_bin_size (a);
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -52,3 +52,7 @@ if (a->used >= KARATSUBA_SQR_CUTOFF) {
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -35,3 +35,7 @@ mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
return res; return res;
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -75,3 +75,7 @@ E2: mp_clear(&t1);
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -53,3 +53,7 @@ mp_sub (mp_int * a, mp_int * b, mp_int * c)
} }
#endif #endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

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