Mercurial > dropbear
comparison libtommath/bn_mp_invmod.c @ 1470:8bba51a55704
Update to libtommath v1.0.1
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 08 Feb 2018 23:11:40 +0800 |
parents | 60fc6476e044 |
children | f52919ffd3b1 |
comparison
equal
deleted
inserted
replaced
1469:51043e868f55 | 1470:8bba51a55704 |
---|---|
23 return MP_VAL; | 23 return MP_VAL; |
24 } | 24 } |
25 | 25 |
26 #ifdef BN_FAST_MP_INVMOD_C | 26 #ifdef BN_FAST_MP_INVMOD_C |
27 /* if the modulus is odd we can use a faster routine instead */ | 27 /* if the modulus is odd we can use a faster routine instead */ |
28 if (mp_isodd (b) == MP_YES) { | 28 if ((mp_isodd(b) == MP_YES) && (mp_cmp_d(b, 1) != MP_EQ)) { |
29 return fast_mp_invmod (a, b, c); | 29 return fast_mp_invmod (a, b, c); |
30 } | 30 } |
31 #endif | 31 #endif |
32 | 32 |
33 #ifdef BN_MP_INVMOD_SLOW_C | 33 #ifdef BN_MP_INVMOD_SLOW_C |
36 return MP_VAL; | 36 return MP_VAL; |
37 #endif | 37 #endif |
38 } | 38 } |
39 #endif | 39 #endif |
40 | 40 |
41 /* $Source$ */ | 41 /* ref: $Format:%D$ */ |
42 /* $Revision$ */ | 42 /* git commit: $Format:%H$ */ |
43 /* $Date$ */ | 43 /* commit time: $Format:%ai$ */ |