Documentation

CslibFrontier.Crypto.Protocols.SelectiveFailure

Selective failure attacks on cryptographic protocols #

A protocol that is private against passive (semi-honest) adversaries may still leak an honest party's secret input w : Secret when a corrupted participant deviates actively from its prescribed response and observes whether the honest party's reconstruction fails (produces an incorrect output, fails a consistency check, or aborts). The formal model and theorems in this module are original to this library, motivated by active deviations against passive protocols such as private information retrieval ([CGKS98]), oblivious transfer, semi-honest Yao two-party computation ([LP09], background on semi-honest Yao and OT), and semi-honest multi-party computation ([Gol04]).

This module provides a protocol-agnostic framework (SelectiveFailure.Model Secret Dev Out) that applies uniformly across private information retrieval (PIR.Scheme), oblivious transfer (MPC.batchOTFunctionality), garbled-circuit two-party computation (MPC.yaoProtocol), and multi-party computation (MPC.Protocol):

Main definitions #

Main results #

References #

A protocol model for analyzing selective failure attacks, parameterized by the honest party's secret input type Secret, the adversary's active deviation type Dev, and the honest party's output type Out.

  • target : Secret → Out

    The ideal (uncorrupted) output expected by the honest party on secret input w.

  • exec : Dev → Secret → ProbComp Out

    The distribution of the honest party's reconstructed output when the corrupted party applies active deviation dev : Dev on secret input w : Secret.

Canonical output-failure games #

def Cslib.Crypto.Protocols.SelectiveFailure.Model.failureRun {Secret Dev Out : Type} [DecidableEq Out] (M : Model Secret Dev Out) (dev : Dev) (w : Secret) :

The probabilistic computation outputting true iff the honest party's reconstructed output under deviation dev on secret w differs from the ideal output M.target w.

noncomputable def Cslib.Crypto.Protocols.SelectiveFailure.Model.failureGame {Secret Dev Out : Type} [DecidableEq Out] (M : Model Secret Dev Out) (dev : Dev) (w : Secret) :

The Boolean failure experiment (Game) under deviation dev on secret w: succeeds (true) when the honest party suffers a reconstruction failure (out ≠ M.target w).

noncomputable def Cslib.Crypto.Protocols.SelectiveFailure.Model.failureProb {Secret Dev Out : Type} [DecidableEq Out] (M : Model Secret Dev Out) (dev : Dev) (w : Secret) :

The probability (ℝ≥0) that the honest party suffers a reconstruction failure (out ≠ M.target w) under deviation dev on secret w.

noncomputable def Cslib.Crypto.Protocols.SelectiveFailure.Model.advantage {Secret Dev Out : Type} [DecidableEq Out] (M : Model Secret Dev Out) (dev : Dev) (w₀ w₁ : Secret) :

The selective-failure distinguishing advantage (ℝ≥0) between candidate secrets w₀ and w₁ under active deviation dev: the absolute difference between their failure probabilities.

A protocol model is selective-failure free if no active deviation dev produces any distinguishing advantage between any two secrets w₀, w₁ from the failure signal.

def Cslib.Crypto.Protocols.SelectiveFailure.Model.IsDeterministicAttack {Secret Dev Out : Type} [DecidableEq Out] (M : Model Secret Dev Out) (dev : Dev) (pred : Secret → Bool) :

An active deviation dev is a deterministic selective failure attack for predicate pred : Secret → Bool if, for every secret w, the failure indicator decide (out ≠ M.target w) equals pred w with probability one.

theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.eval_failureRun {Secret Dev Out : Type} [DecidableEq Out] (M : Model Secret Dev Out) (dev : Dev) (w : Secret) :
(M.failureRun dev w).eval = PMF.map (fun (out : Out) => decide (out ≠ M.target w)) (M.exec dev w).eval
@[simp]
theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.advantage_self {Secret Dev Out : Type} [DecidableEq Out] (M : Model Secret Dev Out) (dev : Dev) (w : Secret) :
M.advantage dev w w = 0
theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.isSelectiveFailureFree_iff {Secret Dev Out : Type} [DecidableEq Out] (M : Model Secret Dev Out) :
M.IsSelectiveFailureFree ↔ ∀ (dev : Dev) (w₀ w₁ : Secret), M.failureGame dev w₀ = M.failureGame dev w₁

IsSelectiveFailureFree holds iff for every deviation dev, the failure game distribution M.failureGame dev w is independent of the secret w.

theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.isDeterministicAttack_iff {Secret Dev Out : Type} [DecidableEq Out] (M : Model Secret Dev Out) {dev : Dev} {pred : Secret → Bool} :
M.IsDeterministicAttack dev pred ↔ ∀ (w : Secret), ∀ out ∈ (M.exec dev w).eval.support, decide (out ≠ M.target w) = pred w

Support characterization of IsDeterministicAttack: under deviation dev, every output in the support of M.exec dev w has failure indicator decide (out ≠ M.target w) = pred w.

theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.IsDeterministicAttack.failureProb_eq {Secret Dev Out : Type} [DecidableEq Out] {M : Model Secret Dev Out} {dev : Dev} {pred : Secret → Bool} (h : M.IsDeterministicAttack dev pred) (w : Secret) :
M.failureProb dev w = if pred w = true then 1 else 0

Under a deterministic selective failure attack for pred, the failure probability on w is 1 when pred w = true and 0 when pred w = false.

theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.IsDeterministicAttack.failureProb_eq_one {Secret Dev Out : Type} [DecidableEq Out] {M : Model Secret Dev Out} {dev : Dev} {pred : Secret → Bool} (h : M.IsDeterministicAttack dev pred) {w : Secret} (hw : pred w = true) :
M.failureProb dev w = 1
theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.IsDeterministicAttack.failureProb_eq_zero {Secret Dev Out : Type} [DecidableEq Out] {M : Model Secret Dev Out} {dev : Dev} {pred : Secret → Bool} (h : M.IsDeterministicAttack dev pred) {w : Secret} (hw : pred w = false) :
M.failureProb dev w = 0
theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.IsDeterministicAttack.advantage_eq_one {Secret Dev Out : Type} [DecidableEq Out] {M : Model Secret Dev Out} {dev : Dev} {pred : Secret → Bool} (h : M.IsDeterministicAttack dev pred) {w₀ w₁ : Secret} (hne : pred w₀ ≠ pred w₁) :
M.advantage dev w₀ w₁ = 1

A deterministic selective failure attack achieves maximum distinguishing advantage 1 between any two secrets w₀, w₁ on which pred differs (pred w₀ ≠ pred w₁).

theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.IsDeterministicAttack.not_isSelectiveFailureFree {Secret Dev Out : Type} [DecidableEq Out] {M : Model Secret Dev Out} {dev : Dev} {pred : Secret → Bool} (h : M.IsDeterministicAttack dev pred) {w₀ w₁ : Secret} (hne : pred w₀ ≠ pred w₁) :

Any deterministic selective failure attack for a non-constant predicate pred refutes IsSelectiveFailureFree.

General structural attack and immunity combinators #

theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.isDeterministicAttack_of_slot {Secret Dev Out : Type} [DecidableEq Out] (M : Model Secret Dev Out) {Ctx Slot : Type} [DecidableEq Slot] (sample : Secret → ProbComp Ctx) (reconstruct : Secret → Ctx → Out) (sel : Secret → Slot) (slot₀ : Slot) (dev : Dev) (hexec : ∀ (w : Secret), M.exec dev w = reconstruct w <$> sample w) (hhit : ∀ (w : Secret), ∀ ctx ∈ (sample w).eval.support, sel w = slot₀ → reconstruct w ctx ≠ M.target w) (hmiss : ∀ (w : Secret), ∀ ctx ∈ (sample w).eval.support, sel w ≠ slot₀ → reconstruct w ctx = M.target w) :
M.IsDeterministicAttack dev fun (w : Secret) => decide (sel w = slot₀)

Slot-selection selective failure combinator. Suppose that on secret w, the execution M.exec dev w is obtained by mapping reconstruct w over a context distribution sample w, where for every supported context ctx:

  • reconstructing from the perturbed slot slot₀ yields an output different from M.target w when sel w = slot₀, and
  • reconstructing from the perturbed slot slot₀ yields M.target w when sel w ≠ slot₀. Then dev is a deterministic selective failure attack for fun w => decide (sel w = slot₀).
theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.isDeterministicAttack_of_decide_eq_one {Secret Dev Ctx F : Type} [One F] [DecidableEq F] (M : Model Secret Dev Bool) (sample : Secret → ProbComp Ctx) (evalField : Secret → Ctx → F) (dev : Dev) (hexec : ∀ (w : Secret), M.exec dev w = (fun (ctx : Ctx) => decide (evalField w ctx = 1)) <$> sample w) (hne_one : ∀ (w : Secret), ∀ ctx ∈ (sample w).eval.support, evalField w ctx ≠ 1) :

Nonlinear = 1 threshold selective failure combinator. For a Boolean-output protocol (Out = Bool) that reconstructs via decide (evalField w ctx = 1) in a type F with Zero F and One F, if under deviation dev every supported context ctx satisfies:

  • evalField w ctx ≠ 1 when M.target w = true (forcing false ≠ true), and
  • evalField w ctx ≠ 1 when M.target w = false (preserving false = false), i.e., evalField w ctx ≠ 1 regardless of M.target w, then dev causes a failure if and only if M.target w = true.
theorem Cslib.Crypto.Protocols.SelectiveFailure.Model.isSelectiveFailureFree_of_map_eq {Secret Dev Out : Type} [DecidableEq Out] (M : Model Secret Dev Out) {View : Type} (view : Dev → Secret → ProbComp View) (err : Dev → View → Bool) (hview : ∀ (dev : Dev) (w₀ w₁ : Secret), (view dev w₀).eval = (view dev w₁).eval) (hfactor : ∀ (dev : Dev) (w : Secret), M.failureGame dev w = PMF.map (err dev) (view dev w).eval) :

Passive-view factorization immunity combinator. If for every deviation dev, the failure game M.failureGame dev w is the pushforward (ProbComp.eval (view dev w)).map (err dev) of a passive view view : Dev → Secret → ProbComp View whose distribution is independent of w, then M is IsSelectiveFailureFree.

Input-indexed payload transfer (1-out-of-N and batch oblivious transfer) #

def Cslib.Crypto.Protocols.SelectiveFailure.indexedPayloadModel {κ Slot α : Type} (m : κ → Slot → α) :
Model (κ → Slot) (κ → Slot → α) (κ → α)

Selective-failure model for an input-indexed payload transfer protocol (such as 1-out-of-N or batch oblivious transfer MPC.batchOTFunctionality): the sender holds a table m : κ → Slot → α, the receiver holds a secret choice vector b : κ → Slot and expects fun j => m j (b j), and a deviating sender substitutes a modified table m' : κ → Slot → α.

def Cslib.Crypto.Protocols.SelectiveFailure.indexedPayloadPerturb {κ Slot α : Type} [DecidableEq κ] [DecidableEq Slot] (m : κ → Slot → α) (j₀ : κ) (s₀ : Slot) (a' : α) :
κ → Slot → α

Single-slot sender perturbation in indexedPayloadModel: replaces entry (j₀, s₀) of the sender's table m with a' while leaving all other slots unchanged.

theorem Cslib.Crypto.Protocols.SelectiveFailure.isDeterministicAttack_indexedPayload {κ Slot α : Type} [Fintype κ] [DecidableEq κ] [DecidableEq Slot] [DecidableEq α] (m : κ → Slot → α) (j₀ : κ) (s₀ : Slot) {a' : α} (hne : a' ≠ m j₀ s₀) :
(indexedPayloadModel m).IsDeterministicAttack (indexedPayloadPerturb m j₀ s₀ a') fun (b : κ → Slot) => decide (b j₀ = s₀)

Deterministic selective failure on input-indexed payload transfer / batch OT: perturbing slot (j₀, s₀) to a' ≠ m j₀ s₀ causes the receiver's output to differ from the honest output if and only if the receiver's secret choice at j₀ is s₀ (b j₀ = s₀).

theorem Cslib.Crypto.Protocols.SelectiveFailure.advantage_indexedPayload_eq_one {κ Slot α : Type} [Fintype κ] [DecidableEq κ] [DecidableEq Slot] [DecidableEq α] (m : κ → Slot → α) (j₀ : κ) (s₀ : Slot) {a' : α} (hne : a' ≠ m j₀ s₀) {b₀ b₁ : κ → Slot} (hb₀ : b₀ j₀ = s₀) (hb₁ : b₁ j₀ ≠ s₀) :
(indexedPayloadModel m).advantage (indexedPayloadPerturb m j₀ s₀ a') b₀ b₁ = 1

Perturbing slot (j₀, s₀) in indexedPayloadModel distinguishes any choice vector b₀ with b₀ j₀ = s₀ from any b₁ with b₁ j₀ ≠ s₀ with selective-failure advantage 1.

Input-indexed payload transfer is not selective-failure free whenever the index set κ is nonempty and the slot type Slot and payload type α are nontrivial.