summaryrefslogtreecommitdiffstats
path: root/generic/tclTomMathDecls.h
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclTomMathDecls.h')
-rw-r--r--generic/tclTomMathDecls.h312
1 files changed, 162 insertions, 150 deletions
diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h
index 52b84ee..6f7ebb8 100644
--- a/generic/tclTomMathDecls.h
+++ b/generic/tclTomMathDecls.h
@@ -16,6 +16,9 @@
#define _TCLTOMMATHDECLS
#include "tcl.h"
+#ifndef BN_H_
+#include "tclTomMath.h"
+#endif
/*
* Define the version of the Stubs table that's exported for tommath
@@ -32,20 +35,23 @@
/* MODULE_SCOPE void* TclBNAlloc( size_t ); */
#define TclBNAlloc(s) ((void*)ckalloc((size_t)(s)))
+/* MODULE_SCOPE void* TclBNCalloc( size_t, size_t ); */
+#define TclBNCalloc(m,s) memset(ckalloc((size_t)(m)*(size_t)(s)),0,(size_t)(m)*(size_t)(s))
/* MODULE_SCOPE void* TclBNRealloc( void*, size_t ); */
#define TclBNRealloc(x,s) ((void*)ckrealloc((char*)(x),(size_t)(s)))
/* MODULE_SCOPE void TclBNFree( void* ); */
#define TclBNFree(x) (ckfree((char*)(x)))
-#define XMALLOC(size) TclBNAlloc(size)
-#define XFREE(mem, size) TclBNFree(mem)
-#define XREALLOC(mem, oldsize, newsize) TclBNRealloc(mem, newsize)
+#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)
/* Rename the global symbols in libtommath to avoid linkage conflicts */
#define bn_reverse TclBN_reverse
-#define s_mp_reverse TclBN_reverse
+#define s_mp_reverse TclBN_int_reverse
#define fast_s_mp_mul_digs TclBN_fast_s_mp_mul_digs
#define s_mp_mul_digs_fast TclBN_fast_s_mp_mul_digs
#define fast_s_mp_sqr TclBN_fast_s_mp_sqr
@@ -70,10 +76,12 @@
#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_bit TclBN_mp_get_bit
-#define mp_get_int TclBN_mp_get_int
-#define mp_get_long TclBN_mp_get_long
-#define mp_get_long_long TclBN_mp_get_long_long
+#define mp_get_long TclBN_mp_get_mag_ul
+#define mp_get_mag_ul TclBN_mp_get_mag_ul
+#define mp_get_long_long TclBN_mp_get_mag_ull
+#define mp_get_mag_ull TclBN_mp_get_mag_ull
#define mp_grow TclBN_mp_grow
#define s_mp_get_bit TclBN_mp_get_bit
#define mp_grow TclBN_mp_grow
@@ -101,8 +109,10 @@
#define mp_rshd TclBN_mp_rshd
#define mp_set TclBN_mp_set
#define mp_set_int TclBN_mp_set_int
-#define mp_set_long TclBN_mp_set_long
-#define mp_set_long_long TclBN_mp_set_long_long
+#define mp_set_long(a,b) (TclBN_mp_set_ul((a),(b)),MP_OKAY)
+#define mp_set_long_long(a,b) (TclBN_mp_set_ull((a),(b)),MP_OKAY)
+#define mp_set_ul TclBN_mp_set_ul
+#define mp_set_ull TclBN_mp_set_ull
#define mp_shrink TclBN_mp_shrink
#define mp_sqr TclBN_mp_sqr
#define mp_sqrt TclBN_mp_sqrt
@@ -117,9 +127,13 @@
#define mp_to_unsigned_bin_n TclBN_mp_to_unsigned_bin_n
#define mp_toom_mul TclBN_mp_toom_mul
#define s_mp_toom_mul TclBN_mp_toom_mul
+#define s_mp_balance_mul TclBN_mp_balance_mul
#define mp_toom_sqr TclBN_mp_toom_sqr
#define s_mp_toom_sqr TclBN_mp_toom_sqr
#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_ubin_size
#define mp_unsigned_bin_size TclBN_mp_unsigned_bin_size
#define mp_xor TclBN_mp_xor
#define mp_zero TclBN_mp_zero
@@ -160,13 +174,13 @@ EXTERN int TclBN_epoch(void);
/* 1 */
EXTERN int TclBN_revision(void);
/* 2 */
-EXTERN int TclBN_mp_add(const mp_int *a, const mp_int *b,
+EXTERN mp_err TclBN_mp_add(const mp_int *a, const mp_int *b,
mp_int *c);
/* 3 */
-EXTERN int TclBN_mp_add_d(const mp_int *a, mp_digit b,
+EXTERN mp_err TclBN_mp_add_d(const mp_int *a, mp_digit b,
mp_int *c);
/* 4 */
-EXTERN int TclBN_mp_and(const mp_int *a, const mp_int *b,
+EXTERN mp_err TclBN_mp_and(const mp_int *a, const mp_int *b,
mp_int *c);
/* 5 */
EXTERN void TclBN_mp_clamp(mp_int *a);
@@ -175,103 +189,103 @@ EXTERN void TclBN_mp_clear(mp_int *a);
/* 7 */
EXTERN void TclBN_mp_clear_multi(mp_int *a, ...);
/* 8 */
-EXTERN int TclBN_mp_cmp(const mp_int *a, const mp_int *b);
+EXTERN mp_ord TclBN_mp_cmp(const mp_int *a, const mp_int *b);
/* 9 */
-EXTERN int TclBN_mp_cmp_d(const mp_int *a, mp_digit b);
+EXTERN mp_ord TclBN_mp_cmp_d(const mp_int *a, mp_digit b);
/* 10 */
-EXTERN int TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b);
+EXTERN mp_ord TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b);
/* 11 */
-EXTERN int TclBN_mp_copy(const mp_int *a, mp_int *b);
+EXTERN mp_err TclBN_mp_copy(const mp_int *a, mp_int *b);
/* 12 */
EXTERN int TclBN_mp_count_bits(const mp_int *a);
/* 13 */
-EXTERN int TclBN_mp_div(const mp_int *a, const mp_int *b,
+EXTERN mp_err TclBN_mp_div(const mp_int *a, const mp_int *b,
mp_int *q, mp_int *r);
/* 14 */
-EXTERN int TclBN_mp_div_d(const mp_int *a, mp_digit b,
+EXTERN mp_err TclBN_mp_div_d(const mp_int *a, mp_digit b,
mp_int *q, mp_digit *r);
/* 15 */
-EXTERN int TclBN_mp_div_2(const mp_int *a, mp_int *q);
+EXTERN mp_err TclBN_mp_div_2(const mp_int *a, mp_int *q);
/* 16 */
-EXTERN int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q,
+EXTERN mp_err TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q,
mp_int *r);
/* 17 */
-EXTERN int TclBN_mp_div_3(const mp_int *a, mp_int *q,
+EXTERN mp_err TclBN_mp_div_3(const mp_int *a, mp_int *q,
mp_digit *r);
/* 18 */
EXTERN void TclBN_mp_exch(mp_int *a, mp_int *b);
/* 19 */
-EXTERN int TclBN_mp_expt_d(const mp_int *a, mp_digit b,
+EXTERN mp_err TclBN_mp_expt_d(const mp_int *a, unsigned int b,
mp_int *c);
/* 20 */
-EXTERN int TclBN_mp_grow(mp_int *a, int size);
+EXTERN mp_err TclBN_mp_grow(mp_int *a, int size);
/* 21 */
-EXTERN int TclBN_mp_init(mp_int *a);
+EXTERN mp_err TclBN_mp_init(mp_int *a);
/* 22 */
-EXTERN int TclBN_mp_init_copy(mp_int *a, const mp_int *b);
+EXTERN mp_err TclBN_mp_init_copy(mp_int *a, const mp_int *b);
/* 23 */
-EXTERN int TclBN_mp_init_multi(mp_int *a, ...);
+EXTERN mp_err TclBN_mp_init_multi(mp_int *a, ...);
/* 24 */
-EXTERN int TclBN_mp_init_set(mp_int *a, mp_digit b);
+EXTERN mp_err TclBN_mp_init_set(mp_int *a, mp_digit b);
/* 25 */
-EXTERN int TclBN_mp_init_size(mp_int *a, int size);
+EXTERN mp_err TclBN_mp_init_size(mp_int *a, int size);
/* 26 */
-EXTERN int TclBN_mp_lshd(mp_int *a, int shift);
+EXTERN mp_err TclBN_mp_lshd(mp_int *a, int shift);
/* 27 */
-EXTERN int TclBN_mp_mod(const mp_int *a, const mp_int *b,
+EXTERN mp_err TclBN_mp_mod(const mp_int *a, const mp_int *b,
mp_int *r);
/* 28 */
-EXTERN int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r);
+EXTERN mp_err TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r);
/* 29 */
-EXTERN int TclBN_mp_mul(const mp_int *a, const mp_int *b,
+EXTERN mp_err TclBN_mp_mul(const mp_int *a, const mp_int *b,
mp_int *p);
/* 30 */
-EXTERN int TclBN_mp_mul_d(const mp_int *a, mp_digit b,
+EXTERN mp_err TclBN_mp_mul_d(const mp_int *a, mp_digit b,
mp_int *p);
/* 31 */
-EXTERN int TclBN_mp_mul_2(const mp_int *a, mp_int *p);
+EXTERN mp_err TclBN_mp_mul_2(const mp_int *a, mp_int *p);
/* 32 */
-EXTERN int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p);
+EXTERN mp_err TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p);
/* 33 */
-EXTERN int TclBN_mp_neg(const mp_int *a, mp_int *b);
+EXTERN mp_err TclBN_mp_neg(const mp_int *a, mp_int *b);
/* 34 */
-EXTERN int TclBN_mp_or(const mp_int *a, const mp_int *b,
+EXTERN mp_err TclBN_mp_or(const mp_int *a, const mp_int *b,
mp_int *c);
/* 35 */
-EXTERN int TclBN_mp_radix_size(const mp_int *a, int radix,
+EXTERN mp_err TclBN_mp_radix_size(const mp_int *a, int radix,
int *size);
/* 36 */
-EXTERN int TclBN_mp_read_radix(mp_int *a, const char *str,
+EXTERN mp_err TclBN_mp_read_radix(mp_int *a, const char *str,
int radix);
/* 37 */
EXTERN void TclBN_mp_rshd(mp_int *a, int shift);
/* 38 */
-EXTERN int TclBN_mp_shrink(mp_int *a);
+EXTERN mp_err TclBN_mp_shrink(mp_int *a);
/* 39 */
EXTERN void TclBN_mp_set(mp_int *a, mp_digit b);
/* 40 */
-EXTERN int TclBN_mp_sqr(const mp_int *a, mp_int *b);
+EXTERN mp_err TclBN_mp_sqr(const mp_int *a, mp_int *b);
/* 41 */
-EXTERN int TclBN_mp_sqrt(const mp_int *a, mp_int *b);
+EXTERN mp_err TclBN_mp_sqrt(const mp_int *a, mp_int *b);
/* 42 */
-EXTERN int TclBN_mp_sub(const mp_int *a, const mp_int *b,
+EXTERN mp_err TclBN_mp_sub(const mp_int *a, const mp_int *b,
mp_int *c);
/* 43 */
-EXTERN int TclBN_mp_sub_d(const mp_int *a, mp_digit b,
+EXTERN mp_err TclBN_mp_sub_d(const mp_int *a, mp_digit b,
mp_int *c);
/* 44 */
-EXTERN int TclBN_mp_to_unsigned_bin(const mp_int *a,
+EXTERN mp_err TclBN_mp_to_unsigned_bin(const mp_int *a,
unsigned char *b);
/* 45 */
-EXTERN int TclBN_mp_to_unsigned_bin_n(const mp_int *a,
+EXTERN mp_err TclBN_mp_to_unsigned_bin_n(const mp_int *a,
unsigned char *b, unsigned long *outlen);
/* 46 */
-EXTERN int TclBN_mp_toradix_n(const mp_int *a, char *str,
+EXTERN mp_err TclBN_mp_toradix_n(const mp_int *a, char *str,
int radix, int maxlen);
/* 47 */
EXTERN int TclBN_mp_unsigned_bin_size(const mp_int *a);
/* 48 */
-EXTERN int TclBN_mp_xor(const mp_int *a, const mp_int *b,
+EXTERN mp_err TclBN_mp_xor(const mp_int *a, const mp_int *b,
mp_int *c);
/* 49 */
EXTERN void TclBN_mp_zero(mp_int *a);
@@ -280,84 +294,83 @@ TCL_DEPRECATED("is private function in libtommath")
void TclBN_reverse(unsigned char *s, int len);
/* 51 */
TCL_DEPRECATED("is private function in libtommath")
-int TclBN_fast_s_mp_mul_digs(const mp_int *a,
+mp_err TclBN_fast_s_mp_mul_digs(const mp_int *a,
const mp_int *b, mp_int *c, int digs);
/* 52 */
TCL_DEPRECATED("is private function in libtommath")
-int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b);
+mp_err TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b);
/* 53 */
TCL_DEPRECATED("is private function in libtommath")
-int TclBN_mp_karatsuba_mul(const mp_int *a,
+mp_err TclBN_mp_karatsuba_mul(const mp_int *a,
const mp_int *b, mp_int *c);
/* 54 */
TCL_DEPRECATED("is private function in libtommath")
-int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b);
+mp_err TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b);
/* 55 */
TCL_DEPRECATED("is private function in libtommath")
-int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b,
+mp_err TclBN_mp_toom_mul(const mp_int *a, const mp_int *b,
mp_int *c);
/* 56 */
TCL_DEPRECATED("is private function in libtommath")
-int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b);
+mp_err TclBN_mp_toom_sqr(const mp_int *a, mp_int *b);
/* 57 */
TCL_DEPRECATED("is private function in libtommath")
-int TclBN_s_mp_add(const mp_int *a, const mp_int *b,
+mp_err TclBN_s_mp_add(const mp_int *a, const mp_int *b,
mp_int *c);
/* 58 */
TCL_DEPRECATED("is private function in libtommath")
-int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b,
+mp_err TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b,
mp_int *c, int digs);
/* 59 */
TCL_DEPRECATED("is private function in libtommath")
-int TclBN_s_mp_sqr(const mp_int *a, mp_int *b);
+mp_err TclBN_s_mp_sqr(const mp_int *a, mp_int *b);
/* 60 */
TCL_DEPRECATED("is private function in libtommath")
-int TclBN_s_mp_sub(const mp_int *a, const mp_int *b,
+mp_err TclBN_s_mp_sub(const mp_int *a, const mp_int *b,
mp_int *c);
/* 61 */
-EXTERN int TclBN_mp_init_set_int(mp_int *a, unsigned long i);
+EXTERN mp_err TclBN_mp_init_set_int(mp_int *a, unsigned long i);
/* 62 */
-EXTERN int TclBN_mp_set_int(mp_int *a, unsigned long i);
+EXTERN mp_err TclBN_mp_set_int(mp_int *a, unsigned long i);
/* 63 */
EXTERN int TclBN_mp_cnt_lsb(const mp_int *a);
/* 64 */
-TCL_DEPRECATED("Use mp_init() + mp_set_long_long()")
+TCL_DEPRECATED("Use mp_init() + mp_set_l()")
void TclBNInitBignumFromLong(mp_int *bignum, long initVal);
/* 65 */
-TCL_DEPRECATED("Use mp_init() + mp_set_long_long()")
+TCL_DEPRECATED("Use mp_init() + mp_set_ll()")
void TclBNInitBignumFromWideInt(mp_int *bignum,
Tcl_WideInt initVal);
/* 66 */
-TCL_DEPRECATED("Use mp_init() + mp_set_long_long()")
+TCL_DEPRECATED("Use mp_init() + mp_set_ull()")
void TclBNInitBignumFromWideUInt(mp_int *bignum,
Tcl_WideUInt initVal);
/* 67 */
-EXTERN int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b,
+EXTERN mp_err TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b,
mp_int *c, int fast);
/* 68 */
-EXTERN int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i);
+EXTERN void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i);
/* 69 */
-EXTERN Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a);
+EXTERN Tcl_WideUInt TclBN_mp_get_mag_ull(const mp_int *a);
/* 70 */
-EXTERN int TclBN_mp_set_long(mp_int *a, unsigned long i);
+EXTERN void TclBN_mp_set_ul(mp_int *a, unsigned long i);
/* 71 */
-EXTERN unsigned long TclBN_mp_get_long(const mp_int *a);
-/* 72 */
-EXTERN unsigned long TclBN_mp_get_int(const mp_int *a);
+EXTERN unsigned long TclBN_mp_get_mag_ul(const mp_int *a);
+/* Slot 72 is reserved */
/* 73 */
-EXTERN int TclBN_mp_tc_and(const mp_int *a, const mp_int *b,
+EXTERN mp_err TclBN_mp_tc_and(const mp_int *a, const mp_int *b,
mp_int *c);
/* 74 */
-EXTERN int TclBN_mp_tc_or(const mp_int *a, const mp_int *b,
+EXTERN mp_err TclBN_mp_tc_or(const mp_int *a, const mp_int *b,
mp_int *c);
/* 75 */
-EXTERN int TclBN_mp_tc_xor(const mp_int *a, const mp_int *b,
+EXTERN mp_err TclBN_mp_tc_xor(const mp_int *a, const mp_int *b,
mp_int *c);
/* 76 */
-EXTERN int TclBN_mp_signed_rsh(const mp_int *a, int b,
+EXTERN mp_err TclBN_mp_signed_rsh(const mp_int *a, int b,
mp_int *c);
/* 77 */
-EXTERN int TclBN_mp_get_bit(const mp_int *a, int b);
+EXTERN mp_bool TclBN_mp_get_bit(const mp_int *a, unsigned int b);
typedef struct TclTomMathStubs {
int magic;
@@ -365,82 +378,82 @@ typedef struct TclTomMathStubs {
int (*tclBN_epoch) (void); /* 0 */
int (*tclBN_revision) (void); /* 1 */
- int (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */
- int (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c); /* 3 */
- int (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */
+ mp_err (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */
+ mp_err (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c); /* 3 */
+ mp_err (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */
void (*tclBN_mp_clamp) (mp_int *a); /* 5 */
void (*tclBN_mp_clear) (mp_int *a); /* 6 */
void (*tclBN_mp_clear_multi) (mp_int *a, ...); /* 7 */
- int (*tclBN_mp_cmp) (const mp_int *a, const mp_int *b); /* 8 */
- int (*tclBN_mp_cmp_d) (const mp_int *a, mp_digit b); /* 9 */
- int (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); /* 10 */
- int (*tclBN_mp_copy) (const mp_int *a, mp_int *b); /* 11 */
+ mp_ord (*tclBN_mp_cmp) (const mp_int *a, const mp_int *b); /* 8 */
+ mp_ord (*tclBN_mp_cmp_d) (const mp_int *a, mp_digit b); /* 9 */
+ mp_ord (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); /* 10 */
+ mp_err (*tclBN_mp_copy) (const mp_int *a, mp_int *b); /* 11 */
int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */
- int (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r); /* 13 */
- int (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */
- int (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */
- int (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */
- int (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); /* 17 */
+ mp_err (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r); /* 13 */
+ mp_err (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */
+ mp_err (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */
+ mp_err (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */
+ mp_err (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); /* 17 */
void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */
- int (*tclBN_mp_expt_d) (const mp_int *a, mp_digit b, mp_int *c); /* 19 */
- int (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */
- int (*tclBN_mp_init) (mp_int *a); /* 21 */
- int (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); /* 22 */
- int (*tclBN_mp_init_multi) (mp_int *a, ...); /* 23 */
- int (*tclBN_mp_init_set) (mp_int *a, mp_digit b); /* 24 */
- int (*tclBN_mp_init_size) (mp_int *a, int size); /* 25 */
- int (*tclBN_mp_lshd) (mp_int *a, int shift); /* 26 */
- int (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r); /* 27 */
- int (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */
- int (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p); /* 29 */
- int (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p); /* 30 */
- int (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */
- int (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */
- int (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */
- int (*tclBN_mp_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 34 */
- int (*tclBN_mp_radix_size) (const mp_int *a, int radix, int *size); /* 35 */
- int (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); /* 36 */
+ mp_err (*tclBN_mp_expt_d) (const mp_int *a, unsigned int b, mp_int *c); /* 19 */
+ mp_err (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */
+ mp_err (*tclBN_mp_init) (mp_int *a); /* 21 */
+ mp_err (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); /* 22 */
+ mp_err (*tclBN_mp_init_multi) (mp_int *a, ...); /* 23 */
+ mp_err (*tclBN_mp_init_set) (mp_int *a, mp_digit b); /* 24 */
+ mp_err (*tclBN_mp_init_size) (mp_int *a, int size); /* 25 */
+ mp_err (*tclBN_mp_lshd) (mp_int *a, int shift); /* 26 */
+ mp_err (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r); /* 27 */
+ mp_err (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */
+ mp_err (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p); /* 29 */
+ mp_err (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p); /* 30 */
+ mp_err (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */
+ mp_err (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */
+ mp_err (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */
+ mp_err (*tclBN_mp_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 34 */
+ mp_err (*tclBN_mp_radix_size) (const mp_int *a, int radix, int *size); /* 35 */
+ mp_err (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); /* 36 */
void (*tclBN_mp_rshd) (mp_int *a, int shift); /* 37 */
- int (*tclBN_mp_shrink) (mp_int *a); /* 38 */
+ mp_err (*tclBN_mp_shrink) (mp_int *a); /* 38 */
void (*tclBN_mp_set) (mp_int *a, mp_digit b); /* 39 */
- int (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */
- int (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */
- int (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */
- int (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c); /* 43 */
- int (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */
- int (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */
- int (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */
+ mp_err (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */
+ mp_err (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */
+ mp_err (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */
+ mp_err (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c); /* 43 */
+ mp_err (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */
+ mp_err (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */
+ mp_err (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */
int (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */
- int (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */
+ mp_err (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */
void (*tclBN_mp_zero) (mp_int *a); /* 49 */
TCL_DEPRECATED_API("is private function in libtommath") void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); /* 52 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 53 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); /* 54 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 55 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b); /* 56 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 57 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 58 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); /* 59 */
- TCL_DEPRECATED_API("is private function in libtommath") int (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 60 */
- int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */
- int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); /* 52 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 53 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); /* 54 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 55 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b); /* 56 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 57 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 58 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); /* 59 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 60 */
+ mp_err (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */
+ mp_err (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */
int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */
- TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */
- TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */
- TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */
- int (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */
- int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */
- Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */
- int (*tclBN_mp_set_long) (mp_int *a, unsigned long i); /* 70 */
- unsigned long (*tclBN_mp_get_long) (const mp_int *a); /* 71 */
- unsigned long (*tclBN_mp_get_int) (const mp_int *a); /* 72 */
- int (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 73 */
- int (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 74 */
- int (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 75 */
- int (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c); /* 76 */
- int (*tclBN_mp_get_bit) (const mp_int *a, int b); /* 77 */
+ TCL_DEPRECATED_API("Use mp_init() + mp_set_l()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */
+ TCL_DEPRECATED_API("Use mp_init() + mp_set_ll()") void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */
+ TCL_DEPRECATED_API("Use mp_init() + mp_set_ull()") void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */
+ mp_err (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */
+ void (*tclBN_mp_set_ull) (mp_int *a, Tcl_WideUInt i); /* 68 */
+ Tcl_WideUInt (*tclBN_mp_get_mag_ull) (const mp_int *a); /* 69 */
+ void (*tclBN_mp_set_ul) (mp_int *a, unsigned long i); /* 70 */
+ unsigned long (*tclBN_mp_get_mag_ul) (const mp_int *a); /* 71 */
+ void (*reserved72)(void);
+ mp_err (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 73 */
+ mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 74 */
+ mp_err (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 75 */
+ mp_err (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c); /* 76 */
+ mp_bool (*tclBN_mp_get_bit) (const mp_int *a, unsigned int b); /* 77 */
} TclTomMathStubs;
extern const TclTomMathStubs *tclTomMathStubsPtr;
@@ -591,16 +604,15 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
(tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) /* 66 */
#define TclBN_mp_expt_d_ex \
(tclTomMathStubsPtr->tclBN_mp_expt_d_ex) /* 67 */
-#define TclBN_mp_set_long_long \
- (tclTomMathStubsPtr->tclBN_mp_set_long_long) /* 68 */
-#define TclBN_mp_get_long_long \
- (tclTomMathStubsPtr->tclBN_mp_get_long_long) /* 69 */
-#define TclBN_mp_set_long \
- (tclTomMathStubsPtr->tclBN_mp_set_long) /* 70 */
-#define TclBN_mp_get_long \
- (tclTomMathStubsPtr->tclBN_mp_get_long) /* 71 */
-#define TclBN_mp_get_int \
- (tclTomMathStubsPtr->tclBN_mp_get_int) /* 72 */
+#define TclBN_mp_set_ull \
+ (tclTomMathStubsPtr->tclBN_mp_set_ull) /* 68 */
+#define TclBN_mp_get_mag_ull \
+ (tclTomMathStubsPtr->tclBN_mp_get_mag_ull) /* 69 */
+#define TclBN_mp_set_ul \
+ (tclTomMathStubsPtr->tclBN_mp_set_ul) /* 70 */
+#define TclBN_mp_get_mag_ul \
+ (tclTomMathStubsPtr->tclBN_mp_get_mag_ul) /* 71 */
+/* Slot 72 is reserved */
#define TclBN_mp_tc_and \
(tclTomMathStubsPtr->tclBN_mp_tc_and) /* 73 */
#define TclBN_mp_tc_or \