Documentation

CslibFrontier.Crypto.Protocols.MPC.DDHOT.Family

Fair-coin DDH oblivious transfer as a protocol family, and its reduction to DDH #

Cslib.Crypto.Protocols.MPC.ddhOTProtocolWith in CslibFrontier/Crypto/Protocols/MPC/DDHOT.lean is a three-message 1-out-of-2 oblivious transfer over a group of prime order, a checked per-branch-coin variant of the protocol of [BS23], Section 23.5.7, Figure 23.17 (p. 1057), parameterized by party coin types, samplers, and exponent projections. Following Section 23.5.7.2 ("Further assumptions about randomness", Remark 23.5, p. 1059) and [Lin17], Section 4.2, Definition 4.1 (p. 7), this module instantiates the parties' coins as the raw fair-coin bit strings they actually draw (sampleExpBits, width n + |encNat (F.order d)|) so that each party's PartyView.coins retains its unreduced bit strings (DDHOTSenderBitCoins for the sender, List Bool for the receiver), runs the protocol over a PrimeOrderGroupFamily F as ddhOTProbFamily, gives the machine encoding ddhOTEncoding, and reduces a corrupted receiver to DDH. CslibFrontier/Crypto/Protocols/MPC/DDHOT/Simulators.lean gives PPT simulators across all static coalitions and proves stand-alone semi-honest security as a step toward Theorem 23.7 (Cslib.Crypto.PrimeOrderGroupFamily.DDH.ddhOTProbFamily_semiHonestSecure, #5829, #5293).

ddhOTEncoding writes group parameters with F.encDesc and group elements as F.encode d words. The sender's input is the pair of words of its two messages and the receiver's input is its choice bit; the sender's output () is the empty word and the receiver's output is the word of its message. A corrupted party's view is written as its view words (ddhOTSenderViewWords, ddhOTReceiverViewWords): the group elements as F.encode d words and the party's raw coin bit strings verbatim (encBits). The words determine the view (ddhOTSenderViewWords_injective, ddhOTReceiverViewWords_injective).

Proof of the reduction. Against a corrupted receiver ({1}), ddhOTReceiverToDDHDistinguisher turns an environment Z into a DDH distinguisher: it runs Z's input choice, draws the receiver's raw coin bit string bBits from sampleExpBits (identical to the real receiver's coin draw, with zero statistical loss on PartyView.coins) together with two chosen-branch bit strings rBits, sBits, and embeds the DDH triple into the unchosen branch via ddhOTReductionWithCoinsOf. In the real game, the honest sender's five bit strings enter the receiver's view only through their ZMod (F.order d) residues, so replacing them with exact uniform exponents costs at most 5 / 2 ^ n (advantage_bind_sampleDDHOTSenderBitCoins_le), after which the hybrid real and ideal games equal the real and random DDH experiments of the exact-branch reduction (real_receiver_eq_ddhRealExperiment_of, ideal_receiver_eq_ddhRandomExperiment_of). The two chosen-branch draws in ddhOTReceiverToDDHDistinguisher cost at most 2 / 2 ^ n in each DDH world, giving advantage_ddhOTReceiverGame_le (≤ ddhAdv + 9 / 2 ^ n). isPPT_ddhOTReceiverToDDHDistinguisher proves that the reduction is uniform strict PPT whenever Z is.

Main definitions #

Main results #

References #

Raw fair-coin bit strings and views as words #

Raw fair-coin bit strings drawn by the sender in ddhOTProbProtocol: one bit string for the Round 1 exponent a and two per branch for Round 3 encryption ([BS23], Section 23.5.7.2, "Further assumptions about randomness", p. 1059).

  • exponentBits : List Bool

    Raw bit string from which the Round 1 exponent a is derived.

  • coinR₀Bits : List Bool

    Raw bit string from which branch 0 coin r₀ is derived.

  • coinS₀Bits : List Bool

    Raw bit string from which branch 0 coin s₀ is derived.

  • coinR₁Bits : List Bool

    Raw bit string from which branch 1 coin r₁ is derived.

  • coinS₁Bits : List Bool

    Raw bit string from which branch 1 coin s₁ is derived.

theorem Cslib.Crypto.Protocols.MPC.encDDHOTSenderBitCoins_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 x1 x2 x3 x4 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBits budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn Turing.MultiTapeTM.encBits budget) (h4 : Turing.MultiTapeTM.ComputableInSpace x4 encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { exponentBits := x0 x, coinR₀Bits := x1 x, coinS₀Bits := x2 x, coinR₁Bits := x3 x, coinS₁Bits := x4 x }) encIn encDDHOTSenderBitCoins budget

The encoding of the sender's raw coins in the fair-coin DDH transfer: its five bit strings in turn, all but the last framed.

theorem Cslib.Crypto.Protocols.MPC.encDDHOTSenderBitCoins_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 : γ → ℕ} {x3 : γ → List Bool} {T3 S3 : γ → ℕ} {x4 : γ → List Bool} {T4 S4 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBits T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn Turing.MultiTapeTM.encBits T3 S3) (h4 : Turing.MultiTapeTM.ComputableInO x4 encIn Turing.MultiTapeTM.encBits T4 S4) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { exponentBits := x0 x, coinR₀Bits := x1 x, coinS₀Bits := x2 x, coinR₁Bits := x3 x, coinS₁Bits := x4 x }) encIn encDDHOTSenderBitCoins (fun (x : γ) => T0 x + (T1 x + (T2 x + (T3 x + T4 x)))) fun (x : γ) => S0 x + (S1 x + (S2 x + (S3 x + S4 x)))
theorem Cslib.Crypto.Protocols.MPC.encDDHOTSenderBitCoins_mk_deg :
Turing.MultiTapeTM.ComputableInDegree (fun (p : List Bool × List Bool × List Bool × List Bool × List Bool) => { exponentBits := p.1, coinR₀Bits := p.2.1, coinS₀Bits := p.2.2.1, coinR₁Bits := p.2.2.2.1, coinS₁Bits := p.2.2.2.2 }) encDDHOTSenderBitCoinsFields encDDHOTSenderBitCoins 1 1

Project the sender's five raw bit strings into DDHOTSenderCoins q by interpreting each bit string as a binary natural number modulo q.

The words of a corrupted sender's view in ddhOTProbProtocol: its two messages, its five raw fair-coin bit strings, and the two branch keys of the receiver's Round 2 message.

  • message₀ : List Bool

    The word of the message m₀.

  • message₁ : List Bool

    The word of the message m₁.

  • exponentBits : List Bool

    The raw bit string from which the Round 1 exponent a is derived.

  • coinR₀Bits : List Bool

    The raw bit string from which branch 0 coin r₀ is derived.

  • coinS₀Bits : List Bool

    The raw bit string from which branch 0 coin s₀ is derived.

  • coinR₁Bits : List Bool

    The raw bit string from which branch 1 coin r₁ is derived.

  • coinS₁Bits : List Bool

    The raw bit string from which branch 1 coin s₁ is derived.

  • branchKey₀ : List Bool

    The word of the branch key w₀.

  • branchKey₁ : List Bool

    The word of the branch key w₁.

theorem Cslib.Crypto.Protocols.MPC.encDDHOTSenderViewWords_mk_deg :
Turing.MultiTapeTM.ComputableInDegree (fun (p : List Bool × List Bool × List Bool × List Bool × List Bool × List Bool × List Bool × List Bool × List Bool) => { message₀ := p.1, message₁ := p.2.1, exponentBits := p.2.2.1, coinR₀Bits := p.2.2.2.1, coinS₀Bits := p.2.2.2.2.1, coinR₁Bits := p.2.2.2.2.2.1, coinS₁Bits := p.2.2.2.2.2.2.1, branchKey₀ := p.2.2.2.2.2.2.2.1, branchKey₁ := p.2.2.2.2.2.2.2.2 }) encDDHOTSenderViewWordsFields encDDHOTSenderViewWords 1 1

The encoding of a sender's view words: each field in turn, all but the last framed.

theorem Cslib.Crypto.Protocols.MPC.encDDHOTSenderViewWords_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 x1 x2 x3 x4 x5 x6 x7 x8 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBits budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn Turing.MultiTapeTM.encBits budget) (h4 : Turing.MultiTapeTM.ComputableInSpace x4 encIn Turing.MultiTapeTM.encBits budget) (h5 : Turing.MultiTapeTM.ComputableInSpace x5 encIn Turing.MultiTapeTM.encBits budget) (h6 : Turing.MultiTapeTM.ComputableInSpace x6 encIn Turing.MultiTapeTM.encBits budget) (h7 : Turing.MultiTapeTM.ComputableInSpace x7 encIn Turing.MultiTapeTM.encBits budget) (h8 : Turing.MultiTapeTM.ComputableInSpace x8 encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { message₀ := x0 x, message₁ := x1 x, exponentBits := x2 x, coinR₀Bits := x3 x, coinS₀Bits := x4 x, coinR₁Bits := x5 x, coinS₁Bits := x6 x, branchKey₀ := x7 x, branchKey₁ := x8 x }) encIn encDDHOTSenderViewWords budget
theorem Cslib.Crypto.Protocols.MPC.encDDHOTSenderViewWords_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 : γ → ℕ} {x3 : γ → List Bool} {T3 S3 : γ → ℕ} {x4 : γ → List Bool} {T4 S4 : γ → ℕ} {x5 : γ → List Bool} {T5 S5 : γ → ℕ} {x6 : γ → List Bool} {T6 S6 : γ → ℕ} {x7 : γ → List Bool} {T7 S7 : γ → ℕ} {x8 : γ → List Bool} {T8 S8 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBits T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn Turing.MultiTapeTM.encBits T3 S3) (h4 : Turing.MultiTapeTM.ComputableInO x4 encIn Turing.MultiTapeTM.encBits T4 S4) (h5 : Turing.MultiTapeTM.ComputableInO x5 encIn Turing.MultiTapeTM.encBits T5 S5) (h6 : Turing.MultiTapeTM.ComputableInO x6 encIn Turing.MultiTapeTM.encBits T6 S6) (h7 : Turing.MultiTapeTM.ComputableInO x7 encIn Turing.MultiTapeTM.encBits T7 S7) (h8 : Turing.MultiTapeTM.ComputableInO x8 encIn Turing.MultiTapeTM.encBits T8 S8) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { message₀ := x0 x, message₁ := x1 x, exponentBits := x2 x, coinR₀Bits := x3 x, coinS₀Bits := x4 x, coinR₁Bits := x5 x, coinS₁Bits := x6 x, branchKey₀ := x7 x, branchKey₁ := x8 x }) encIn encDDHOTSenderViewWords (fun (x : γ) => T0 x + (T1 x + (T2 x + (T3 x + (T4 x + (T5 x + (T6 x + (T7 x + T8 x)))))))) fun (x : γ) => S0 x + (S1 x + (S2 x + (S3 x + (S4 x + (S5 x + (S6 x + (S7 x + S8 x)))))))

The words of a corrupted receiver's view in ddhOTProbProtocol: its choice bit, its raw fair-coin bit string, the sender's first message, and the two components of each branch ciphertext of the sender's reply.

  • choiceBit : Bool

    The receiver's choice bit σ.

  • coinBits : List Bool

    The receiver's raw fair-coin bit string.

  • firstMessage : List Bool

    The word of the sender's first message u.

  • ephemeral₀ : List Bool

    The word of the first component of the ciphertext of branch 0.

  • body₀ : List Bool

    The word of the second component of the ciphertext of branch 0.

  • ephemeral₁ : List Bool

    The word of the first component of the ciphertext of branch 1.

  • body₁ : List Bool

    The word of the second component of the ciphertext of branch 1.

The encoding of a receiver's view words: each field in turn, all but the last framed.

theorem Cslib.Crypto.Protocols.MPC.encDDHOTReceiverViewWords_mk_deg :
Turing.MultiTapeTM.ComputableInDegree (fun (p : Bool × List Bool × List Bool × List Bool × List Bool × List Bool × List Bool) => { choiceBit := p.1, coinBits := p.2.1, firstMessage := p.2.2.1, ephemeral₀ := p.2.2.2.1, body₀ := p.2.2.2.2.1, ephemeral₁ := p.2.2.2.2.2.1, body₁ := p.2.2.2.2.2.2 }) encDDHOTReceiverViewWordsFields encDDHOTReceiverViewWords 1 1
theorem Cslib.Crypto.Protocols.MPC.encDDHOTReceiverViewWords_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Bool} {T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 : γ → ℕ} {x3 : γ → List Bool} {T3 S3 : γ → ℕ} {x4 : γ → List Bool} {T4 S4 : γ → ℕ} {x5 : γ → List Bool} {T5 S5 : γ → ℕ} {x6 : γ → List Bool} {T6 S6 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBool T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn Turing.MultiTapeTM.encBits T3 S3) (h4 : Turing.MultiTapeTM.ComputableInO x4 encIn Turing.MultiTapeTM.encBits T4 S4) (h5 : Turing.MultiTapeTM.ComputableInO x5 encIn Turing.MultiTapeTM.encBits T5 S5) (h6 : Turing.MultiTapeTM.ComputableInO x6 encIn Turing.MultiTapeTM.encBits T6 S6) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { choiceBit := x0 x, coinBits := x1 x, firstMessage := x2 x, ephemeral₀ := x3 x, body₀ := x4 x, ephemeral₁ := x5 x, body₁ := x6 x }) encIn encDDHOTReceiverViewWords (fun (x : γ) => T0 x + (T1 x + (T2 x + (T3 x + (T4 x + (T5 x + T6 x)))))) fun (x : γ) => S0 x + (S1 x + (S2 x + (S3 x + (S4 x + (S5 x + S6 x)))))
theorem Cslib.Crypto.Protocols.MPC.encDDHOTReceiverViewWords_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → Bool} {x1 x2 x3 x4 x5 x6 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBool budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn Turing.MultiTapeTM.encBits budget) (h4 : Turing.MultiTapeTM.ComputableInSpace x4 encIn Turing.MultiTapeTM.encBits budget) (h5 : Turing.MultiTapeTM.ComputableInSpace x5 encIn Turing.MultiTapeTM.encBits budget) (h6 : Turing.MultiTapeTM.ComputableInSpace x6 encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { choiceBit := x0 x, coinBits := x1 x, firstMessage := x2 x, ephemeral₀ := x3 x, body₀ := x4 x, ephemeral₁ := x5 x, body₁ := x6 x }) encIn encDDHOTReceiverViewWords budget
@[reducible, inline]

The view words of the two parties of ddhOTProbProtocol: DDHOTSenderViewWords for the sender (party 0) and DDHOTReceiverViewWords for the receiver (party 1).

Raw fair-coin bit-string sampling #

Sample a raw fair-coin bit string of width n + |encNat (F.order d)|, the underlying random bit string from which sampleExp n d derives an approximately uniform residue modulo F.order d ([BS23], Section 23.5.7.2, Remark 23.5, p. 1059).

sampleExpBits is uniform strict PPT whenever n and d are computable in polynomial time.

Interpreting a sampleExpBits n d bit string via BitString.binaryValue in ZMod (F.order d) has the exact same residue law as sampleExp n d.

Replacing the ZMod (F.order d) residue of one sampleExpBits n d draw by an exact uniform draw changes Game.advantage by at most 1 / 2 ^ n.

Sample the sender's five raw fair-coin bit strings in ddhOTProbProtocol via five independent sampleExpBits n d draws.

Replacing the five projected ZMod (F.order d) residues of sampleDDHOTSenderBitCoins n d with five exact uniform draws (sampleDDHOTSenderCoins) changes Game.advantage by at most 5 / 2 ^ n.

The fair-coin protocol family and its encoding #

Fair-coin three-message DDH 1-out-of-2 Oblivious Transfer protocol over F.Carrier d at security parameter n, with raw fair-coin bit strings (DDHOTSenderBitCoins and List Bool) stored unreduced in PartyView.coins ([BS23], Section 23.5.7.2, Remark 23.5, p. 1059).

@[reducible, inline]

ddhOTProbProtocol over the groups of F as a ProtocolFamily: at security parameter n and public parameters d, both parties draw raw fair-coin bit strings via sampleExpBits n d, retain those bit strings in PartyView.coins, and compute otFunctionality (F.Carrier d).

The words of a sender's view in ddhOTProbProtocol over F.Carrier d: the messages and branch keys as F.encode d words, and the five raw coin bit strings verbatim.

The words of a receiver's view in ddhOTProbProtocol over F.Carrier d: the choice bit, the raw coin bit string verbatim, and the received group elements as F.encode d words.

The words determine a sender's view, including its five unreduced coin bit strings.

The words determine a receiver's view, including its unreduced coin bit string.

The encoding of ddhOTProbFamily for machines. Group parameters are written with F.encDesc. The sender's input (m₀, m₁) is the pair of words (F.encode d m₀, F.encode d m₁) (encPair encBits encBits) and the receiver's input is its choice bit (encBool). The sender's output () is the empty word (encUnit) and the receiver's output m_σ is the word F.encode d m_σ. Each party's view is its view words (ddhOTSenderViewWords, ddhOTReceiverViewWords, preserving the raw coin bit strings), encoded by encDDHOTSenderViewWords and encDDHOTReceiverViewWords.

Corrupted receiver: the reduction to DDH #

The DDH distinguisher built from an environment Z that corrupts the receiver: given the security parameter n, group parameters d and a DDH triple (u, v, w), run Z.choose, draw the receiver's raw coin bit string bBits and two chosen-branch bit strings rBits, sBits with sampleExpBits n d, and run ddhOTReductionWithCoinsOf with Z.guess, recording bBits unreduced in the receiver's PartyView.coins and embedding (u, v, w) into the unchosen branch.

Concrete reduction step for a corrupted receiver in ddhOTProbFamily against the exact-sender-mask simulator ddhOTReceiverSimOf (which draws the receiver's raw bit string via sampleExpBits n d and the five sender/mask exponents uniformly): every environment's advantage is at most the DDH advantage of ddhOTReceiverToDDHDistinguisher Z plus 9 / 2 ^ n. For the certified PPT simulator ddhOTReceiverSimProb, see advantage_ddhOTProbReceiverGame_le in CslibFrontier/Crypto/Protocols/MPC/DDHOT/Simulators.lean.

Corrupted receiver: efficiency of the reduction #