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 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
#define MP_GT   1
#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
#define MP_MASK   ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1))
#define MP_MEM   -2
#define MP_NEG   1
#define MP_NO   0
#define MP_OKAY   0
#define MP_PREC   8
#define MP_VAL   -3
#define MP_WARRAY   (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1))
#define MP_YES   1
#define MP_ZPOS   0
#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 50 of file libtommath.c.

#define BN_MP_CLEAR_MULTI_C

Definition at line 49 of file libtommath.c.

#define BN_MP_DIV_SMALL

Definition at line 47 of file libtommath.c.

#define BN_MP_INIT_MULTI_C

Definition at line 48 of file libtommath.c.

#define BN_MP_INVMOD_C

Definition at line 21 of file libtommath.c.

#define BN_MP_INVMOD_SLOW_C

Definition at line 25 of file libtommath.c.

#define BN_S_MP_EXPTMOD_C

Definition at line 22 of file libtommath.c.

#define BN_S_MP_MUL_DIGS_C

Definition at line 24 of file libtommath.c.

#define BN_S_MP_MUL_HIGH_DIGS_C

Definition at line 27 of file libtommath.c.

#define BN_S_MP_SQR_C

Definition at line 26 of file libtommath.c.

#define DIGIT_BIT   28

Definition at line 72 of file libtommath.c.

#define LTM_NO_NEG_EXP

Definition at line 55 of file libtommath.c.

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

Definition at line 64 of file libtommath.c.

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

Definition at line 60 of file libtommath.c.

#define MP_28BIT

Definition at line 73 of file libtommath.c.

#define MP_EQ   0

Definition at line 84 of file libtommath.c.

#define MP_GT   1

Definition at line 85 of file libtommath.c.

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

Definition at line 123 of file libtommath.c.

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

Definition at line 124 of file libtommath.c.

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

Definition at line 122 of file libtommath.c.

#define MP_LOW_MEM

Definition at line 100 of file libtommath.c.

#define MP_LT   -1

Definition at line 83 of file libtommath.c.

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

Definition at line 81 of file libtommath.c.

#define MP_MEM   -2

Definition at line 91 of file libtommath.c.

#define MP_NEG   1

Definition at line 88 of file libtommath.c.

#define MP_NO   0

Definition at line 95 of file libtommath.c.

#define MP_OKAY   0

Definition at line 90 of file libtommath.c.

#define MP_PREC   8

Definition at line 107 of file libtommath.c.

#define MP_VAL   -3

Definition at line 92 of file libtommath.c.

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

Definition at line 112 of file libtommath.c.

#define MP_YES   1

Definition at line 94 of file libtommath.c.

#define MP_ZPOS   0

Definition at line 87 of file libtommath.c.

#define OPT_CAST (  ) 

Definition at line 67 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 128 of file libtommath.c.

#define TAB_SIZE   32

Definition at line 1863 of file libtommath.c.

#define XFREE   os_free

Definition at line 77 of file libtommath.c.

#define XMALLOC   os_malloc

Definition at line 76 of file libtommath.c.

#define XREALLOC   os_realloc

Definition at line 78 of file libtommath.c.


Typedef Documentation

typedef unsigned long mp_digit

Definition at line 69 of file libtommath.c.

typedef int mp_err

Definition at line 97 of file libtommath.c.

typedef u64 mp_word

Definition at line 70 of file libtommath.c.


Function Documentation

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

Definition at line 189 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 2408 of file libtommath.c.

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

Definition at line 2203 of file libtommath.c.

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

Definition at line 1289 of file libtommath.c.

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

Definition at line 411 of file libtommath.c.

static void mp_clamp ( mp_int a  )  [static]

Definition at line 1231 of file libtommath.c.

static void mp_clear ( mp_int a  )  [static]

Definition at line 388 of file libtommath.c.

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

Definition at line 1472 of file libtommath.c.

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

Definition at line 670 of file libtommath.c.

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

Definition at line 692 of file libtommath.c.

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

Definition at line 911 of file libtommath.c.

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

Definition at line 1113 of file libtommath.c.

static int mp_count_bits ( mp_int a  )  [static]

Definition at line 1534 of file libtommath.c.

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

Definition at line 1594 of file libtommath.c.

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

Definition at line 1009 of file libtommath.c.

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

Definition at line 1214 of file libtommath.c.

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

Definition at line 578 of file libtommath.c.

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

Definition at line 1248 of file libtommath.c.

static int mp_init ( mp_int a  )  [static]

Definition at line 362 of file libtommath.c.

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

Definition at line 1085 of file libtommath.c.

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

Definition at line 1433 of file libtommath.c.

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

Definition at line 2480 of file libtommath.c.

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

Definition at line 1487 of file libtommath.c.

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

Definition at line 547 of file libtommath.c.

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

Definition at line 1558 of file libtommath.c.

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

Definition at line 480 of file libtommath.c.

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

Definition at line 1368 of file libtommath.c.

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

Definition at line 527 of file libtommath.c.

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

Definition at line 946 of file libtommath.c.

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

Definition at line 2243 of file libtommath.c.

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

Definition at line 2137 of file libtommath.c.

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

Definition at line 2175 of file libtommath.c.

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

Definition at line 2228 of file libtommath.c.

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

Definition at line 1160 of file libtommath.c.

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

Definition at line 1309 of file libtommath.c.

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

Definition at line 2096 of file libtommath.c.

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

Definition at line 443 of file libtommath.c.

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

Definition at line 981 of file libtommath.c.

static int mp_unsigned_bin_size ( mp_int a  )  [static]

Definition at line 746 of file libtommath.c.

static void mp_zero ( mp_int a  )  [static]

Definition at line 1097 of file libtommath.c.

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

Definition at line 207 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 1868 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 2326 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 2574 of file libtommath.c.

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

Definition at line 2508 of file libtommath.c.

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

Definition at line 295 of file libtommath.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Fri Jan 11 10:04:46 2013