Classes | Defines | Typedefs | Functions
libtommath.c File Reference

Go to the source code of this file.

Classes

struct  mp_int

Defines

#define BN_MP_ABS_C
#define BN_MP_CLEAR_MULTI_C
#define BN_MP_DIV_SMALL
#define BN_MP_INIT_MULTI_C
#define BN_MP_INVMOD_C
#define BN_MP_INVMOD_SLOW_C
#define BN_S_MP_EXPTMOD_C
#define BN_S_MP_MUL_DIGS_C
#define BN_S_MP_MUL_HIGH_DIGS_C
#define BN_S_MP_SQR_C
#define CHAR_BIT   8
#define DIGIT_BIT   28
#define LTM_NO_NEG_EXP
#define MAX(x, y)   ((x)>(y)?(x):(y))
#define MIN(x, y)   ((x)<(y)?(x):(y))
#define MP_28BIT
#define MP_EQ   0 /* equal to */
#define MP_GT   1 /* greater than */
#define mp_iseven(a)   (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
#define mp_isodd(a)   (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
#define mp_iszero(a)   (((a)->used == 0) ? MP_YES : MP_NO)
#define MP_LOW_MEM
#define MP_LT   -1 /* less than */
#define MP_MASK   ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1))
#define MP_MEM   -2 /* out of mem */
#define MP_NEG   1 /* negative */
#define MP_NO   0 /* no response */
#define MP_OKAY   0 /* ok result */
#define MP_PREC   8 /* default digits of precision */
#define MP_VAL   -3 /* invalid input */
#define MP_WARRAY   (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1))
#define MP_YES   1 /* yes response */
#define MP_ZPOS   0 /* positive integer */
#define OPT_CAST(x)
#define s_mp_mul(a, b, c)   s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
#define TAB_SIZE   32
#define XFREE   os_free
#define XMALLOC   os_malloc
#define XREALLOC   os_realloc

Typedefs

typedef unsigned long mp_digit
typedef int mp_err
typedef u64 mp_word

Functions

static void bn_reverse (unsigned char *s, int len)
static int fast_s_mp_mul_digs (mp_int *a, mp_int *b, mp_int *c, int digs)
static int mp_2expt (mp_int *a, int b)
static int mp_abs (mp_int *a, mp_int *b)
static int mp_add (mp_int *a, mp_int *b, mp_int *c)
static void mp_clamp (mp_int *a)
static void mp_clear (mp_int *a)
static void mp_clear_multi (mp_int *mp,...)
static int mp_cmp (mp_int *a, mp_int *b)
static int mp_cmp_d (mp_int *a, mp_digit b)
static int mp_cmp_mag (mp_int *a, mp_int *b)
static int mp_copy (mp_int *a, mp_int *b)
static int mp_count_bits (mp_int *a)
static int mp_div (mp_int *a, mp_int *b, mp_int *c, mp_int *d)
static int mp_div_2d (mp_int *a, int b, mp_int *c, mp_int *d)
static void mp_exch (mp_int *a, mp_int *b)
static int mp_exptmod (mp_int *G, mp_int *X, mp_int *P, mp_int *Y)
static int mp_grow (mp_int *a, int size)
static int mp_init (mp_int *a)
static int mp_init_copy (mp_int *a, mp_int *b)
static int mp_init_multi (mp_int *mp,...)
static int mp_init_size (mp_int *a, int size)
static int mp_lshd (mp_int *a, int b)
static int mp_mod (mp_int *a, mp_int *b, mp_int *c)
static int mp_mod_2d (mp_int *a, int b, mp_int *c)
static int mp_mul (mp_int *a, mp_int *b, mp_int *c)
static int mp_mul_2d (mp_int *a, int b, mp_int *c)
static int mp_mulmod (mp_int *a, mp_int *b, mp_int *c, mp_int *d)
static int mp_read_unsigned_bin (mp_int *a, const unsigned char *b, int c)
static int mp_reduce (mp_int *x, mp_int *m, mp_int *mu)
static int mp_reduce_2k_l (mp_int *a, mp_int *n, mp_int *d)
static int mp_reduce_2k_setup_l (mp_int *a, mp_int *d)
static int mp_reduce_setup (mp_int *a, mp_int *b)
static void mp_rshd (mp_int *a, int b)
static void mp_set (mp_int *a, mp_digit b)
static int mp_sqr (mp_int *a, mp_int *b)
static int mp_sub (mp_int *a, mp_int *b, mp_int *c)
static int mp_to_unsigned_bin (mp_int *a, unsigned char *b)
static int mp_unsigned_bin_size (mp_int *a)
static void mp_zero (mp_int *a)
static int s_mp_add (mp_int *a, mp_int *b, mp_int *c)
static int s_mp_exptmod (mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode)
static int s_mp_mul_digs (mp_int *a, mp_int *b, mp_int *c, int digs)
static int s_mp_mul_high_digs (mp_int *a, mp_int *b, mp_int *c, int digs)
static int s_mp_sqr (mp_int *a, mp_int *b)
static int s_mp_sub (mp_int *a, mp_int *b, mp_int *c)

Define Documentation

#define BN_MP_ABS_C

Definition at line 48 of file libtommath.c.

Definition at line 47 of file libtommath.c.

#define BN_MP_DIV_SMALL

Definition at line 45 of file libtommath.c.

Definition at line 46 of file libtommath.c.

#define BN_MP_INVMOD_C

Definition at line 21 of file libtommath.c.

Definition at line 24 of file libtommath.c.

Value:
/* Note: #undef in tommath_superclass.h; this would
                           * require BN_MP_EXPTMOD_FAST_C instead */

Definition at line 22 of file libtommath.c.

Definition at line 23 of file libtommath.c.

Value:
/* Note: #undef in tommath_superclass.h; this
                                 * would require other than mp_reduce */

Definition at line 26 of file libtommath.c.

#define BN_S_MP_SQR_C

Definition at line 25 of file libtommath.c.

#define CHAR_BIT   8

Definition at line 18 of file libtommath.c.

#define DIGIT_BIT   28

Definition at line 70 of file libtommath.c.

#define LTM_NO_NEG_EXP

Definition at line 53 of file libtommath.c.

#define MAX (   x,
  y 
)    ((x)>(y)?(x):(y))

Definition at line 62 of file libtommath.c.

#define MIN (   x,
  y 
)    ((x)<(y)?(x):(y))

Definition at line 58 of file libtommath.c.

#define MP_28BIT

Definition at line 71 of file libtommath.c.

#define MP_EQ   0 /* equal to */

Definition at line 82 of file libtommath.c.

#define MP_GT   1 /* greater than */

Definition at line 83 of file libtommath.c.

#define mp_iseven (   a)    (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)

Definition at line 121 of file libtommath.c.

#define mp_isodd (   a)    (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)

Definition at line 122 of file libtommath.c.

#define mp_iszero (   a)    (((a)->used == 0) ? MP_YES : MP_NO)

Definition at line 120 of file libtommath.c.

#define MP_LOW_MEM

Definition at line 98 of file libtommath.c.

#define MP_LT   -1 /* less than */

Definition at line 81 of file libtommath.c.

#define MP_MASK   ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1))

Definition at line 79 of file libtommath.c.

#define MP_MEM   -2 /* out of mem */

Definition at line 89 of file libtommath.c.

#define MP_NEG   1 /* negative */

Definition at line 86 of file libtommath.c.

#define MP_NO   0 /* no response */

Definition at line 93 of file libtommath.c.

#define MP_OKAY   0 /* ok result */

Definition at line 88 of file libtommath.c.

#define MP_PREC   8 /* default digits of precision */

Definition at line 105 of file libtommath.c.

#define MP_VAL   -3 /* invalid input */

Definition at line 90 of file libtommath.c.

#define MP_WARRAY   (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1))

Definition at line 110 of file libtommath.c.

#define MP_YES   1 /* yes response */

Definition at line 92 of file libtommath.c.

#define MP_ZPOS   0 /* positive integer */

Definition at line 85 of file libtommath.c.

#define OPT_CAST (   x)

Definition at line 65 of file libtommath.c.

#define s_mp_mul (   a,
  b,
 
)    s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)

Definition at line 126 of file libtommath.c.

#define TAB_SIZE   32

Definition at line 1861 of file libtommath.c.

#define XFREE   os_free

Definition at line 75 of file libtommath.c.

#define XMALLOC   os_malloc

Definition at line 74 of file libtommath.c.

#define XREALLOC   os_realloc

Definition at line 76 of file libtommath.c.


Typedef Documentation

typedef unsigned long mp_digit

Definition at line 67 of file libtommath.c.

typedef int mp_err

Definition at line 95 of file libtommath.c.

typedef u64 mp_word

Definition at line 68 of file libtommath.c.


Function Documentation

static void bn_reverse ( unsigned char *  s,
int  len 
) [static]

Definition at line 187 of file libtommath.c.

static int fast_s_mp_mul_digs ( mp_int a,
mp_int b,
mp_int c,
int  digs 
) [static]

Definition at line 2406 of file libtommath.c.

static int mp_2expt ( mp_int a,
int  b 
) [static]

Definition at line 2201 of file libtommath.c.

static int mp_abs ( mp_int a,
mp_int b 
) [static]

Definition at line 1287 of file libtommath.c.

static int mp_add ( mp_int a,
mp_int b,
mp_int c 
) [static]

Definition at line 409 of file libtommath.c.

static void mp_clamp ( mp_int a) [static]

Definition at line 1229 of file libtommath.c.

static void mp_clear ( mp_int a) [static]

Definition at line 386 of file libtommath.c.

static void mp_clear_multi ( mp_int mp,
  ... 
) [static]

Definition at line 1470 of file libtommath.c.

static int mp_cmp ( mp_int a,
mp_int b 
) [static]

Definition at line 668 of file libtommath.c.

static int mp_cmp_d ( mp_int a,
mp_digit  b 
) [static]

Definition at line 690 of file libtommath.c.

static int mp_cmp_mag ( mp_int a,
mp_int b 
) [static]

Definition at line 909 of file libtommath.c.

static int mp_copy ( mp_int a,
mp_int b 
) [static]

Definition at line 1111 of file libtommath.c.

static int mp_count_bits ( mp_int a) [static]

Definition at line 1532 of file libtommath.c.

static int mp_div ( mp_int a,
mp_int b,
mp_int c,
mp_int d 
) [static]

Definition at line 1592 of file libtommath.c.

static int mp_div_2d ( mp_int a,
int  b,
mp_int c,
mp_int d 
) [static]

Definition at line 1007 of file libtommath.c.

static void mp_exch ( mp_int a,
mp_int b 
) [static]

Definition at line 1212 of file libtommath.c.

static int mp_exptmod ( mp_int G,
mp_int X,
mp_int P,
mp_int Y 
) [static]

Definition at line 576 of file libtommath.c.

static int mp_grow ( mp_int a,
int  size 
) [static]

Definition at line 1246 of file libtommath.c.

static int mp_init ( mp_int a) [static]

Definition at line 360 of file libtommath.c.

static int mp_init_copy ( mp_int a,
mp_int b 
) [static]

Definition at line 1083 of file libtommath.c.

static int mp_init_multi ( mp_int mp,
  ... 
) [static]

Definition at line 1431 of file libtommath.c.

static int mp_init_size ( mp_int a,
int  size 
) [static]

Definition at line 2478 of file libtommath.c.

static int mp_lshd ( mp_int a,
int  b 
) [static]

Definition at line 1485 of file libtommath.c.

static int mp_mod ( mp_int a,
mp_int b,
mp_int c 
) [static]

Definition at line 545 of file libtommath.c.

static int mp_mod_2d ( mp_int a,
int  b,
mp_int c 
) [static]

Definition at line 1556 of file libtommath.c.

static int mp_mul ( mp_int a,
mp_int b,
mp_int c 
) [static]

Definition at line 478 of file libtommath.c.

static int mp_mul_2d ( mp_int a,
int  b,
mp_int c 
) [static]

Definition at line 1366 of file libtommath.c.

static int mp_mulmod ( mp_int a,
mp_int b,
mp_int c,
mp_int d 
) [static]

Definition at line 525 of file libtommath.c.

static int mp_read_unsigned_bin ( mp_int a,
const unsigned char *  b,
int  c 
) [static]

Definition at line 944 of file libtommath.c.

static int mp_reduce ( mp_int x,
mp_int m,
mp_int mu 
) [static]

Definition at line 2241 of file libtommath.c.

static int mp_reduce_2k_l ( mp_int a,
mp_int n,
mp_int d 
) [static]

Definition at line 2135 of file libtommath.c.

static int mp_reduce_2k_setup_l ( mp_int a,
mp_int d 
) [static]

Definition at line 2173 of file libtommath.c.

static int mp_reduce_setup ( mp_int a,
mp_int b 
) [static]

Definition at line 2226 of file libtommath.c.

static void mp_rshd ( mp_int a,
int  b 
) [static]

Definition at line 1158 of file libtommath.c.

static void mp_set ( mp_int a,
mp_digit  b 
) [static]

Definition at line 1307 of file libtommath.c.

static int mp_sqr ( mp_int a,
mp_int b 
) [static]

Definition at line 2094 of file libtommath.c.

static int mp_sub ( mp_int a,
mp_int b,
mp_int c 
) [static]

Definition at line 441 of file libtommath.c.

static int mp_to_unsigned_bin ( mp_int a,
unsigned char *  b 
) [static]

Definition at line 979 of file libtommath.c.

static int mp_unsigned_bin_size ( mp_int a) [static]

Definition at line 744 of file libtommath.c.

static void mp_zero ( mp_int a) [static]

Definition at line 1095 of file libtommath.c.

static int s_mp_add ( mp_int a,
mp_int b,
mp_int c 
) [static]

Definition at line 205 of file libtommath.c.

static int s_mp_exptmod ( mp_int G,
mp_int X,
mp_int P,
mp_int Y,
int  redmode 
) [static]

Definition at line 1866 of file libtommath.c.

static int s_mp_mul_digs ( mp_int a,
mp_int b,
mp_int c,
int  digs 
) [static]

Definition at line 2324 of file libtommath.c.

static int s_mp_mul_high_digs ( mp_int a,
mp_int b,
mp_int c,
int  digs 
) [static]

Definition at line 2572 of file libtommath.c.

static int s_mp_sqr ( mp_int a,
mp_int b 
) [static]

Definition at line 2506 of file libtommath.c.

static int s_mp_sub ( mp_int a,
mp_int b,
mp_int c 
) [static]

Definition at line 293 of file libtommath.c.



wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:33:24