mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 20:54:41 +02:00
Fix shift and clear digits
This commit is contained in:
@@ -684,8 +684,10 @@ int mp_mod_2d (mp_int * a, int b, mp_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] &= (mp_digit) ((((mp_digit) 1) <<
|
x = DIGIT_BIT - (b % DIGIT_BIT);
|
||||||
(((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1));
|
if (x != DIGIT_BIT) {
|
||||||
|
c->dp[b / DIGIT_BIT] &= ~((mp_digit)0) >> x;
|
||||||
|
}
|
||||||
mp_clamp (c);
|
mp_clamp (c);
|
||||||
return MP_OKAY;
|
return MP_OKAY;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user