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.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/plink/sshbn.c b/tools/plink/sshbn.c
index 51cecdf2b..5c1870876 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);
}
}
@@ -599,7 +599,7 @@ static void internal_add_shifted(BignumInt *number,
while (addend) {
addend += number[word];
- number[word] = (BignumInt) addend & BIGNUM_INT_MASK;
+ number[word] = (BignumInt) (addend & BIGNUM_INT_MASK);
addend >>= BIGNUM_INT_BITS;
word++;
}
@@ -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;
@@ -1430,7 +1430,7 @@ Bignum bigadd(Bignum a, Bignum b)
for (i = 1; i <= rlen; i++) {
carry += (i <= (int)a[0] ? a[i] : 0);
carry += (i <= (int)b[0] ? b[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;
@@ -1460,7 +1460,7 @@ Bignum bigsub(Bignum a, Bignum b)
for (i = 1; i <= rlen; i++) {
carry += (i <= (int)a[0] ? a[i] : 0);
carry += (i <= (int)b[0] ? b[i] ^ BIGNUM_INT_MASK : BIGNUM_INT_MASK);
- 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;
@@ -1529,7 +1529,7 @@ Bignum bignum_add_long(Bignum number, unsigned long addendx)
carry += addend & BIGNUM_INT_MASK;
carry += (i <= (int)number[0] ? number[i] : 0);
addend >>= BIGNUM_INT_BITS;
- ret[i] = (BignumInt) carry & BIGNUM_INT_MASK;
+ ret[i] = (BignumInt) (carry & BIGNUM_INT_MASK);
carry >>= BIGNUM_INT_BITS;
if (ret[i] != 0)
maxspot = i;