diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-23 07:38:49 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-23 07:38:49 (GMT) |
commit | 86f51a0a0b0c3eb9945f12e6aa8972d3878c67ff (patch) | |
tree | 6cdd7a9edb5bfba87f3714cf7964efe1e1e2d3c1 /generic | |
parent | 7129a50b10269174f1d8f247449abe6df0dc890a (diff) | |
download | tcl-86f51a0a0b0c3eb9945f12e6aa8972d3878c67ff.zip tcl-86f51a0a0b0c3eb9945f12e6aa8972d3878c67ff.tar.gz tcl-86f51a0a0b0c3eb9945f12e6aa8972d3878c67ff.tar.bz2 |
Add mp_pack, mp_pack_count and mp_unpack to the libtommath stub table. Not used by Tcl, but can be used by extensions (backported from 8.7)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclStubInit.c | 6 | ||||
-rw-r--r-- | generic/tclTomMath.decls | 11 | ||||
-rw-r--r-- | generic/tclTomMathDecls.h | 34 |
3 files changed, 39 insertions, 12 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 89a33e4..ee0412a 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -948,13 +948,13 @@ const TclTomMathStubs tclTomMathStubs = { TclBN_mp_set_ull, /* 68 */ TclBN_mp_get_mag_ull, /* 69 */ TclBN_mp_set_ll, /* 70 */ - 0, /* 71 */ - 0, /* 72 */ + TclBN_mp_unpack, /* 71 */ + TclBN_mp_pack, /* 72 */ TclBN_mp_tc_and, /* 73 */ TclBN_mp_tc_or, /* 74 */ TclBN_mp_tc_xor, /* 75 */ TclBN_mp_signed_rsh, /* 76 */ - 0, /* 77 */ + TclBN_mp_pack_count, /* 77 */ TclBN_mp_to_ubin, /* 78 */ TclBN_mp_div_ld, /* 79 */ TclBN_mp_to_radix, /* 80 */ diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index 0aa9a42..27afefd 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -243,6 +243,14 @@ declare 69 { declare 70 { void TclBN_mp_set_ll(mp_int *a, Tcl_WideInt i) } +declare 71 { + 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) +} +declare 72 { + 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) +} # Added in libtommath 1.1.0 declare 73 { @@ -257,6 +265,9 @@ declare 75 { declare 76 { mp_err TclBN_mp_signed_rsh(const mp_int *a, int b, mp_int *c) } +declare 77 { + size_t TclBN_mp_pack_count(const mp_int *a, size_t nails, size_t size) +} # Added in libtommath 1.2.0 declare 78 { diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 6991643..e6f23aa 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -89,6 +89,8 @@ #define mp_mul_d TclBN_mp_mul_d #define mp_neg TclBN_mp_neg #define mp_or TclBN_mp_or +#define mp_pack TclBN_mp_pack +#define mp_pack_count TclBN_mp_pack_count #define mp_radix_size TclBN_mp_radix_size #define mp_read_radix TclBN_mp_read_radix #define mp_rshd TclBN_mp_rshd @@ -114,6 +116,7 @@ #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_unpack TclBN_mp_unpack #define mp_ubin_size TclBN_mp_unsigned_bin_size #define mp_unsigned_bin_size(a) ((int)TclBN_mp_unsigned_bin_size(a)) #define mp_xor TclBN_mp_xor @@ -329,8 +332,16 @@ EXTERN void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i); EXTERN Tcl_WideUInt TclBN_mp_get_mag_ull(const mp_int *a); /* 70 */ EXTERN void TclBN_mp_set_ll(mp_int *a, Tcl_WideInt i); -/* Slot 71 is reserved */ -/* Slot 72 is reserved */ +/* 71 */ +EXTERN 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); +/* 72 */ +EXTERN 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); /* 73 */ EXTERN mp_err TclBN_mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c); @@ -343,7 +354,9 @@ EXTERN mp_err TclBN_mp_tc_xor(const mp_int *a, const mp_int *b, /* 76 */ EXTERN mp_err TclBN_mp_signed_rsh(const mp_int *a, int b, mp_int *c); -/* Slot 77 is reserved */ +/* 77 */ +EXTERN size_t TclBN_mp_pack_count(const mp_int *a, size_t nails, + size_t size); /* 78 */ EXTERN int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written); @@ -429,13 +442,13 @@ typedef struct TclTomMathStubs { 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_ll) (mp_int *a, Tcl_WideInt i); /* 70 */ - void (*reserved71)(void); - void (*reserved72)(void); + 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 */ + 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 */ 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 */ - void (*reserved77)(void); + size_t (*tclBN_mp_pack_count) (const mp_int *a, size_t nails, size_t size); /* 77 */ int (*tclBN_mp_to_ubin) (const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written); /* 78 */ mp_err (*tclBN_mp_div_ld) (const mp_int *a, Tcl_WideUInt b, mp_int *q, Tcl_WideUInt *r); /* 79 */ int (*tclBN_mp_to_radix) (const mp_int *a, char *str, size_t maxlen, size_t *written, int radix); /* 80 */ @@ -595,8 +608,10 @@ extern const TclTomMathStubs *tclTomMathStubsPtr; (tclTomMathStubsPtr->tclBN_mp_get_mag_ull) /* 69 */ #define TclBN_mp_set_ll \ (tclTomMathStubsPtr->tclBN_mp_set_ll) /* 70 */ -/* Slot 71 is reserved */ -/* Slot 72 is reserved */ +#define TclBN_mp_unpack \ + (tclTomMathStubsPtr->tclBN_mp_unpack) /* 71 */ +#define TclBN_mp_pack \ + (tclTomMathStubsPtr->tclBN_mp_pack) /* 72 */ #define TclBN_mp_tc_and \ (tclTomMathStubsPtr->tclBN_mp_tc_and) /* 73 */ #define TclBN_mp_tc_or \ @@ -605,7 +620,8 @@ extern const TclTomMathStubs *tclTomMathStubsPtr; (tclTomMathStubsPtr->tclBN_mp_tc_xor) /* 75 */ #define TclBN_mp_signed_rsh \ (tclTomMathStubsPtr->tclBN_mp_signed_rsh) /* 76 */ -/* Slot 77 is reserved */ +#define TclBN_mp_pack_count \ + (tclTomMathStubsPtr->tclBN_mp_pack_count) /* 77 */ #define TclBN_mp_to_ubin \ (tclTomMathStubsPtr->tclBN_mp_to_ubin) /* 78 */ #define TclBN_mp_div_ld \ |