forked from wolfSSL/wolfssl
Check shift value
This commit is contained in:
@ -1027,7 +1027,13 @@ void fp_mod_2d(fp_int *a, int b, fp_int *c)
|
|||||||
c->dp[x] = 0;
|
c->dp[x] = 0;
|
||||||
}
|
}
|
||||||
/* clear the digit that is not completely outside/inside the modulus */
|
/* clear the digit that is not completely outside/inside the modulus */
|
||||||
c->dp[b / DIGIT_BIT] &= ~((fp_digit)0) >> (DIGIT_BIT - b);
|
x = DIGIT_BIT - b;
|
||||||
|
if (x > 0) {
|
||||||
|
c->dp[b / DIGIT_BIT] &= ~((fp_digit)0) >> x;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
c->dp[b / DIGIT_BIT] &= ~((fp_digit)0) << -x;
|
||||||
|
|
||||||
fp_clamp (c);
|
fp_clamp (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user