Documentation

CslibFrontier.Crypto.Protocols.UC.SFE

Ideal UC Secure Function Evaluation with Abort #

This module defines the n-party ideal functionality fsfe for secure function evaluation (SFE) with abort of a deterministic function f : (Fin n → In) → (Fin n → Out) 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{sfe}}$ of [BS23] (v0.6, §23.5.3, printed pp. 1043–1044; with $\mathcal{F}_{\mathrm{ot}}$ in §23.5.7, printed p. 1056, as its two-party special case) to UC.IdealFunctionality.

Model and scope #

Main definitions #

Main results #

References #

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

Party-port inputs for fsfe: each party i submits its input once via input val and polls for its output via query.

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

    Party-port outputs for fsfe: either the party's computed output output val or aborted.

    Instances For
      @[instance_reducible]
      def Cslib.Crypto.Protocols.UC.instDecidableEqSFEOutput.decEq {Out✝ : Type} [DecidableEq Out✝] (x✝ x✝¹ : SFEOutput Out✝) :
      Decidable (x✝ = x✝¹)
      @[instance_reducible]
      instance Cslib.Crypto.Protocols.UC.instReprSFEOutput {Out✝ : Type} [Repr Out✝] :
      Repr (SFEOutput Out✝)

      Non-leaking status flags exposed on the backdoor of fsfe: per-party input arrival flags, per-party output delivery flags, and the global abort flag.

      • submitted : Fin n → Bool

        Whether party i has submitted its input.

      • delivered : Fin n → Bool

        Whether party i's output has been released.

      • aborted : Bool

        Whether the computation has been aborted.

      Backdoor queries of fsfe: query reads SFEStatus n, deliver party releases output to party once all inputs are present and no abort occurred, and abort sets the abort flag.

      Instances For
        @[instance_reducible]

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

        Internal state of fsfe.

        • inputs : Fin n → Option In

          Per-party submitted inputs, write-once.

        • delivered : Fin n → Bool

          Per-party output delivery flags.

        • aborted : Bool

          Whether the adversary has aborted the evaluation.

        Whether every party i : Fin n has submitted an input.

        Extract the public SFEStatus n flags from SFEState n In.

        def Cslib.Crypto.Protocols.UC.SFEState.eval? {n : ℕ} {In Out : Type} (f : (Fin n → In) → Fin n → Out) (s : SFEState n In) :
        Option (Fin n → Out)

        Evaluate f when all n parties have submitted inputs, returning none otherwise.

        def Cslib.Crypto.Protocols.UC.SFEState.partyOutput {n : ℕ} {In Out : Type} (f : (Fin n → In) → Fin n → Out) (s : SFEState n In) (i : Fin n) :

        Party i's observable output in state s on SFEInput.query. Delivered outputs persist even if a selective abort occurs later; undelivered parties observe some .aborted after an abort.

        structure Cslib.Crypto.Protocols.UC.SFEState.Monotone {n : ℕ} {In : Type} (s s' : SFEState n In) :

        Monotonicity relation between states s and s' across activations of fsfe: every submitted input is write-once immutable, and delivered and aborted are sticky.

        Ideal n-party secure function evaluation with abort fsfe #

        def Cslib.Crypto.Protocols.UC.fsfe {n : ℕ} {In Out : Type} (f : (Fin n → In) → Fin n → Out) :

        The ideal n-party secure function evaluation functionality with abort $\mathcal{F}_{\mathrm{SFE}}$ adapting [BS23] (v0.6, §23.5.3, printed pp. 1043–1044) for a deterministic function f : (Fin n → In) → (Fin n → Out):

        • Each party i : Fin n submits input val once (subsequent inputs are ignored) and polls query to read its output once released (some (.output (f x i))), or some .aborted if aborted before its output was delivered.
        • Backdoor query returns SFEStatus n (only arrival, delivery, and abort flags); deliver i releases party i's output when all parties have submitted and no abort occurred; abort sets aborted := true.

        Unlike [BS23] (§23.5.3, pp. 1043–1044), which uses per-wire recipient lists and silent abort via withheld output delivery (none), fsfe uses homogeneous per-party input/output types and explicit SFEBackdoor.abort commands yielding some .aborted (the synchronous SFE-with-abort convention needed for #1212).

        Call-budget bounds and multi-session compatibility #

        theorem Cslib.Crypto.Protocols.UC.fsfe_isBounded {n : ℕ} {In Out : Type} (f : (Fin n → In) → Fin n → Out) (κ : ℕ) (C : Finset (Fin n)) :

        fsfe f is deterministic and makes zero oracle calls per activation.

        theorem Cslib.Crypto.Protocols.UC.fsfe_polyBounded {n : ℕ} {In Out : Type} (f : (Fin n → In) → Fin n → Out) :

        fsfe f has polynomial call budget 0.

        theorem Cslib.Crypto.Protocols.UC.fsfe_multiSession_polyBounded {n : ℕ} {In Out : Type} (f : (Fin n → In) → Fin n → Out) (SSID : Type) [DecidableEq SSID] :

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

        State invariants and write-once input lock #

        theorem Cslib.Crypto.Protocols.UC.SFEState.Monotone.trans {n : ℕ} {In : Type} {a b c : SFEState n In} (hab : a.Monotone b) (hbc : b.Monotone c) :
        theorem Cslib.Crypto.Protocols.UC.SFEState.monotone_of_mem_support_runFrom {n : ℕ} {In Out α : Type} (f : (Fin n → In) → Fin n → Out) (κ : ℕ) (C : Finset (Fin n)) (prog : ProbOracleComp (protocolSpec n (SFEInput In) (SFEOutput Out) (RoutedNetQ n (SFEInput In) (SFEBackdoor n)) (RoutedNetR (SFEOutput Out) (SFEBackdoorReply n))) α) (s : SFEState n In) {x : α × SFEState n In} (hx : x ∈ (Machine.closeEval ((corruptRouter C ((fsfe f).toProtocol κ C)).runFrom prog s)).support) :
        s.Monotone x.2

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

        Honest evaluation agreement and abort correctness #

        def Cslib.Crypto.Protocols.UC.honestSFEEnv {n : ℕ} {In Out : Type} [DecidableEq Out] (f : (Fin n → In) → Fin n → Out) (x : Fin n → In) (target : Fin n) :

        Honest-execution environment (C = ∅) for fsfe f: all n parties submit x, the backdoor releases output to party target, and target polls some (.output (f x target)).

        def Cslib.Crypto.Protocols.UC.abortSFEEnv {n : ℕ} {In Out : Type} (x : Fin n → In) (target : Fin n) :

        Abort-test environment (C = ∅) for fsfe f: all n parties submit x, the backdoor issues abort, and target polls some .aborted.

        theorem Cslib.Crypto.Protocols.UC.eval_exec_honestSFEEnv {n : ℕ} {In Out : Type} [DecidableEq Out] (f : (Fin n → In) → Fin n → Out) (x : Fin n → In) (target : Fin n) (κ : ℕ) (z : List Bool) :

        Honest evaluation agreement of fsfe: when all parties submit x and the backdoor delivers to target without aborting, target observes some (.output (f x target)) with probability 1.

        theorem Cslib.Crypto.Protocols.UC.eval_exec_abortSFEEnv {n : ℕ} {In Out : Type} (f : (Fin n → In) → Fin n → Out) (x : Fin n → In) (target : Fin n) (κ : ℕ) (z : List Bool) :

        Abort correctness of fsfe: when all parties submit x and the backdoor aborts before delivering to target, target observes some .aborted with probability 1.

        Honest-input privacy #

        structure Cslib.Crypto.Protocols.UC.SFECorruptEquiv {n : ℕ} {In Out : Type} (C : Finset (Fin n)) (f : (Fin n → In) → Fin n → Out) (s₁ s₂ : SFEState n In) :

        State equivalence for post-output honest-input privacy of fsfe f under static corruption set C: corrupted inputs match, all arrival/delivery/abort flags match, and for every pair of full input vectors extending s₁ and s₂ and agreeing on C, f yields the same outputs on C.

        • inputs_corrupt (i : Fin n) : i ∈ C → s₁.inputs i = s₂.inputs i

          Corrupted parties' submitted inputs agree.

        • submitted_eq (i : Fin n) : (s₁.inputs i).isSome = (s₂.inputs i).isSome

          All parties have the same input-arrival status.

        • delivered_eq : s₁.delivered = s₂.delivered

          Output delivery flags agree.

        • aborted_eq : s₁.aborted = s₂.aborted

          Abort flags agree.

        • outputs_corrupt (x₁ x₂ : Fin n → In) : (∀ (j : Fin n) (v : In), s₁.inputs j = some v → x₁ j = v) → (∀ (j : Fin n) (v : In), s₂.inputs j = some v → x₂ j = v) → (∀ j ∈ C, x₁ j = x₂ j) → ∀ i ∈ C, f x₁ i = f x₂ i

          All completions extending s₁ and s₂ and agreeing on C produce identical f-outputs on C.

        structure Cslib.Crypto.Protocols.UC.SFEPreOutputEquiv {n : ℕ} {In : Type} (C : Finset (Fin n)) (s₁ s₂ : SFEState n In) :

        State equivalence for pre-output honest-input privacy of fsfe f under static corruption set C: corrupted inputs, arrival flags, honest-party delivery flags, and abort flags match, while no corrupted party has received its output yet.

        • inputs_corrupt (i : Fin n) : i ∈ C → s₁.inputs i = s₂.inputs i

          Corrupted parties' submitted inputs agree.

        • submitted_eq (i : Fin n) : (s₁.inputs i).isSome = (s₂.inputs i).isSome

          All parties have the same input-arrival status.

        • corrupt_undelivered₁ (i : Fin n) : i ∈ C → s₁.delivered i = false

          No corrupted party has had its output delivered in s₁.

        • corrupt_undelivered₂ (i : Fin n) : i ∈ C → s₂.delivered i = false

          No corrupted party has had its output delivered in s₂.

        • honest_delivered_eq (i : Fin n) : i ∉ C → s₁.delivered i = s₂.delivered i

          Delivery flags on honest parties match.

        • aborted_eq : s₁.aborted = s₂.aborted

          Abort flags agree.

        theorem Cslib.Crypto.Protocols.UC.eval_runFrom_fsfe_corrupt_eq {n : ℕ} {In Out α : Type} (C : Finset (Fin n)) (f : (Fin n → In) → Fin n → Out) (κ : ℕ) {s₁ s₂ : SFEState n In} (h : SFECorruptEquiv C f s₁ s₂) (program : ProbOracleComp (netSpec (RoutedNetQ n (SFEInput In) (SFEBackdoor n)) (RoutedNetR (SFEOutput Out) (SFEBackdoorReply n))) α) :

        Honest-input privacy (post-output): for static corruption set C, any two states s₁, s₂ satisfying SFECorruptEquiv C f s₁ s₂ produce identical distributions across every network-port program liftNet program (including all corrupted-party inputs/queries and all backdoor queries/deliveries/aborts).

        theorem Cslib.Crypto.Protocols.UC.eval_runFrom_fsfe_corrupt_inputs_eq {n : ℕ} {In Out α : Type} (C : Finset (Fin n)) (f : (Fin n → In) → Fin n → Out) (κ : ℕ) {x₁ x₂ : Fin n → In} (hxC : ∀ i ∈ C, x₁ i = x₂ i) (hfC : ∀ i ∈ C, f x₁ i = f x₂ i) (delivered : Fin n → Bool) (aborted : Bool) (program : ProbOracleComp (netSpec (RoutedNetQ n (SFEInput In) (SFEBackdoor n)) (RoutedNetR (SFEOutput Out) (SFEBackdoorReply n))) α) :
        (Prod.fst <$> Machine.closeProgram ((corruptRouter C ((fsfe f).toProtocol κ C)).runFrom (liftNet program) { inputs := fun (i : Fin n) => some (x₁ i), delivered := delivered, aborted := aborted })).eval = (Prod.fst <$> Machine.closeProgram ((corruptRouter C ((fsfe f).toProtocol κ C)).runFrom (liftNet program) { inputs := fun (i : Fin n) => some (x₂ i), delivered := delivered, aborted := aborted })).eval

        Honest-input privacy (input-vector form): two full input vectors x₁, x₂ : Fin n → In agreeing on C and producing identical f-outputs on C induce identical C-and-backdoor behavior across every network-port program liftNet program.

        theorem Cslib.Crypto.Protocols.UC.eval_runFrom_fsfe_corrupt_preAllSubmitted_eq {n : ℕ} {In Out α : Type} (C : Finset (Fin n)) (f : (Fin n → In) → Fin n → Out) (κ : ℕ) {s₁ s₂ : SFEState n In} (h : SFEPreOutputEquiv C s₁ s₂) (hhonest : ∃ j ∉ C, s₁.inputs j = none) (program : ProbOracleComp (netSpec (RoutedNetQ n (SFEInput In) (SFEBackdoor n)) (RoutedNetR (SFEOutput Out) (SFEBackdoorReply n))) α) :

        Honest-input privacy (pre-all-submitted): if at least one honest party j ∉ C has not yet submitted an input (s₁.inputs j = none), and s₁, s₂ match on C, arrival flags, and undelivered/abort flags, then ANY network-port program liftNet program produces identical output distributions on s₁ and s₂ regardless of honest inputs or f-outputs.

        theorem Cslib.Crypto.Protocols.UC.eval_runFrom_fsfe_corrupt_preDeliver_eq {n : ℕ} {In Out α : Type} (C : Finset (Fin n)) (f : (Fin n → In) → Fin n → Out) (κ : ℕ) {s₁ s₂ : SFEState n In} (h : SFEPreOutputEquiv C s₁ s₂) (program : ProbOracleComp (netSpec (RoutedNetQ n (SFEInput In) (SFEBackdoor n)) (RoutedNetR (SFEOutput Out) (SFEBackdoorReply n))) α) (hnodel : OracleComp.QueriesSatisfy (Sum.elim (fun (x : ℕ) => True) fun (q : RoutedNetQ n (SFEInput In) (SFEBackdoor n)) => match q with | Sum.inr (SFEBackdoor.deliver i) => i ∉ C | x => True) program) :

        Honest-input privacy (pre-output, even after all inputs arrive): for any two states s₁, s₂ satisfying SFEPreOutputEquiv C s₁ s₂ (including two full input vectors x₁, x₂ agreeing on C without requiring f x₁ i = f x₂ i), any network-port program program that does not invoke .deliver i for i ∈ C produces identical output distributions on s₁ and s₂.

        Relationship between fot and 2-party fsfe #

        The 2-party deterministic function for 1-out-of-2 oblivious transfer: sender 0 supplies OTMessages M (receiving Unit), receiver 1 supplies Bool (receiving msgs.select b). Malformed role inputs default to .inl ().

        Concrete 2-party fsfe instantiation of 1-out-of-2 oblivious transfer.

        Role-enforcing 2-party hybrid protocol adapting otSFE M to the OTInput M / OTOutput M interface of fot M:

        • Party 0 forwards .send msgs as (0, .input (.inl msgs)) and returns none.
        • Party 1 forwards .choose b as (1, .input (.inr b)) (returning none) and .query as (1, .query) (mapping .output (.inr m) to .delivered m and .aborted to .aborted).

        otInSFEHybrid M makes at most 1 subroutine call per activation.

        Internal state of otInSFESim M, tracking corrupted-party otSFE inputs (including malformed inputs not forwarded to fot M), per-party delivery flags, and abort status.

        Instances For
          @[instance_reducible]

          Two-call-per-activation simulator for compose (otInSFEHybrid M) (otSFE M).toProtocol against fot M, working for every message type M and every static corruption set C : Finset (Fin 2):

          • Tracks (corruptIn0, corruptIn1, sfeDel0, sfeDel1, sfeAborted) in OTInSFESimState M.
          • Polls OTBackdoor.query on fot M to reconstruct SFEStatus and allSubmitted.
          • Forwards well-formed corrupted .inl msgs / .inr b inputs once to fot M.
          • Forwards .deliver 1 as OTBackdoor.deliver iff allSub && !sfeAborted with well-formed inputs, and forwards .abort as OTBackdoor.abort iff !sfeDel1.

          otInSFESim M makes at most 2 oracle calls per activation.

          Exact execution equivalence for otInSFEHybrid: for every message type M, every static corruption set C : Finset (Fin 2), and every environment Z, running compose (otInSFEHybrid M) (otSFE M).toProtocol with the dummy adversary is identically equal (as a ProbComp Bool program) to running fot M with otInSFESim M.

          Zero-error UC realization of fot M via otInSFEHybrid M and otSFE M: for every message type M, the composed hybrid protocol compose (otInSFEHybrid M) (otSFE M).toProtocol UC-realizes fot M with zero error via the 2-call-per-activation simulator otInSFESim M.

          Composition corollary in this library's call-bounded static-UC model (Realizes): any protocol π that realizes otSFE M composes with otInSFEHybrid M to realize fot M.

          Semantic difference 1 (sender abort visibility): after an .abort on the backdoor, sender 0 polling .query receives some .aborted in otSFE M (since every party of fsfe receives an output or abort), whereas sender 0 always receives none in fot M.

          Semantic difference 2 (selective per-party delivery in otSFE): after both parties submit (msgs, b), issuing .deliver 0 releases some (.output (.inl ())) to sender 0 while receiver 1 still observes none, and a subsequent .abort leaves sender 0 with its delivered output and receiver 1 with some .aborted. (fot has only a single .deliver for receiver 1.)