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:
Simon Tatham 2019-01-03 10:37:19 +00:00
Родитель 34d78286e6
Коммит df1ed3ba6e
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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;
for (; word < x->nw; word++) {
x->w[word] &= mask;
mask = -(size_t)1;
mask = 0;
}
}