32 int (*init)(
void **a);
39 int (*init_copy)(
void **dst,
void *src);
45 void (*deinit)(
void *a);
54 int (*neg)(
void *src,
void *dst);
61 int (*copy)(
void *src,
void *dst);
70 int (*set_int)(
void *a,
unsigned long n);
76 unsigned long (*get_int)(
void *a);
83 unsigned long (*get_digit)(
void *a,
int n);
89 int (*get_digit_count)(
void *a);
96 int (*compare)(
void *a,
void *b);
103 int (*compare_d)(
void *a,
unsigned long n);
109 int (*count_bits)(
void * a);
115 int (*count_lsb_bits)(
void *a);
122 int (*twoexpt)(
void *a ,
int n);
132 int (*read_radix)(
void *a,
const char *str,
int radix);
140 int (*write_radix)(
void *a,
char *str,
int radix);
146 unsigned long (*unsigned_size)(
void *a);
153 int (*unsigned_write)(
void *src,
unsigned char *dst);
161 int (*unsigned_read)(
void *dst,
unsigned char *src,
unsigned long len);
171 int (*add)(
void *a,
void *b,
void *c);
180 int (*addi)(
void *a,
unsigned long b,
void *c);
188 int (*sub)(
void *a,
void *b,
void *c);
196 int (*subi)(
void *a,
unsigned long b,
void *c);
204 int (*
mul)(
void *a,
void *b,
void *c);
212 int (*muli)(
void *a,
unsigned long b,
void *c);
219 int (*sqr)(
void *a,
void *b);
228 int (*mpdiv)(
void *a,
void *b,
void *c,
void *d);
235 int (*div_2)(
void *a,
void *b);
243 int (*modi)(
void *a,
unsigned long b,
unsigned long *c);
251 int (*gcd)(
void *a,
void *b,
void *c);
259 int (*lcm)(
void *a,
void *b,
void *c);
268 int (*mulmod)(
void *a,
void *b,
void *c,
void *d);
276 int (*sqrmod)(
void *a,
void *b,
void *c);
284 int (*invmod)(
void *,
void *,
void *);
293 int (*montgomery_setup)(
void *a,
void **b);
300 int (*montgomery_normalization)(
void *a,
void *b);
308 int (*montgomery_reduce)(
void *a,
void *b,
void *c);
314 void (*montgomery_deinit)(
void *a);
325 int (*exptmod)(
void *a,
void *b,
void *c,
void *d);
332 int (*isprime)(
void *a,
int *b);
411 int (*rsa_me)(
const unsigned char *in,
unsigned long inlen,
412 unsigned char *out,
unsigned long *outlen,
int which,
433 #if !defined(DESC_DEF_ONLY) && defined(LTC_SOURCE)
435 #define MP_DIGIT_BIT ltc_mp.bits_per_digit
438 #define mp_init(a) ltc_mp.init(a)
439 #define mp_init_multi ltc_init_multi
440 #define mp_clear(a) ltc_mp.deinit(a)
441 #define mp_clear_multi ltc_deinit_multi
442 #define mp_init_copy(a, b) ltc_mp.init_copy(a, b)
444 #define mp_neg(a, b) ltc_mp.neg(a, b)
445 #define mp_copy(a, b) ltc_mp.copy(a, b)
447 #define mp_set(a, b) ltc_mp.set_int(a, b)
448 #define mp_set_int(a, b) ltc_mp.set_int(a, b)
449 #define mp_get_int(a) ltc_mp.get_int(a)
450 #define mp_get_digit(a, n) ltc_mp.get_digit(a, n)
451 #define mp_get_digit_count(a) ltc_mp.get_digit_count(a)
452 #define mp_cmp(a, b) ltc_mp.compare(a, b)
453 #define mp_cmp_d(a, b) ltc_mp.compare_d(a, b)
454 #define mp_count_bits(a) ltc_mp.count_bits(a)
455 #define mp_cnt_lsb(a) ltc_mp.count_lsb_bits(a)
456 #define mp_2expt(a, b) ltc_mp.twoexpt(a, b)
458 #define mp_read_radix(a, b, c) ltc_mp.read_radix(a, b, c)
459 #define mp_toradix(a, b, c) ltc_mp.write_radix(a, b, c)
460 #define mp_unsigned_bin_size(a) ltc_mp.unsigned_size(a)
461 #define mp_to_unsigned_bin(a, b) ltc_mp.unsigned_write(a, b)
462 #define mp_read_unsigned_bin(a, b, c) ltc_mp.unsigned_read(a, b, c)
464 #define mp_add(a, b, c) ltc_mp.add(a, b, c)
465 #define mp_add_d(a, b, c) ltc_mp.addi(a, b, c)
466 #define mp_sub(a, b, c) ltc_mp.sub(a, b, c)
467 #define mp_sub_d(a, b, c) ltc_mp.subi(a, b, c)
468 #define mp_mul(a, b, c) ltc_mp.mul(a, b, c)
469 #define mp_mul_d(a, b, c) ltc_mp.muli(a, b, c)
470 #define mp_sqr(a, b) ltc_mp.sqr(a, b)
471 #define mp_div(a, b, c, d) ltc_mp.mpdiv(a, b, c, d)
472 #define mp_div_2(a, b) ltc_mp.div_2(a, b)
473 #define mp_mod(a, b, c) ltc_mp.mpdiv(a, b, NULL, c)
474 #define mp_mod_d(a, b, c) ltc_mp.modi(a, b, c)
475 #define mp_gcd(a, b, c) ltc_mp.gcd(a, b, c)
476 #define mp_lcm(a, b, c) ltc_mp.lcm(a, b, c)
478 #define mp_mulmod(a, b, c, d) ltc_mp.mulmod(a, b, c, d)
479 #define mp_sqrmod(a, b, c) ltc_mp.sqrmod(a, b, c)
480 #define mp_invmod(a, b, c) ltc_mp.invmod(a, b, c)
482 #define mp_montgomery_setup(a, b) ltc_mp.montgomery_setup(a, b)
483 #define mp_montgomery_normalization(a, b) ltc_mp.montgomery_normalization(a, b)
484 #define mp_montgomery_reduce(a, b, c) ltc_mp.montgomery_reduce(a, b, c)
485 #define mp_montgomery_free(a) ltc_mp.montgomery_deinit(a)
487 #define mp_exptmod(a,b,c,d) ltc_mp.exptmod(a,b,c,d)
488 #define mp_prime_is_prime(a, b, c) ltc_mp.isprime(a, c)
490 #define mp_iszero(a) (mp_cmp_d(a, 0) == LTC_MP_EQ ? LTC_MP_YES : LTC_MP_NO)
491 #define mp_isodd(a) (mp_get_digit_count(a) > 0 ? (mp_get_digit(a, 0) & 1 ? LTC_MP_YES : LTC_MP_NO) : LTC_MP_NO)
492 #define mp_exch(a, b) do { void *ABC__tmp = a; a = b; b = ABC__tmp; } while(0);
494 #define mp_tohex(a, b) mp_toradix(a, b, 16)
int ltc_init_multi(void **a,...)
ltc_math_descriptor ltc_mp
int bits_per_digit
Definition: tomcrypt_math.h:24
void rsa_key
Definition: tomcrypt_math.h:15
float mul(float a, float b)
Definition: g3dmath.h:453
Definition: tomcrypt_math.h:19
char * name
Definition: tomcrypt_math.h:21
void ltc_deinit_multi(void *a,...)
void ecc_point
Definition: tomcrypt_math.h:11
uint8 const P[]
Definition: AuthenticationPackets.cpp:225
Definition: tomcrypt_prng.h:50
uint8 const Q[]
Definition: AuthenticationPackets.cpp:237