Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-10 10:32:41

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 s_mp_div_3 TclBN_mp_div_3
0071 #define mp_div_d TclBN_mp_div_d
0072 #define mp_exch TclBN_mp_exch
0073 #define mp_expt_d TclBN_mp_expt_d
0074 #define mp_expt_d_ex TclBN_mp_expt_d_ex
0075 #define mp_expt_n TclBN_mp_expt_d
0076 #define mp_expt_u32 TclBN_mp_expt_d
0077 #define mp_get_mag_ull TclBN_mp_get_mag_ull
0078 #define mp_grow TclBN_mp_grow
0079 #define mp_init TclBN_mp_init
0080 #define mp_init_copy TclBN_mp_init_copy
0081 #define mp_init_multi TclBN_mp_init_multi
0082 #define mp_init_set TclBN_mp_init_set
0083 #define mp_init_set_int TclBN_mp_init_set_int
0084 #define mp_init_size TclBN_mp_init_size
0085 #define mp_lshd TclBN_mp_lshd
0086 #define mp_mod TclBN_mp_mod
0087 #define mp_mod_2d TclBN_mp_mod_2d
0088 #define mp_mul TclBN_mp_mul
0089 #define mp_mul_2 TclBN_mp_mul_2
0090 #define mp_mul_2d TclBN_mp_mul_2d
0091 #define mp_mul_d TclBN_mp_mul_d
0092 #define mp_neg TclBN_mp_neg
0093 #define mp_or TclBN_mp_or
0094 #define mp_pack TclBN_mp_pack
0095 #define mp_pack_count TclBN_mp_pack_count
0096 #define mp_radix_size TclBN_mp_radix_size
0097 #define mp_read_radix TclBN_mp_read_radix
0098 #define mp_rshd TclBN_mp_rshd
0099 #define mp_set TclBN_mp_set
0100 #define mp_set_int(a,b) (TclBN_mp_set_int(a,(unsigned int)(b)),MP_OKAY)
0101 #define mp_set_ll TclBN_mp_set_ll
0102 #define mp_set_long(a,b) (TclBN_mp_set_int(a,b),MP_OKAY)
0103 #define mp_set_ul(a,b) (void)TclBN_mp_set_int(a,b)
0104 #define mp_set_ull TclBN_mp_set_ull
0105 #define mp_set_u64 TclBN_mp_set_ull
0106 #define mp_shrink TclBN_mp_shrink
0107 #define mp_sqr TclBN_mp_sqr
0108 #define mp_sqrt TclBN_mp_sqrt
0109 #define mp_sub TclBN_mp_sub
0110 #define mp_sub_d TclBN_mp_sub_d
0111 #define mp_signed_rsh TclBN_mp_signed_rsh
0112 #define mp_tc_and TclBN_mp_and
0113 #define mp_tc_div_2d TclBN_mp_signed_rsh
0114 #define mp_tc_or TclBN_mp_or
0115 #define mp_tc_xor TclBN_mp_xor
0116 #define mp_to_unsigned_bin TclBN_mp_to_unsigned_bin
0117 #define mp_to_unsigned_bin_n TclBN_mp_to_unsigned_bin_n
0118 #define mp_toradix_n TclBN_mp_toradix_n
0119 #define mp_to_radix TclBN_mp_to_radix
0120 #define mp_to_ubin TclBN_mp_to_ubin
0121 #define mp_unpack TclBN_mp_unpack
0122 #define mp_ubin_size TclBN_mp_unsigned_bin_size
0123 #define mp_unsigned_bin_size(a) ((int)TclBN_mp_unsigned_bin_size(a))
0124 #define mp_xor TclBN_mp_xor
0125 #define mp_zero TclBN_mp_zero
0126 #define s_mp_add TclBN_s_mp_add
0127 #define s_mp_balance_mul TclBN_mp_balance_mul
0128 #define s_mp_karatsuba_mul TclBN_mp_karatsuba_mul
0129 #define s_mp_karatsuba_sqr TclBN_mp_karatsuba_sqr
0130 #define s_mp_mul_digs TclBN_s_mp_mul_digs
0131 #define s_mp_mul_digs_fast TclBN_fast_s_mp_mul_digs
0132 #define s_mp_reverse TclBN_s_mp_reverse
0133 #define s_mp_sqr TclBN_s_mp_sqr
0134 #define s_mp_sqr_fast TclBN_fast_s_mp_sqr
0135 #define s_mp_sub TclBN_s_mp_sub
0136 #define s_mp_toom_mul TclBN_mp_toom_mul
0137 #define s_mp_toom_sqr TclBN_mp_toom_sqr
0138 
0139 #undef TCL_STORAGE_CLASS
0140 #ifdef BUILD_tcl
0141 #   define TCL_STORAGE_CLASS DLLEXPORT
0142 #else
0143 #   ifdef USE_TCL_STUBS
0144 #      define TCL_STORAGE_CLASS
0145 #   else
0146 #      define TCL_STORAGE_CLASS DLLIMPORT
0147 #   endif
0148 #endif
0149 
0150 /*
0151  * WARNING: This file is automatically generated by the tools/genStubs.tcl
0152  * script.  Any modifications to the function declarations below should be made
0153  * in the generic/tclInt.decls script.
0154  */
0155 
0156 /* !BEGIN!: Do not edit below this line. */
0157 
0158 #ifdef __cplusplus
0159 extern "C" {
0160 #endif
0161 
0162 /*
0163  * Exported function declarations:
0164  */
0165 
0166 /* 0 */
0167 EXTERN int      TclBN_epoch(void);
0168 /* 1 */
0169 EXTERN int      TclBN_revision(void);
0170 /* 2 */
0171 EXTERN mp_err       TclBN_mp_add(const mp_int *a, const mp_int *b,
0172                 mp_int *c);
0173 /* 3 */
0174 EXTERN mp_err       TclBN_mp_add_d(const mp_int *a, mp_digit b,
0175                 mp_int *c);
0176 /* 4 */
0177 EXTERN mp_err       TclBN_mp_and(const mp_int *a, const mp_int *b,
0178                 mp_int *c);
0179 /* 5 */
0180 EXTERN void     TclBN_mp_clamp(mp_int *a);
0181 /* 6 */
0182 EXTERN void     TclBN_mp_clear(mp_int *a);
0183 /* 7 */
0184 EXTERN void     TclBN_mp_clear_multi(mp_int *a, ...);
0185 /* 8 */
0186 EXTERN mp_ord       TclBN_mp_cmp(const mp_int *a, const mp_int *b);
0187 /* 9 */
0188 EXTERN mp_ord       TclBN_mp_cmp_d(const mp_int *a, mp_digit b);
0189 /* 10 */
0190 EXTERN mp_ord       TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b);
0191 /* 11 */
0192 EXTERN mp_err       TclBN_mp_copy(const mp_int *a, mp_int *b);
0193 /* 12 */
0194 EXTERN int      TclBN_mp_count_bits(const mp_int *a);
0195 /* 13 */
0196 EXTERN mp_err       TclBN_mp_div(const mp_int *a, const mp_int *b,
0197                 mp_int *q, mp_int *r);
0198 /* 14 */
0199 EXTERN mp_err       TclBN_mp_div_d(const mp_int *a, mp_digit b,
0200                 mp_int *q, mp_digit *r);
0201 /* 15 */
0202 EXTERN mp_err       TclBN_mp_div_2(const mp_int *a, mp_int *q);
0203 /* 16 */
0204 EXTERN mp_err       TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q,
0205                 mp_int *r);
0206 /* 17 */
0207 EXTERN mp_err       TclBN_mp_div_3(const mp_int *a, mp_int *q,
0208                 mp_digit *r);
0209 /* 18 */
0210 EXTERN void     TclBN_mp_exch(mp_int *a, mp_int *b);
0211 /* 19 */
0212 EXTERN mp_err       TclBN_mp_expt_d(const mp_int *a, int b, mp_int *c);
0213 /* 20 */
0214 EXTERN mp_err       TclBN_mp_grow(mp_int *a, int size);
0215 /* 21 */
0216 EXTERN mp_err       TclBN_mp_init(mp_int *a);
0217 /* 22 */
0218 EXTERN mp_err       TclBN_mp_init_copy(mp_int *a, const mp_int *b);
0219 /* 23 */
0220 EXTERN mp_err       TclBN_mp_init_multi(mp_int *a, ...);
0221 /* 24 */
0222 EXTERN mp_err       TclBN_mp_init_set(mp_int *a, mp_digit b);
0223 /* 25 */
0224 EXTERN mp_err       TclBN_mp_init_size(mp_int *a, int size);
0225 /* 26 */
0226 EXTERN mp_err       TclBN_mp_lshd(mp_int *a, int shift);
0227 /* 27 */
0228 EXTERN mp_err       TclBN_mp_mod(const mp_int *a, const mp_int *b,
0229                 mp_int *r);
0230 /* 28 */
0231 EXTERN mp_err       TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r);
0232 /* 29 */
0233 EXTERN mp_err       TclBN_mp_mul(const mp_int *a, const mp_int *b,
0234                 mp_int *p);
0235 /* 30 */
0236 EXTERN mp_err       TclBN_mp_mul_d(const mp_int *a, mp_digit b,
0237                 mp_int *p);
0238 /* 31 */
0239 EXTERN mp_err       TclBN_mp_mul_2(const mp_int *a, mp_int *p);
0240 /* 32 */
0241 EXTERN mp_err       TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p);
0242 /* 33 */
0243 EXTERN mp_err       TclBN_mp_neg(const mp_int *a, mp_int *b);
0244 /* 34 */
0245 EXTERN mp_err       TclBN_mp_or(const mp_int *a, const mp_int *b,
0246                 mp_int *c);
0247 /* 35 */
0248 EXTERN mp_err       TclBN_mp_radix_size(const mp_int *a, int radix,
0249                 int *size);
0250 /* 36 */
0251 EXTERN mp_err       TclBN_mp_read_radix(mp_int *a, const char *str,
0252                 int radix);
0253 /* 37 */
0254 EXTERN void     TclBN_mp_rshd(mp_int *a, int shift);
0255 /* 38 */
0256 EXTERN mp_err       TclBN_mp_shrink(mp_int *a);
0257 /* 39 */
0258 EXTERN void     TclBN_mp_set(mp_int *a, mp_digit b);
0259 /* 40 */
0260 EXTERN mp_err       TclBN_mp_sqr(const mp_int *a, mp_int *b);
0261 /* 41 */
0262 EXTERN mp_err       TclBN_mp_sqrt(const mp_int *a, mp_int *b);
0263 /* 42 */
0264 EXTERN mp_err       TclBN_mp_sub(const mp_int *a, const mp_int *b,
0265                 mp_int *c);
0266 /* 43 */
0267 EXTERN mp_err       TclBN_mp_sub_d(const mp_int *a, mp_digit b,
0268                 mp_int *c);
0269 /* 44 */
0270 EXTERN mp_err       TclBN_mp_to_unsigned_bin(const mp_int *a,
0271                 unsigned char *b);
0272 /* 45 */
0273 EXTERN mp_err       TclBN_mp_to_unsigned_bin_n(const mp_int *a,
0274                 unsigned char *b, unsigned long *outlen);
0275 /* 46 */
0276 EXTERN mp_err       TclBN_mp_toradix_n(const mp_int *a, char *str,
0277                 int radix, int maxlen);
0278 /* 47 */
0279 EXTERN size_t       TclBN_mp_unsigned_bin_size(const mp_int *a);
0280 /* 48 */
0281 EXTERN mp_err       TclBN_mp_xor(const mp_int *a, const mp_int *b,
0282                 mp_int *c);
0283 /* 49 */
0284 EXTERN void     TclBN_mp_zero(mp_int *a);
0285 /* 50 */
0286 EXTERN void     TclBN_reverse(unsigned char *s, int len);
0287 /* 51 */
0288 EXTERN mp_err       TclBN_fast_s_mp_mul_digs(const mp_int *a,
0289                 const mp_int *b, mp_int *c, int digs);
0290 /* 52 */
0291 EXTERN mp_err       TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b);
0292 /* 53 */
0293 EXTERN mp_err       TclBN_mp_karatsuba_mul(const mp_int *a,
0294                 const mp_int *b, mp_int *c);
0295 /* 54 */
0296 EXTERN mp_err       TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b);
0297 /* 55 */
0298 EXTERN mp_err       TclBN_mp_toom_mul(const mp_int *a, const mp_int *b,
0299                 mp_int *c);
0300 /* 56 */
0301 EXTERN mp_err       TclBN_mp_toom_sqr(const mp_int *a, mp_int *b);
0302 /* 57 */
0303 EXTERN mp_err       TclBN_s_mp_add(const mp_int *a, const mp_int *b,
0304                 mp_int *c);
0305 /* 58 */
0306 EXTERN mp_err       TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b,
0307                 mp_int *c, int digs);
0308 /* 59 */
0309 EXTERN mp_err       TclBN_s_mp_sqr(const mp_int *a, mp_int *b);
0310 /* 60 */
0311 EXTERN mp_err       TclBN_s_mp_sub(const mp_int *a, const mp_int *b,
0312                 mp_int *c);
0313 /* 61 */
0314 EXTERN mp_err       TclBN_mp_init_set_int(mp_int *a, unsigned long i);
0315 /* 62 */
0316 EXTERN mp_err       TclBN_mp_set_int(mp_int *a, unsigned long i);
0317 /* 63 */
0318 EXTERN int      TclBN_mp_cnt_lsb(const mp_int *a);
0319 /* 64 */
0320 EXTERN int      TclBNInitBignumFromLong(mp_int *bignum, long initVal);
0321 /* 65 */
0322 EXTERN int      TclBNInitBignumFromWideInt(mp_int *bignum,
0323                 Tcl_WideInt initVal);
0324 /* 66 */
0325 EXTERN int      TclBNInitBignumFromWideUInt(mp_int *bignum,
0326                 Tcl_WideUInt initVal);
0327 /* 67 */
0328 EXTERN mp_err       TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b,
0329                 mp_int *c, int fast);
0330 /* 68 */
0331 EXTERN void     TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i);
0332 /* 69 */
0333 EXTERN Tcl_WideUInt TclBN_mp_get_mag_ull(const mp_int *a);
0334 /* 70 */
0335 EXTERN void     TclBN_mp_set_ll(mp_int *a, Tcl_WideInt i);
0336 /* 71 */
0337 EXTERN mp_err       TclBN_mp_unpack(mp_int *rop, size_t count,
0338                 mp_order order, size_t size,
0339                 mp_endian endian, size_t nails,
0340                 const void *op);
0341 /* 72 */
0342 EXTERN mp_err       TclBN_mp_pack(void *rop, size_t maxcount,
0343                 size_t *written, mp_order order, size_t size,
0344                 mp_endian endian, size_t nails,
0345                 const mp_int *op);
0346 /* 73 */
0347 EXTERN mp_err       TclBN_mp_tc_and(const mp_int *a, const mp_int *b,
0348                 mp_int *c);
0349 /* 74 */
0350 EXTERN mp_err       TclBN_mp_tc_or(const mp_int *a, const mp_int *b,
0351                 mp_int *c);
0352 /* 75 */
0353 EXTERN mp_err       TclBN_mp_tc_xor(const mp_int *a, const mp_int *b,
0354                 mp_int *c);
0355 /* 76 */
0356 EXTERN mp_err       TclBN_mp_signed_rsh(const mp_int *a, int b,
0357                 mp_int *c);
0358 /* 77 */
0359 EXTERN size_t       TclBN_mp_pack_count(const mp_int *a, size_t nails,
0360                 size_t size);
0361 /* 78 */
0362 EXTERN int      TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf,
0363                 size_t maxlen, size_t *written);
0364 /* 79 */
0365 EXTERN mp_err       TclBN_mp_div_ld(const mp_int *a, Tcl_WideUInt b,
0366                 mp_int *q, Tcl_WideUInt *r);
0367 /* 80 */
0368 EXTERN int      TclBN_mp_to_radix(const mp_int *a, char *str,
0369                 size_t maxlen, size_t *written, int radix);
0370 
0371 typedef struct TclTomMathStubs {
0372     int magic;
0373     void *hooks;
0374 
0375     int (*tclBN_epoch) (void); /* 0 */
0376     int (*tclBN_revision) (void); /* 1 */
0377     mp_err (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */
0378     mp_err (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c); /* 3 */
0379     mp_err (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */
0380     void (*tclBN_mp_clamp) (mp_int *a); /* 5 */
0381     void (*tclBN_mp_clear) (mp_int *a); /* 6 */
0382     void (*tclBN_mp_clear_multi) (mp_int *a, ...); /* 7 */
0383     mp_ord (*tclBN_mp_cmp) (const mp_int *a, const mp_int *b); /* 8 */
0384     mp_ord (*tclBN_mp_cmp_d) (const mp_int *a, mp_digit b); /* 9 */
0385     mp_ord (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); /* 10 */
0386     mp_err (*tclBN_mp_copy) (const mp_int *a, mp_int *b); /* 11 */
0387     int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */
0388     mp_err (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r); /* 13 */
0389     mp_err (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */
0390     mp_err (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */
0391     mp_err (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */
0392     mp_err (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); /* 17 */
0393     void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */
0394     mp_err (*tclBN_mp_expt_d) (const mp_int *a, int b, mp_int *c); /* 19 */
0395     mp_err (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */
0396     mp_err (*tclBN_mp_init) (mp_int *a); /* 21 */
0397     mp_err (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); /* 22 */
0398     mp_err (*tclBN_mp_init_multi) (mp_int *a, ...); /* 23 */
0399     mp_err (*tclBN_mp_init_set) (mp_int *a, mp_digit b); /* 24 */
0400     mp_err (*tclBN_mp_init_size) (mp_int *a, int size); /* 25 */
0401     mp_err (*tclBN_mp_lshd) (mp_int *a, int shift); /* 26 */
0402     mp_err (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r); /* 27 */
0403     mp_err (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */
0404     mp_err (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p); /* 29 */
0405     mp_err (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p); /* 30 */
0406     mp_err (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */
0407     mp_err (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */
0408     mp_err (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */
0409     mp_err (*tclBN_mp_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 34 */
0410     mp_err (*tclBN_mp_radix_size) (const mp_int *a, int radix, int *size); /* 35 */
0411     mp_err (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); /* 36 */
0412     void (*tclBN_mp_rshd) (mp_int *a, int shift); /* 37 */
0413     mp_err (*tclBN_mp_shrink) (mp_int *a); /* 38 */
0414     void (*tclBN_mp_set) (mp_int *a, mp_digit b); /* 39 */
0415     mp_err (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */
0416     mp_err (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */
0417     mp_err (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */
0418     mp_err (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c); /* 43 */
0419     mp_err (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */
0420     mp_err (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */
0421     mp_err (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */
0422     size_t (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */
0423     mp_err (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */
0424     void (*tclBN_mp_zero) (mp_int *a); /* 49 */
0425     void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */
0426     mp_err (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */
0427     mp_err (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); /* 52 */
0428     mp_err (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 53 */
0429     mp_err (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); /* 54 */
0430     mp_err (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 55 */
0431     mp_err (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b); /* 56 */
0432     mp_err (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 57 */
0433     mp_err (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 58 */
0434     mp_err (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); /* 59 */
0435     mp_err (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 60 */
0436     mp_err (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */
0437     mp_err (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */
0438     int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */
0439     int (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */
0440     int (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */
0441     int (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */
0442     mp_err (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */
0443     void (*tclBN_mp_set_ull) (mp_int *a, Tcl_WideUInt i); /* 68 */
0444     Tcl_WideUInt (*tclBN_mp_get_mag_ull) (const mp_int *a); /* 69 */
0445     void (*tclBN_mp_set_ll) (mp_int *a, Tcl_WideInt i); /* 70 */
0446     mp_err (*tclBN_mp_unpack) (mp_int *rop, size_t count, mp_order order, size_t size, mp_endian endian, size_t nails, const void *op); /* 71 */
0447     mp_err (*tclBN_mp_pack) (void *rop, size_t maxcount, size_t *written, mp_order order, size_t size, mp_endian endian, size_t nails, const mp_int *op); /* 72 */
0448     mp_err (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 73 */
0449     mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 74 */
0450     mp_err (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 75 */
0451     mp_err (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c); /* 76 */
0452     size_t (*tclBN_mp_pack_count) (const mp_int *a, size_t nails, size_t size); /* 77 */
0453     int (*tclBN_mp_to_ubin) (const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written); /* 78 */
0454     mp_err (*tclBN_mp_div_ld) (const mp_int *a, Tcl_WideUInt b, mp_int *q, Tcl_WideUInt *r); /* 79 */
0455     int (*tclBN_mp_to_radix) (const mp_int *a, char *str, size_t maxlen, size_t *written, int radix); /* 80 */
0456 } TclTomMathStubs;
0457 
0458 extern const TclTomMathStubs *tclTomMathStubsPtr;
0459 
0460 #ifdef __cplusplus
0461 }
0462 #endif
0463 
0464 #if defined(USE_TCL_STUBS)
0465 
0466 /*
0467  * Inline function declarations:
0468  */
0469 
0470 #define TclBN_epoch \
0471     (tclTomMathStubsPtr->tclBN_epoch) /* 0 */
0472 #define TclBN_revision \
0473     (tclTomMathStubsPtr->tclBN_revision) /* 1 */
0474 #define TclBN_mp_add \
0475     (tclTomMathStubsPtr->tclBN_mp_add) /* 2 */
0476 #define TclBN_mp_add_d \
0477     (tclTomMathStubsPtr->tclBN_mp_add_d) /* 3 */
0478 #define TclBN_mp_and \
0479     (tclTomMathStubsPtr->tclBN_mp_and) /* 4 */
0480 #define TclBN_mp_clamp \
0481     (tclTomMathStubsPtr->tclBN_mp_clamp) /* 5 */
0482 #define TclBN_mp_clear \
0483     (tclTomMathStubsPtr->tclBN_mp_clear) /* 6 */
0484 #define TclBN_mp_clear_multi \
0485     (tclTomMathStubsPtr->tclBN_mp_clear_multi) /* 7 */
0486 #define TclBN_mp_cmp \
0487     (tclTomMathStubsPtr->tclBN_mp_cmp) /* 8 */
0488 #define TclBN_mp_cmp_d \
0489     (tclTomMathStubsPtr->tclBN_mp_cmp_d) /* 9 */
0490 #define TclBN_mp_cmp_mag \
0491     (tclTomMathStubsPtr->tclBN_mp_cmp_mag) /* 10 */
0492 #define TclBN_mp_copy \
0493     (tclTomMathStubsPtr->tclBN_mp_copy) /* 11 */
0494 #define TclBN_mp_count_bits \
0495     (tclTomMathStubsPtr->tclBN_mp_count_bits) /* 12 */
0496 #define TclBN_mp_div \
0497     (tclTomMathStubsPtr->tclBN_mp_div) /* 13 */
0498 #define TclBN_mp_div_d \
0499     (tclTomMathStubsPtr->tclBN_mp_div_d) /* 14 */
0500 #define TclBN_mp_div_2 \
0501     (tclTomMathStubsPtr->tclBN_mp_div_2) /* 15 */
0502 #define TclBN_mp_div_2d \
0503     (tclTomMathStubsPtr->tclBN_mp_div_2d) /* 16 */
0504 #define TclBN_mp_div_3 \
0505     (tclTomMathStubsPtr->tclBN_mp_div_3) /* 17 */
0506 #define TclBN_mp_exch \
0507     (tclTomMathStubsPtr->tclBN_mp_exch) /* 18 */
0508 #define TclBN_mp_expt_d \
0509     (tclTomMathStubsPtr->tclBN_mp_expt_d) /* 19 */
0510 #define TclBN_mp_grow \
0511     (tclTomMathStubsPtr->tclBN_mp_grow) /* 20 */
0512 #define TclBN_mp_init \
0513     (tclTomMathStubsPtr->tclBN_mp_init) /* 21 */
0514 #define TclBN_mp_init_copy \
0515     (tclTomMathStubsPtr->tclBN_mp_init_copy) /* 22 */
0516 #define TclBN_mp_init_multi \
0517     (tclTomMathStubsPtr->tclBN_mp_init_multi) /* 23 */
0518 #define TclBN_mp_init_set \
0519     (tclTomMathStubsPtr->tclBN_mp_init_set) /* 24 */
0520 #define TclBN_mp_init_size \
0521     (tclTomMathStubsPtr->tclBN_mp_init_size) /* 25 */
0522 #define TclBN_mp_lshd \
0523     (tclTomMathStubsPtr->tclBN_mp_lshd) /* 26 */
0524 #define TclBN_mp_mod \
0525     (tclTomMathStubsPtr->tclBN_mp_mod) /* 27 */
0526 #define TclBN_mp_mod_2d \
0527     (tclTomMathStubsPtr->tclBN_mp_mod_2d) /* 28 */
0528 #define TclBN_mp_mul \
0529     (tclTomMathStubsPtr->tclBN_mp_mul) /* 29 */
0530 #define TclBN_mp_mul_d \
0531     (tclTomMathStubsPtr->tclBN_mp_mul_d) /* 30 */
0532 #define TclBN_mp_mul_2 \
0533     (tclTomMathStubsPtr->tclBN_mp_mul_2) /* 31 */
0534 #define TclBN_mp_mul_2d \
0535     (tclTomMathStubsPtr->tclBN_mp_mul_2d) /* 32 */
0536 #define TclBN_mp_neg \
0537     (tclTomMathStubsPtr->tclBN_mp_neg) /* 33 */
0538 #define TclBN_mp_or \
0539     (tclTomMathStubsPtr->tclBN_mp_or) /* 34 */
0540 #define TclBN_mp_radix_size \
0541     (tclTomMathStubsPtr->tclBN_mp_radix_size) /* 35 */
0542 #define TclBN_mp_read_radix \
0543     (tclTomMathStubsPtr->tclBN_mp_read_radix) /* 36 */
0544 #define TclBN_mp_rshd \
0545     (tclTomMathStubsPtr->tclBN_mp_rshd) /* 37 */
0546 #define TclBN_mp_shrink \
0547     (tclTomMathStubsPtr->tclBN_mp_shrink) /* 38 */
0548 #define TclBN_mp_set \
0549     (tclTomMathStubsPtr->tclBN_mp_set) /* 39 */
0550 #define TclBN_mp_sqr \
0551     (tclTomMathStubsPtr->tclBN_mp_sqr) /* 40 */
0552 #define TclBN_mp_sqrt \
0553     (tclTomMathStubsPtr->tclBN_mp_sqrt) /* 41 */
0554 #define TclBN_mp_sub \
0555     (tclTomMathStubsPtr->tclBN_mp_sub) /* 42 */
0556 #define TclBN_mp_sub_d \
0557     (tclTomMathStubsPtr->tclBN_mp_sub_d) /* 43 */
0558 #define TclBN_mp_to_unsigned_bin \
0559     (tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin) /* 44 */
0560 #define TclBN_mp_to_unsigned_bin_n \
0561     (tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin_n) /* 45 */
0562 #define TclBN_mp_toradix_n \
0563     (tclTomMathStubsPtr->tclBN_mp_toradix_n) /* 46 */
0564 #define TclBN_mp_unsigned_bin_size \
0565     (tclTomMathStubsPtr->tclBN_mp_unsigned_bin_size) /* 47 */
0566 #define TclBN_mp_xor \
0567     (tclTomMathStubsPtr->tclBN_mp_xor) /* 48 */
0568 #define TclBN_mp_zero \
0569     (tclTomMathStubsPtr->tclBN_mp_zero) /* 49 */
0570 #define TclBN_reverse \
0571     (tclTomMathStubsPtr->tclBN_reverse) /* 50 */
0572 #define TclBN_fast_s_mp_mul_digs \
0573     (tclTomMathStubsPtr->tclBN_fast_s_mp_mul_digs) /* 51 */
0574 #define TclBN_fast_s_mp_sqr \
0575     (tclTomMathStubsPtr->tclBN_fast_s_mp_sqr) /* 52 */
0576 #define TclBN_mp_karatsuba_mul \
0577     (tclTomMathStubsPtr->tclBN_mp_karatsuba_mul) /* 53 */
0578 #define TclBN_mp_karatsuba_sqr \
0579     (tclTomMathStubsPtr->tclBN_mp_karatsuba_sqr) /* 54 */
0580 #define TclBN_mp_toom_mul \
0581     (tclTomMathStubsPtr->tclBN_mp_toom_mul) /* 55 */
0582 #define TclBN_mp_toom_sqr \
0583     (tclTomMathStubsPtr->tclBN_mp_toom_sqr) /* 56 */
0584 #define TclBN_s_mp_add \
0585     (tclTomMathStubsPtr->tclBN_s_mp_add) /* 57 */
0586 #define TclBN_s_mp_mul_digs \
0587     (tclTomMathStubsPtr->tclBN_s_mp_mul_digs) /* 58 */
0588 #define TclBN_s_mp_sqr \
0589     (tclTomMathStubsPtr->tclBN_s_mp_sqr) /* 59 */
0590 #define TclBN_s_mp_sub \
0591     (tclTomMathStubsPtr->tclBN_s_mp_sub) /* 60 */
0592 #define TclBN_mp_init_set_int \
0593     (tclTomMathStubsPtr->tclBN_mp_init_set_int) /* 61 */
0594 #define TclBN_mp_set_int \
0595     (tclTomMathStubsPtr->tclBN_mp_set_int) /* 62 */
0596 #define TclBN_mp_cnt_lsb \
0597     (tclTomMathStubsPtr->tclBN_mp_cnt_lsb) /* 63 */
0598 #define TclBNInitBignumFromLong \
0599     (tclTomMathStubsPtr->tclBNInitBignumFromLong) /* 64 */
0600 #define TclBNInitBignumFromWideInt \
0601     (tclTomMathStubsPtr->tclBNInitBignumFromWideInt) /* 65 */
0602 #define TclBNInitBignumFromWideUInt \
0603     (tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) /* 66 */
0604 #define TclBN_mp_expt_d_ex \
0605     (tclTomMathStubsPtr->tclBN_mp_expt_d_ex) /* 67 */
0606 #define TclBN_mp_set_ull \
0607     (tclTomMathStubsPtr->tclBN_mp_set_ull) /* 68 */
0608 #define TclBN_mp_get_mag_ull \
0609     (tclTomMathStubsPtr->tclBN_mp_get_mag_ull) /* 69 */
0610 #define TclBN_mp_set_ll \
0611     (tclTomMathStubsPtr->tclBN_mp_set_ll) /* 70 */
0612 #define TclBN_mp_unpack \
0613     (tclTomMathStubsPtr->tclBN_mp_unpack) /* 71 */
0614 #define TclBN_mp_pack \
0615     (tclTomMathStubsPtr->tclBN_mp_pack) /* 72 */
0616 #define TclBN_mp_tc_and \
0617     (tclTomMathStubsPtr->tclBN_mp_tc_and) /* 73 */
0618 #define TclBN_mp_tc_or \
0619     (tclTomMathStubsPtr->tclBN_mp_tc_or) /* 74 */
0620 #define TclBN_mp_tc_xor \
0621     (tclTomMathStubsPtr->tclBN_mp_tc_xor) /* 75 */
0622 #define TclBN_mp_signed_rsh \
0623     (tclTomMathStubsPtr->tclBN_mp_signed_rsh) /* 76 */
0624 #define TclBN_mp_pack_count \
0625     (tclTomMathStubsPtr->tclBN_mp_pack_count) /* 77 */
0626 #define TclBN_mp_to_ubin \
0627     (tclTomMathStubsPtr->tclBN_mp_to_ubin) /* 78 */
0628 #define TclBN_mp_div_ld \
0629     (tclTomMathStubsPtr->tclBN_mp_div_ld) /* 79 */
0630 #define TclBN_mp_to_radix \
0631     (tclTomMathStubsPtr->tclBN_mp_to_radix) /* 80 */
0632 
0633 #endif /* defined(USE_TCL_STUBS) */
0634 
0635 /* !END!: Do not edit above this line. */
0636 
0637 #undef TCL_STORAGE_CLASS
0638 #define TCL_STORAGE_CLASS DLLIMPORT
0639 
0640 #ifdef USE_TCL_STUBS
0641 #undef TclBNInitBignumFromLong
0642 #define TclBNInitBignumFromLong(a,b) \
0643     do { \
0644         (a)->dp = NULL; \
0645         (void)tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(b)); \
0646         if ((a)->dp == NULL) { \
0647         Tcl_Panic("initialization failure in TclBNInitBignumFromLong"); \
0648         } \
0649     } while (0)
0650 #undef TclBNInitBignumFromWideInt
0651 #define TclBNInitBignumFromWideInt(a,b) \
0652     do { \
0653         (a)->dp = NULL; \
0654         (void)tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)); \
0655         if ((a)->dp == NULL) { \
0656         Tcl_Panic("initialization failure in TclBNInitBignumFromWideInt"); \
0657         } \
0658     } while (0)
0659 #undef TclBNInitBignumFromWideUInt
0660 #define TclBNInitBignumFromWideUInt(a,b) \
0661     do { \
0662         (a)->dp = NULL; \
0663         (void)tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)); \
0664         if ((a)->dp == NULL) { \
0665         Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); \
0666         } \
0667     } while (0)
0668 #define mp_init_i32(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(int32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0669 #define mp_init_l(a,b)   (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0670 #define mp_init_ll(a,b)  (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0671 #define mp_init_i64(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0672 #define mp_init_u32(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(uint32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0673 #define mp_init_ul(a,b)  (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(unsigned long)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0674 #define mp_init_ull(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0675 #define mp_init_u64(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0676 #else
0677 #define mp_init_i32(a,b) (((a)->dp=NULL,(TclBNInitBignumFromLong)((a),(int32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0678 #define mp_init_l(a,b)   (((a)->dp=NULL,(TclBNInitBignumFromLong)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0679 #define mp_init_ll(a,b)  (((a)->dp=NULL,(TclBNInitBignumFromWideInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0680 #define mp_init_i64(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0681 #define mp_init_u32(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(uint32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0682 #define mp_init_ul(a,b)  (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(unsigned long)(b)),(a)->dp)?MP_OKAY:MP_ERR)
0683 #define mp_init_ull(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0684 #define mp_init_u64(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
0685 #endif /* USE_TCL_STUBS */
0686 #endif /* _TCLINTDECLS */