diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-24 18:58:31 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-24 18:58:31 (GMT) |
commit | 94ef14f2fe7454b1f9483b2718ae78c3f578959b (patch) | |
tree | 34bb4eda11bc7857cd9671860f9563d1b01147c2 /generic | |
parent | 5837fdc42cd33f9b1f81bc4f75b9dad62b0631b2 (diff) | |
download | tcl-94ef14f2fe7454b1f9483b2718ae78c3f578959b.zip tcl-94ef14f2fe7454b1f9483b2718ae78c3f578959b.tar.gz tcl-94ef14f2fe7454b1f9483b2718ae78c3f578959b.tar.bz2 |
Combine two libtommath stub entries, which (almost) do the same
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclStubInit.c | 6 | ||||
-rw-r--r-- | generic/tclTomMath.decls | 5 | ||||
-rw-r--r-- | generic/tclTomMathDecls.h | 16 |
3 files changed, 10 insertions, 17 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index d1911d7..ea53e42 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -430,7 +430,7 @@ mp_err mp_to_unsigned_bin(const mp_int *a, unsigned char *b) mp_err mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen) { - size_t n = mp_ubin_size(a); + size_t n = TclBN_mp_unsigned_bin_size(a); if (*outlen < (unsigned long)n) { return MP_VAL; } @@ -445,8 +445,6 @@ mp_err mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen) } return mp_to_radix(a, str, (size_t)maxlen, NULL, radix); } -#undef TclBN_mp_unsigned_bin_size -#define TclBN_mp_unsigned_bin_size (int (*)(const mp_int *a)) mp_ubin_size void bn_reverse(unsigned char *s, int len) { @@ -929,7 +927,7 @@ const TclTomMathStubs tclTomMathStubs = { TclBN_mp_signed_rsh, /* 76 */ TclBN_mp_get_bit, /* 77 */ TclBN_mp_to_ubin, /* 78 */ - TclBN_mp_ubin_size, /* 79 */ + 0, /* 79 */ TclBN_mp_to_radix, /* 80 */ }; diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index 0d16fe3..c8092aa 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -166,7 +166,7 @@ declare 46 { mp_err TclBN_mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen) } declare 47 { - int TclBN_mp_unsigned_bin_size(const mp_int *a) + size_t TclBN_mp_unsigned_bin_size(const mp_int *a) } declare 48 { mp_err TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c) @@ -262,9 +262,6 @@ declare 77 { declare 78 { int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written) } -declare 79 { - size_t TclBN_mp_ubin_size(const mp_int *a) -} declare 80 { int TclBN_mp_to_radix(const mp_int *a, char *str, size_t maxlen, size_t *written, int radix) } diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index ceabc22..8d8ca67 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -127,8 +127,8 @@ #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_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 #define mp_zero TclBN_mp_zero #define s_mp_add TclBN_s_mp_add @@ -277,7 +277,7 @@ EXTERN mp_err TclBN_mp_to_unsigned_bin_n(const mp_int *a, 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); +EXTERN size_t TclBN_mp_unsigned_bin_size(const mp_int *a); /* 48 */ EXTERN mp_err TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c); @@ -351,8 +351,7 @@ EXTERN mp_bool TclBN_mp_get_bit(const mp_int *a, unsigned int b); /* 78 */ EXTERN int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written); -/* 79 */ -EXTERN size_t TclBN_mp_ubin_size(const mp_int *a); +/* Slot 79 is reserved */ /* 80 */ EXTERN int TclBN_mp_to_radix(const mp_int *a, char *str, size_t maxlen, size_t *written, int radix); @@ -408,7 +407,7 @@ typedef struct TclTomMathStubs { 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 */ + size_t (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */ 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 */ void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */ @@ -440,7 +439,7 @@ typedef struct TclTomMathStubs { 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 */ int (*tclBN_mp_to_ubin) (const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written); /* 78 */ - size_t (*tclBN_mp_ubin_size) (const mp_int *a); /* 79 */ + void (*reserved79)(void); int (*tclBN_mp_to_radix) (const mp_int *a, char *str, size_t maxlen, size_t *written, int radix); /* 80 */ } TclTomMathStubs; @@ -610,8 +609,7 @@ extern const TclTomMathStubs *tclTomMathStubsPtr; (tclTomMathStubsPtr->tclBN_mp_get_bit) /* 77 */ #define TclBN_mp_to_ubin \ (tclTomMathStubsPtr->tclBN_mp_to_ubin) /* 78 */ -#define TclBN_mp_ubin_size \ - (tclTomMathStubsPtr->tclBN_mp_ubin_size) /* 79 */ +/* Slot 79 is reserved */ #define TclBN_mp_to_radix \ (tclTomMathStubsPtr->tclBN_mp_to_radix) /* 80 */ |