|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _TCLTOMMATHDECLS |
|
#define _TCLTOMMATHDECLS |
|
|
|
#include "tcl.h" |
|
#ifndef BN_H_ |
|
#include "tclTomMath.h" |
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#define TCLTOMMATH_EPOCH 0 |
|
#define TCLTOMMATH_REVISION 0 |
|
|
|
#define Tcl_TomMath_InitStubs(interp,version) \ |
|
(TclTomMathInitializeStubs((interp),(version),\ |
|
TCLTOMMATH_EPOCH,TCLTOMMATH_REVISION)) |
|
|
|
|
|
|
|
|
|
#define TclBNAlloc(s) ((void*)ckalloc((size_t)(s))) |
|
|
|
#define TclBNCalloc(m,s) memset(ckalloc((size_t)(m)*(size_t)(s)),0,(size_t)(m)*(size_t)(s)) |
|
|
|
#define TclBNRealloc(x,s) ((void*)ckrealloc((char*)(x),(size_t)(s))) |
|
|
|
#define TclBNFree(x) (ckfree((char*)(x))) |
|
|
|
#define MP_MALLOC(size) TclBNAlloc(size) |
|
#define MP_CALLOC(nmemb, size) TclBNCalloc(nmemb, size) |
|
#define MP_REALLOC(mem, oldsize, newsize) TclBNRealloc(mem, newsize) |
|
#define MP_FREE(mem, size) TclBNFree(mem) |
|
|
|
|
|
|
|
|
|
#define bn_reverse TclBN_reverse |
|
#define mp_add TclBN_mp_add |
|
#define mp_add_d TclBN_mp_add_d |
|
#define mp_and TclBN_mp_and |
|
#define mp_clamp TclBN_mp_clamp |
|
#define mp_clear TclBN_mp_clear |
|
#define mp_clear_multi TclBN_mp_clear_multi |
|
#define mp_cmp TclBN_mp_cmp |
|
#define mp_cmp_d TclBN_mp_cmp_d |
|
#define mp_cmp_mag TclBN_mp_cmp_mag |
|
#define mp_cnt_lsb TclBN_mp_cnt_lsb |
|
#define mp_copy TclBN_mp_copy |
|
#define mp_count_bits TclBN_mp_count_bits |
|
#define mp_div TclBN_mp_div |
|
#define mp_div_2 TclBN_mp_div_2 |
|
#define mp_div_2d TclBN_mp_div_2d |
|
#define mp_div_3 TclBN_mp_div_3 |
|
#define mp_div_d TclBN_mp_div_d |
|
#define mp_exch TclBN_mp_exch |
|
#define mp_expt_d TclBN_mp_expt_d |
|
#define mp_expt_d_ex TclBN_mp_expt_d_ex |
|
#define mp_expt_u32 TclBN_mp_expt_d |
|
#define mp_get_mag_ull TclBN_mp_get_mag_ull |
|
#define mp_grow TclBN_mp_grow |
|
#define mp_init TclBN_mp_init |
|
#define mp_init_copy TclBN_mp_init_copy |
|
#define mp_init_multi TclBN_mp_init_multi |
|
#define mp_init_set TclBN_mp_init_set |
|
#define mp_init_set_int TclBN_mp_init_set_int |
|
#define mp_init_size TclBN_mp_init_size |
|
#define mp_lshd TclBN_mp_lshd |
|
#define mp_mod TclBN_mp_mod |
|
#define mp_mod_2d TclBN_mp_mod_2d |
|
#define mp_mul TclBN_mp_mul |
|
#define mp_mul_2 TclBN_mp_mul_2 |
|
#define mp_mul_2d TclBN_mp_mul_2d |
|
#define mp_mul_d TclBN_mp_mul_d |
|
#define mp_neg TclBN_mp_neg |
|
#define mp_or TclBN_mp_or |
|
#define mp_radix_size TclBN_mp_radix_size |
|
#define mp_read_radix TclBN_mp_read_radix |
|
#define mp_rshd TclBN_mp_rshd |
|
#define mp_set TclBN_mp_set |
|
#define mp_set_int(a,b) (TclBN_mp_set_int(a,(unsigned int)(b)),MP_OKAY) |
|
#define mp_set_ll TclBN_mp_set_ll |
|
#define mp_set_long(a,b) (TclBN_mp_set_int(a,b),MP_OKAY) |
|
#define mp_set_ul(a,b) (void)TclBN_mp_set_int(a,b) |
|
#define mp_set_ull TclBN_mp_set_ull |
|
#define mp_set_u64 TclBN_mp_set_ull |
|
#define mp_shrink TclBN_mp_shrink |
|
#define mp_sqr TclBN_mp_sqr |
|
#define mp_sqrt TclBN_mp_sqrt |
|
#define mp_sub TclBN_mp_sub |
|
#define mp_sub_d TclBN_mp_sub_d |
|
#define mp_signed_rsh TclBN_mp_signed_rsh |
|
#define mp_tc_and TclBN_mp_and |
|
#define mp_tc_div_2d TclBN_mp_signed_rsh |
|
#define mp_tc_or TclBN_mp_or |
|
#define mp_tc_xor TclBN_mp_xor |
|
#define mp_to_unsigned_bin TclBN_mp_to_unsigned_bin |
|
#define mp_to_unsigned_bin_n TclBN_mp_to_unsigned_bin_n |
|
#define mp_toradix_n TclBN_mp_toradix_n |
|
#define mp_to_radix TclBN_mp_to_radix |
|
#define mp_to_ubin TclBN_mp_to_ubin |
|
#define mp_ubin_size TclBN_mp_unsigned_bin_size |
|
#define mp_unsigned_bin_size(a) ((int)TclBN_mp_unsigned_bin_size(a)) |
|
#define mp_xor TclBN_mp_xor |
|
#define mp_zero TclBN_mp_zero |
|
#define s_mp_add TclBN_s_mp_add |
|
#define s_mp_balance_mul TclBN_mp_balance_mul |
|
#define s_mp_karatsuba_mul TclBN_mp_karatsuba_mul |
|
#define s_mp_karatsuba_sqr TclBN_mp_karatsuba_sqr |
|
#define s_mp_mul_digs TclBN_s_mp_mul_digs |
|
#define s_mp_mul_digs_fast TclBN_fast_s_mp_mul_digs |
|
#define s_mp_reverse TclBN_s_mp_reverse |
|
#define s_mp_sqr TclBN_s_mp_sqr |
|
#define s_mp_sqr_fast TclBN_fast_s_mp_sqr |
|
#define s_mp_sub TclBN_s_mp_sub |
|
#define s_mp_toom_mul TclBN_mp_toom_mul |
|
#define s_mp_toom_sqr TclBN_mp_toom_sqr |
|
|
|
#undef TCL_STORAGE_CLASS |
|
#ifdef BUILD_tcl |
|
# define TCL_STORAGE_CLASS DLLEXPORT |
|
#else |
|
# ifdef USE_TCL_STUBS |
|
# define TCL_STORAGE_CLASS |
|
# else |
|
# define TCL_STORAGE_CLASS DLLIMPORT |
|
# endif |
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus |
|
extern "C" { |
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
EXTERN int TclBN_epoch(void); |
|
|
|
EXTERN int TclBN_revision(void); |
|
|
|
EXTERN mp_err TclBN_mp_add(const mp_int *a, const mp_int *b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_add_d(const mp_int *a, mp_digit b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_and(const mp_int *a, const mp_int *b, |
|
mp_int *c); |
|
|
|
EXTERN void TclBN_mp_clamp(mp_int *a); |
|
|
|
EXTERN void TclBN_mp_clear(mp_int *a); |
|
|
|
EXTERN void TclBN_mp_clear_multi(mp_int *a, ...); |
|
|
|
EXTERN mp_ord TclBN_mp_cmp(const mp_int *a, const mp_int *b); |
|
|
|
EXTERN mp_ord TclBN_mp_cmp_d(const mp_int *a, mp_digit b); |
|
|
|
EXTERN mp_ord TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b); |
|
|
|
EXTERN mp_err TclBN_mp_copy(const mp_int *a, mp_int *b); |
|
|
|
EXTERN int TclBN_mp_count_bits(const mp_int *a); |
|
|
|
EXTERN mp_err TclBN_mp_div(const mp_int *a, const mp_int *b, |
|
mp_int *q, mp_int *r); |
|
|
|
EXTERN mp_err TclBN_mp_div_d(const mp_int *a, mp_digit b, |
|
mp_int *q, mp_digit *r); |
|
|
|
EXTERN mp_err TclBN_mp_div_2(const mp_int *a, mp_int *q); |
|
|
|
EXTERN mp_err TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, |
|
mp_int *r); |
|
|
|
EXTERN mp_err TclBN_mp_div_3(const mp_int *a, mp_int *q, |
|
mp_digit *r); |
|
|
|
EXTERN void TclBN_mp_exch(mp_int *a, mp_int *b); |
|
|
|
EXTERN mp_err TclBN_mp_expt_d(const mp_int *a, unsigned int b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_grow(mp_int *a, int size); |
|
|
|
EXTERN mp_err TclBN_mp_init(mp_int *a); |
|
|
|
EXTERN mp_err TclBN_mp_init_copy(mp_int *a, const mp_int *b); |
|
|
|
EXTERN mp_err TclBN_mp_init_multi(mp_int *a, ...); |
|
|
|
EXTERN mp_err TclBN_mp_init_set(mp_int *a, mp_digit b); |
|
|
|
EXTERN mp_err TclBN_mp_init_size(mp_int *a, int size); |
|
|
|
EXTERN mp_err TclBN_mp_lshd(mp_int *a, int shift); |
|
|
|
EXTERN mp_err TclBN_mp_mod(const mp_int *a, const mp_int *b, |
|
mp_int *r); |
|
|
|
EXTERN mp_err TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r); |
|
|
|
EXTERN mp_err TclBN_mp_mul(const mp_int *a, const mp_int *b, |
|
mp_int *p); |
|
|
|
EXTERN mp_err TclBN_mp_mul_d(const mp_int *a, mp_digit b, |
|
mp_int *p); |
|
|
|
EXTERN mp_err TclBN_mp_mul_2(const mp_int *a, mp_int *p); |
|
|
|
EXTERN mp_err TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p); |
|
|
|
EXTERN mp_err TclBN_mp_neg(const mp_int *a, mp_int *b); |
|
|
|
EXTERN mp_err TclBN_mp_or(const mp_int *a, const mp_int *b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_radix_size(const mp_int *a, int radix, |
|
int *size); |
|
|
|
EXTERN mp_err TclBN_mp_read_radix(mp_int *a, const char *str, |
|
int radix); |
|
|
|
EXTERN void TclBN_mp_rshd(mp_int *a, int shift); |
|
|
|
EXTERN mp_err TclBN_mp_shrink(mp_int *a); |
|
|
|
EXTERN void TclBN_mp_set(mp_int *a, mp_digit b); |
|
|
|
EXTERN mp_err TclBN_mp_sqr(const mp_int *a, mp_int *b); |
|
|
|
EXTERN mp_err TclBN_mp_sqrt(const mp_int *a, mp_int *b); |
|
|
|
EXTERN mp_err TclBN_mp_sub(const mp_int *a, const mp_int *b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_sub_d(const mp_int *a, mp_digit b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_to_unsigned_bin(const mp_int *a, |
|
unsigned char *b); |
|
|
|
EXTERN mp_err TclBN_mp_to_unsigned_bin_n(const mp_int *a, |
|
unsigned char *b, unsigned long *outlen); |
|
|
|
EXTERN mp_err TclBN_mp_toradix_n(const mp_int *a, char *str, |
|
int radix, int maxlen); |
|
|
|
EXTERN size_t TclBN_mp_unsigned_bin_size(const mp_int *a); |
|
|
|
EXTERN mp_err TclBN_mp_xor(const mp_int *a, const mp_int *b, |
|
mp_int *c); |
|
|
|
EXTERN void TclBN_mp_zero(mp_int *a); |
|
|
|
EXTERN void TclBN_reverse(unsigned char *s, int len); |
|
|
|
EXTERN mp_err TclBN_fast_s_mp_mul_digs(const mp_int *a, |
|
const mp_int *b, mp_int *c, int digs); |
|
|
|
EXTERN mp_err TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b); |
|
|
|
EXTERN mp_err TclBN_mp_karatsuba_mul(const mp_int *a, |
|
const mp_int *b, mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b); |
|
|
|
EXTERN mp_err TclBN_mp_toom_mul(const mp_int *a, const mp_int *b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_toom_sqr(const mp_int *a, mp_int *b); |
|
|
|
EXTERN mp_err TclBN_s_mp_add(const mp_int *a, const mp_int *b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b, |
|
mp_int *c, int digs); |
|
|
|
EXTERN mp_err TclBN_s_mp_sqr(const mp_int *a, mp_int *b); |
|
|
|
EXTERN mp_err TclBN_s_mp_sub(const mp_int *a, const mp_int *b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_init_set_int(mp_int *a, unsigned long i); |
|
|
|
EXTERN mp_err TclBN_mp_set_int(mp_int *a, unsigned long i); |
|
|
|
EXTERN int TclBN_mp_cnt_lsb(const mp_int *a); |
|
|
|
EXTERN int TclBNInitBignumFromLong(mp_int *bignum, long initVal); |
|
|
|
EXTERN int TclBNInitBignumFromWideInt(mp_int *bignum, |
|
Tcl_WideInt initVal); |
|
|
|
EXTERN int TclBNInitBignumFromWideUInt(mp_int *bignum, |
|
Tcl_WideUInt initVal); |
|
|
|
EXTERN mp_err TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, |
|
mp_int *c, int fast); |
|
|
|
EXTERN void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i); |
|
|
|
EXTERN Tcl_WideUInt TclBN_mp_get_mag_ull(const mp_int *a); |
|
|
|
EXTERN void TclBN_mp_set_ll(mp_int *a, Tcl_WideInt i); |
|
|
|
|
|
|
|
EXTERN mp_err TclBN_mp_tc_and(const mp_int *a, const mp_int *b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_tc_or(const mp_int *a, const mp_int *b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_tc_xor(const mp_int *a, const mp_int *b, |
|
mp_int *c); |
|
|
|
EXTERN mp_err TclBN_mp_signed_rsh(const mp_int *a, int b, |
|
mp_int *c); |
|
|
|
|
|
EXTERN int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf, |
|
size_t maxlen, size_t *written); |
|
|
|
EXTERN mp_err TclBN_mp_div_ld(const mp_int *a, Tcl_WideUInt b, |
|
mp_int *q, Tcl_WideUInt *r); |
|
|
|
EXTERN int TclBN_mp_to_radix(const mp_int *a, char *str, |
|
size_t maxlen, size_t *written, int radix); |
|
|
|
typedef struct TclTomMathStubs { |
|
int magic; |
|
void *hooks; |
|
|
|
int (*tclBN_epoch) (void); |
|
int (*tclBN_revision) (void); |
|
mp_err (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); |
|
mp_err (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c); |
|
mp_err (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); |
|
void (*tclBN_mp_clamp) (mp_int *a); |
|
void (*tclBN_mp_clear) (mp_int *a); |
|
void (*tclBN_mp_clear_multi) (mp_int *a, ...); |
|
mp_ord (*tclBN_mp_cmp) (const mp_int *a, const mp_int *b); |
|
mp_ord (*tclBN_mp_cmp_d) (const mp_int *a, mp_digit b); |
|
mp_ord (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); |
|
mp_err (*tclBN_mp_copy) (const mp_int *a, mp_int *b); |
|
int (*tclBN_mp_count_bits) (const mp_int *a); |
|
mp_err (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r); |
|
mp_err (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r); |
|
mp_err (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); |
|
mp_err (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); |
|
mp_err (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); |
|
void (*tclBN_mp_exch) (mp_int *a, mp_int *b); |
|
mp_err (*tclBN_mp_expt_d) (const mp_int *a, unsigned int b, mp_int *c); |
|
mp_err (*tclBN_mp_grow) (mp_int *a, int size); |
|
mp_err (*tclBN_mp_init) (mp_int *a); |
|
mp_err (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); |
|
mp_err (*tclBN_mp_init_multi) (mp_int *a, ...); |
|
mp_err (*tclBN_mp_init_set) (mp_int *a, mp_digit b); |
|
mp_err (*tclBN_mp_init_size) (mp_int *a, int size); |
|
mp_err (*tclBN_mp_lshd) (mp_int *a, int shift); |
|
mp_err (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r); |
|
mp_err (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); |
|
mp_err (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p); |
|
mp_err (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p); |
|
mp_err (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); |
|
mp_err (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); |
|
mp_err (*tclBN_mp_neg) (const mp_int *a, mp_int *b); |
|
mp_err (*tclBN_mp_or) (const mp_int *a, const mp_int *b, mp_int *c); |
|
mp_err (*tclBN_mp_radix_size) (const mp_int *a, int radix, int *size); |
|
mp_err (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); |
|
void (*tclBN_mp_rshd) (mp_int *a, int shift); |
|
mp_err (*tclBN_mp_shrink) (mp_int *a); |
|
void (*tclBN_mp_set) (mp_int *a, mp_digit b); |
|
mp_err (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); |
|
mp_err (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); |
|
mp_err (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); |
|
mp_err (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c); |
|
mp_err (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); |
|
mp_err (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); |
|
mp_err (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); |
|
size_t (*tclBN_mp_unsigned_bin_size) (const mp_int *a); |
|
mp_err (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); |
|
void (*tclBN_mp_zero) (mp_int *a); |
|
void (*tclBN_reverse) (unsigned char *s, int len); |
|
mp_err (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); |
|
mp_err (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); |
|
mp_err (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); |
|
mp_err (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); |
|
mp_err (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); |
|
mp_err (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b); |
|
mp_err (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); |
|
mp_err (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); |
|
mp_err (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); |
|
mp_err (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); |
|
mp_err (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); |
|
mp_err (*tclBN_mp_set_int) (mp_int *a, unsigned long i); |
|
int (*tclBN_mp_cnt_lsb) (const mp_int *a); |
|
int (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); |
|
int (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); |
|
int (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); |
|
mp_err (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); |
|
void (*tclBN_mp_set_ull) (mp_int *a, Tcl_WideUInt i); |
|
Tcl_WideUInt (*tclBN_mp_get_mag_ull) (const mp_int *a); |
|
void (*tclBN_mp_set_ll) (mp_int *a, Tcl_WideInt i); |
|
void (*reserved71)(void); |
|
void (*reserved72)(void); |
|
mp_err (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c); |
|
mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c); |
|
mp_err (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c); |
|
mp_err (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c); |
|
void (*reserved77)(void); |
|
int (*tclBN_mp_to_ubin) (const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written); |
|
mp_err (*tclBN_mp_div_ld) (const mp_int *a, Tcl_WideUInt b, mp_int *q, Tcl_WideUInt *r); |
|
int (*tclBN_mp_to_radix) (const mp_int *a, char *str, size_t maxlen, size_t *written, int radix); |
|
} TclTomMathStubs; |
|
|
|
extern const TclTomMathStubs *tclTomMathStubsPtr; |
|
|
|
#ifdef __cplusplus |
|
} |
|
#endif |
|
|
|
#if defined(USE_TCL_STUBS) |
|
|
|
|
|
|
|
|
|
|
|
#define TclBN_epoch \ |
|
(tclTomMathStubsPtr->tclBN_epoch) |
|
#define TclBN_revision \ |
|
(tclTomMathStubsPtr->tclBN_revision) |
|
#define TclBN_mp_add \ |
|
(tclTomMathStubsPtr->tclBN_mp_add) |
|
#define TclBN_mp_add_d \ |
|
(tclTomMathStubsPtr->tclBN_mp_add_d) |
|
#define TclBN_mp_and \ |
|
(tclTomMathStubsPtr->tclBN_mp_and) |
|
#define TclBN_mp_clamp \ |
|
(tclTomMathStubsPtr->tclBN_mp_clamp) |
|
#define TclBN_mp_clear \ |
|
(tclTomMathStubsPtr->tclBN_mp_clear) |
|
#define TclBN_mp_clear_multi \ |
|
(tclTomMathStubsPtr->tclBN_mp_clear_multi) |
|
#define TclBN_mp_cmp \ |
|
(tclTomMathStubsPtr->tclBN_mp_cmp) |
|
#define TclBN_mp_cmp_d \ |
|
(tclTomMathStubsPtr->tclBN_mp_cmp_d) |
|
#define TclBN_mp_cmp_mag \ |
|
(tclTomMathStubsPtr->tclBN_mp_cmp_mag) |
|
#define TclBN_mp_copy \ |
|
(tclTomMathStubsPtr->tclBN_mp_copy) |
|
#define TclBN_mp_count_bits \ |
|
(tclTomMathStubsPtr->tclBN_mp_count_bits) |
|
#define TclBN_mp_div \ |
|
(tclTomMathStubsPtr->tclBN_mp_div) |
|
#define TclBN_mp_div_d \ |
|
(tclTomMathStubsPtr->tclBN_mp_div_d) |
|
#define TclBN_mp_div_2 \ |
|
(tclTomMathStubsPtr->tclBN_mp_div_2) |
|
#define TclBN_mp_div_2d \ |
|
(tclTomMathStubsPtr->tclBN_mp_div_2d) |
|
#define TclBN_mp_div_3 \ |
|
(tclTomMathStubsPtr->tclBN_mp_div_3) |
|
#define TclBN_mp_exch \ |
|
(tclTomMathStubsPtr->tclBN_mp_exch) |
|
#define TclBN_mp_expt_d \ |
|
(tclTomMathStubsPtr->tclBN_mp_expt_d) |
|
#define TclBN_mp_grow \ |
|
(tclTomMathStubsPtr->tclBN_mp_grow) |
|
#define TclBN_mp_init \ |
|
(tclTomMathStubsPtr->tclBN_mp_init) |
|
#define TclBN_mp_init_copy \ |
|
(tclTomMathStubsPtr->tclBN_mp_init_copy) |
|
#define TclBN_mp_init_multi \ |
|
(tclTomMathStubsPtr->tclBN_mp_init_multi) |
|
#define TclBN_mp_init_set \ |
|
(tclTomMathStubsPtr->tclBN_mp_init_set) |
|
#define TclBN_mp_init_size \ |
|
(tclTomMathStubsPtr->tclBN_mp_init_size) |
|
#define TclBN_mp_lshd \ |
|
(tclTomMathStubsPtr->tclBN_mp_lshd) |
|
#define TclBN_mp_mod \ |
|
(tclTomMathStubsPtr->tclBN_mp_mod) |
|
#define TclBN_mp_mod_2d \ |
|
(tclTomMathStubsPtr->tclBN_mp_mod_2d) |
|
#define TclBN_mp_mul \ |
|
(tclTomMathStubsPtr->tclBN_mp_mul) |
|
#define TclBN_mp_mul_d \ |
|
(tclTomMathStubsPtr->tclBN_mp_mul_d) |
|
#define TclBN_mp_mul_2 \ |
|
(tclTomMathStubsPtr->tclBN_mp_mul_2) |
|
#define TclBN_mp_mul_2d \ |
|
(tclTomMathStubsPtr->tclBN_mp_mul_2d) |
|
#define TclBN_mp_neg \ |
|
(tclTomMathStubsPtr->tclBN_mp_neg) |
|
#define TclBN_mp_or \ |
|
(tclTomMathStubsPtr->tclBN_mp_or) |
|
#define TclBN_mp_radix_size \ |
|
(tclTomMathStubsPtr->tclBN_mp_radix_size) |
|
#define TclBN_mp_read_radix \ |
|
(tclTomMathStubsPtr->tclBN_mp_read_radix) |
|
#define TclBN_mp_rshd \ |
|
(tclTomMathStubsPtr->tclBN_mp_rshd) |
|
#define TclBN_mp_shrink \ |
|
(tclTomMathStubsPtr->tclBN_mp_shrink) |
|
#define TclBN_mp_set \ |
|
(tclTomMathStubsPtr->tclBN_mp_set) |
|
#define TclBN_mp_sqr \ |
|
(tclTomMathStubsPtr->tclBN_mp_sqr) |
|
#define TclBN_mp_sqrt \ |
|
(tclTomMathStubsPtr->tclBN_mp_sqrt) |
|
#define TclBN_mp_sub \ |
|
(tclTomMathStubsPtr->tclBN_mp_sub) |
|
#define TclBN_mp_sub_d \ |
|
(tclTomMathStubsPtr->tclBN_mp_sub_d) |
|
#define TclBN_mp_to_unsigned_bin \ |
|
(tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin) |
|
#define TclBN_mp_to_unsigned_bin_n \ |
|
(tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin_n) |
|
#define TclBN_mp_toradix_n \ |
|
(tclTomMathStubsPtr->tclBN_mp_toradix_n) |
|
#define TclBN_mp_unsigned_bin_size \ |
|
(tclTomMathStubsPtr->tclBN_mp_unsigned_bin_size) |
|
#define TclBN_mp_xor \ |
|
(tclTomMathStubsPtr->tclBN_mp_xor) |
|
#define TclBN_mp_zero \ |
|
(tclTomMathStubsPtr->tclBN_mp_zero) |
|
#define TclBN_reverse \ |
|
(tclTomMathStubsPtr->tclBN_reverse) |
|
#define TclBN_fast_s_mp_mul_digs \ |
|
(tclTomMathStubsPtr->tclBN_fast_s_mp_mul_digs) |
|
#define TclBN_fast_s_mp_sqr \ |
|
(tclTomMathStubsPtr->tclBN_fast_s_mp_sqr) |
|
#define TclBN_mp_karatsuba_mul \ |
|
(tclTomMathStubsPtr->tclBN_mp_karatsuba_mul) |
|
#define TclBN_mp_karatsuba_sqr \ |
|
(tclTomMathStubsPtr->tclBN_mp_karatsuba_sqr) |
|
#define TclBN_mp_toom_mul \ |
|
(tclTomMathStubsPtr->tclBN_mp_toom_mul) |
|
#define TclBN_mp_toom_sqr \ |
|
(tclTomMathStubsPtr->tclBN_mp_toom_sqr) |
|
#define TclBN_s_mp_add \ |
|
(tclTomMathStubsPtr->tclBN_s_mp_add) |
|
#define TclBN_s_mp_mul_digs \ |
|
(tclTomMathStubsPtr->tclBN_s_mp_mul_digs) |
|
#define TclBN_s_mp_sqr \ |
|
(tclTomMathStubsPtr->tclBN_s_mp_sqr) |
|
#define TclBN_s_mp_sub \ |
|
(tclTomMathStubsPtr->tclBN_s_mp_sub) |
|
#define TclBN_mp_init_set_int \ |
|
(tclTomMathStubsPtr->tclBN_mp_init_set_int) |
|
#define TclBN_mp_set_int \ |
|
(tclTomMathStubsPtr->tclBN_mp_set_int) |
|
#define TclBN_mp_cnt_lsb \ |
|
(tclTomMathStubsPtr->tclBN_mp_cnt_lsb) |
|
#define TclBNInitBignumFromLong \ |
|
(tclTomMathStubsPtr->tclBNInitBignumFromLong) |
|
#define TclBNInitBignumFromWideInt \ |
|
(tclTomMathStubsPtr->tclBNInitBignumFromWideInt) |
|
#define TclBNInitBignumFromWideUInt \ |
|
(tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) |
|
#define TclBN_mp_expt_d_ex \ |
|
(tclTomMathStubsPtr->tclBN_mp_expt_d_ex) |
|
#define TclBN_mp_set_ull \ |
|
(tclTomMathStubsPtr->tclBN_mp_set_ull) |
|
#define TclBN_mp_get_mag_ull \ |
|
(tclTomMathStubsPtr->tclBN_mp_get_mag_ull) |
|
#define TclBN_mp_set_ll \ |
|
(tclTomMathStubsPtr->tclBN_mp_set_ll) |
|
|
|
|
|
#define TclBN_mp_tc_and \ |
|
(tclTomMathStubsPtr->tclBN_mp_tc_and) |
|
#define TclBN_mp_tc_or \ |
|
(tclTomMathStubsPtr->tclBN_mp_tc_or) |
|
#define TclBN_mp_tc_xor \ |
|
(tclTomMathStubsPtr->tclBN_mp_tc_xor) |
|
#define TclBN_mp_signed_rsh \ |
|
(tclTomMathStubsPtr->tclBN_mp_signed_rsh) |
|
|
|
#define TclBN_mp_to_ubin \ |
|
(tclTomMathStubsPtr->tclBN_mp_to_ubin) |
|
#define TclBN_mp_div_ld \ |
|
(tclTomMathStubsPtr->tclBN_mp_div_ld) |
|
#define TclBN_mp_to_radix \ |
|
(tclTomMathStubsPtr->tclBN_mp_to_radix) |
|
|
|
#endif |
|
|
|
|
|
|
|
#undef TCL_STORAGE_CLASS |
|
#define TCL_STORAGE_CLASS DLLIMPORT |
|
|
|
#ifdef USE_TCL_STUBS |
|
#undef TclBNInitBignumFromLong |
|
#define TclBNInitBignumFromLong(a,b) \ |
|
do { \ |
|
(a)->dp = NULL; \ |
|
(void)tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(b)); \ |
|
if ((a)->dp == NULL) { \ |
|
Tcl_Panic("initialization failure in TclBNInitBignumFromLong"); \ |
|
} \ |
|
} while (0) |
|
#undef TclBNInitBignumFromWideInt |
|
#define TclBNInitBignumFromWideInt(a,b) \ |
|
do { \ |
|
(a)->dp = NULL; \ |
|
(void)tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)); \ |
|
if ((a)->dp == NULL) { \ |
|
Tcl_Panic("initialization failure in TclBNInitBignumFromWideInt"); \ |
|
} \ |
|
} while (0) |
|
#undef TclBNInitBignumFromWideUInt |
|
#define TclBNInitBignumFromWideUInt(a,b) \ |
|
do { \ |
|
(a)->dp = NULL; \ |
|
(void)tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)); \ |
|
if ((a)->dp == NULL) { \ |
|
Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); \ |
|
} \ |
|
} while (0) |
|
#define mp_init_i32(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(int32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_l(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_ll(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_i64(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_u32(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(uint32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_ul(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(unsigned long)(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_ull(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_u64(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#else |
|
#define mp_init_i32(a,b) (((a)->dp=NULL,(TclBNInitBignumFromLong)((a),(int32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_l(a,b) (((a)->dp=NULL,(TclBNInitBignumFromLong)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_ll(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_i64(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_u32(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(uint32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_ul(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(unsigned long)(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_ull(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#define mp_init_u64(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR) |
|
#endif |
|
#endif |
|
|