Skip to content

Conversation

@themighty1
Copy link
Collaborator

This PR adds randomization to garbler's initial gate id and key.

The rationale for it was discussed in:
#341
#7

@themighty1 themighty1 requested a review from sinui0 November 3, 2025 14:26
@themighty1 themighty1 changed the title feat(garble-core): randomize gate is and cipher key feat(garble-core): randomize gate id and cipher key Dec 29, 2025
@themighty1
Copy link
Collaborator Author

@sinui0 , could you ack the conceptual approach of this PR? Then I can resolve the conflicts.

[dev-dependencies]
mpz-ot-core = { workspace = true, features = ["test-utils"] }

bincode = { workspace = true }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
bincode = { workspace = true }

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we use bincode in a test which serializes and deserializes the SetupMsg to simulate a realistic scenario where the setup message is transmitted

Copy link
Collaborator

Choose a reason for hiding this comment

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

That is essentially just testing serde, I would omit that in unit tests unless you're specifically testing a custom serialization impl

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I misspoke, it is actually used in crates/garble-core/benches/garble.rs

b.iter(|| {
            let setup: SetupMsg = bincode::deserialize(&msg).unwrap();
            let mut ev = Evaluator::default();
            ev.setup(setup).unwrap();

I used it to avoid making SetupMsg Clone/Copy.

(oops, I noticed that I made SetupMsg Clone and Copy already which I shouldn't have)

do you agree with keeping bincode and removing Clone/Copy ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@sinui0 , i think you may have missed my last question here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would just keep it Clone. Nothing wrong with that. Copy is too presumptuous. The serialization is unnecessary, IMO, but its just a nit

@themighty1
Copy link
Collaborator Author

Addressed feedback, merged dev.
I realized that key/gid must be derived from a seed, so that required API change (one of the last commits)
ready for review @sinui0

@themighty1 themighty1 requested a review from sinui0 January 2, 2026 13:11
@themighty1 themighty1 merged commit b8b8884 into dev Jan 2, 2026
3 checks passed
@themighty1 themighty1 deleted the feat/random_gid_and_key branch January 2, 2026 14:38
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