refactor(mpc-tls): unify client and mpc - #1169
Open
th4s wants to merge 5 commits into
Open
Conversation
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
Fuses the forked-rustls TLS client with the MPC protocol into one coherent
connection, removing the
Statetrait, theDerefhack, thebackendfacade,and the duplicated leader/follower setup. Behaviour and the leader↔follower wire
protocol are unchanged.
Motivation
The crate ran two overlapping state machines on the leader (a boxed
dyn Statehandshake SM and a separate
Init→…→Closedenum), reached the MPC through anopaque
backendfield onCommonState, leaned on aClientConnection: Deref<CommonState>hack, and kept shared setup as free functions in
utils.rs.Key changes
MpcSession(session.rs): shared MPC core (key exchange, PRF, recordlayer, VM, ctx) embedded by both leader and follower. Absorbs the
utils.rsfree functions and de-duplicates setup/key-derivation.
Conn/TlsIo(conn.rs): the live connection — TLS framing (TlsIo)plus the
MpcSession— owning the session directly. ReplacesCommonStateand the
backendfacade.MpcTlsLeader(leader.rs): the single public type. InternalSetup → Livelifecycle;
Livedrives aPhasethat isHandshaking(state machine + inputs)or
Online(traffic), flipping in place when the handshake completes.Derefhack removed.
handshakemodule (renamed fromclient): the handshake state machine(
hs/tls12/tls13), the online router (traffic), and TLS-client policy(config, cert verification, signing). The boxed
dyn Statetrait is replacedby a closed
Handshakeenum; public types are re-exported at the crate root(
mpc_tls::ClientConfig, …).