Skip to content
Snippets Groups Projects
Commit 364fb601 authored by Matt Johnston's avatar Matt Johnston
Browse files

Update to libtommath v1.0

parent a79b6151
No related branches found
No related tags found
No related merge requests found
Showing
with 163 additions and 160 deletions
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_PRIME_MILLER_RABIN_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* Miller-Rabin test of "a" to the base of "b" as described in
Loading
Loading
@@ -67,10 +67,10 @@ int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result)
}
 
/* if y != 1 and y != n1 do */
if (mp_cmp_d (&y, 1) != MP_EQ && mp_cmp (&y, &n1) != MP_EQ) {
if ((mp_cmp_d (&y, 1) != MP_EQ) && (mp_cmp (&y, &n1) != MP_EQ)) {
j = 1;
/* while j <= s-1 and y != n1 */
while ((j <= (s - 1)) && mp_cmp (&y, &n1) != MP_EQ) {
while ((j <= (s - 1)) && (mp_cmp (&y, &n1) != MP_EQ)) {
if ((err = mp_sqrmod (&y, a, &y)) != MP_OKAY) {
goto LBL_Y;
}
Loading
Loading
@@ -98,6 +98,6 @@ LBL_N1:mp_clear (&n1);
}
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_prime_miller_rabin.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_PRIME_NEXT_PRIME_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* finds the next prime after the number "a" using "t" trials
Loading
Loading
@@ -22,12 +22,12 @@
*/
int mp_prime_next_prime(mp_int *a, int t, int bbs_style)
{
int err, res, x, y;
int err, res = MP_NO, x, y;
mp_digit res_tab[PRIME_SIZE], step, kstep;
mp_int b;
 
/* ensure t is valid */
if (t <= 0 || t > PRIME_SIZE) {
if ((t <= 0) || (t > PRIME_SIZE)) {
return MP_VAL;
}
 
Loading
Loading
@@ -84,7 +84,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style)
if ((err = mp_sub_d(a, (a->dp[0] & 3) + 1, a)) != MP_OKAY) { return err; };
}
} else {
if (mp_iseven(a) == 1) {
if (mp_iseven(a) == MP_YES) {
/* force odd */
if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) {
return err;
Loading
Loading
@@ -129,7 +129,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style)
y = 1;
}
}
} while (y == 1 && step < ((((mp_digit)1)<<DIGIT_BIT) - kstep));
} while ((y == 1) && (step < ((((mp_digit)1) << DIGIT_BIT) - kstep)));
 
/* add the step */
if ((err = mp_add_d(a, step, a)) != MP_OKAY) {
Loading
Loading
@@ -137,7 +137,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style)
}
 
/* if didn't pass sieve and step == MAX then skip test */
if (y == 1 && step >= ((((mp_digit)1)<<DIGIT_BIT) - kstep)) {
if ((y == 1) && (step >= ((((mp_digit)1) << DIGIT_BIT) - kstep))) {
continue;
}
 
Loading
Loading
@@ -165,6 +165,6 @@ LBL_ERR:
 
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_prime_next_prime.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_PRIME_RABIN_MILLER_TRIALS_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
 
Loading
Loading
@@ -47,6 +47,6 @@ int mp_prime_rabin_miller_trials(int size)
 
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_prime_rabin_miller_trials.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_PRIME_RANDOM_EX_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* makes a truly random prime of a given size (bits),
Loading
Loading
@@ -21,7 +21,6 @@
*
* LTM_PRIME_BBS - make prime congruent to 3 mod 4
* LTM_PRIME_SAFE - make sure (p-1)/2 is prime as well (implies LTM_PRIME_BBS)
* LTM_PRIME_2MSB_OFF - make the 2nd highest bit zero
* LTM_PRIME_2MSB_ON - make the 2nd highest bit one
*
* You have to supply a callback which fills in a buffer with random bytes. "dat" is a parameter you can
Loading
Loading
@@ -37,12 +36,12 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback
int res, err, bsize, maskOR_msb_offset;
 
/* sanity check the input */
if (size <= 1 || t <= 0) {
if ((size <= 1) || (t <= 0)) {
return MP_VAL;
}
 
/* LTM_PRIME_SAFE implies LTM_PRIME_BBS */
if (flags & LTM_PRIME_SAFE) {
if ((flags & LTM_PRIME_SAFE) != 0) {
flags |= LTM_PRIME_BBS;
}
 
Loading
Loading
@@ -61,13 +60,13 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback
/* calc the maskOR_msb */
maskOR_msb = 0;
maskOR_msb_offset = ((size & 7) == 1) ? 1 : 0;
if (flags & LTM_PRIME_2MSB_ON) {
if ((flags & LTM_PRIME_2MSB_ON) != 0) {
maskOR_msb |= 0x80 >> ((9 - size) & 7);
}
 
/* get the maskOR_lsb */
maskOR_lsb = 1;
if (flags & LTM_PRIME_BBS) {
if ((flags & LTM_PRIME_BBS) != 0) {
maskOR_lsb |= 3;
}
 
Loading
Loading
@@ -95,7 +94,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback
continue;
}
 
if (flags & LTM_PRIME_SAFE) {
if ((flags & LTM_PRIME_SAFE) != 0) {
/* see if (a-1)/2 is prime */
if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) { goto error; }
if ((err = mp_div_2(a, a)) != MP_OKAY) { goto error; }
Loading
Loading
@@ -105,7 +104,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback
}
} while (res == MP_NO);
 
if (flags & LTM_PRIME_SAFE) {
if ((flags & LTM_PRIME_SAFE) != 0) {
/* restore a to the original value */
if ((err = mp_mul_2(a, a)) != MP_OKAY) { goto error; }
if ((err = mp_add_d(a, 1, a)) != MP_OKAY) { goto error; }
Loading
Loading
@@ -120,6 +119,6 @@ error:
 
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_prime_random_ex.c,v $ */
/* $Revision: 1.4 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_RADIX_SIZE_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* returns size of ASCII reprensentation */
Loading
Loading
@@ -24,14 +24,8 @@ int mp_radix_size (mp_int * a, int radix, int *size)
 
*size = 0;
 
/* special case for binary */
if (radix == 2) {
*size = mp_count_bits (a) + (a->sign == MP_NEG ? 1 : 0) + 1;
return MP_OKAY;
}
/* make sure the radix is in range */
if (radix < 2 || radix > 64) {
if ((radix < 2) || (radix > 64)) {
return MP_VAL;
}
 
Loading
Loading
@@ -40,6 +34,12 @@ int mp_radix_size (mp_int * a, int radix, int *size)
return MP_OKAY;
}
 
/* special case for binary */
if (radix == 2) {
*size = mp_count_bits (a) + ((a->sign == MP_NEG) ? 1 : 0) + 1;
return MP_OKAY;
}
/* digs is the digit count */
digs = 0;
 
Loading
Loading
@@ -73,6 +73,6 @@ int mp_radix_size (mp_int * a, int radix, int *size)
 
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_radix_size.c,v $ */
/* $Revision: 1.4 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_RADIX_SMAP_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,13 +12,13 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* chars used in radix conversions */
const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_radix_smap.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_RAND_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* makes a pseudo-random int of a given size */
Loading
Loading
@@ -29,7 +29,7 @@ mp_rand (mp_int * a, int digits)
 
/* first place a random non-zero digit */
do {
d = ((mp_digit) abs (rand ())) & MP_MASK;
d = ((mp_digit) abs (MP_GEN_RANDOM())) & MP_MASK;
} while (d == 0);
 
if ((res = mp_add_d (a, d, a)) != MP_OKAY) {
Loading
Loading
@@ -41,7 +41,7 @@ mp_rand (mp_int * a, int digits)
return res;
}
 
if ((res = mp_add_d (a, ((mp_digit) abs (rand ())), a)) != MP_OKAY) {
if ((res = mp_add_d (a, ((mp_digit) abs (MP_GEN_RANDOM())), a)) != MP_OKAY) {
return res;
}
}
Loading
Loading
@@ -50,6 +50,6 @@ mp_rand (mp_int * a, int digits)
}
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_rand.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_READ_RADIX_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* read a string [ASCII] in a given radix */
Loading
Loading
@@ -25,7 +25,7 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
mp_zero(a);
 
/* make sure the radix is ok */
if (radix < 2 || radix > 64) {
if ((radix < 2) || (radix > 64)) {
return MP_VAL;
}
 
Loading
Loading
@@ -43,12 +43,12 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
mp_zero (a);
/* process each digit of the string */
while (*str) {
/* if the radix < 36 the conversion is case insensitive
while (*str != '\0') {
/* if the radix <= 36 the conversion is case insensitive
* this allows numbers like 1AB and 1ab to represent the same value
* [e.g. in hex]
*/
ch = (char) ((radix < 36) ? toupper (*str) : *str);
ch = (radix <= 36) ? (char)toupper((int)*str) : *str;
for (y = 0; y < 64; y++) {
if (ch == mp_s_rmap[y]) {
break;
Loading
Loading
@@ -73,13 +73,13 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
}
/* set the sign only if a != 0 */
if (mp_iszero(a) != 1) {
if (mp_iszero(a) != MP_YES) {
a->sign = neg;
}
return MP_OKAY;
}
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_read_radix.c,v $ */
/* $Revision: 1.4 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_READ_SIGNED_BIN_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* read signed bin, big endian, first byte is 0==positive or 1==negative */
Loading
Loading
@@ -36,6 +36,6 @@ int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c)
}
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_read_signed_bin.c,v $ */
/* $Revision: 1.4 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_READ_UNSIGNED_BIN_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* reads a unsigned char array, assumes the msb is stored first [big endian] */
Loading
Loading
@@ -37,12 +37,12 @@ int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c)
}
 
#ifndef MP_8BIT
a->dp[0] |= *b++;
a->used += 1;
a->dp[0] |= *b++;
a->used += 1;
#else
a->dp[0] = (*b & MP_MASK);
a->dp[1] |= ((*b++ >> 7U) & 1);
a->used += 2;
a->dp[0] = (*b & MP_MASK);
a->dp[1] |= ((*b++ >> 7U) & 1);
a->used += 2;
#endif
}
mp_clamp (a);
Loading
Loading
@@ -50,6 +50,6 @@ int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c)
}
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_read_unsigned_bin.c,v $ */
/* $Revision: 1.4 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,10 +12,10 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* reduces x mod m, assumes 0 < x < m**2, mu is
/* reduces x mod m, assumes 0 < x < m**2, mu is
* precomputed via mp_reduce_setup.
* From HAC pp.604 Algorithm 14.42
*/
Loading
Loading
@@ -30,10 +30,10 @@ int mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
}
 
/* q1 = x / b**(k-1) */
mp_rshd (&q, um - 1);
mp_rshd (&q, um - 1);
 
/* according to HAC this optimization is ok */
if (((unsigned long) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) {
if (((mp_digit) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) {
if ((res = mp_mul (&q, mu, &q)) != MP_OKAY) {
goto CLEANUP;
}
Loading
Loading
@@ -46,8 +46,8 @@ int mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) {
goto CLEANUP;
}
#else
{
#else
{
res = MP_VAL;
goto CLEANUP;
}
Loading
Loading
@@ -55,7 +55,7 @@ int mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
}
 
/* q3 = q2 / b**(k+1) */
mp_rshd (&q, um + 1);
mp_rshd (&q, um + 1);
 
/* x = x mod b**(k+1), quick (no division) */
if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) {
Loading
Loading
@@ -87,7 +87,7 @@ int mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
goto CLEANUP;
}
}
CLEANUP:
mp_clear (&q);
 
Loading
Loading
@@ -95,6 +95,6 @@ CLEANUP:
}
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_reduce.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_2K_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* reduces a modulo n where n is of the form 2**p - d */
Loading
Loading
@@ -20,35 +20,37 @@ int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d)
{
mp_int q;
int p, res;
if ((res = mp_init(&q)) != MP_OKAY) {
return res;
}
p = mp_count_bits(n);
p = mp_count_bits(n);
top:
/* q = a/2**p, a = a mod 2**p */
if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) {
goto ERR;
}
if (d != 1) {
/* q = q * d */
if ((res = mp_mul_d(&q, d, &q)) != MP_OKAY) {
if ((res = mp_mul_d(&q, d, &q)) != MP_OKAY) {
goto ERR;
}
}
/* a = a + q */
if ((res = s_mp_add(a, &q, a)) != MP_OKAY) {
goto ERR;
}
if (mp_cmp_mag(a, n) != MP_LT) {
s_mp_sub(a, n, a);
if ((res = s_mp_sub(a, n, a)) != MP_OKAY) {
goto ERR;
}
goto top;
}
ERR:
mp_clear(&q);
return res;
Loading
Loading
@@ -56,6 +58,6 @@ ERR:
 
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_2k.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_2K_L_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,10 +12,10 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* reduces a modulo n where n is of the form 2**p - d
/* reduces a modulo n where n is of the form 2**p - d
This differs from reduce_2k since "d" can be larger
than a single digit.
*/
Loading
Loading
@@ -23,33 +23,35 @@ int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d)
{
mp_int q;
int p, res;
if ((res = mp_init(&q)) != MP_OKAY) {
return res;
}
p = mp_count_bits(n);
p = mp_count_bits(n);
top:
/* q = a/2**p, a = a mod 2**p */
if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) {
goto ERR;
}
/* q = q * d */
if ((res = mp_mul(&q, d, &q)) != MP_OKAY) {
if ((res = mp_mul(&q, d, &q)) != MP_OKAY) {
goto ERR;
}
/* a = a + q */
if ((res = s_mp_add(a, &q, a)) != MP_OKAY) {
goto ERR;
}
if (mp_cmp_mag(a, n) != MP_LT) {
s_mp_sub(a, n, a);
if ((res = s_mp_sub(a, n, a)) != MP_OKAY) {
goto ERR;
}
goto top;
}
ERR:
mp_clear(&q);
return res;
Loading
Loading
@@ -57,6 +59,6 @@ ERR:
 
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_2k_l.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_2K_SETUP_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* determines the setup value */
Loading
Loading
@@ -42,6 +42,6 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d)
}
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_2k_setup.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_2K_SETUP_L_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* determines the setup value */
Loading
Loading
@@ -39,6 +39,6 @@ ERR:
}
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_2k_setup_l.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_IS_2K_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* determines if mp_reduce_2k can be used */
Loading
Loading
@@ -47,6 +47,6 @@ int mp_reduce_is_2k(mp_int *a)
 
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_is_2k.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_IS_2K_L_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* determines if reduce_2k_l can be used */
Loading
Loading
@@ -39,6 +39,6 @@ int mp_reduce_is_2k_l(mp_int *a)
 
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_is_2k_l.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_REDUCE_SETUP_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* pre-calculate the value required for Barrett reduction
Loading
Loading
@@ -29,6 +29,6 @@ int mp_reduce_setup (mp_int * a, mp_int * b)
}
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_setup.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_RSHD_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* shift right a certain amount of digits */
Loading
Loading
@@ -32,7 +32,7 @@ void mp_rshd (mp_int * a, int b)
}
 
{
register mp_digit *bottom, *top;
mp_digit *bottom, *top;
 
/* shift the digits down */
 
Loading
Loading
@@ -67,6 +67,6 @@ void mp_rshd (mp_int * a, int b)
}
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_rshd.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
#include <tommath.h>
#include <tommath_private.h>
#ifdef BN_MP_SET_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
Loading
Loading
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
 
/* set to a digit */
Loading
Loading
@@ -24,6 +24,6 @@ void mp_set (mp_int * a, mp_digit b)
}
#endif
 
/* $Source: /cvs/libtom/libtommath/bn_mp_set.c,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2006/03/31 14:18:44 $ */
/* $Source$ */
/* $Revision$ */
/* $Date$ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment