Documentation

CslibFrontier.Crypto.Protocols.MPC.IKNP

IKNP oblivious-transfer extension #

The protocol of Ishai, Kilian, Nissim and Petrank [IshaiKilianNissimPetrank2003, Section 3, Figure 1], which implements m transfers of values in L from κ base transfers of m-bit strings and a correlation-robust family H : Fin m → BitString κ → L (Cslib.Crypto.CorrelationRobust). Party 0, the sender, holds pairs X : Fin m → Bool → L; party 1, the receiver, holds choice bits r : Fin m → Bool. The functionality is the ideal batched transfer batchOTFunctionality m L, which gives fun j => X j (r j) to the receiver and nothing to the sender.

  1. The receiver samples a uniform m × κ matrix T, with rows tⱼ and columns tⁱ. The parties make one call to batchOTSpec κ (BitString m) with the roles reversed (iknpRoleReversal): the receiver offers the pair (tⁱ, tⁱ + r) for each i, and the sender chooses with a uniform s : BitString κ. The sender learns the matrix with rows qⱼ = tⱼ + rⱼ s.
  2. The sender sends X j b + H j (qⱼ + b s) for each j and b (iknpMasked).
  3. The receiver outputs Y j (r j) - H j tⱼ; its mask is H j tⱼ because qⱼ + rⱼ s = tⱼ (iknp_mask_input).

The paper's values are bit strings, L = BitString ℓ, where subtraction is addition; here L is any finite additive commutative group.

These statements are per instance and are not themselves security theorems: they are stated on the joint distribution of the corrupted party's view and both outputs, one simulator per corrupted party, with a concrete advantage in place of computational indistinguishability. The security theorem, semi-honest security of the protocol family against either party under correlation robustness, is Cslib.Crypto.CorrelationRobust.iknpSemiHonestSecure.

Scope: the base transfers are the ideal oracle, and no composition theorem replaces them by a protocol. The statements are for a single instance (H, inputs and distinguisher fixed), with no security parameter, and running time is not tracked. Only semi-honest security is covered, not the malicious variant of the paper. CslibFrontier/Crypto/Protocols/MPC/IKNP/Family.lean runs the protocol as a family of bit-transfer extensions, with PPT simulators and a PPT reduction, and proves it semi-honest secure from the asymptotic correlation-robustness assumption (Cslib.Crypto.CorrelationRobust.iknpSemiHonestSecure).

Main definitions #

Main results #

References #

@[reducible]

The coins: the sender's base choice string s and the receiver's matrix T, by rows.

@[reducible]

The parties of the base transfers, with the roles reversed: the extension's receiver (party 1) is the base sender (slot 0), and the extension's sender (party 0) is the base receiver (slot 1).

@[reducible]

The schedule: κ base transfers of m-bit strings with the roles reversed, then the sender's message of masked pairs.

def Cslib.Crypto.Protocols.MPC.iknpColumns {κ m : ℕ} (r : Fin m → Bool) (T : Fin m → BitString κ) :
Fin κ → Bool → BitString m

The receiver's base-transfer input: for each column index i of T, the pair of m-bit columns (tⁱ, tⁱ + r).

def Cslib.Crypto.Protocols.MPC.iknpRows {κ m : ℕ} (Q : Fin κ → BitString m) :
Fin m → BitString κ

The rows of the matrix whose columns are Q (the transpose, Function.swap Q).

def Cslib.Crypto.Protocols.MPC.iknpMasked {κ m : ℕ} {L : Type} [Add L] (H : Fin m → BitString κ → L) (X : Fin m → Bool → L) (s : BitString κ) (Q : Fin κ → BitString m) :
Fin m → Bool → L

The sender's message: the pair X j masked by H j qⱼ and H j (qⱼ + s), where qⱼ is the j-th row of the matrix received from the base transfers.

The base-transfer queries: the receiver offers the columns (tⁱ, tⁱ + r) and the sender chooses with s.

def Cslib.Crypto.Protocols.MPC.iknpSend {κ m : ℕ} {L : Type} [Add L] (H : Fin m → BitString κ → L) (st : ((batchOTSpec m L).Query () 0 × IKNPCoins κ m 0) × (Round.oracle () iknpRoleReversal).Received 0) :
Fin m → Bool → L

The sender's message from its input, its coins and the columns it received.

@[reducible]

The local state of each party at the end of the protocol.

def Cslib.Crypto.Protocols.MPC.iknpOutput {κ m : ℕ} {L : Type} [AddGroup L] (H : Fin m → BitString κ → L) (i : Fin 2) (st : IKNPFinal κ m L i) :

The outputs: the sender outputs nothing; the receiver unmasks the chosen entry of each pair with H j tⱼ.

noncomputable def Cslib.Crypto.Protocols.MPC.iknpProtocol {κ m : ℕ} {L : Type} [AddCommGroup L] (H : Fin m → BitString κ → L) :

The IKNP protocol in the hybrid model with κ base transfers of m-bit strings.

Runs of the protocol #

Sample the coins: a uniform base choice string s and a uniform matrix T.

def Cslib.Crypto.Protocols.MPC.iknpCoins {κ m : ℕ} (c : BitString κ × (Fin m → BitString κ)) (i : Fin 2) :
IKNPCoins κ m i

The coins (s, T) as a coin tuple.

def Cslib.Crypto.Protocols.MPC.iknpSenderView {κ m : ℕ} {L : Type} (X : Fin m → Bool → L) (s : BitString κ) (Q : Fin κ → BitString m) :

The sender's view: its input X, its base choice string s and the columns Q it receives from the base transfers.

def Cslib.Crypto.Protocols.MPC.iknpReceiverView {κ m : ℕ} {L : Type} (r : Fin m → Bool) (T : Fin m → BitString κ) (Y : Fin m → Bool → L) :

The receiver's view: its choice bits r, its matrix T and the masked pairs Y.

theorem Cslib.Crypto.Protocols.MPC.iknp_mask_input {κ m : ℕ} (r : Fin m → Bool) (T : Fin m → BitString κ) (s : BitString κ) (j : Fin m) (b : Bool) :
(if b = true then iknpRows (fun (i : Fin κ) => iknpColumns r T i (s i)) j + s else iknpRows (fun (i : Fin κ) => iknpColumns r T i (s i)) j) = if b = r j then T j else T j + s

The key identity: the j-th row of the matrix the sender receives is tⱼ shifted by s exactly when rⱼ holds, so the sender's two masks are H j tⱼ on the receiver's choice and H j (tⱼ + s) on the other entry.

theorem Cslib.Crypto.Protocols.MPC.iknp_output_of_mem_support {κ m : ℕ} {L : Type} [AddCommGroup L] (H : Fin m → BitString κ → L) (x : (i : Fin 2) → (batchOTSpec m L).Query () i) {res : ((i : Fin 2) → PartyView ((batchOTSpec m L).Query ()) (IKNPCoins κ m) (iknpSchedule κ m L) i) × ((i : Fin 2) → (batchOTSpec m L).Answer () i)} (hres : res ∈ ((iknpProtocol H).evalWith (batchOTWorld κ (BitString m)) x).support) :

Correctness: in every run the receiver outputs fun j => X j (r j) and the sender outputs nothing.

Privacy against the sender #

The simulator for a corrupted sender: a fresh base choice string and uniform columns.

theorem Cslib.Crypto.Protocols.MPC.realJoint_iknp_sender {κ m : ℕ} {L : Type} [AddCommGroup L] (H : Fin m → BitString κ → L) (x : (i : Fin 2) → (batchOTSpec m L).Query () i) :
(iknpProtocol H).realJoint (batchOTWorld κ (BitString m)) {0} x = PMF.map (fun (c : BitString κ × (Fin m → BitString κ)) => (singletonView (iknpSenderView (x 0) c.1 fun (i : Fin κ) => iknpColumns (x 1) c.2 i (c.1 i)), batchOTAnswer x)) (sampleIKNPCoins κ m).eval

The real joint distribution for a corrupted sender: its choice string and the columns it receives, with T uniform.

theorem Cslib.Crypto.Protocols.MPC.idealJoint_iknp_sender {κ m : ℕ} {L : Type} [AddCommGroup L] (H : Fin m → BitString κ → L) (x : (i : Fin 2) → (batchOTSpec m L).Query () i) :

Perfect privacy against the sender: the ideal joint distribution with iknpSenderSim equals the real one, because the columns tⁱ + sᵢ r are uniform whatever s and r are.

theorem Cslib.Crypto.Protocols.MPC.semiHonestAdvantage_iknp_sender {κ m : ℕ} {L : Type} [AddCommGroup L] (H : Fin m → BitString κ → L) (x : (i : Fin 2) → (batchOTSpec m L).Query () i) (D : ((i : ↥{0}) → PartyView ((batchOTSpec m L).Query ()) (IKNPCoins κ m) (iknpSchedule κ m L) ↑i) × ((i : Fin 2) → (batchOTSpec m L).Answer () i) → ProbComp Bool) :

A corrupted sender has advantage zero against every distinguisher.

Privacy against the receiver #

noncomputable def Cslib.Crypto.Protocols.MPC.iknpReceiverSim {κ m : ℕ} {L : Type} [AddCommGroup L] [Fintype L] (H : Fin m → BitString κ → L) :

The simulator for a corrupted receiver with choice bits r and output z: a uniform matrix T, the chosen entries z j + H j tⱼ, and uniform values in place of the other entries.

def Cslib.Crypto.Protocols.MPC.iknpReduction {κ m : ℕ} {L : Type} [AddCommGroup L] (H : Fin m → BitString κ → L) (x : (i : Fin 2) → (batchOTSpec m L).Query () i) (D : ((i : ↥{1}) → PartyView ((batchOTSpec m L).Query ()) (IKNPCoins κ m) (iknpSchedule κ m L) ↑i) × ((i : Fin 2) → (batchOTSpec m L).Answer () i) → ProbComp Bool) :

The correlation-robustness distinguisher that a distinguisher D on the receiver's joint view and outputs induces, for the inputs x: given inputs t and values w, it masks the chosen entries with H j tⱼ and the other entries with w j, and runs D.

theorem Cslib.Crypto.Protocols.MPC.realJoint_iknp_receiver {κ m : ℕ} {L : Type} [AddCommGroup L] (H : Fin m → BitString κ → L) (x : (i : Fin 2) → (batchOTSpec m L).Query () i) :
(iknpProtocol H).realJoint (batchOTWorld κ (BitString m)) {1} x = PMF.map (fun (c : BitString κ × (Fin m → BitString κ)) => (singletonView (iknpReceiverView (x 1) c.2 fun (j : Fin m) (b : Bool) => x 0 j b + if b = x 1 j then H j (c.2 j) else H j (c.2 j + c.1)), batchOTAnswer x)) (sampleIKNPCoins κ m).eval

The real joint distribution for a corrupted receiver.

theorem Cslib.Crypto.Protocols.MPC.realJoint_iknp_receiver_bind {κ m : ℕ} {L : Type} [AddCommGroup L] (H : Fin m → BitString κ → L) (x : (i : Fin 2) → (batchOTSpec m L).Query () i) (D : ((i : ↥{1}) → PartyView ((batchOTSpec m L).Query ()) (IKNPCoins κ m) (iknpSchedule κ m L) ↑i) × ((i : Fin 2) → (batchOTSpec m L).Answer () i) → ProbComp Bool) :
(((iknpProtocol H).realJoint (batchOTWorld κ (BitString m)) {1} x).bind fun (res : ((i : ↥{1}) → PartyView ((batchOTSpec m L).Query ()) (IKNPCoins κ m) (iknpSchedule κ m L) ↑i) × ((i : Fin 2) → (batchOTSpec m L).Answer () i)) => (D res).eval) = CorrelationRobust.realGame H (iknpReduction H x D)

The real joint distribution for a corrupted receiver, tested by D, is the real correlation-robustness game of iknpReduction H x D: the unchosen entries are masked by H j (tⱼ + s).

theorem Cslib.Crypto.Protocols.MPC.idealJoint_iknp_receiver_bind {κ m : ℕ} {L : Type} [AddCommGroup L] [Fintype L] (H : Fin m → BitString κ → L) (x : (i : Fin 2) → (batchOTSpec m L).Query () i) (D : ((i : ↥{1}) → PartyView ((batchOTSpec m L).Query ()) (IKNPCoins κ m) (iknpSchedule κ m L) ↑i) × ((i : Fin 2) → (batchOTSpec m L).Answer () i) → ProbComp Bool) :

The ideal joint distribution for a corrupted receiver with iknpReceiverSim, tested by D, is the ideal correlation-robustness game of iknpReduction H x D: the simulator's uniform unchosen entries are uniform masks shifted by the sender's unchosen values.

theorem Cslib.Crypto.Protocols.MPC.semiHonestAdvantage_iknp_receiver {κ m : ℕ} {L : Type} [AddCommGroup L] [Fintype L] (H : Fin m → BitString κ → L) (x : (i : Fin 2) → (batchOTSpec m L).Query () i) (D : ((i : ↥{1}) → PartyView ((batchOTSpec m L).Query ()) (IKNPCoins κ m) (iknpSchedule κ m L) ↑i) × ((i : Fin 2) → (batchOTSpec m L).Answer () i) → ProbComp Bool) :

A step of the receiver's case of [IKNP03], §5, at one instance, not the security theorem: every distinguisher's advantage between the ideal joint distribution with iknpReceiverSim and the real one equals the correlation-robustness advantage of the reduction iknpReduction against H. The asymptotic theorem, with PPT simulators and a PPT reduction, is Cslib.Crypto.CorrelationRobust.iknpSemiHonestSecure.