Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:30:22

0001 /*
0002  *----------------------------------------------------------------------
0003  *
0004  * tclTomMathDecls.h --
0005  *
0006  *  This file contains the declarations for the 'libtommath'
0007  *  functions that are exported by the Tcl library.
0008  *
0009  * Copyright (c) 2005 by Kevin B. Kenny.  All rights reserved.
0010  *
0011  * See the file "license.terms" for information on usage and redistribution
0012  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
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  * Define the version of the Stubs table that's exported for tommath
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 /* Define custom memory allocation for libtommath */
0035 
0036 /* MODULE_SCOPE void* TclBNAlloc( size_t ); */
0037 #define TclBNAlloc(s) ((void*)ckalloc((size_t)(s)))
0038 /* MODULE_SCOPE void* TclBNCalloc( size_t, size_t ); */
0039 #define TclBNCalloc(m,s) memset(ckalloc((size_t)(m)*(size_t)(s)),0,(size_t)(m)*(size_t)(s))
0040 /* MODULE_SCOPE void* TclBNRealloc( void*, size_t ); */
0041 #define TclBNRealloc(x,s) ((void*)ckrealloc((char*)(x),(size_t)(s)))
0042 /* MODULE_SCOPE void  TclBNFree( void* ); */
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 /* Rename the global symbols in libtommath to avoid linkage conflicts */
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  * WARNING: This file is automatically generated by the tools/genStubs.tcl
0147  * script.  Any modifications to the function declarations below should be made
0148  * in the generic/tclInt.decls script.
0149  */
0150 
0151 /* !BEGIN!: Do not edit below this line. */
0152 
0153 #ifdef __cplusplus
0154 extern "C" {
0155 #endif
0156 
0157 /*
0158  * Exported function declarations:
0159  */
0160 
0161 /* 0 */
0162 EXTERN int      TclBN_epoch(void);
0163 /* 1 */
0164 EXTERN int      TclBN_revision(void);
0165 /* 2 */
0166 EXTERN mp_err       TclBN_mp_add(const mp_int *a, const mp_int *b,
0167                 mp_int *c);
0168 /* 3 */
0169 EXTERN mp_err       TclBN_mp_add_d(const mp_int *a, mp_digit b,
0170                 mp_int *c);
0171 /* 4 */
0172 EXTERN mp_err       TclBN_mp_and(const mp_int *a, const mp_int *b,
0173                 mp_int *c);
0174 /* 5 */
0175 EXTERN void     TclBN_mp_clamp(mp_int *a);
0176 /* 6 */
0177 EXTERN void     TclBN_mp_clear(mp_int *a);
0178 /* 7 */
0179 EXTERN void     TclBN_mp_clear_multi(mp_int *a, ...);
0180 /* 8 */
0181 EXTERN mp_ord       TclBN_mp_cmp(const mp_int *a, const mp_int *b);
0182 /* 9 */
0183 EXTERN mp_ord       TclBN_mp_cmp_d(const mp_int *a, mp_digit b);
0184 /* 10 */
0185 EXTERN mp_ord       TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b);
0186 /* 11 */
0187 EXTERN mp_err       TclBN_mp_copy(const mp_int *a, mp_int *b);
0188 /* 12 */
0189 EXTERN int      TclBN_mp_count_bits(const mp_int *a);
0190 /* 13 */
0191 EXTERN mp_err       TclBN_mp_div(const mp_int *a, const mp_int *b,
0192                 mp_int *q, mp_int *r);
0193 /* 14 */
0194 EXTERN mp_err       TclBN_mp_div_d(const mp_int *a, mp_digit b,
0195                 mp_int *q, mp_digit *r);
0196 /* 15 */
0197 EXTERN mp_err       TclBN_mp_div_2(const mp_int *a, mp_int *q);
0198 /* 16 */
0199 EXTERN mp_err       TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q,
0200                 mp_int *r);
0201 /* 17 */
0202 EXTERN mp_err       TclBN_mp_div_3(const mp_int *a, mp_int *q,
0203                 mp_digit *r);
0204 /* 18 */
0205 EXTERN void     TclBN_mp_exch(mp_int *a, mp_int *b);
0206 /* 19 */
0207 EXTERN mp_err       TclBN_mp_expt_d(const mp_int *a, unsigned int b,
0208                 mp_int *c);
0209 /* 20 */
0210 EXTERN mp_err       TclBN_mp_grow(mp_int *a, int size);
0211 /* 21 */
0212 EXTERN mp_err       TclBN_mp_init(mp_int *a);
0213 /* 22 */
0214 EXTERN mp_err       TclBN_mp_init_copy(mp_int *a, const mp_int *b);
0215 /* 23 */
0216 EXTERN mp_err       TclBN_mp_init_multi(mp_int *a, ...);
0217 /* 24 */
0218 EXTERN mp_err       TclBN_mp_init_set(mp_int *a, mp_digit b);
0219 /* 25 */
0220 EXTERN mp_err       TclBN_mp_init_size(mp_int *a, int size);
0221 /* 26 */
0222 EXTERN mp_err       TclBN_mp_lshd(mp_int *a, int shift);
0223 /* 27 */
0224 EXTERN mp_err       TclBN_mp_mod(const mp_int *a, const mp_int *b,
0225                 mp_int *r);
0226 /* 28 */
0227 EXTERN mp_err       TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r);
0228 /* 29 */
0229 EXTERN mp_err       TclBN_mp_mul(const mp_int *a, const mp_int *b,
0230                 mp_int *p);
0231 /* 30 */
0232 EXTERN mp_err       TclBN_mp_mul_d(const mp_int *a, mp_digit b,
0233                 mp_int *p);
0234 /* 31 */
0235 EXTERN mp_err       TclBN_mp_mul_2(const mp_int *a, mp_int *p);
0236 /* 32 */
0237 EXTERN mp_err       TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p);
0238 /* 33 */
0239 EXTERN mp_err       TclBN_mp_neg(const mp_int *a, mp_int *b);
0240 /* 34 */
0241 EXTERN mp_err       TclBN_mp_or(const mp_int *a, const mp_int *b,
0242                 mp_int *c);
0243 /* 35 */
0244 EXTERN mp_err       TclBN_mp_radix_size(const mp_int *a, int radix,
0245                 int *size);
0246 /* 36 */
0247 EXTERN mp_err       TclBN_mp_read_radix(mp_int *a, const char *str,
0248                 int radix);
0249 /* 37 */
0250 EXTERN void     TclBN_mp_rshd(mp_int *a, int shift);
0251 /* 38 */
0252 EXTERN mp_err       TclBN_mp_shrink(mp_int *a);
0253 /* 39 */
0254 EXTERN void     TclBN_mp_set(mp_int *a, mp_digit b);
0255 /* 40 */
0256 EXTERN mp_err       TclBN_mp_sqr(const mp_int *a, mp_int *b);
0257 /* 41 */
0258 EXTERN mp_err       TclBN_mp_sqrt(const mp_int *a, mp_int *b);
0259 /* 42 */
0260 EXTERN mp_err       TclBN_mp_sub(const mp_int *a, const mp_int *b,
0261                 mp_int *c);
0262 /* 43 */
0263 EXTERN mp_err       TclBN_mp_sub_d(const mp_int *a, mp_digit b,
0264                 mp_int *c);
0265 /* 44 */
0266 EXTERN mp_err       TclBN_mp_to_unsigned_bin(const mp_int *a,
0267                 unsigned char *b);
0268 /* 45 */
0269 EXTERN mp_err       TclBN_mp_to_unsigned_bin_n(const mp_int *a,
0270                 unsigned char *b, unsigned long *outlen);
0271 /* 46 */
0272 EXTERN mp_err       TclBN_mp_toradix_n(const mp_int *a, char *str,
0273                 int radix, int maxlen);
0274 /* 47 */
0275 EXTERN size_t       TclBN_mp_unsigned_bin_size(const mp_int *a);
0276 /* 48 */
0277 EXTERN mp_err       TclBN_mp_xor(const mp_int *a, const mp_int *b,
0278                 mp_int *c);
0279 /* 49 */
0280 EXTERN void     TclBN_mp_zero(mp_int *a);
0281 /* 50 */
0282 EXTERN void     TclBN_reverse(unsigned char *s, int len);
0283 /* 51 */
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 /* 52 */
0287 EXTERN mp_err       TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b);
0288 /* 53 */
0289 EXTERN mp_err       TclBN_mp_karatsuba_mul(const mp_int *a,
0290                 const mp_int *b, mp_int *c);
0291 /* 54 */
0292 EXTERN mp_err       TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b);
0293 /* 55 */
0294 EXTERN mp_err       TclBN_mp_toom_mul(const mp_int *a, const mp_int *b,
0295                 mp_int *c);
0296 /* 56 */
0297 EXTERN mp_err       TclBN_mp_toom_sqr(const mp_int *a, mp_int *b);
0298 /* 57 */
0299 EXTERN mp_err       TclBN_s_mp_add(const mp_int *a, const mp_int *b,
0300                 mp_int *c);
0301 /* 58 */
0302 EXTERN mp_err       TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b,
0303                 mp_int *c, int digs);
0304 /* 59 */
0305 EXTERN mp_err       TclBN_s_mp_sqr(const mp_int *a, mp_int *b);
0306 /* 60 */
0307 EXTERN mp_err       TclBN_s_mp_sub(const mp_int *a, const mp_int *b,
0308                 mp_int *c);
0309 /* 61 */
0310 EXTERN mp_err       TclBN_mp_init_set_int(mp_int *a, unsigned long i);
0311 /* 62 */
0312 EXTERN mp_err       TclBN_mp_set_int(mp_int *a, unsigned long i);
0313 /* 63 */
0314 EXTERN int      TclBN_mp_cnt_lsb(const mp_int *a);
0315 /* 64 */
0316 EXTERN int      TclBNInitBignumFromLong(mp_int *bignum, long initVal);
0317 /* 65 */
0318 EXTERN int      TclBNInitBignumFromWideInt(mp_int *bignum,
0319                 Tcl_WideInt initVal);
0320 /* 66 */
0321 EXTERN int      TclBNInitBignumFromWideUInt(mp_int *bignum,
0322                 Tcl_WideUInt initVal);
0323 /* 67 */
0324 EXTERN mp_err       TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b,
0325                 mp_int *c, int fast);
0326 /* 68 */
0327 EXTERN void     TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i);
0328 /* 69 */
0329 EXTERN Tcl_WideUInt TclBN_mp_get_mag_ull(const mp_int *a);
0330 /* 70 */
0331 EXTERN void     TclBN_mp_set_ll(mp_int *a, Tcl_WideInt i);
0332 /* Slot 71 is reserved */
0333 /* Slot 72 is reserved */
0334 /* 73 */
0335 EXTERN mp_err       TclBN_mp_tc_and(const mp_int *a, const mp_int *b,
0336                 mp_int *c);
0337 /* 74 */
0338 EXTERN mp_err       TclBN_mp_tc_or(const mp_int *a, const mp_int *b,
0339                 mp_int *c);
0340 /* 75 */
0341 EXTERN mp_err       TclBN_mp_tc_xor(const mp_int *a, const mp_int *b,
0342                 mp_int *c);
0343 /* 76 */
0344 EXTERN mp_err       TclBN_mp_signed_rsh(const mp_int *a, int b,
0345                 mp_int *c);
0346 /* Slot 77 is reserved */
0347 /* 78 */
0348 EXTERN int      TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf,
0349                 size_t maxlen, size_t *written);
0350 /* 79 */
0351 EXTERN mp_err       TclBN_mp_div_ld(const mp_int *a, Tcl_WideUInt b,
0352                 mp_int *q, Tcl_WideUInt *r);
0353 /* 80 */
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); /* 0 */
0362     int (*tclBN_revision) (void); /* 1 */
0363     mp_err (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */
0364     mp_err (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c); /* 3 */
0365     mp_err (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */
0366     void (*tclBN_mp_clamp) (mp_int *a); /* 5 */
0367     void (*tclBN_mp_clear) (mp_int *a); /* 6 */
0368     void (*tclBN_mp_clear_multi) (mp_int *a, ...); /* 7 */
0369     mp_ord (*tclBN_mp_cmp) (const mp_int *a, const mp_int *b); /* 8 */
0370     mp_ord (*tclBN_mp_cmp_d) (const mp_int *a, mp_digit b); /* 9 */
0371     mp_ord (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); /* 10 */
0372     mp_err (*tclBN_mp_copy) (const mp_int *a, mp_int *b); /* 11 */
0373     int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */
0374     mp_err (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r); /* 13 */
0375     mp_err (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */
0376     mp_err (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */
0377     mp_err (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */
0378     mp_err (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); /* 17 */
0379     void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */
0380     mp_err (*tclBN_mp_expt_d) (const mp_int *a, unsigned int b, mp_int *c); /* 19 */
0381     mp_err (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */
0382     mp_err (*tclBN_mp_init) (mp_int *a); /* 21 */
0383     mp_err (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); /* 22 */
0384     mp_err (*tclBN_mp_init_multi) (mp_int *a, ...); /* 23 */
0385     mp_err (*tclBN_mp_init_set) (mp_int *a, mp_digit b); /* 24 */
0386     mp_err (*tclBN_mp_init_size) (mp_int *a, int size); /* 25 */
0387     mp_err (*tclBN_mp_lshd) (mp_int *a, int shift); /* 26 */
0388     mp_err (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r); /* 27 */
0389     mp_err (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */
0390     mp_err (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p); /* 29 */
0391     mp_err (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p); /* 30 */
0392     mp_err (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */
0393     mp_err (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */
0394     mp_err (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */
0395     mp_err (*tclBN_mp_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 34 */
0396     mp_err (*tclBN_mp_radix_size) (const mp_int *a, int radix, int *size); /* 35 */
0397     mp_err (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); /* 36 */
0398     void (*tclBN_mp_rshd) (mp_int *a, int shift); /* 37 */
0399     mp_err (*tclBN_mp_shrink) (mp_int *a); /* 38 */
0400     void (*tclBN_mp_set) (mp_int *a, mp_digit b); /* 39 */
0401     mp_err (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */
0402     mp_err (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */
0403     mp_err (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */
0404     mp_err (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c); /* 43 */
0405     mp_err (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */
0406     mp_err (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */
0407     mp_err (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */
0408     size_t (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */
0409     mp_err (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */
0410     void (*tclBN_mp_zero) (mp_int *a); /* 49 */
0411     void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */
0412     mp_err (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */
0413     mp_err (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); /* 52 */
0414     mp_err (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 53 */
0415     mp_err (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); /* 54 */
0416     mp_err (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 55 */
0417     mp_err (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b); /* 56 */
0418     mp_err (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 57 */
0419     mp_err (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 58 */
0420     mp_err (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); /* 59 */
0421     mp_err (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 60 */
0422     mp_err (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */
0423     mp_err (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */
0424     int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */
0425     int (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */
0426     int (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */
0427     int (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */
0428     mp_err (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */
0429     void (*tclBN_mp_set_ull) (mp_int *a, Tcl_WideUInt i); /* 68 */
0430     Tcl_WideUInt (*tclBN_mp_get_mag_ull) (const mp_int *a); /* 69 */
0431     void (*tclBN_mp_set_ll) (mp_int *a, Tcl_WideInt i); /* 70 */
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); /* 73 */
0435     mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 74 */
0436     mp_err (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 75 */
0437     mp_err (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c); /* 76 */
0438     void (*reserved77)(void);
0439     int (*tclBN_mp_to_ubin) (const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written); /* 78 */
0440     mp_err (*tclBN_mp_div_ld) (const mp_int *a, Tcl_WideUInt b, mp_int *q, Tcl_WideUInt *r); /* 79 */
0441     int (*tclBN_mp_to_radix) (const mp_int *a, char *str, size_t maxlen, size_t *written, int radix); /* 80 */
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  * Inline function declarations:
0454  */
0455 
0456 #define TclBN_epoch \
0457     (tclTomMathStubsPtr->tclBN_epoch) /* 0 */
0458 #define TclBN_revision \
0459     (tclTomMathStubsPtr->tclBN_revision) /* 1 */
0460 #define TclBN_mp_add \
0461     (tclTomMathStubsPtr->tclBN_mp_add) /* 2 */
0462 #define TclBN_mp_add_d \
0463     (tclTomMathStubsPtr->tclBN_mp_add_d) /* 3 */
0464 #define TclBN_mp_and \
0465     (tclTomMathStubsPtr->tclBN_mp_and) /* 4 */
0466 #define TclBN_mp_clamp \
0467     (tclTomMathStubsPtr->tclBN_mp_clamp) /* 5 */
0468 #define TclBN_mp_clear \
0469     (tclTomMathStubsPtr->tclBN_mp_clear) /* 6 */
0470 #define TclBN_mp_clear_multi \
0471     (tclTomMathStubsPtr->tclBN_mp_clear_multi) /* 7 */
0472 #define TclBN_mp_cmp \
0473     (tclTomMathStubsPtr->tclBN_mp_cmp) /* 8 */
0474 #define TclBN_mp_cmp_d \
0475     (tclTomMathStubsPtr->tclBN_mp_cmp_d) /* 9 */
0476 #define TclBN_mp_cmp_mag \
0477     (tclTomMathStubsPtr->tclBN_mp_cmp_mag) /* 10 */
0478 #define TclBN_mp_copy \
0479     (tclTomMathStubsPtr->tclBN_mp_copy) /* 11 */
0480 #define TclBN_mp_count_bits \
0481     (tclTomMathStubsPtr->tclBN_mp_count_bits) /* 12 */
0482 #define TclBN_mp_div \
0483     (tclTomMathStubsPtr->tclBN_mp_div) /* 13 */
0484 #define TclBN_mp_div_d \
0485     (tclTomMathStubsPtr->tclBN_mp_div_d) /* 14 */
0486 #define TclBN_mp_div_2 \
0487     (tclTomMathStubsPtr->tclBN_mp_div_2) /* 15 */
0488 #define TclBN_mp_div_2d \
0489     (tclTomMathStubsPtr->tclBN_mp_div_2d) /* 16 */
0490 #define TclBN_mp_div_3 \
0491     (tclTomMathStubsPtr->tclBN_mp_div_3) /* 17 */
0492 #define TclBN_mp_exch \
0493     (tclTomMathStubsPtr->tclBN_mp_exch) /* 18 */
0494 #define TclBN_mp_expt_d \
0495     (tclTomMathStubsPtr->tclBN_mp_expt_d) /* 19 */
0496 #define TclBN_mp_grow \
0497     (tclTomMathStubsPtr->tclBN_mp_grow) /* 20 */
0498 #define TclBN_mp_init \
0499     (tclTomMathStubsPtr->tclBN_mp_init) /* 21 */
0500 #define TclBN_mp_init_copy \
0501     (tclTomMathStubsPtr->tclBN_mp_init_copy) /* 22 */
0502 #define TclBN_mp_init_multi \
0503     (tclTomMathStubsPtr->tclBN_mp_init_multi) /* 23 */
0504 #define TclBN_mp_init_set \
0505     (tclTomMathStubsPtr->tclBN_mp_init_set) /* 24 */
0506 #define TclBN_mp_init_size \
0507     (tclTomMathStubsPtr->tclBN_mp_init_size) /* 25 */
0508 #define TclBN_mp_lshd \
0509     (tclTomMathStubsPtr->tclBN_mp_lshd) /* 26 */
0510 #define TclBN_mp_mod \
0511     (tclTomMathStubsPtr->tclBN_mp_mod) /* 27 */
0512 #define TclBN_mp_mod_2d \
0513     (tclTomMathStubsPtr->tclBN_mp_mod_2d) /* 28 */
0514 #define TclBN_mp_mul \
0515     (tclTomMathStubsPtr->tclBN_mp_mul) /* 29 */
0516 #define TclBN_mp_mul_d \
0517     (tclTomMathStubsPtr->tclBN_mp_mul_d) /* 30 */
0518 #define TclBN_mp_mul_2 \
0519     (tclTomMathStubsPtr->tclBN_mp_mul_2) /* 31 */
0520 #define TclBN_mp_mul_2d \
0521     (tclTomMathStubsPtr->tclBN_mp_mul_2d) /* 32 */
0522 #define TclBN_mp_neg \
0523     (tclTomMathStubsPtr->tclBN_mp_neg) /* 33 */
0524 #define TclBN_mp_or \
0525     (tclTomMathStubsPtr->tclBN_mp_or) /* 34 */
0526 #define TclBN_mp_radix_size \
0527     (tclTomMathStubsPtr->tclBN_mp_radix_size) /* 35 */
0528 #define TclBN_mp_read_radix \
0529     (tclTomMathStubsPtr->tclBN_mp_read_radix) /* 36 */
0530 #define TclBN_mp_rshd \
0531     (tclTomMathStubsPtr->tclBN_mp_rshd) /* 37 */
0532 #define TclBN_mp_shrink \
0533     (tclTomMathStubsPtr->tclBN_mp_shrink) /* 38 */
0534 #define TclBN_mp_set \
0535     (tclTomMathStubsPtr->tclBN_mp_set) /* 39 */
0536 #define TclBN_mp_sqr \
0537     (tclTomMathStubsPtr->tclBN_mp_sqr) /* 40 */
0538 #define TclBN_mp_sqrt \
0539     (tclTomMathStubsPtr->tclBN_mp_sqrt) /* 41 */
0540 #define TclBN_mp_sub \
0541     (tclTomMathStubsPtr->tclBN_mp_sub) /* 42 */
0542 #define TclBN_mp_sub_d \
0543     (tclTomMathStubsPtr->tclBN_mp_sub_d) /* 43 */
0544 #define TclBN_mp_to_unsigned_bin \
0545     (tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin) /* 44 */
0546 #define TclBN_mp_to_unsigned_bin_n \
0547     (tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin_n) /* 45 */
0548 #define TclBN_mp_toradix_n \
0549     (tclTomMathStubsPtr->tclBN_mp_toradix_n) /* 46 */
0550 #define TclBN_mp_unsigned_bin_size \
0551     (tclTomMathStubsPtr->tclBN_mp_unsigned_bin_size) /* 47 */
0552 #define TclBN_mp_xor \
0553     (tclTomMathStubsPtr->tclBN_mp_xor) /* 48 */
0554 #define TclBN_mp_zero \
0555     (tclTomMathStubsPtr->tclBN_mp_zero) /* 49 */
0556 #define TclBN_reverse \
0557     (tclTomMathStubsPtr->tclBN_reverse) /* 50 */
0558 #define TclBN_fast_s_mp_mul_digs \
0559     (tclTomMathStubsPtr->tclBN_fast_s_mp_mul_digs) /* 51 */
0560 #define TclBN_fast_s_mp_sqr \
0561     (tclTomMathStubsPtr->tclBN_fast_s_mp_sqr) /* 52 */
0562 #define TclBN_mp_karatsuba_mul \
0563     (tclTomMathStubsPtr->tclBN_mp_karatsuba_mul) /* 53 */
0564 #define TclBN_mp_karatsuba_sqr \
0565     (tclTomMathStubsPtr->tclBN_mp_karatsuba_sqr) /* 54 */
0566 #define TclBN_mp_toom_mul \
0567     (tclTomMathStubsPtr->tclBN_mp_toom_mul) /* 55 */
0568 #define TclBN_mp_toom_sqr \
0569     (tclTomMathStubsPtr->tclBN_mp_toom_sqr) /* 56 */
0570 #define TclBN_s_mp_add \
0571     (tclTomMathStubsPtr->tclBN_s_mp_add) /* 57 */
0572 #define TclBN_s_mp_mul_digs \
0573     (tclTomMathStubsPtr->tclBN_s_mp_mul_digs) /* 58 */
0574 #define TclBN_s_mp_sqr \
0575     (tclTomMathStubsPtr->tclBN_s_mp_sqr) /* 59 */
0576 #define TclBN_s_mp_sub \
0577     (tclTomMathStubsPtr->tclBN_s_mp_sub) /* 60 */
0578 #define TclBN_mp_init_set_int \
0579     (tclTomMathStubsPtr->tclBN_mp_init_set_int) /* 61 */
0580 #define TclBN_mp_set_int \
0581     (tclTomMathStubsPtr->tclBN_mp_set_int) /* 62 */
0582 #define TclBN_mp_cnt_lsb \
0583     (tclTomMathStubsPtr->tclBN_mp_cnt_lsb) /* 63 */
0584 #define TclBNInitBignumFromLong \
0585     (tclTomMathStubsPtr->tclBNInitBignumFromLong) /* 64 */
0586 #define TclBNInitBignumFromWideInt \
0587     (tclTomMathStubsPtr->tclBNInitBignumFromWideInt) /* 65 */
0588 #define TclBNInitBignumFromWideUInt \
0589     (tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) /* 66 */
0590 #define TclBN_mp_expt_d_ex \
0591     (tclTomMathStubsPtr->tclBN_mp_expt_d_ex) /* 67 */
0592 #define TclBN_mp_set_ull \
0593     (tclTomMathStubsPtr->tclBN_mp_set_ull) /* 68 */
0594 #define TclBN_mp_get_mag_ull \
0595     (tclTomMathStubsPtr->tclBN_mp_get_mag_ull) /* 69 */
0596 #define TclBN_mp_set_ll \
0597     (tclTomMathStubsPtr->tclBN_mp_set_ll) /* 70 */
0598 /* Slot 71 is reserved */
0599 /* Slot 72 is reserved */
0600 #define TclBN_mp_tc_and \
0601     (tclTomMathStubsPtr->tclBN_mp_tc_and) /* 73 */
0602 #define TclBN_mp_tc_or \
0603     (tclTomMathStubsPtr->tclBN_mp_tc_or) /* 74 */
0604 #define TclBN_mp_tc_xor \
0605     (tclTomMathStubsPtr->tclBN_mp_tc_xor) /* 75 */
0606 #define TclBN_mp_signed_rsh \
0607     (tclTomMathStubsPtr->tclBN_mp_signed_rsh) /* 76 */
0608 /* Slot 77 is reserved */
0609 #define TclBN_mp_to_ubin \
0610     (tclTomMathStubsPtr->tclBN_mp_to_ubin) /* 78 */
0611 #define TclBN_mp_div_ld \
0612     (tclTomMathStubsPtr->tclBN_mp_div_ld) /* 79 */
0613 #define TclBN_mp_to_radix \
0614     (tclTomMathStubsPtr->tclBN_mp_to_radix) /* 80 */
0615 
0616 #endif /* defined(USE_TCL_STUBS) */
0617 
0618 /* !END!: Do not edit above this line. */
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 /* USE_TCL_STUBS */
0669 #endif /* _TCLINTDECLS */