Skip to content

fix(ole-core): use original ROT choice bits in OLE receiver#377

Draft
heeckhau wants to merge 1 commit into
devfrom
fix/ole-prime-field-bits
Draft

fix(ole-core): use original ROT choice bits in OLE receiver#377
heeckhau wants to merge 1 commit into
devfrom
fix/ole-prime-field-bits

Conversation

@heeckhau
Copy link
Copy Markdown
Collaborator

@heeckhau heeckhau commented Mar 6, 2026

Summary

  • For prime fields where 2^k > p (e.g. P256), the OLE receiver converted ROT choice bits to a field element via from_lsb0_iter then back via iter_lsb0. This round-trip can alter bits due to modular reduction, causing the additive share computation to use bits inconsistent with the ROT messages.
  • Additionally, ark-ff's From<BigInt> panics for values >= p, making this a potential crash (~2^{-32} probability per OLE for P256).
  • 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.
  • Removes the now-unused itybity dependency from mpz-ole-core.

Closes #343

Test plan

  • New test test_ole_p256_choices_exceed_prime with all-ones bits (value >= p) — passes with fix, fails without
  • All existing mpz-ole-core tests pass (11/11)
  • Downstream crates pass: mpz-ole, mpz-share-conversion-core, mpz-share-conversion
  • Full tlsn test suite passes with patched mpz (via [patch] in Cargo.toml)

🤖 Generated with Claude Code

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
@heeckhau heeckhau marked this pull request as draft March 9, 2026 12:03
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.

Verify OLE over prime field implementation

1 participant