summaryrefslogtreecommitdiff
path: root/libtommath/bn_s_mp_sub.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2017-06-24 22:37:14 +0800
committerMatt Johnston <matt@ucc.asn.au>2017-06-24 22:37:14 +0800
commit4411cfea2e4e342b481fd1931ed82f25936d1fe4 (patch)
treed080c8df7d78afe0b28a0561aa4ee062e6b4fc70 /libtommath/bn_s_mp_sub.c
parent5b7abf855ea4fbe2aac19fde351ab292474736fe (diff)
downloaddropbear-4411cfea2e4e342b481fd1931ed82f25936d1fe4.tar.gz
Update to libtommath v1.0
Diffstat (limited to 'libtommath/bn_s_mp_sub.c')
-rw-r--r--libtommath/bn_s_mp_sub.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c
index f5949f5..c0ea556 100644
--- a/libtommath/bn_s_mp_sub.c
+++ b/libtommath/bn_s_mp_sub.c
@@ -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, tomstdenis@gmail.com, http://math.libtomcrypt.com
+ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
/* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */
@@ -35,8 +35,8 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
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 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
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 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
*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 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
#endif
-/* $Source: /cvs/libtom/libtommath/bn_s_mp_sub.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2006/03/31 14:18:44 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */