diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-07-26 13:12:31 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-07-26 13:12:31 (GMT) |
commit | 1cb1fee6edc063cb49beb0188c2a3db4771846fa (patch) | |
tree | a36ad0bb70244ac8d7c74e3f72101e8299f68e64 /libtommath/bn_deprecated.c | |
parent | 508e022fa975ee61d6aef292a45eabccc2e3d662 (diff) | |
download | tcl-1cb1fee6edc063cb49beb0188c2a3db4771846fa.zip tcl-1cb1fee6edc063cb49beb0188c2a3db4771846fa.tar.gz tcl-1cb1fee6edc063cb49beb0188c2a3db4771846fa.tar.bz2 |
Update to latest "develop" branch of libtommath
Diffstat (limited to 'libtommath/bn_deprecated.c')
-rw-r--r-- | libtommath/bn_deprecated.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/libtommath/bn_deprecated.c b/libtommath/bn_deprecated.c index b4a2fa7..4beafe6 100644 --- a/libtommath/bn_deprecated.c +++ b/libtommath/bn_deprecated.c @@ -195,14 +195,38 @@ mp_err mp_prime_is_divisible(const mp_int *a, mp_bool *result) mp_err mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) { (void)fast; - return mp_expt_d(a, b, c); + if (b > MP_MIN(MP_DIGIT_MAX, UINT32_MAX)) { + return MP_VAL; + } + return mp_expt_u32(a, (uint32_t)b, c); +} +#endif +#ifdef BN_MP_EXPT_D_C +mp_err mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) +{ + if (b > MP_MIN(MP_DIGIT_MAX, UINT32_MAX)) { + return MP_VAL; + } + return mp_expt_u32(a, (uint32_t)b, c); } #endif #ifdef BN_MP_N_ROOT_EX_C mp_err mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) { (void)fast; - return mp_n_root(a, b, c); + if (b > MP_MIN(MP_DIGIT_MAX, UINT32_MAX)) { + return MP_VAL; + } + return mp_root_u32(a, (uint32_t)b, c); +} +#endif +#ifdef BN_MP_N_ROOT_C +mp_err mp_n_root(const mp_int *a, mp_digit b, mp_int *c) +{ + if (b > MP_MIN(MP_DIGIT_MAX, UINT32_MAX)) { + return MP_VAL; + } + return mp_root_u32(a, (uint32_t)b, c); } #endif #endif |