summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-01-13 15:37:21 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-01-13 15:37:21 (GMT)
commit071381e9840e2c4e214943c393dcffd64c7eadd5 (patch)
tree382e6b3389bc73b5b4583f64a5830a2e0bef58e8
parent5f79368eafbc887b92115322ec00c4b51f29493c (diff)
downloadtcl-071381e9840e2c4e214943c393dcffd64c7eadd5.zip
tcl-071381e9840e2c4e214943c393dcffd64c7eadd5.tar.gz
tcl-071381e9840e2c4e214943c393dcffd64c7eadd5.tar.bz2
Add mp_unpack() to the libtommath stub table, so this function is available to extensions (and to Tcl itself, but not used yet)
-rw-r--r--generic/tclStubInit.c3
-rw-r--r--generic/tclTomMath.decls4
-rw-r--r--generic/tclTomMathDecls.h12
-rw-r--r--unix/Makefile.in5
-rw-r--r--win/Makefile.in1
-rw-r--r--win/makefile.vc1
6 files changed, 21 insertions, 5 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 6b2786b..0afc503 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -138,6 +138,7 @@ static void uniCodePanic(void) {
#define TclBN_mp_to_radix mp_to_radix
#define TclBN_mp_to_ubin mp_to_ubin
#define TclBN_mp_ubin_size mp_ubin_size
+#define TclBN_mp_unpack mp_unpack
#define TclBN_mp_xor mp_xor
#define TclBN_mp_zero mp_zero
#define TclBN_s_mp_add s_mp_add
@@ -1200,7 +1201,7 @@ const TclTomMathStubs tclTomMathStubs = {
TclBN_mp_set_u64, /* 68 */
TclBN_mp_get_mag_u64, /* 69 */
TclBN_mp_set_i64, /* 70 */
- 0, /* 71 */
+ TclBN_mp_unpack, /* 71 */
0, /* 72 */
TclBN_mp_tc_and, /* 73 */
TclBN_mp_tc_or, /* 74 */
diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls
index 9d6eb1c..5ea16f1 100644
--- a/generic/tclTomMath.decls
+++ b/generic/tclTomMath.decls
@@ -244,6 +244,10 @@ declare 69 {
declare 70 {
void TclBN_mp_set_i64(mp_int *a, int64_t i)
}
+declare 71 {
+ mp_err MP_WUR TclBN_mp_unpack(mp_int *rop, size_t count, mp_order order, size_t size,
+ mp_endian endian, size_t nails, const void *op)
+}
# Added in libtommath 1.1.0
declare 73 {deprecated {merged with mp_and}} {
diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h
index 1427e8b..4c1505f 100644
--- a/generic/tclTomMathDecls.h
+++ b/generic/tclTomMathDecls.h
@@ -141,6 +141,7 @@ MODULE_SCOPE mp_err TclBN_s_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c);
#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_unpack TclBN_mp_unpack
#define mp_xor TclBN_mp_xor
#define mp_zero TclBN_mp_zero
#define s_mp_add TclBN_s_mp_add
@@ -379,7 +380,11 @@ EXTERN void TclBN_mp_set_u64(mp_int *a, uint64_t i);
EXTERN uint64_t TclBN_mp_get_mag_u64(const mp_int *a) MP_WUR;
/* 70 */
EXTERN void TclBN_mp_set_i64(mp_int *a, int64_t i);
-/* Slot 71 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) MP_WUR;
/* Slot 72 is reserved */
/* 73 */
TCL_DEPRECATED("merged with mp_and")
@@ -482,7 +487,7 @@ typedef struct TclTomMathStubs {
void (*tclBN_mp_set_u64) (mp_int *a, uint64_t i); /* 68 */
uint64_t (*tclBN_mp_get_mag_u64) (const mp_int *a) MP_WUR; /* 69 */
void (*tclBN_mp_set_i64) (mp_int *a, int64_t i); /* 70 */
- void (*reserved71)(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) MP_WUR; /* 71 */
void (*reserved72)(void);
TCL_DEPRECATED_API("merged with mp_and") mp_err (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 73 */
TCL_DEPRECATED_API("merged with mp_or") mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 74 */
@@ -648,7 +653,8 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
(tclTomMathStubsPtr->tclBN_mp_get_mag_u64) /* 69 */
#define TclBN_mp_set_i64 \
(tclTomMathStubsPtr->tclBN_mp_set_i64) /* 70 */
-/* Slot 71 is reserved */
+#define TclBN_mp_unpack \
+ (tclTomMathStubsPtr->tclBN_mp_unpack) /* 71 */
/* Slot 72 is reserved */
#define TclBN_mp_tc_and \
(tclTomMathStubsPtr->tclBN_mp_tc_and) /* 73 */
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 4ad001e..0dfdaf3 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -340,7 +340,7 @@ TOMMATH_OBJS = bn_s_mp_reverse.o bn_s_mp_mul_digs_fast.o \
bn_mp_set_u64.o bn_mp_shrink.o \
bn_mp_sqr.o bn_mp_sqrt.o bn_mp_sub.o bn_mp_sub_d.o \
bn_mp_signed_rsh.o \
- bn_mp_to_ubin.o \
+ bn_mp_to_ubin.o bn_mp_unpack.o \
bn_s_mp_toom_mul.o bn_s_mp_toom_sqr.o bn_mp_to_radix.o \
bn_mp_ubin_size.o bn_mp_xor.o bn_mp_zero.o bn_s_mp_add.o \
bn_s_mp_mul_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o
@@ -1740,6 +1740,9 @@ bn_mp_to_radix.o: $(TOMMATH_DIR)/bn_mp_to_radix.c $(MATHHDRS)
bn_mp_ubin_size.o: $(TOMMATH_DIR)/bn_mp_ubin_size.c $(MATHHDRS)
$(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_ubin_size.c
+bn_mp_unpack.o: $(TOMMATH_DIR)/bn_mp_unpack.c $(MATHHDRS)
+ $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_unpack.c
+
bn_mp_xor.o: $(TOMMATH_DIR)/bn_mp_xor.c $(MATHHDRS)
$(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_xor.c
diff --git a/win/Makefile.in b/win/Makefile.in
index 26e8b5c..c93f50a 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -414,6 +414,7 @@ TOMMATH_OBJS = \
bn_mp_to_ubin.${OBJEXT} \
bn_mp_to_radix.${OBJEXT} \
bn_mp_ubin_size.${OBJEXT} \
+ bn_mp_unpack.${OBJEXT} \
bn_mp_xor.${OBJEXT} \
bn_mp_zero.${OBJEXT} \
bn_s_mp_add.${OBJEXT} \
diff --git a/win/makefile.vc b/win/makefile.vc
index ed3a852..66879ab 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -393,6 +393,7 @@ TOMMATHOBJS = \
$(TMP_DIR)\bn_mp_to_ubin.obj \
$(TMP_DIR)\bn_mp_to_radix.obj \
$(TMP_DIR)\bn_mp_ubin_size.obj \
+ $(TMP_DIR)\bn_mp_unpack.obj \
$(TMP_DIR)\bn_mp_xor.obj \
$(TMP_DIR)\bn_mp_zero.obj \
$(TMP_DIR)\bn_s_mp_add.obj \