Mercurial > dropbear
diff libtommath/bn_fast_mp_montgomery_reduce.c @ 1436:60fc6476e044
Update to libtommath v1.0
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 24 Jun 2017 22:37:14 +0800 |
parents | 5ff8218bcee9 |
children | 8bba51a55704 |
line wrap: on
line diff
--- a/libtommath/bn_fast_mp_montgomery_reduce.c Sat Jun 24 17:50:50 2017 +0800 +++ b/libtommath/bn_fast_mp_montgomery_reduce.c Sat Jun 24 22:37:14 2017 +0800 @@ -1,4 +1,4 @@ -#include <tommath.h> +#include <tommath_private.h> #ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis * @@ -12,7 +12,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, [email protected], http://math.libtomcrypt.com + * Tom St Denis, [email protected], http://libtom.org */ /* computes xR**-1 == x (mod N) via Montgomery Reduction @@ -32,7 +32,7 @@ olduse = x->used; /* grow a as required */ - if (x->alloc < n->used + 1) { + if (x->alloc < (n->used + 1)) { if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) { return res; } @@ -42,8 +42,8 @@ * an array of double precision words W[...] */ { - register mp_word *_W; - register mp_digit *tmpx; + mp_word *_W; + mp_digit *tmpx; /* alias for the W[] array */ _W = W; @@ -57,7 +57,7 @@ } /* zero the high words of W[a->used..m->used*2] */ - for (; ix < n->used * 2 + 1; ix++) { + for (; ix < ((n->used * 2) + 1); ix++) { *_W++ = 0; } } @@ -72,7 +72,7 @@ * by casting the value down to a mp_digit. Note this requires * that W[ix-1] have the carry cleared (see after the inner loop) */ - register mp_digit mu; + mp_digit mu; mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK); /* a = a + mu * m * b**i @@ -90,9 +90,9 @@ * first m->used words of W[] have the carries fixed */ { - register int iy; - register mp_digit *tmpn; - register mp_word *_W; + int iy; + mp_digit *tmpn; + mp_word *_W; /* alias for the digits of the modulus */ tmpn = n->dp; @@ -115,8 +115,8 @@ * significant digits we zeroed]. */ { - register mp_digit *tmpx; - register mp_word *_W, *_W1; + mp_digit *tmpx; + mp_word *_W, *_W1; /* nox fix rest of carries */ @@ -126,7 +126,7 @@ /* alias for next word, where the carry goes */ _W = W + ++ix; - for (; ix <= n->used * 2 + 1; ix++) { + for (; ix <= ((n->used * 2) + 1); ix++) { *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT); } @@ -143,7 +143,7 @@ /* alias for shifted double precision result */ _W = W + n->used; - for (ix = 0; ix < n->used + 1; ix++) { + for (ix = 0; ix < (n->used + 1); ix++) { *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK)); } @@ -167,6 +167,6 @@ } #endif -/* $Source: /cvs/libtom/libtommath/bn_fast_mp_montgomery_reduce.c,v $ */ -/* $Revision: 1.3 $ */ -/* $Date: 2006/03/31 14:18:44 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */