aboutsummaryrefslogtreecommitdiff
path: root/tools/plink/sshbn.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/plink/sshbn.c')
-rw-r--r--tools/plink/sshbn.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/plink/sshbn.c b/tools/plink/sshbn.c
index 51cecdf2b..bf149cd77 100644
--- a/tools/plink/sshbn.c
+++ b/tools/plink/sshbn.c
@@ -172,7 +172,7 @@ static BignumInt internal_add(const BignumInt *a, const BignumInt *b,
for (i = len-1; i >= 0; i--) {
carry += (BignumDblInt)a[i] + b[i];
- c[i] = (BignumInt)carry;
+ c[i] = (BignumInt)(carry&BIGNUM_INT_MASK);
carry >>= BIGNUM_INT_BITS;
}
@@ -192,7 +192,7 @@ static void internal_sub(const BignumInt *a, const BignumInt *b,
for (i = len-1; i >= 0; i--) {
carry += (BignumDblInt)a[i] + (b[i] ^ BIGNUM_INT_MASK);
- c[i] = (BignumInt)carry;
+ c[i] = (BignumInt)(carry&BIGNUM_INT_MASK);
carry >>= BIGNUM_INT_BITS;
}
}
@@ -418,7 +418,7 @@ static void internal_mul(const BignumInt *a, const BignumInt *b,
carry = 0;
for (cp = cps, bp = b + len; cp--, bp-- > b ;) {
t = (MUL_WORD(*ap, *bp) + carry) + *cp;
- *cp = (BignumInt) t;
+ *cp = (BignumInt) (t & 0xffffffff);
carry = (BignumInt)(t >> BIGNUM_INT_BITS);
}
*cp = carry;
@@ -520,7 +520,7 @@ static void internal_mul_low(const BignumInt *a, const BignumInt *b,
carry = 0;
for (cp = cps, bp = b + len; bp--, cp-- > c ;) {
t = (MUL_WORD(*ap, *bp) + carry) + *cp;
- *cp = (BignumInt) t;
+ *cp = (BignumInt) (t&BIGNUM_INT_MASK);
carry = (BignumInt)(t >> BIGNUM_INT_BITS);
}
}
@@ -687,9 +687,9 @@ static void internal_mod(BignumInt *a, int alen,
t = MUL_WORD(q, m[k]);
t += c;
c = (unsigned)(t >> BIGNUM_INT_BITS);
- if ((BignumInt) t > a[i + k])
+ if (((BignumInt)(t&0xffffffff)) > a[i + k])
c++;
- a[i + k] -= (BignumInt) t;
+ a[i + k] -= (BignumInt) (t&0xffffffff);
}
/* Add back m in case of borrow */
@@ -1390,7 +1390,7 @@ Bignum bigmuladd(Bignum a, Bignum b, Bignum addend)
for (i = 1; i <= rlen; i++) {
carry += (i <= (int)ret[0] ? ret[i] : 0);
carry += (i <= (int)addend[0] ? addend[i] : 0);
- ret[i] = (BignumInt) carry & BIGNUM_INT_MASK;
+ ret[i] = (BignumInt) (carry & BIGNUM_INT_MASK);
carry >>= BIGNUM_INT_BITS;
if (ret[i] != 0 && i > maxspot)
maxspot = i;