From 0ddca9ccf5bf55a5b06b7b34d62701c18114f1c1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 12 Apr 2024 15:12:45 +0000 Subject: Re-generate tclTomMath.h from tommath.h --- generic/tclTomMath.h | 72 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 00b6503..fa5863b 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -77,12 +77,11 @@ typedef unsigned int private_mp_word; typedef unsigned long long mp_digit; #define MP_DIGIT_DECLARED #endif +#if defined(__GNUC__) typedef unsigned long private_mp_word __attribute__((mode(TI))); +#endif # define MP_DIGIT_BIT 60 #else -/* this is the default case, 28-bit digits */ - -/* this is to make porting into LibTomCrypt easier :-) */ #ifndef MP_DIGIT_DECLARED typedef unsigned int mp_digit; #define MP_DIGIT_DECLARED @@ -402,7 +401,7 @@ uint64_t mp_get_mag_u64(const mp_int *a) MP_WUR; unsigned long mp_get_mag_ul(const mp_int *a) MP_WUR; */ /* -Tcl_WideUInt mp_get_mag_ull(const mp_int *a) MP_WUR; +MP_DEPRECATED(mp_get_mag_u64) Tcl_WideUInt mp_get_mag_ull(const mp_int *a) MP_WUR; */ /* get integer, set integer (long) */ @@ -427,22 +426,24 @@ mp_err mp_init_ul(mp_int *a, unsigned long b) MP_WUR; /* get integer, set integer (Tcl_WideInt) */ /* -Tcl_WideInt mp_get_ll(const mp_int *a) MP_WUR; +MP_DEPRECATED(mp_get_i64) Tcl_WideInt mp_get_ll(const mp_int *a) MP_WUR; */ /* -void mp_set_ll(mp_int *a, Tcl_WideInt b); +MP_DEPRECATED(mp_set_i64) void mp_set_ll(mp_int *a, Tcl_WideInt b); */ /* -mp_err mp_init_ll(mp_int *a, Tcl_WideInt b) MP_WUR; +MP_DEPRECATED(mp_init_i64) mp_err mp_init_ll(mp_int *a, Tcl_WideInt b) MP_WUR; */ /* get integer, set integer (Tcl_WideUInt) */ -#define mp_get_ull(a) ((Tcl_WideUInt)mp_get_ll(a)) /* -void mp_set_ull(mp_int *a, Tcl_WideUInt b); +#define mp_get_ull(a) (MP_DEPRECATED_PRAGMA("mp_get_ull() has been deprecated, use mp_get_u64()") ((Tcl_WideUInt)mp_get_ll(a))) */ /* -mp_err mp_init_ull(mp_int *a, Tcl_WideUInt b) MP_WUR; +MP_DEPRECATED(mp_set_u64) void mp_set_ull(mp_int *a, Tcl_WideUInt b); +*/ +/* +MP_DEPRECATED(mp_init_u64) mp_err mp_init_ull(mp_int *a, Tcl_WideUInt b) MP_WUR; */ /* set to single unsigned digit, up to MP_DIGIT_MAX */ @@ -461,7 +462,7 @@ MP_DEPRECATED(mp_get_mag_u32/mp_get_u32) unsigned long mp_get_int(const mp_int * MP_DEPRECATED(mp_get_mag_ul/mp_get_ul) unsigned long mp_get_long(const mp_int *a) MP_WUR; */ /* -MP_DEPRECATED(mp_get_mag_ull/mp_get_ull) Tcl_WideUInt mp_get_long_long(const mp_int *a) MP_WUR; +MP_DEPRECATED(mp_get_mag_u64/mp_get_u64) Tcl_WideUInt mp_get_long_long(const mp_int *a) MP_WUR; */ /* MP_DEPRECATED(mp_set_ul) mp_err mp_set_int(mp_int *a, unsigned long b); @@ -491,6 +492,7 @@ mp_err mp_init_copy(mp_int *a, const mp_int *b) MP_WUR; void mp_clamp(mp_int *a); */ + /* export binary data */ /* MP_DEPRECATED(mp_pack) mp_err mp_export(void *rop, size_t *countp, int order, size_t size, @@ -543,7 +545,7 @@ mp_err mp_div_2(const mp_int *a, mp_int *b) MP_WUR; /* a/3 => 3c + d == a */ /* -mp_err mp_div_3(const mp_int *a, mp_int *c, mp_digit *d) MP_WUR; +MP_DEPRECATED(mp_div_d) mp_err mp_div_3(const mp_int *a, mp_int *c, mp_digit *d) MP_WUR; */ /* c = a * 2**b, implemented as c = a << b */ @@ -778,18 +780,42 @@ mp_err mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp mp_err mp_lcm(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; */ +/* Integer logarithm to integer base */ +/* +mp_err mp_log_n(const mp_int *a, int base, int *c) MP_WUR; +*/ +/* +MP_DEPRECATED(mp_log_n) mp_err mp_log_u32(const mp_int *a, uint32_t base, uint32_t *c) MP_WUR; +*/ + +/* c = a**b */ +/* +mp_err mp_expt_n(const mp_int *a, int b, mp_int *c) MP_WUR; +*/ +/* +MP_DEPRECATED(mp_expt_n) mp_err mp_expt_u32(const mp_int *a, uint32_t b, mp_int *c) MP_WUR; +*/ +/* +MP_DEPRECATED(mp_expt_n) mp_err mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) MP_WUR; +*/ +/* +MP_DEPRECATED(mp_expt_n) mp_err mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR; +*/ /* finds one of the b'th root of a, such that |c|**b <= |a| * * returns error if a < 0 and b is even */ + /* +mp_err mp_root_n(const mp_int *a, int b, mp_int *c) MP_WUR; +*/ /* -mp_err mp_root_u32(const mp_int *a, unsigned int b, mp_int *c) MP_WUR; +MP_DEPRECATED(mp_root_n) mp_err mp_root_u32(const mp_int *a, uint32_t b, mp_int *c) MP_WUR; */ /* -MP_DEPRECATED(mp_root_u32) mp_err mp_n_root(const mp_int *a, mp_digit b, mp_int *c) MP_WUR; +MP_DEPRECATED(mp_root_n) mp_err mp_n_root(const mp_int *a, mp_digit b, mp_int *c) MP_WUR; */ /* -MP_DEPRECATED(mp_root_u32) mp_err mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR; +MP_DEPRECATED(mp_root_n) mp_err mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR; */ /* special sqrt algo */ @@ -1012,22 +1038,6 @@ MP_DEPRECATED(mp_prime_rand) mp_err mp_prime_random_ex(mp_int *a, int t, int siz mp_err mp_prime_rand(mp_int *a, int t, int size, int flags) MP_WUR; */ -/* Integer logarithm to integer base */ -/* -mp_err mp_log_u32(const mp_int *a, unsigned int base, unsigned int *c) MP_WUR; -*/ - -/* c = a**b */ -/* -mp_err mp_expt_n(const mp_int *a, int b, mp_int *c) MP_WUR; -*/ -/* -MP_DEPRECATED(mp_expt_n) mp_err mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) MP_WUR; -*/ -/* -MP_DEPRECATED(mp_expt_n) mp_err mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR; -*/ - /* ---> radix conversion <--- */ /* int mp_count_bits(const mp_int *a) MP_WUR; -- cgit v0.12