File indexing completed on 2025-01-17 09:56:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _TCLTOMMATHDECLS
0016 #define _TCLTOMMATHDECLS
0017
0018 #include "tcl.h"
0019 #ifndef BN_H_
0020 #include "tclTomMath.h"
0021 #endif
0022
0023
0024
0025
0026
0027 #define TCLTOMMATH_EPOCH 0
0028 #define TCLTOMMATH_REVISION 0
0029
0030 #define Tcl_TomMath_InitStubs(interp,version) \
0031 (TclTomMathInitializeStubs((interp),(version),\
0032 TCLTOMMATH_EPOCH,TCLTOMMATH_REVISION))
0033
0034
0035
0036
0037 #define TclBNAlloc(s) ((void*)ckalloc((size_t)(s)))
0038
0039 #define TclBNCalloc(m,s) memset(ckalloc((size_t)(m)*(size_t)(s)),0,(size_t)(m)*(size_t)(s))
0040
0041 #define TclBNRealloc(x,s) ((void*)ckrealloc((char*)(x),(size_t)(s)))
0042
0043 #define TclBNFree(x) (ckfree((char*)(x)))
0044
0045 #define MP_MALLOC(size) TclBNAlloc(size)
0046 #define MP_CALLOC(nmemb, size) TclBNCalloc(nmemb, size)
0047 #define MP_REALLOC(mem, oldsize, newsize) TclBNRealloc(mem, newsize)
0048 #define MP_FREE(mem, size) TclBNFree(mem)
0049
0050
0051
0052
0053 #define bn_reverse TclBN_reverse
0054 #define mp_add TclBN_mp_add
0055 #define mp_add_d TclBN_mp_add_d
0056 #define mp_and TclBN_mp_and
0057 #define mp_clamp TclBN_mp_clamp
0058 #define mp_clear TclBN_mp_clear
0059 #define mp_clear_multi TclBN_mp_clear_multi
0060 #define mp_cmp TclBN_mp_cmp
0061 #define mp_cmp_d TclBN_mp_cmp_d
0062 #define mp_cmp_mag TclBN_mp_cmp_mag
0063 #define mp_cnt_lsb TclBN_mp_cnt_lsb
0064 #define mp_copy TclBN_mp_copy
0065 #define mp_count_bits TclBN_mp_count_bits
0066 #define mp_div TclBN_mp_div
0067 #define mp_div_2 TclBN_mp_div_2
0068 #define mp_div_2d TclBN_mp_div_2d
0069 #define mp_div_3 TclBN_mp_div_3
0070 #define mp_div_d TclBN_mp_div_d
0071 #define mp_exch TclBN_mp_exch
0072 #define mp_expt_d TclBN_mp_expt_d
0073 #define mp_expt_d_ex TclBN_mp_expt_d_ex
0074 #define mp_expt_u32 TclBN_mp_expt_d
0075 #define mp_get_mag_ull TclBN_mp_get_mag_ull
0076 #define mp_grow TclBN_mp_grow
0077 #define mp_init TclBN_mp_init
0078 #define mp_init_copy TclBN_mp_init_copy
0079 #define mp_init_multi TclBN_mp_init_multi
0080 #define mp_init_set TclBN_mp_init_set
0081 #define mp_init_set_int TclBN_mp_init_set_int
0082 #define mp_init_size TclBN_mp_init_size
0083 #define mp_lshd TclBN_mp_lshd
0084 #define mp_mod TclBN_mp_mod
0085 #define mp_mod_2d TclBN_mp_mod_2d
0086 #define mp_mul TclBN_mp_mul
0087 #define mp_mul_2 TclBN_mp_mul_2
0088 #define mp_mul_2d TclBN_mp_mul_2d
0089 #define mp_mul_d TclBN_mp_mul_d
0090 #define mp_neg TclBN_mp_neg
0091 #define mp_or TclBN_mp_or
0092 #define mp_radix_size TclBN_mp_radix_size
0093 #define mp_read_radix TclBN_mp_read_radix
0094 #define mp_rshd TclBN_mp_rshd
0095 #define mp_set TclBN_mp_set
0096 #define mp_set_int(a,b) (TclBN_mp_set_int(a,(unsigned int)(b)),MP_OKAY)
0097 #define mp_set_ll TclBN_mp_set_ll
0098 #define mp_set_long(a,b) (TclBN_mp_set_int(a,b),MP_OKAY)
0099 #define mp_set_ul(a,b) (void)TclBN_mp_set_int(a,b)
0100 #define mp_set_ull TclBN_mp_set_ull
0101 #define mp_set_u64 TclBN_mp_set_ull
0102 #define mp_shrink TclBN_mp_shrink
0103 #define mp_sqr TclBN_mp_sqr
0104 #define mp_sqrt TclBN_mp_sqrt
0105 #define mp_sub TclBN_mp_sub
0106 #define mp_sub_d TclBN_mp_sub_d
0107 #define mp_signed_rsh TclBN_mp_signed_rsh
0108 #define mp_tc_and TclBN_mp_and
0109 #define mp_tc_div_2d TclBN_mp_signed_rsh
0110 #define mp_tc_or TclBN_mp_or
0111 #define mp_tc_xor TclBN_mp_xor
0112 #define mp_to_unsigned_bin TclBN_mp_to_unsigned_bin
0113 #define mp_to_unsigned_bin_n TclBN_mp_to_unsigned_bin_n
0114 #define mp_toradix_n TclBN_mp_toradix_n
0115 #define mp_to_radix TclBN_mp_to_radix
0116 #define mp_to_ubin TclBN_mp_to_ubin
0117 #define mp_ubin_size TclBN_mp_unsigned_bin_size
0118 #define mp_unsigned_bin_size(a) ((int)TclBN_mp_unsigned_bin_size(a))
0119 #define mp_xor TclBN_mp_xor
0120 #define mp_zero TclBN_mp_zero
0121 #define s_mp_add TclBN_s_mp_add
0122 #define s_mp_balance_mul TclBN_mp_balance_mul
0123 #define s_mp_karatsuba_mul TclBN_mp_karatsuba_mul
0124 #define s_mp_karatsuba_sqr TclBN_mp_karatsuba_sqr
0125 #define s_mp_mul_digs TclBN_s_mp_mul_digs
0126 #define s_mp_mul_digs_fast TclBN_fast_s_mp_mul_digs
0127 #define s_mp_reverse TclBN_s_mp_reverse
0128 #define s_mp_sqr TclBN_s_mp_sqr
0129 #define s_mp_sqr_fast TclBN_fast_s_mp_sqr
0130 #define s_mp_sub TclBN_s_mp_sub
0131 #define s_mp_toom_mul TclBN_mp_toom_mul
0132 #define s_mp_toom_sqr TclBN_mp_toom_sqr
0133
0134 #undef TCL_STORAGE_CLASS
0135 #ifdef BUILD_tcl
0136 # define TCL_STORAGE_CLASS DLLEXPORT
0137 #else
0138 # ifdef USE_TCL_STUBS
0139 # define TCL_STORAGE_CLASS
0140 # else
0141 # define TCL_STORAGE_CLASS DLLIMPORT
0142 # endif
0143 #endif
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153 #ifdef __cplusplus
0154 extern "C" {
0155 #endif
0156
0157
0158
0159
0160
0161
0162 EXTERN int TclBN_epoch(void);
0163
0164 EXTERN int TclBN_revision(void);
0165
0166 EXTERN mp_err TclBN_mp_add(const mp_int *a, const mp_int *b,
0167 mp_int *c);
0168
0169 EXTERN mp_err TclBN_mp_add_d(const mp_int *a, mp_digit b,
0170 mp_int *c);
0171
0172 EXTERN mp_err TclBN_mp_and(const mp_int *a, const mp_int *b,
0173 mp_int *c);
0174
0175 EXTERN void TclBN_mp_clamp(mp_int *a);
0176
0177 EXTERN void TclBN_mp_clear(mp_int *a);
0178
0179 EXTERN void TclBN_mp_clear_multi(mp_int *a, ...);
0180
0181 EXTERN mp_ord TclBN_mp_cmp(const mp_int *a, const mp_int *b);
0182
0183 EXTERN mp_ord TclBN_mp_cmp_d(const mp_int *a, mp_digit b);
0184
0185 EXTERN mp_ord TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b);
0186
0187 EXTERN mp_err TclBN_mp_copy(const mp_int *a, mp_int *b);
0188
0189 EXTERN int TclBN_mp_count_bits(const mp_int *a);
0190
0191 EXTERN mp_err TclBN_mp_div(const mp_int *a, const mp_int *b,
0192 mp_int *q, mp_int *r);
0193
0194 EXTERN mp_err TclBN_mp_div_d(const mp_int *a, mp_digit b,
0195 mp_int *q, mp_digit *r);
0196
0197 EXTERN mp_err TclBN_mp_div_2(const mp_int *a, mp_int *q);
0198
0199 EXTERN mp_err TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q,
0200 mp_int *r);
0201
0202 EXTERN mp_err TclBN_mp_div_3(const mp_int *a, mp_int *q,
0203 mp_digit *r);
0204
0205 EXTERN void TclBN_mp_exch(mp_int *a, mp_int *b);
0206
0207 EXTERN mp_err TclBN_mp_expt_d(const mp_int *a, unsigned int b,
0208 mp_int *c);
0209
0210 EXTERN mp_err TclBN_mp_grow(mp_int *a, int size);
0211
0212 EXTERN mp_err TclBN_mp_init(mp_int *a);
0213
0214 EXTERN mp_err TclBN_mp_init_copy(mp_int *a, const mp_int *b);
0215
0216 EXTERN mp_err TclBN_mp_init_multi(mp_int *a, ...);
0217
0218 EXTERN mp_err TclBN_mp_init_set(mp_int *a, mp_digit b);
0219
0220 EXTERN mp_err TclBN_mp_init_size(mp_int *a, int size);
0221
0222 EXTERN mp_err TclBN_mp_lshd(mp_int *a, int shift);
0223
0224 EXTERN mp_err TclBN_mp_mod(const mp_int *a, const mp_int *b,
0225 mp_int *r);
0226
0227 EXTERN mp_err TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r);
0228
0229 EXTERN mp_err TclBN_mp_mul(const mp_int *a, const mp_int *b,
0230 mp_int *p);
0231
0232 EXTERN mp_err TclBN_mp_mul_d(const mp_int *a, mp_digit b,
0233 mp_int *p);
0234
0235 EXTERN mp_err TclBN_mp_mul_2(const mp_int *a, mp_int *p);
0236
0237 EXTERN mp_err TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p);
0238
0239 EXTERN mp_err TclBN_mp_neg(const mp_int *a, mp_int *b);
0240
0241 EXTERN mp_err TclBN_mp_or(const mp_int *a, const mp_int *b,
0242 mp_int *c);
0243
0244 EXTERN mp_err TclBN_mp_radix_size(const mp_int *a, int radix,
0245 int *size);
0246
0247 EXTERN mp_err TclBN_mp_read_radix(mp_int *a, const char *str,
0248 int radix);
0249
0250 EXTERN void TclBN_mp_rshd(mp_int *a, int shift);
0251
0252 EXTERN mp_err TclBN_mp_shrink(mp_int *a);
0253
0254 EXTERN void TclBN_mp_set(mp_int *a, mp_digit b);
0255
0256 EXTERN mp_err TclBN_mp_sqr(const mp_int *a, mp_int *b);
0257
0258 EXTERN mp_err TclBN_mp_sqrt(const mp_int *a, mp_int *b);
0259
0260 EXTERN mp_err TclBN_mp_sub(const mp_int *a, const mp_int *b,
0261 mp_int *c);
0262
0263 EXTERN mp_err TclBN_mp_sub_d(const mp_int *a, mp_digit b,
0264 mp_int *c);
0265
0266 EXTERN mp_err TclBN_mp_to_unsigned_bin(const mp_int *a,
0267 unsigned char *b);
0268
0269 EXTERN mp_err TclBN_mp_to_unsigned_bin_n(const mp_int *a,
0270 unsigned char *b, unsigned long *outlen);
0271
0272 EXTERN mp_err TclBN_mp_toradix_n(const mp_int *a, char *str,
0273 int radix, int maxlen);
0274
0275 EXTERN size_t TclBN_mp_unsigned_bin_size(const mp_int *a);
0276
0277 EXTERN mp_err TclBN_mp_xor(const mp_int *a, const mp_int *b,
0278 mp_int *c);
0279
0280 EXTERN void TclBN_mp_zero(mp_int *a);
0281
0282 EXTERN void TclBN_reverse(unsigned char *s, int len);
0283
0284 EXTERN mp_err TclBN_fast_s_mp_mul_digs(const mp_int *a,
0285 const mp_int *b, mp_int *c, int digs);
0286
0287 EXTERN mp_err TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b);
0288
0289 EXTERN mp_err TclBN_mp_karatsuba_mul(const mp_int *a,
0290 const mp_int *b, mp_int *c);
0291
0292 EXTERN mp_err TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b);
0293
0294 EXTERN mp_err TclBN_mp_toom_mul(const mp_int *a, const mp_int *b,
0295 mp_int *c);
0296
0297 EXTERN mp_err TclBN_mp_toom_sqr(const mp_int *a, mp_int *b);
0298
0299 EXTERN mp_err TclBN_s_mp_add(const mp_int *a, const mp_int *b,
0300 mp_int *c);
0301
0302 EXTERN mp_err TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b,
0303 mp_int *c, int digs);
0304
0305 EXTERN mp_err TclBN_s_mp_sqr(const mp_int *a, mp_int *b);
0306
0307 EXTERN mp_err TclBN_s_mp_sub(const mp_int *a, const mp_int *b,
0308 mp_int *c);
0309
0310 EXTERN mp_err TclBN_mp_init_set_int(mp_int *a, unsigned long i);
0311
0312 EXTERN mp_err TclBN_mp_set_int(mp_int *a, unsigned long i);
0313
0314 EXTERN int TclBN_mp_cnt_lsb(const mp_int *a);
0315
0316 EXTERN int TclBNInitBignumFromLong(mp_int *bignum, long initVal);
0317
0318 EXTERN int TclBNInitBignumFromWideInt(mp_int *bignum,
0319 Tcl_WideInt initVal);
0320
0321 EXTERN int TclBNInitBignumFromWideUInt(mp_int *bignum,
0322 Tcl_WideUInt initVal);
0323
0324 EXTERN mp_err TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b,
0325 mp_int *c, int fast);
0326
0327 EXTERN void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i);
0328
0329 EXTERN Tcl_WideUInt TclBN_mp_get_mag_ull(const mp_int *a);
0330
0331 EXTERN void TclBN_mp_set_ll(mp_int *a, Tcl_WideInt i);
0332
0333
0334
0335 EXTERN mp_err TclBN_mp_tc_and(const mp_int *a, const mp_int *b,
0336 mp_int *c);
0337
0338 EXTERN mp_err TclBN_mp_tc_or(const mp_int *a, const mp_int *b,
0339 mp_int *c);
0340
0341 EXTERN mp_err TclBN_mp_tc_xor(const mp_int *a, const mp_int *b,
0342 mp_int *c);
0343
0344 EXTERN mp_err TclBN_mp_signed_rsh(const mp_int *a, int b,
0345 mp_int *c);
0346
0347
0348 EXTERN int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf,
0349 size_t maxlen, size_t *written);
0350
0351 EXTERN mp_err TclBN_mp_div_ld(const mp_int *a, Tcl_WideUInt b,
0352 mp_int *q, Tcl_WideUInt *r);
0353
0354 EXTERN int TclBN_mp_to_radix(const mp_int *a, char *str,
0355 size_t maxlen, size_t *written, int radix);
0356
0357 typedef struct TclTomMathStubs {
0358 int magic;
0359 void *hooks;
0360
0361 int (*tclBN_epoch) (void);
0362 int (*tclBN_revision) (void);
0363 mp_err (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c);
0364 mp_err (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c);
0365 mp_err (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c);
0366 void (*tclBN_mp_clamp) (mp_int *a);
0367 void (*tclBN_mp_clear) (mp_int *a);
0368 void (*tclBN_mp_clear_multi) (mp_int *a, ...);
0369 mp_ord (*tclBN_mp_cmp) (const mp_int *a, const mp_int *b);
0370 mp_ord (*tclBN_mp_cmp_d) (const mp_int *a, mp_digit b);
0371 mp_ord (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b);
0372 mp_err (*tclBN_mp_copy) (const mp_int *a, mp_int *b);
0373 int (*tclBN_mp_count_bits) (const mp_int *a);
0374 mp_err (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r);
0375 mp_err (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r);
0376 mp_err (*tclBN_mp_div_2) (const mp_int *a, mp_int *q);
0377 mp_err (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r);
0378 mp_err (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r);
0379 void (*tclBN_mp_exch) (mp_int *a, mp_int *b);
0380 mp_err (*tclBN_mp_expt_d) (const mp_int *a, unsigned int b, mp_int *c);
0381 mp_err (*tclBN_mp_grow) (mp_int *a, int size);
0382 mp_err (*tclBN_mp_init) (mp_int *a);
0383 mp_err (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b);
0384 mp_err (*tclBN_mp_init_multi) (mp_int *a, ...);
0385 mp_err (*tclBN_mp_init_set) (mp_int *a, mp_digit b);
0386 mp_err (*tclBN_mp_init_size) (mp_int *a, int size);
0387 mp_err (*tclBN_mp_lshd) (mp_int *a, int shift);
0388 mp_err (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r);
0389 mp_err (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r);
0390 mp_err (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p);
0391 mp_err (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p);
0392 mp_err (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p);
0393 mp_err (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p);
0394 mp_err (*tclBN_mp_neg) (const mp_int *a, mp_int *b);
0395 mp_err (*tclBN_mp_or) (const mp_int *a, const mp_int *b, mp_int *c);
0396 mp_err (*tclBN_mp_radix_size) (const mp_int *a, int radix, int *size);
0397 mp_err (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix);
0398 void (*tclBN_mp_rshd) (mp_int *a, int shift);
0399 mp_err (*tclBN_mp_shrink) (mp_int *a);
0400 void (*tclBN_mp_set) (mp_int *a, mp_digit b);
0401 mp_err (*tclBN_mp_sqr) (const mp_int *a, mp_int *b);
0402 mp_err (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b);
0403 mp_err (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c);
0404 mp_err (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c);
0405 mp_err (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b);
0406 mp_err (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen);
0407 mp_err (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen);
0408 size_t (*tclBN_mp_unsigned_bin_size) (const mp_int *a);
0409 mp_err (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c);
0410 void (*tclBN_mp_zero) (mp_int *a);
0411 void (*tclBN_reverse) (unsigned char *s, int len);
0412 mp_err (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs);
0413 mp_err (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b);
0414 mp_err (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c);
0415 mp_err (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b);
0416 mp_err (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c);
0417 mp_err (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b);
0418 mp_err (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c);
0419 mp_err (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs);
0420 mp_err (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b);
0421 mp_err (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c);
0422 mp_err (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i);
0423 mp_err (*tclBN_mp_set_int) (mp_int *a, unsigned long i);
0424 int (*tclBN_mp_cnt_lsb) (const mp_int *a);
0425 int (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal);
0426 int (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal);
0427 int (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal);
0428 mp_err (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast);
0429 void (*tclBN_mp_set_ull) (mp_int *a, Tcl_WideUInt i);
0430 Tcl_WideUInt (*tclBN_mp_get_mag_ull) (const mp_int *a);
0431 void (*tclBN_mp_set_ll) (mp_int *a, Tcl_WideInt i);
0432 void (*reserved71)(void);
0433 void (*reserved72)(void);
0434 mp_err (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c);
0435 mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c);
0436 mp_err (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c);
0437 mp_err (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c);
0438 void (*reserved77)(void);
0439 int (*tclBN_mp_to_ubin) (const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written);
0440 mp_err (*tclBN_mp_div_ld) (const mp_int *a, Tcl_WideUInt b, mp_int *q, Tcl_WideUInt *r);
0441 int (*tclBN_mp_to_radix) (const mp_int *a, char *str, size_t maxlen, size_t *written, int radix);
0442 } TclTomMathStubs;
0443
0444 extern const TclTomMathStubs *tclTomMathStubsPtr;
0445
0446 #ifdef __cplusplus
0447 }
0448 #endif
0449
0450 #if defined(USE_TCL_STUBS)
0451
0452
0453
0454
0455
0456 #define TclBN_epoch \
0457 (tclTomMathStubsPtr->tclBN_epoch)
0458 #define TclBN_revision \
0459 (tclTomMathStubsPtr->tclBN_revision)
0460 #define TclBN_mp_add \
0461 (tclTomMathStubsPtr->tclBN_mp_add)
0462 #define TclBN_mp_add_d \
0463 (tclTomMathStubsPtr->tclBN_mp_add_d)
0464 #define TclBN_mp_and \
0465 (tclTomMathStubsPtr->tclBN_mp_and)
0466 #define TclBN_mp_clamp \
0467 (tclTomMathStubsPtr->tclBN_mp_clamp)
0468 #define TclBN_mp_clear \
0469 (tclTomMathStubsPtr->tclBN_mp_clear)
0470 #define TclBN_mp_clear_multi \
0471 (tclTomMathStubsPtr->tclBN_mp_clear_multi)
0472 #define TclBN_mp_cmp \
0473 (tclTomMathStubsPtr->tclBN_mp_cmp)
0474 #define TclBN_mp_cmp_d \
0475 (tclTomMathStubsPtr->tclBN_mp_cmp_d)
0476 #define TclBN_mp_cmp_mag \
0477 (tclTomMathStubsPtr->tclBN_mp_cmp_mag)
0478 #define TclBN_mp_copy \
0479 (tclTomMathStubsPtr->tclBN_mp_copy)
0480 #define TclBN_mp_count_bits \
0481 (tclTomMathStubsPtr->tclBN_mp_count_bits)
0482 #define TclBN_mp_div \
0483 (tclTomMathStubsPtr->tclBN_mp_div)
0484 #define TclBN_mp_div_d \
0485 (tclTomMathStubsPtr->tclBN_mp_div_d)
0486 #define TclBN_mp_div_2 \
0487 (tclTomMathStubsPtr->tclBN_mp_div_2)
0488 #define TclBN_mp_div_2d \
0489 (tclTomMathStubsPtr->tclBN_mp_div_2d)
0490 #define TclBN_mp_div_3 \
0491 (tclTomMathStubsPtr->tclBN_mp_div_3)
0492 #define TclBN_mp_exch \
0493 (tclTomMathStubsPtr->tclBN_mp_exch)
0494 #define TclBN_mp_expt_d \
0495 (tclTomMathStubsPtr->tclBN_mp_expt_d)
0496 #define TclBN_mp_grow \
0497 (tclTomMathStubsPtr->tclBN_mp_grow)
0498 #define TclBN_mp_init \
0499 (tclTomMathStubsPtr->tclBN_mp_init)
0500 #define TclBN_mp_init_copy \
0501 (tclTomMathStubsPtr->tclBN_mp_init_copy)
0502 #define TclBN_mp_init_multi \
0503 (tclTomMathStubsPtr->tclBN_mp_init_multi)
0504 #define TclBN_mp_init_set \
0505 (tclTomMathStubsPtr->tclBN_mp_init_set)
0506 #define TclBN_mp_init_size \
0507 (tclTomMathStubsPtr->tclBN_mp_init_size)
0508 #define TclBN_mp_lshd \
0509 (tclTomMathStubsPtr->tclBN_mp_lshd)
0510 #define TclBN_mp_mod \
0511 (tclTomMathStubsPtr->tclBN_mp_mod)
0512 #define TclBN_mp_mod_2d \
0513 (tclTomMathStubsPtr->tclBN_mp_mod_2d)
0514 #define TclBN_mp_mul \
0515 (tclTomMathStubsPtr->tclBN_mp_mul)
0516 #define TclBN_mp_mul_d \
0517 (tclTomMathStubsPtr->tclBN_mp_mul_d)
0518 #define TclBN_mp_mul_2 \
0519 (tclTomMathStubsPtr->tclBN_mp_mul_2)
0520 #define TclBN_mp_mul_2d \
0521 (tclTomMathStubsPtr->tclBN_mp_mul_2d)
0522 #define TclBN_mp_neg \
0523 (tclTomMathStubsPtr->tclBN_mp_neg)
0524 #define TclBN_mp_or \
0525 (tclTomMathStubsPtr->tclBN_mp_or)
0526 #define TclBN_mp_radix_size \
0527 (tclTomMathStubsPtr->tclBN_mp_radix_size)
0528 #define TclBN_mp_read_radix \
0529 (tclTomMathStubsPtr->tclBN_mp_read_radix)
0530 #define TclBN_mp_rshd \
0531 (tclTomMathStubsPtr->tclBN_mp_rshd)
0532 #define TclBN_mp_shrink \
0533 (tclTomMathStubsPtr->tclBN_mp_shrink)
0534 #define TclBN_mp_set \
0535 (tclTomMathStubsPtr->tclBN_mp_set)
0536 #define TclBN_mp_sqr \
0537 (tclTomMathStubsPtr->tclBN_mp_sqr)
0538 #define TclBN_mp_sqrt \
0539 (tclTomMathStubsPtr->tclBN_mp_sqrt)
0540 #define TclBN_mp_sub \
0541 (tclTomMathStubsPtr->tclBN_mp_sub)
0542 #define TclBN_mp_sub_d \
0543 (tclTomMathStubsPtr->tclBN_mp_sub_d)
0544 #define TclBN_mp_to_unsigned_bin \
0545 (tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin)
0546 #define TclBN_mp_to_unsigned_bin_n \
0547 (tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin_n)
0548 #define TclBN_mp_toradix_n \
0549 (tclTomMathStubsPtr->tclBN_mp_toradix_n)
0550 #define TclBN_mp_unsigned_bin_size \
0551 (tclTomMathStubsPtr->tclBN_mp_unsigned_bin_size)
0552 #define TclBN_mp_xor \
0553 (tclTomMathStubsPtr->tclBN_mp_xor)
0554 #define TclBN_mp_zero \
0555 (tclTomMathStubsPtr->tclBN_mp_zero)
0556 #define TclBN_reverse \
0557 (tclTomMathStubsPtr->tclBN_reverse)
0558 #define TclBN_fast_s_mp_mul_digs \
0559 (tclTomMathStubsPtr->tclBN_fast_s_mp_mul_digs)
0560 #define TclBN_fast_s_mp_sqr \
0561 (tclTomMathStubsPtr->tclBN_fast_s_mp_sqr)
0562 #define TclBN_mp_karatsuba_mul \
0563 (tclTomMathStubsPtr->tclBN_mp_karatsuba_mul)
0564 #define TclBN_mp_karatsuba_sqr \
0565 (tclTomMathStubsPtr->tclBN_mp_karatsuba_sqr)
0566 #define TclBN_mp_toom_mul \
0567 (tclTomMathStubsPtr->tclBN_mp_toom_mul)
0568 #define TclBN_mp_toom_sqr \
0569 (tclTomMathStubsPtr->tclBN_mp_toom_sqr)
0570 #define TclBN_s_mp_add \
0571 (tclTomMathStubsPtr->tclBN_s_mp_add)
0572 #define TclBN_s_mp_mul_digs \
0573 (tclTomMathStubsPtr->tclBN_s_mp_mul_digs)
0574 #define TclBN_s_mp_sqr \
0575 (tclTomMathStubsPtr->tclBN_s_mp_sqr)
0576 #define TclBN_s_mp_sub \
0577 (tclTomMathStubsPtr->tclBN_s_mp_sub)
0578 #define TclBN_mp_init_set_int \
0579 (tclTomMathStubsPtr->tclBN_mp_init_set_int)
0580 #define TclBN_mp_set_int \
0581 (tclTomMathStubsPtr->tclBN_mp_set_int)
0582 #define TclBN_mp_cnt_lsb \
0583 (tclTomMathStubsPtr->tclBN_mp_cnt_lsb)
0584 #define TclBNInitBignumFromLong \
0585 (tclTomMathStubsPtr->tclBNInitBignumFromLong)
0586 #define TclBNInitBignumFromWideInt \
0587 (tclTomMathStubsPtr->tclBNInitBignumFromWideInt)
0588 #define TclBNInitBignumFromWideUInt \
0589 (tclTomMathStubsPtr->tclBNInitBignumFromWideUInt)
0590 #define TclBN_mp_expt_d_ex \
0591 (tclTomMathStubsPtr->tclBN_mp_expt_d_ex)
0592 #define TclBN_mp_set_ull \
0593 (tclTomMathStubsPtr->tclBN_mp_set_ull)
0594 #define TclBN_mp_get_mag_ull \
0595 (tclTomMathStubsPtr->tclBN_mp_get_mag_ull)
0596 #define TclBN_mp_set_ll \
0597 (tclTomMathStubsPtr->tclBN_mp_set_ll)
0598
0599
0600 #define TclBN_mp_tc_and \
0601 (tclTomMathStubsPtr->tclBN_mp_tc_and)
0602 #define TclBN_mp_tc_or \
0603 (tclTomMathStubsPtr->tclBN_mp_tc_or)
0604 #define TclBN_mp_tc_xor \
0605 (tclTomMathStubsPtr->tclBN_mp_tc_xor)
0606 #define TclBN_mp_signed_rsh \
0607 (tclTomMathStubsPtr->tclBN_mp_signed_rsh)
0608
0609 #define TclBN_mp_to_ubin \
0610 (tclTomMathStubsPtr->tclBN_mp_to_ubin)
0611 #define TclBN_mp_div_ld \
0612 (tclTomMathStubsPtr->tclBN_mp_div_ld)
0613 #define TclBN_mp_to_radix \
0614 (tclTomMathStubsPtr->tclBN_mp_to_radix)
0615
0616 #endif
0617
0618
0619
0620 #undef TCL_STORAGE_CLASS
0621 #define TCL_STORAGE_CLASS DLLIMPORT
0622
0623 #ifdef USE_TCL_STUBS
0624 #undef TclBNInitBignumFromLong
0625 #define TclBNInitBignumFromLong(a,b) \
0626 do { \
0627 (a)->dp = NULL; \
0628 (void)tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(b)); \
0629 if ((a)->dp == NULL) { \
0630 Tcl_Panic("initialization failure in TclBNInitBignumFromLong"); \
0631 } \
0632 } while (0)
0633 #undef TclBNInitBignumFromWideInt
0634 #define TclBNInitBignumFromWideInt(a,b) \
0635 do { \
0636 (a)->dp = NULL; \
0637 (void)tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)); \
0638 if ((a)->dp == NULL) { \
0639 Tcl_Panic("initialization failure in TclBNInitBignumFromWideInt"); \
0640 } \
0641 } while (0)
0642 #undef TclBNInitBignumFromWideUInt
0643 #define TclBNInitBignumFromWideUInt(a,b) \
0644 do { \
0645 (a)->dp = NULL; \
0646 (void)tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)); \
0647 if ((a)->dp == NULL) { \
0648 Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); \
0649 } \
0650 } while (0)
0651 #define mp_init_i32(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(int32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0652 #define mp_init_l(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0653 #define mp_init_ll(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0654 #define mp_init_i64(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0655 #define mp_init_u32(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(uint32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0656 #define mp_init_ul(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(unsigned long)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0657 #define mp_init_ull(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0658 #define mp_init_u64(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0659 #else
0660 #define mp_init_i32(a,b) (((a)->dp=NULL,(TclBNInitBignumFromLong)((a),(int32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0661 #define mp_init_l(a,b) (((a)->dp=NULL,(TclBNInitBignumFromLong)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0662 #define mp_init_ll(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0663 #define mp_init_i64(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0664 #define mp_init_u32(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(uint32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0665 #define mp_init_ul(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(unsigned long)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0666 #define mp_init_ull(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0667 #define mp_init_u64(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0668 #endif
0669 #endif