Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MontFp issue in fields with 64 * k bits #550

Merged
merged 5 commits into from
Dec 21, 2022
Merged

Fix MontFp issue in fields with 64 * k bits #550

merged 5 commits into from
Dec 21, 2022

Conversation

weikengchen
Copy link
Member

@weikengchen weikengchen commented Dec 18, 2022

Description

Previously, we changed the logic of field multiplication to support 64 * k bits, as in #509 and #532.

We did not, however, change the one that affects the MontFp macro. This was previously not detected because MontFp uses a special, dedicated function to perform the computation (since it cannot use Fp because Fp has not yet been constructed), while the rest is using other functions.

This PR fixes so, in that MontFp will also call a function that is aware of the 64 * k issue.

closes: #549


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Re-reviewed Files changed in the GitHub PR explorer

N/A:

  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Wrote unit tests

@weikengchen
Copy link
Member Author

Randomized tests appear to be difficult to add, as several functions are private (and are intended to be so).

@mmagician
Copy link
Member

How about we add regression tests for the specific failure case that we know of? I think it's better to have a few tests not following our test-templates than not having them and risking incorrect computation now & in the future.

@weikengchen
Copy link
Member Author

Let me add one.

@weikengchen
Copy link
Member Author

Update and cc @Pratyush

  • spare bit is now used
  • added a test

@weikengchen weikengchen merged commit 3351d0f into master Dec 21, 2022
@weikengchen weikengchen deleted the fix-montfp branch December 21, 2022 06:13
andrewmilson added a commit to andrewmilson/algebra that referenced this pull request Jan 1, 2023
* upstream/master: (29 commits)
  Fix some clippy lints (arkworks-rs#570)
  Correct tag name & complete command suggestion (arkworks-rs#569)
  Open a "release-PR" against a `releases` branch (arkworks-rs#566)
  Allow to overwrite default impl of `msm` in TwistedEdwards form (arkworks-rs#567)
  Remove poly-benches. (arkworks-rs#558)
  DO NOT MERGE YET. Release 0.4 (arkworks-rs#512)
  otherwise downstream users that have not migrated will not see warning (arkworks-rs#563)
  use `into_bigint()` in `Debug` for `Fp<P, N>` (arkworks-rs#562)
  Add `frobenius_map_in_place` (arkworks-rs#557)
  Fix test_sw_properties for some cofactor groups (arkworks-rs#555)
  Move h2c tests to test-templates (arkworks-rs#554)
  impl `CanonicalSerialize/Deserialize` for `BigUint` (arkworks-rs#551)
  Fix MontFp issue in fields with 64 * k bits (arkworks-rs#550)
  Fix tests for Modulus plus one div four (arkworks-rs#552)
  fix (arkworks-rs#547)
  Rename all `*Parameters` to `*Config` (arkworks-rs#545)
  Fix doc-comment on `SWUMap` and CamelCase `(CO)DOMAIN`
  Small cleanups in hash-to-curve (arkworks-rs#544)
  Allow to overwrite the default implementation of `msm` (arkworks-rs#528)
  Move `multi_miller_loop` and `final_exponentiation` into `BW6Config` (arkworks-rs#542)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MontFp failure
4 participants