diff options
Diffstat (limited to 'libtommath/bn_mp_reduce_is_2k_l.c')
-rw-r--r-- | libtommath/bn_mp_reduce_is_2k_l.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index 7b57865..22c7582 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -1,4 +1,4 @@ -#include <tommath.h> +#include <tommath_private.h> #ifdef BN_MP_REDUCE_IS_2K_L_C /* LibTomMath, multiple-precision integer library -- Tom St Denis * @@ -12,14 +12,14 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com + * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ /* determines if reduce_2k_l can be used */ -int mp_reduce_is_2k_l(mp_int *a) +int mp_reduce_is_2k_l(const mp_int *a) { int ix, iy; - + if (a->used == 0) { return MP_NO; } else if (a->used == 1) { @@ -27,14 +27,18 @@ int mp_reduce_is_2k_l(mp_int *a) } else if (a->used > 1) { /* if more than half of the digits are -1 we're sold */ for (iy = ix = 0; ix < a->used; ix++) { - if (a->dp[ix] == MP_MASK) { - ++iy; - } + if (a->dp[ix] == MP_MASK) { + ++iy; + } } return (iy >= (a->used/2)) ? MP_YES : MP_NO; - + } return MP_NO; } #endif + +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ |