diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-13 19:07:13 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-13 19:07:13 (GMT) |
commit | 505f963287b050bd46871d4659cebc65986ca5ac (patch) | |
tree | 853ad3262ab07f7c5755e76b8154f36f24608014 /libtommath/bn_mp_invmod.c | |
parent | 689987ea924a8fded1801777c1a14ab1205fa826 (diff) | |
download | tcl-505f963287b050bd46871d4659cebc65986ca5ac.zip tcl-505f963287b050bd46871d4659cebc65986ca5ac.tar.gz tcl-505f963287b050bd46871d4659cebc65986ca5ac.tar.bz2 |
Update to latest libtommath's "develop" branch. On the way to 1.2.0
Diffstat (limited to 'libtommath/bn_mp_invmod.c')
-rw-r--r-- | libtommath/bn_mp_invmod.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index f1a482d..d5d6bbc 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -1,40 +1,27 @@ #include "tommath_private.h" #ifdef BN_MP_INVMOD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * SPDX-License-Identifier: Unlicense - */ +/* LibTomMath, multiple-precision integer library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ /* hac 14.61, pp608 */ -int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c) +mp_err mp_invmod(const mp_int *a, const mp_int *b, mp_int *c) { /* b cannot be negative and has to be >1 */ if ((b->sign == MP_NEG) || (mp_cmp_d(b, 1uL) != MP_GT)) { return MP_VAL; } -#ifdef BN_FAST_MP_INVMOD_C +#ifdef BN_S_MP_INVMOD_FAST_C /* if the modulus is odd we can use a faster routine instead */ - if ((mp_isodd(b) == MP_YES)) { - return fast_mp_invmod(a, b, c); + if (MP_IS_ODD(b)) { + return s_mp_invmod_fast(a, b, c); } #endif -#ifdef BN_MP_INVMOD_SLOW_C - return mp_invmod_slow(a, b, c); +#ifdef BN_S_MP_INVMOD_SLOW_C + return s_mp_invmod_slow(a, b, c); #else return MP_VAL; #endif } #endif - -/* ref: $Format:%D$ */ -/* git commit: $Format:%H$ */ -/* commit time: $Format:%ai$ */ |