Documentation

CslibFrontier.Crypto.Protocols.UC.ObliviousTransfer

Ideal UC 1-out-of-2 Oblivious Transfer #

This module defines the two-party ideal 1-out-of-2 oblivious transfer functionality fot in this library's call-bounded, static-corruption, pull-only UC execution model (CslibFrontier/Crypto/Protocols/UC/Execution.lean, based on the UC execution and emulation framework of [Can20a], Section 4). The functionality adapts $\mathcal{F}_{\mathrm{ot}}$ of [BS23] (v0.6, §23.5.7, printed p. 1056, defined there as the two-party special case of $\mathcal{F}_{\mathrm{sfe}}$ in §23.5.3, printed pp. 1043–1044) to UC.IdealFunctionality.

Model and scope #

Main definitions #

Main results #

References #

Request, reply, status, backdoor, and state types #

The sender's pair of messages (m₀, m₁) submitted to 1-out-of-2 oblivious transfer.

  • m₀ : M

    Message delivered when receiver chooses false.

  • m₁ : M

    Message delivered when receiver chooses true.

Instances For
    @[instance_reducible]

    Select m₀ on false and m₁ on true.

    Party-port inputs for fot: sender 0 submits send msgs, while receiver 1 submits choose b and polls query.

    Instances For
      @[instance_reducible]
      @[instance_reducible]

      Party-port outputs for fot: receiver 1 receives either delivered msg or aborted.

      Instances For
        @[instance_reducible]

        Non-leaking status flags exposed on the backdoor of fot: readiness of each party, delivery status, and abort status, without revealing m₀, m₁, or b.

        • senderReady : Bool

          Whether sender 0 has submitted its message pair.

        • receiverReady : Bool

          Whether receiver 1 has submitted its choice bit.

        • delivered : Bool

          Whether output has been released to receiver 1.

        • aborted : Bool

          Whether the transfer has been aborted.

        Instances For

          Backdoor queries of fot: query reads OTStatus, deliver releases the selected message to receiver 1 once both inputs are present and no abort occurred, and abort aborts before delivery.

          Instances For

            Backdoor replies of fot: either status flags or an acknowledgement.

            Instances For

              Internal state of fot.

              • senderMsgs : Option (OTMessages M)

                Sender 0's submitted message pair, write-once.

              • receiverChoice : Option Bool

                Receiver 1's submitted choice bit, write-once.

              • delivered : Bool

                Whether the adversary has released the chosen message to receiver 1.

              • aborted : Bool

                Whether the adversary has aborted the transfer.

              Instances For
                @[instance_reducible]
                @[instance_reducible]

                Extract the public OTStatus flags from OTState.

                Receiver 1's observable output in state s on OTInput.query.

                Monotonicity relation between states s and s' across activations of fot: inputs are write-once immutable, and delivered and aborted are sticky.

                Ideal 1-out-of-2 oblivious transfer functionality fot #

                The ideal two-party 1-out-of-2 oblivious transfer functionality $\mathcal{F}_{\mathrm{OT}}$ adapting [BS23] (v0.6, §23.5.7, printed p. 1056, as the two-party special case of $\mathcal{F}_{\mathrm{sfe}}$ in §23.5.3, printed pp. 1043–1044) for sender 0 : Fin 2 and receiver 1 : Fin 2, generic over message type M:

                Unlike [BS23] (§23.5.3, §23.5.7), which models abort silently via withheld output delivery (none), fot provides an explicit OTBackdoor.abort command yielding some .aborted (following the synchronous SFE-with-abort convention needed for #1212).

                Call-budget bounds and multi-session compatibility #

                theorem Cslib.Crypto.Protocols.UC.fot_isBounded (M : Type) (κ : ℕ) (C : Finset (Fin 2)) :
                ((fot M).toProtocol κ C).IsBounded 0

                fot is deterministic and makes zero oracle calls per activation.

                fot has polynomial call budget 0.

                The lazy multi-session extension (fot M).multiSession SSID has polynomial call budget 0.

                State invariants and write-once immutability #

                theorem Cslib.Crypto.Protocols.UC.OTState.Monotone.trans {M : Type} {a b c : OTState M} (hab : a.Monotone b) (hbc : b.Monotone c) :

                Write-once input lock and delivery/abort monotonicity: across any program run against corruptRouter C ((fot M).toProtocol κ C), every reachable final state satisfies OTState.Monotone relative to the starting state s.

                Honest delivery and abort correctness #

                Honest-execution environment (C = ∅) for fot M: sender 0 submits msgs, receiver 1 submits b, the backdoor delivers, and receiver 1 polls for some (.delivered (msgs.select b)).

                Abort-test environment (C = ∅) for fot M: sender 0 submits msgs, receiver 1 submits b, the backdoor aborts, and receiver 1 polls for some .aborted.

                Correctness / honest delivery of fot: with no corruptions and the dummy adversary, honestOTEnv msgs b observes some (.delivered (msgs.select b)) with probability 1.

                Abort correctness of fot: when the backdoor issues .abort before delivery, receiver 1 observes some .aborted with probability 1.

                Sender privacy (C = {1}, unselected-message independence) #

                State of the unselected-message-independent machine fotSelectedView.

                • delivered : Bool

                  Whether output has been delivered to receiver 1.

                • aborted : Bool

                  Whether the transfer has been aborted.

                Instances For

                  Machine capturing the entire port and backdoor behavior of corruptRouter {1} ((fot M).toProtocol κ {1}) once both senderMsgs and receiverChoice = some b are fixed, depending only on the selected message mSelected.

                  theorem Cslib.Crypto.Protocols.UC.runFrom_fot_corruptReceiver {M α : Type} (κ : ℕ) (msgs : OTMessages M) (b : Bool) (program : ProbOracleComp (protocolSpec 2 (OTInput M) (OTOutput M) (RoutedNetQ 2 (OTInput M) OTBackdoor) (RoutedNetR (OTOutput M) OTBackdoorReply)) α) (st : OTSelectedViewState) :
                  (corruptRouter {1} ((fot M).toProtocol κ {1})).runFrom program { senderMsgs := some msgs, receiverChoice := some b, delivered := st.delivered, aborted := st.aborted } = (Prod.map id fun (st' : OTSelectedViewState) => { senderMsgs := some msgs, receiverChoice := some b, delivered := st'.delivered, aborted := st'.aborted }) <$> (fotSelectedView (msgs.select b)).runFrom program st

                  Sender privacy (factoring through fotSelectedView): when receiver 1 is corrupted (C = {1}) and choice bit b is fixed (receiverChoice = some b), running any program over ALL party and backdoor ports against corruptRouter {1} ((fot M).toProtocol κ {1}) from senderMsgs = some msgs factors through fotSelectedView (msgs.select b), which has no access to msgs.select (!b).

                  theorem Cslib.Crypto.Protocols.UC.eval_runFrom_fot_corruptReceiver_eq_of_select_eq {M α : Type} (κ : ℕ) {msgs msgs' : OTMessages M} {b : Bool} (hsel : msgs.select b = msgs'.select b) (program : ProbOracleComp (protocolSpec 2 (OTInput M) (OTOutput M) (RoutedNetQ 2 (OTInput M) OTBackdoor) (RoutedNetR (OTOutput M) OTBackdoorReply)) α) (delivered aborted : Bool) :
                  (Prod.fst <$> Machine.closeProgram ((corruptRouter {1} ((fot M).toProtocol κ {1})).runFrom program { senderMsgs := some msgs, receiverChoice := some b, delivered := delivered, aborted := aborted })).eval = (Prod.fst <$> Machine.closeProgram ((corruptRouter {1} ((fot M).toProtocol κ {1})).runFrom program { senderMsgs := some msgs', receiverChoice := some b, delivered := delivered, aborted := aborted })).eval

                  Sender privacy (unselected-message independence): for C = {1} and fixed b, any two sender message pairs msgs, msgs' agreeing on the selected branch (msgs.select b = msgs'.select b) produce identical output distributions across every port/backdoor program program.

                  Receiver privacy (C = {0}, choice-bit hiding) #

                  State of the choice-bit-independent machine fotSenderView seen on the network port when sender 0 is corrupted (C = {0}) and receiver 1 has submitted its choice bit.

                  • senderMsgs : Option (OTMessages M)

                    Sender 0's submitted message pair, if any.

                  • delivered : Bool

                    Whether output has been delivered to receiver 1.

                  • aborted : Bool

                    Whether the transfer has been aborted.

                  Instances For
                    @[instance_reducible]

                    Choice-bit-independent machine capturing the party-0 and backdoor behavior of corruptRouter {0} ((fot M).toProtocol κ {0}) once receiverChoice = some b is set.

                    theorem Cslib.Crypto.Protocols.UC.runFrom_fot_corruptSender {M α : Type} (κ : ℕ) (b : Bool) (program : ProbOracleComp (netSpec (RoutedNetQ 2 (OTInput M) OTBackdoor) (RoutedNetR (OTOutput M) OTBackdoorReply)) α) (st : OTSenderViewState M) :
                    (corruptRouter {0} ((fot M).toProtocol κ {0})).runFrom (liftNet program) { senderMsgs := st.senderMsgs, receiverChoice := some b, delivered := st.delivered, aborted := st.aborted } = (Prod.map id fun (st' : OTSenderViewState M) => { senderMsgs := st'.senderMsgs, receiverChoice := some b, delivered := st'.delivered, aborted := st'.aborted }) <$> (fotSenderView M).runFrom program st

                    Receiver privacy (factoring through fotSenderView): when sender 0 is corrupted (C = {0}) and receiver 1 has submitted b, every network-port program liftNet program (covering party-0 queries and backdoor queries) factors through fotSenderView M, which is independent of b.

                    theorem Cslib.Crypto.Protocols.UC.eval_runFrom_fot_corruptSender_flip {M α : Type} (κ : ℕ) (b : Bool) (program : ProbOracleComp (netSpec (RoutedNetQ 2 (OTInput M) OTBackdoor) (RoutedNetR (OTOutput M) OTBackdoorReply)) α) (st : OTSenderViewState M) :
                    (Prod.fst <$> Machine.closeProgram ((corruptRouter {0} ((fot M).toProtocol κ {0})).runFrom (liftNet program) { senderMsgs := st.senderMsgs, receiverChoice := some b, delivered := st.delivered, aborted := st.aborted })).eval = (Prod.fst <$> Machine.closeProgram ((corruptRouter {0} ((fot M).toProtocol κ {0})).runFrom (liftNet program) { senderMsgs := st.senderMsgs, receiverChoice := some !b, delivered := st.delivered, aborted := st.aborted })).eval

                    Receiver privacy (choice-bit hiding): for C = {0}, flipping receiver 1's choice bit b to !b leaves the entire party-0 and backdoor behavior (liftNet program) identically distributed.

                    Impossibility of one-message sender-to-receiver plain-model OT #

                    Network queries for a one-message (sender-to-receiver) plain-model OT protocol: the adversary can read the sender's message (readMsg) and deliver a message to the receiver (deliverMsg).

                    Instances For
                      @[instance_reducible]
                      def Cslib.Crypto.Protocols.UC.instDecidableEqPlainOTNetQ.decEq {Msg✝ : Type} [DecidableEq Msg✝] (x✝ x✝¹ : PlainOTNetQ Msg✝) :
                      Decidable (x✝ = x✝¹)
                      @[instance_reducible]

                      Network replies for a one-message plain-model OT protocol.

                      Instances For
                        def Cslib.Crypto.Protocols.UC.instDecidableEqPlainOTNetR.decEq {Msg✝ : Type} [DecidableEq Msg✝] (x✝ x✝¹ : PlainOTNetR Msg✝) :
                        Decidable (x✝ = x✝¹)
                        @[instance_reducible]
                        @[instance_reducible]

                        A one-message (sender-to-receiver) plain-model 1-out-of-2 OT scheme over Bool: sender 0 runs send κ m₀ m₁ to produce a single message c : Msg, and receiver 1 runs recv κ c b locally to recover m_b.

                        • send : ℕ → Bool → Bool → ProbComp Msg

                          Sender algorithm producing a single message from (m₀, m₁).

                        • recv : ℕ → Msg → Bool → ProbComp Bool

                          Receiver recovery algorithm computing m_b from the sender's message and choice bit b.

                        State of a compiled PlainSenderOT protocol.

                        • senderMsg : Option Msg

                          Message posted by sender 0, if any.

                        • receiverChoice : Option Bool

                          Choice bit submitted by receiver 1, if any.

                        • receiverOut : Option Bool

                          Output recovered by receiver 1, if delivered.

                        Instances For
                          @[instance_reducible]
                          noncomputable def Cslib.Crypto.Protocols.UC.PlainSenderOT.acceptGame {Msg : Type} (scheme : PlainSenderOT Msg) (κ : ℕ) (b : Bool) :

                          Honest completeness probability of scheme for choice bit b over uniform (m₀, m₁) at security parameter κ.

                          noncomputable def Cslib.Crypto.Protocols.UC.PlainSenderOT.acceptProb {Msg : Type} (scheme : PlainSenderOT Msg) (κ : ℕ) (b : Bool) :

                          Probability that an honest receiver recovers m_b on uniform (m₀, m₁).

                          Polynomial call budgets pS and pR for scheme.send and scheme.recv.

                          Compile a PlainSenderOT scheme into a two-party UC Protocol in the plain model (matching OTInput Bool / OTOutput Bool): sender 0 computes c ← scheme.send κ m₀ m₁ once; receiver 1 records b once; deliverMsg c forwards c to receiver 1 (matching senderMsg when 0 ∉ C, or any c when 0 ∈ C) and runs scheme.recv κ c b.

                          If scheme has polynomial call budgets pS and pR, then scheme.toProtocol has polynomial call budget pS + pR.

                          Corrupted-receiver extraction environment (C = {1}) for a one-message plain-model OT scheme: samples uniform (m₀, m₁), sends ⟨m₀, m₁⟩ to honest sender 0, reads the network message c, runs scheme.recv locally on both false and true, and checks whether both bits were recovered.

                          theorem Cslib.Crypto.Protocols.UC.corruptOTReceiverEnv_polyBounded {Msg : Type} {scheme : PlainSenderOT Msg} {pR : Polynomial ℕ} (hR : ∀ (κ : ℕ) (c : Msg) (b : Bool), OracleComp.IsQueryBounded (scheme.recv κ c b) (Polynomial.eval κ pR)) :

                          If scheme.recv has polynomial call budget pR, then corruptOTReceiverEnv scheme has polynomial call budget 2 * pR + 4.

                          In the real execution with C = {1} and dummyAdversary, corruptOTReceiverEnv scheme recovers both m₀ and m₁ with probability at least acceptProb false + acceptProb true - 1.

                          Ideal-world corrupted-receiver extraction bound: against fot Bool, every simulator S₁ for C = {1} succeeds on corruptOTReceiverEnv scheme with probability at most 1 / 2.

                          theorem Cslib.Crypto.Protocols.UC.not_realizesWithin_fot_of_plainSenderOT {Msg : Type} [DecidableEq Msg] {scheme : PlainSenderOT Msg} {pR : Polynomial ℕ} (hR : ∀ (κ : ℕ) (c : Msg) (b : Bool), OracleComp.IsQueryBounded (scheme.recv κ c b) (Polynomial.eval κ pR)) (g : Polynomial ℕ) (ε : Polynomial ℕ → Polynomial ℕ → ℕ → NNReal) (κ : ℕ) (hgap : ↑(ε 1 (2 * pR + 4) κ) + 3 / 2 < ↑(scheme.acceptProb κ false) + ↑(scheme.acceptProb κ true)) :

                          Concrete Impossibility of One-Message Plain-Model OT: if scheme.recv has polynomial call budget pR and at security parameter κ the error bound ε satisfies ε 1 (2 * pR + 4) κ + 3 / 2 < scheme.acceptProb κ false + scheme.acceptProb κ true, then scheme.toProtocol does not UC-realize fot Bool within (g, ε).

                          theorem Cslib.Crypto.Protocols.UC.not_realizes_fot_of_plainSenderOT {Msg : Type} [DecidableEq Msg] {scheme : PlainSenderOT Msg} {pR : Polynomial ℕ} (hR : ∀ (κ : ℕ) (c : Msg) (b : Bool), OracleComp.IsQueryBounded (scheme.recv κ c b) (Polynomial.eval κ pR)) {c : NNReal} (hc : 0 < c) (hcomplete : ∀ᶠ (κ : ℕ) in Filter.atTop, 3 / 2 + ↑c ≤ ↑(scheme.acceptProb κ false) + ↑(scheme.acceptProb κ true)) :

                          Impossibility of One-Message Plain-Model OT (UC.Realizes): no one-message sender-to-receiver plain-model OT scheme with polynomial-call-bounded recovery whose honest acceptance probabilities eventually sum to at least 3 / 2 + c (for c > 0) UC-realizes fot Bool.