Skip to content

MSB 5PC Adder: 5-of-5 to 3-of-3 additive re-sharing of Vec<Shares> - #149

Open
gayathrigarimella wants to merge 8 commits into
tfhard-5pcfrom
tfhard/5pc/feature/5to3additiveshares
Open

MSB 5PC Adder: 5-of-5 to 3-of-3 additive re-sharing of Vec<Shares>#149
gayathrigarimella wants to merge 8 commits into
tfhard-5pcfrom
tfhard/5pc/feature/5to3additiveshares

Conversation

@gayathrigarimella

Copy link
Copy Markdown

inputs -> given 5 parties with a Vec
outputs -> 3 parties with Vec of same underlying value; support default configuration of parties that learn the output P_0, P_1, P_2 and flexible configuration to modify the three parties that learn the output.

main changes are in new file rss5_ops.rs with some testing support in test_utils.rs (create 5 party additive shares and reconstruct additive shares). the changes include

  • function reshare_five_to_three_party_additive(...) - uses a. pairwise PRF keys setup and b. specification of 3 parties that must receive output and re-shares Vec from 5 parties to 3 parties such that they encode the same consistent inputs shares.
  • struct FiveToThreeRoles - specifies the 3 receivers of output for the function above.
  • unit tests for default roles and rotated roles for batch re-sharing of inputs.

marsenis and others added 6 commits August 25, 2026 21:39
Generalizes the node-setup layer beyond the 3-party ring: NetworkSession
gains Role-addressed send_to/receive_from, MpcNetworkHandle/PeerConnections
now establish connections to any number of peers instead of exactly 2, and
a new MeshControlChannel provides a Role-addressed control-plane channel
(with an all-to-all sync barrier) alongside the untouched 3-party
ControlChannel. Also fixes build_network_handle deriving only 3 local
identities regardless of party count.

Adds two new shared-PRF key configurations for a 5-party protocol:
ThresholdPrfKeys (a (3,5) config where k_{i,j} is known only to the 3
parties outside {i,j}) and PairwisePrfKeys (lambda_{i,j} known only to i
and j), each with a symmetric XOR-combine network handshake in
protocol::ops. All existing 3PC structs, signatures, and behavior are
unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@gayathrigarimella

Copy link
Copy Markdown
Author

The struct defines 2 senders s0, s1 and 3 receivers r0, r1 and r2.
In this PRF-based implementation, the senders s0 and s1, send their correction shares to a fixed receiver r2. If required, this can be modified such that say r1 and r2 receive one correction share each

Base automatically changed from tfhard/claude/networking-prf to tfhard-5pc September 2, 2026 18:50

@marsenis marsenis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Only minor comments.Thanks, Gayathri!
Let me first merge Evangelia's PR into tfhard-5pc, resolve conflicts with the base branch and run linter, and then I'll approve for merging.

T: NetworkInt,
Standard: Distribution<T>,
{
roles.validate()?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this a debug_assert!(roles.validate().is_ok());. It might slow down production code if it runs every time this function is called.

}
}

/// Convenience wrapper over [`reshare_five_to_three_additive`] hardcoding the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typo/unresolved link


/// Reconstructs the plaintext values from the 3 recipients' 3-of-3
/// additive shares
fn reconstruct_additive_shares_5of3(recipient_shares: &[(Role, Vec<RingElement<u16>>)]) -> Vec<u16> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename perhaps? The 5 in the function name is confusing since we're reconstructing a 3-of-3 sharing.

}
}

let reconstructed = reconstruct_additive_shares_5of3(&results);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the more general function reconstruct_additive_shares() defined in test_utils.rs?

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.

3 participants