Mercurial > dropbear
diff libtommath/bn_s_mp_sub.c @ 1439:8d24733026c5 coverity
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 24 Jun 2017 23:33:16 +0800 |
parents | 60fc6476e044 |
children | 8bba51a55704 |
line wrap: on
line diff
--- a/libtommath/bn_s_mp_sub.c Sat Jun 03 00:10:58 2017 +0800 +++ b/libtommath/bn_s_mp_sub.c Sat Jun 24 23:33:16 2017 +0800 @@ -1,4 +1,4 @@ -#include <tommath.h> +#include <tommath_private.h> #ifdef BN_S_MP_SUB_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 */ /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ @@ -35,8 +35,8 @@ c->used = max; { - register mp_digit u, *tmpa, *tmpb, *tmpc; - register int i; + mp_digit u, *tmpa, *tmpb, *tmpc; + int i; /* alias for digit pointers */ tmpa = a->dp; @@ -47,14 +47,14 @@ u = 0; for (i = 0; i < min; i++) { /* T[i] = A[i] - B[i] - U */ - *tmpc = *tmpa++ - *tmpb++ - u; + *tmpc = (*tmpa++ - *tmpb++) - u; /* U = carry bit of T[i] * Note this saves performing an AND operation since * if a carry does occur it will propagate all the way to the * MSB. As a result a single shift is enough to get the carry */ - u = *tmpc >> ((mp_digit)(CHAR_BIT * sizeof (mp_digit) - 1)); + u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); /* Clear carry from T[i] */ *tmpc++ &= MP_MASK; @@ -66,7 +66,7 @@ *tmpc = *tmpa++ - u; /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)(CHAR_BIT * sizeof (mp_digit) - 1)); + u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); /* Clear carry from T[i] */ *tmpc++ &= MP_MASK; @@ -84,6 +84,6 @@ #endif -/* $Source: /cvs/libtom/libtommath/bn_s_mp_sub.c,v $ */ -/* $Revision: 1.3 $ */ -/* $Date: 2006/03/31 14:18:44 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */