modinv_var in section 7 of doc/safegcd_implementation.md calls normalize(f, d, Mi), but normalize takes the modulus M. As written it returns the right inverse for 1 of 2008 inputs; with M, for all 2008.
doc: pass M, not Mi, to normalize in modinv_var #1992
pull fametrano wants to merge 1 commits into bitcoin-core:master from fametrano:doc-safegcd-modinv-var-normalize changing 1 files +1 −1-
fametrano commented at 8:56 AM on November 8, 2026: contributor
-
doc: pass M, not Mi, to normalize in modinv_var f901165097
-
Yudis-bit commented at 1:27 PM on November 8, 2026: contributor
Running section 7
modinv_varfails on all inputs other than 1 when passingMitonormalize. In section 4 and 7normalize(sign, v, M)expects the modulusMto bringvinto[0, M). Fix looks correct. -
fametrano commented at 6:59 AM on November 9, 2026: contributor
The two Wine jobs fail because
ubuntu-latestis now ubuntu-26.04: every test exits withwine: socket : Function not implemented. The last green Wine jobs, on master on 2026-11-04 and on PRs up to 2026-11-06, ran on ubuntu-24.04, so master and other PRs should hit this too. Pinningmingw_debiantoubuntu-24.04would be one way out.