fix(ole-core): use original ROT choice bits in OLE receiver#377
Draft
heeckhau wants to merge 1 commit into
Draft
fix(ole-core): use original ROT choice bits in OLE receiver#377heeckhau wants to merge 1 commit into
heeckhau wants to merge 1 commit into
Conversation
For prime fields where 2^k > p (e.g. P256), converting ROT choice bits
to a field element via `from_lsb0_iter` and then back via `iter_lsb0`
can produce different bits due to modular reduction. This caused the
OLE additive share computation to use bits inconsistent with the ROT
messages, breaking correctness (~2^{-32} probability per OLE for P256).
Additionally, ark-ff panics when `from_lsb0_iter` receives a value >= p,
making this a potential crash in production.
The fix computes both the additive and multiplicative shares directly
from the original choice bits using field arithmetic, which naturally
reduces without altering the bit representation.
Closes #343
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
2^k > p(e.g. P256), the OLE receiver converted ROT choice bits to a field element viafrom_lsb0_iterthen back viaiter_lsb0. This round-trip can alter bits due to modular reduction, causing the additive share computation to use bits inconsistent with the ROT messages.From<BigInt>panics for values >= p, making this a potential crash (~2^{-32} probability per OLE for P256).itybitydependency frommpz-ole-core.Closes #343
Test plan
test_ole_p256_choices_exceed_primewith all-ones bits (value >= p) — passes with fix, fails withoutmpz-ole-coretests pass (11/11)mpz-ole,mpz-share-conversion-core,mpz-share-conversiontlsntest suite passes with patched mpz (via[patch]in Cargo.toml)🤖 Generated with Claude Code