mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
Fix goof in mp_reduce_mod_2to.
It correctly masked off bits in the partial word, but then left all higher words _unchanged_ rather than zeroing them. Apparently its use in mp_invert_mod_2to was in restricted enough circumstances not to cause a failure there!
This commit is contained in:
parent
34d78286e6
commit
df1ed3ba6e
2
mpint.c
2
mpint.c
@ -1124,7 +1124,7 @@ void mp_reduce_mod_2to(mp_int *x, size_t p)
|
|||||||
size_t mask = ((size_t)1 << (p % BIGNUM_INT_BITS)) - 1;
|
size_t mask = ((size_t)1 << (p % BIGNUM_INT_BITS)) - 1;
|
||||||
for (; word < x->nw; word++) {
|
for (; word < x->nw; word++) {
|
||||||
x->w[word] &= mask;
|
x->w[word] &= mask;
|
||||||
mask = -(size_t)1;
|
mask = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user