LibsignalBound.lean
Declarations on this page (28)
-
def CryptoGames.
CKA. MakesAtMostQueries -
def CryptoGames.
PRFPRNG. MakesAtMostQueries - abbrev Fig8Adv
- abbrev LCt
- abbrev FsAdv
- def fsSlotCount
- def macForgeryTerm
- def ratchetCostBudget
- def ratchetFsAdapterBudget
- def fsRatchetCostBudget
- def evalTwoStage1
- abbrev CostedFits
- abbrev CostedOpsSizeHonest
- abbrev CostedSampSizeHonest
- def GRedBounded
- def CostedMidFits
- def GTwoStageBounded
- def GRedCostByKind
- def GRed2CostByKind
- structure FsCostedReds
- def fsCostedBounds
- def pubToADCosted
- def multiSlotAdvCosted
- def chainPRGTermCosted
- def saltPRFTermCosted
- def wireOtccaTermCosted
- structure Fig8CostedReds
- def fig8CostedBounds
Adversary types, cost budgets and costed reduction bundles for the libsignal session bound
Trusted in part. The theorems of Computational/ use every definition in this file except saltPRFTerm, wireOtccaTerm, multiSlotAdv and pubToAD; the ones they use are part of what you must read to trust the result. Those four are checked by Lean. Refine., chainPRGTerm, fsShortBound, fsCompBound, fig8ShortBound and their …With forms are in Computational/, checked by Lean. See Computational/.
This file defines the adversary types, the message-blanking map of ACD19 Lemma 18 (Alwen, Coretti, Dodis, ePrint 2018/1037), the per-slot advantage terms of the symmetric-ratchet FS-AEAD bound, the explicit syntactic step-cost budgets, and the ReductionDsl costed reduction bundles used by libsignal_.
Every reduction in the session and E2E bounds is represented as a first-order ReductionDsl. or ReductionDsl. over atomicSig ℓ Pt (AtomicOps.lean, TargetCodecs.lean), where every base sort carries an explicit 32-byte block measure sz and multi-step chain iterations, skipped-key scans, and protobuf wire codecs are accounted at primitive granularity. GRedBounded and GTwoStageBounded enforce single-execution step-cost budgets (ratchetCostBudget, fsRatchetCostBudget, ratchetFsAdapterBudget), program size, target query counts, operator/sampler size-honesty, and run-local state and output bounds, while GRedCostByKind and GRed2CostByKind refine step-cost and target-query accounting when game queries are split by kind (online vs. offline random-oracle queries).
Because macForgeryProb ≥ 2⁻⁶⁴ (8-byte MAC tag) and each FS-AEAD instance pays 4 * macForgeryTerm C qd = 4 * q * macForgeryProb outside the fsSlotCount qR slot sum (summed across epoch/message guesses and doubled by the window/signed-pre-key authenticity term), the bound is meaningful only for moderately long sessions: the MAC-forgery term reaches 2⁻³² at q = 9459 / 7327 / 1986 / 151 queries for qep = 0 / 1 / 10 / q, and reaches 1 at q = 619925131 / 480191941 / 130210321 / 38967 (see DEV-LS31 in Computational/).
@[expose] public sectionopen OracleComp OracleSpec ENNReal
def CryptoGames.
A makes at most q queries to the Fig. 3 CKA oracles (its own coins are unrestricted).
def CryptoGames.CKA.MakesAtMostQueries {State Coins Msg CKey : Type}
(A : CryptoGames.CKA.Adversary State Coins Msg CKey) (q : ℕ) : Prop :=
A.IsQueryBoundP (· matches .inr _) q
def CryptoGames.
A makes at most q queries to the PRF-PRNG oracles (its own coins are unrestricted).
def CryptoGames.PRFPRNG.MakesAtMostQueries {State I Out : Type}
(A : CryptoGames.PRFPRNG.Adversary State I Out) (q : ℕ) : Prop :=
A.IsQueryBoundP (· matches .inr _) qnamespace CryptoGames.LibsignalSMopen Ratchet LibsignalInst LibsignalSession HMAC HKDF CBC LibsignalAead SM SM.Construction CKA
AEADScheme MACScheme WireAEAD FSAEADsection Typesabbrev Fig8Adv
Adversary against the Fig. 8 instance lFig8 (messages LibsignalMsgPublicPart × Plain ℓ).
abbrev Fig8Adv (Pt : Type) (ℓ : ℕ) :=
SM.Adversary (LibsignalSim.Fig8St Pt) (LibsignalMsgPublicPart × Plain ℓ) (BitVec 256) (LibsignalSim.Fig8C Pt)2 declarations not shown (lines 78–90): theorems, which Lean checks, or definitions that no headline statement uses
CryptoGames., CryptoGames.
end Typesend CryptoGames.LibsignalSMnamespace CryptoVerification.LibsignalSessionopen CryptoGames CryptoGames.LibsignalSM Ratchet LibsignalInst LibsignalSession
HMAC HKDF CBC LibsignalAead SM SM.Construction CKA AEADScheme MACScheme WireAEAD FSAEADsection Boundsvariable {Pt : Type} [DecidableEq Pt]abbrev LCt
Per-message AEAD ciphertext pairing wire (ser, tag) with the 32-byte SPQR salt.
abbrev LCt := LibsignalCiphertextWithSalt32abbrev FsAdv
abbrev FsAdv (Pt : Type) (ℓ : ℕ) :=
FSAEAD.RatchetAdversary (BitVec 256) (BitVec 256) (Header Pt) (LibsignalMsgPublicPart × Plain ℓ) LCtdef fsSlotCount
Active hybrid slot count 2 * qR + (maxForwardJumps + 1) of ACD19 Theorem 5 for a qR-query FS-AEAD adversary: at most qR main-chain slots and qR + maxForwardJumps + 1 lookahead-chain slots bounded by the skip window (DEV-LS10).
def fsSlotCount (qR : ℕ) : ℕ := 2 * qR + (maxForwardJumps + 1)4 declarations not shown (lines 118–148): theorems, which Lean checks, or definitions that no headline statement uses
CryptoVerification., CryptoVerification., CryptoVerification., CryptoVerification.
def macForgeryTerm
Per-chain MAC-forgery term qd * macForgeryProb C.qd decryptions (DEV-LS23), charged twice per chain (4 * macForgeryTerm C qd per FS-AEAD instance).
noncomputable def macForgeryTerm (C : Crypto) (qd : ℕ) : ℝ≥0∞ := qd * macForgeryProb C.Fvariable [Zero Pt] [SampleableType Pt]Costed reduction bundles and budgets
def ratchetCostBudget
Quadratic syntactic step-cost budget across session-layer reductions (maxForwardJumps = 25000).
def ratchetCostBudget (q qep : ℕ) : ℕ :=
2 ^ 12 * (q + 1) ^ 2 * (maxForwardJumps + ReductionDsl.bits qep)def ratchetFsAdapterBudget
Step-cost budget for the five single-slot and adapter reductions in FsCostedReds that perform no maxForwardJumps-step chain iterations.
def ratchetFsAdapterBudget (qR qep : ℕ) : ℕ :=
2 ^ 24 * (qR + 1) + 2 ^ 10 * (qR + 1) ^ 2 + 2 ^ 12 * (qR + 1) * ReductionDsl.bits qepdef fsRatchetCostBudget
Step-cost budget for the two-stage FS-AEAD hybrid reductions (prgRedZero, multiRed).
def fsRatchetCostBudget (q qep : ℕ) : ℕ :=
min (ratchetCostBudget q qep)
(2 ^ 14 * (q + 1) ^ 2 + 2 ^ 15 * (q + 1) * (maxForwardJumps + ReductionDsl.bits qep))def evalTwoStage1
Sequential evaluation of both stages of a unit-challenge TwoStageCostedReduction at query fuel fuel and default output dflt.
def evalTwoStage1 {S : ReductionDsl.Sig} {O : ReductionDsl.Ops S} {ι κ : Type}
{T : OracleSpec ι} {I : ReductionDsl.Iface S T} {G : OracleSpec κ}
{C : ReductionDsl.GameCodec S G} {rIn aIn aOut out : ReductionDsl.Ty S}
(R : ReductionDsl.TwoStageCostedReduction O I G C rIn aIn aOut .unit .unit out)
(fuel : ℕ) (dflt : aOut.denote)
(A : aIn.denote → OracleComp (unifSpec + G) aOut.denote) (x : rIn.denote) :
OracleComp T out.denote := do
let (_, m) ← R.eval1 A x fuel dflt
R.eval2 m () fuel dfltabbrev CostedFits
Recursive block, bit, and list size bound on a ReductionDsl value (ReductionDsl.).
abbrev CostedFits {S : ReductionDsl.Sig} (B : ℕ) : (t : ReductionDsl.Ty S) → t.denote → Prop :=
_root_.ReductionDsl.ValFits Babbrev CostedOpsSizeHonest
Operator size-honesty obligation: each operator o increases the size bound by at most O..
abbrev CostedOpsSizeHonest {S : ReductionDsl.Sig}
(O : ReductionDsl.Ops S) : Prop :=
_root_.ReductionDsl.OpsSizeHonest Oabbrev CostedSampSizeHonest
Sampler size-honesty obligation: each sampler s outputs values bounded by X..
abbrev CostedSampSizeHonest {S : ReductionDsl.Sig}
(X : ReductionDsl.Samplers S) : Prop :=
_root_.ReductionDsl.SampSizeHonest Xdef GRedBounded
Step-cost, program-size, target-query, operator/sampler size-honesty, and run-local output/state block-size bounds for a 1-stage CostedReduction at source query bound q, target query bound qOut, and step-cost budget costBudget. Size bounds are quantified per run via supportWhen (I. so interfaces with unbounded Bytes or .nat fields remain satisfiable.
def GRedBounded {S : ReductionDsl.Sig}
{O : ReductionDsl.Ops S} {ι κ : Type}
{T : OracleSpec ι} {I : ReductionDsl.Iface S T} {G : OracleSpec κ}
{C : ReductionDsl.GameCodec S G} {rIn aIn aOut out : ReductionDsl.Ty S}
(R : ReductionDsl.CostedReduction O I G C rIn aIn aOut out)
(wTag : I.Tag → ℕ) (wSamp : I.smp.Samp → ℕ)
(q qOut costBudget : ℕ) : Prop :=
R.totalCost q ≤ costBudget ∧
R.size ≤ ReductionDsl.reductionSizeBudget + 2 ^ 12 * ReductionDsl.bits costBudget ∧
R.totalQueries wTag wSamp q ≤ qOut ∧
CostedOpsSizeHonest O ∧
CostedSampSizeHonest I.smp ∧
∀ (B : ℕ),
(∀ v : aOut.denote, CostedFits B aOut v) →
∀ (A : aIn.denote → OracleComp (unifSpec + G) aOut.denote),
(∀ a, (A a).IsQueryBoundP (fun t => t.isRight = true) q) →
(∀ a, ReductionDsl.AllGameQueriesFit B C (A a)) →
∀ (x : rIn.denote), CostedFits B rIn x →
let widthB := 2 * (costBudget + q + 1) * (B + 1)
(∀ y ∈ ReductionDsl.supportWhen (I.AnswerFits B) (R.eval A x), CostedFits widthB out y) ∧
(∀ r0 ∈ ReductionDsl.supportWhen (I.AnswerFits B) (R.init.eval (.cons x .nil)),
∀ r1 ∈ ReductionDsl.supportWhen (I.AnswerFits B) ((simulateQ R.impl (A r0.1)).run r0.2),
CostedFits widthB R.σ r1.2)def CostedMidFits
Block-size bound on a two-stage mid-state.
@[reducible] def CostedMidFits {S : ReductionDsl.Sig} {κ : Type} {G : OracleSpec κ} {α : Type}
(B : ℕ) (π σ ch : ReductionDsl.Ty S) :
ReductionDsl.Mid G α π.denote σ.denote ch.denote → Prop
| .done _ s => CostedFits B σ s
| .paused _ c p s _ => CostedFits B ch c ∧ CostedFits B π p ∧ CostedFits B σ sdef GTwoStageBounded
Step-cost, program-size, target-query, operator/sampler size-honesty, and run-local mid-state and output block-size bounds for a TwoStageCostedReduction at fuel q, target query bound qOut, and step-cost budget costBudget.
def GTwoStageBounded {S : ReductionDsl.Sig}
{O : ReductionDsl.Ops S} {ι κ : Type}
{T : OracleSpec ι} {I : ReductionDsl.Iface S T} {G : OracleSpec κ}
{C : ReductionDsl.GameCodec S G} {rIn aIn aOut ch rIn2 out : ReductionDsl.Ty S}
(R : ReductionDsl.TwoStageCostedReduction O I G C rIn aIn aOut ch rIn2 out)
(wTag : I.Tag → ℕ) (wSamp : I.smp.Samp → ℕ)
(q qOut costBudget : ℕ) : Prop :=
R.totalCost q ≤ costBudget ∧
R.size ≤ ReductionDsl.reductionSizeBudget + 2 ^ 12 * ReductionDsl.bits costBudget ∧
R.totalQueries wTag wSamp q ≤ qOut ∧
CostedOpsSizeHonest O ∧
CostedSampSizeHonest I.smp ∧
∀ (B : ℕ),
(∀ v : aOut.denote, CostedFits B aOut v) →
∀ (A : aIn.denote → OracleComp (unifSpec + G) aOut.denote),
(∀ a, ReductionDsl.AllGameQueriesFit B C (A a)) →
∀ (x : rIn.denote), CostedFits B rIn x →
∀ (dflt : aOut.denote),
let widthB := 2 * (costBudget + 2 * q + 1) * (B + 1)
∀ cm ∈ ReductionDsl.supportWhen (I.AnswerFits B) (R.eval1 A x q dflt),
CostedFits widthB ch cm.1 ∧
CostedMidFits widthB R.π R.σ ch cm.2 ∧
∀ (y : rIn2.denote), CostedFits B rIn2 y →
∀ z ∈ ReductionDsl.supportWhen (I.AnswerFits B) (R.eval2 cm.2 y q dflt),
CostedFits widthB out zdef GRedCostByKind
Per-kind step-cost and target-query bound for a 1-stage CostedReduction whose game queries are partitioned by kind : κ → Fin n with per-kind budgets qKind: each query pays only its own kind's handler cost (CostBoundedByKind), and total target queries over (List. qKind).sum source queries are at most qOut. Paired alongside GRedBounded for size-honesty and run-local value-size bounds.
def GRedCostByKind {S : ReductionDsl.Sig}
{O : ReductionDsl.Ops S} {ι κ : Type}
{T : OracleSpec ι} {I : ReductionDsl.Iface S T} {G : OracleSpec κ}
{C : ReductionDsl.GameCodec S G} {rIn aIn aOut out : ReductionDsl.Ty S}
(R : ReductionDsl.CostedReduction O I G C rIn aIn aOut out)
(wTag : I.Tag → ℕ) (wSamp : I.smp.Samp → ℕ)
{n : ℕ} (kind : κ → Fin n) (qKind : Fin n → ℕ) (qOut costBudget : ℕ) : Prop :=
R.CostBoundedByKind kind qKind costBudget ∧
R.totalQueries wTag wSamp (List.ofFn qKind).sum ≤ qOutdef GRed2CostByKind
Per-kind step-cost and target-query bound for a TwoStageCostedReduction under query partition kind and budgets qKind, requiring CostBoundedByKind across both stages, zero pre-challenge target queries (init, handlePre, chDone), and at most qOut total target queries. Paired alongside GRed2Bounded for size-honesty and run-local value-size bounds.
def GRed2CostByKind {S : ReductionDsl.Sig}
{O : ReductionDsl.Ops S} {ι κ : Type}
{T : OracleSpec ι} {I : ReductionDsl.Iface S T} {G : OracleSpec κ}
{C : ReductionDsl.GameCodec S G} {rIn aIn aOut ch rIn2 out : ReductionDsl.Ty S}
(R : ReductionDsl.TwoStageCostedReduction O I G C rIn aIn aOut ch rIn2 out)
(wTag : I.Tag → ℕ) (wSamp : I.smp.Samp → ℕ)
{n : ℕ} (kind : κ → Fin n) (qKind : Fin n → ℕ) (qOut costBudget : ℕ) : Prop :=
R.CostBoundedByKind kind qKind costBudget ∧
R.init.queries wTag wSamp + R.handlePre.queries wTag wSamp + R.chDone.queries wTag wSamp = 0 ∧
R.totalQueries wTag wSamp (List.ofFn qKind).sum ≤ qOutstructure FsCostedReds
Costed reduction programs for ACD19 Theorem 5 and the per-message AEAD salt and wire hops on libsignal's symmetric ratchet (fsShortBound).
omit [Zero Pt] [SampleableType Pt] in
structure FsCostedReds (C : Crypto) (codec : SignalMessageProtoCodec) (ℓ : ℕ)
(encT : Pt → PublicKey) (idOf : Party → IdentityKey) where
/-- Public-header projection reduction `FSAEAD.pubRed` (`DEV-LS13`). -/
pubRed :
ReductionDsl.CostedReduction
(ReductionDsl.atomicFsOps ℓ Pt C encT)
(ReductionDsl.fsaeadPubTargetIface ℓ Pt)
(FSAEAD.spec
(RatchetSenderState (BitVec 256))
(RatchetReceiverState (BitVec 256) (BitVec 256))
(Header Pt) (LibsignalMsgPublicPart × Plain ℓ) (ℕ × LCt))
(ReductionDsl.fsaeadPubCodec ℓ Pt) .unit .unit .bool .bool
/-- Cumulative chain-PRG reduction `FSAEAD.Thm5.cumulativeChainPrgReduction` at hop index `j`. -/
prgRedZero : (j : ℕ) →
ReductionDsl.TwoStageCostedReduction
(ReductionDsl.atomicFsOps ℓ Pt C encT)
(ReductionDsl.coinOnlyBaseIface ℓ Pt)
(FSAEAD.spec
(RatchetSenderState (BitVec 256))
(RatchetReceiverState (BitVec 256) (BitVec 256))
(Header Pt × LibsignalMsgPublicPart) (Plain ℓ) (ℕ × LCt))
(ReductionDsl.fsaeadRatchetCodec ℓ Pt)
(.prod ReductionDsl.BV256 ReductionDsl.BV256) .unit .bool .unit .unit .bool
/-- Multi-slot OT-CCA reduction `FSAEAD.Thm5.multiSlotOtccaReduction` for chain `la : Bool`. -/
multiRed : (la : Bool) →
ReductionDsl.TwoStageCostedReduction
(ReductionDsl.atomicFsOps ℓ Pt C encT)
(ReductionDsl.slotOtccaTargetIface ℓ Pt)
(FSAEAD.spec
(RatchetSenderState (BitVec 256))
(RatchetReceiverState (BitVec 256) (BitVec 256))
(Header Pt × LibsignalMsgPublicPart) (Plain ℓ) (ℕ × LCt))
(ReductionDsl.fsaeadRatchetCodec ℓ Pt) .unit .unit .bool .unit .unit .bool
/-- Multi-to-single-slot salt-PRF wrapper `slotSaltRed` at hop index `j`. -/
slotSaltRed : (j : ℕ) →
ReductionDsl.CostedReduction
(ReductionDsl.atomicFsOps ℓ Pt C encT)
(ReductionDsl.slotOtccaTargetIface ℓ Pt)
(AEADScheme.otccaSpec (ℕ × (Header Pt × LibsignalMsgPublicPart)) (Plain ℓ) LCt)
(ReductionDsl.slotOtccaCodec ℓ Pt)
.unit .unit .bool .bool
/-- Single-slot salt-PRF reduction `lSaltRed`. -/
lSaltRed :
ReductionDsl.CostedReduction
(ReductionDsl.atomicFsOps ℓ Pt C encT)
(ReductionDsl.saltPrfTargetIface ℓ Pt)
(AEADScheme.otccaSpec (ℕ × (Header Pt × LibsignalMsgPublicPart)) (Plain ℓ) LCt)
(ReductionDsl.slotOtccaCodec ℓ Pt)
.unit .unit .bool .bool
/-- Multi-to-single-slot wire-OT-CCA wrapper `slotWireRed` at hop index `j`. -/
slotWireRed : (j : ℕ) →
ReductionDsl.CostedReduction
(ReductionDsl.atomicFsOps ℓ Pt C encT)
(ReductionDsl.slotOtccaTargetIface ℓ Pt)
(AEADScheme.otccaSpec (ℕ × (Header Pt × LibsignalMsgPublicPart)) (Plain ℓ) LCt)
(ReductionDsl.slotOtccaCodec ℓ Pt)
.unit .unit .bool .bool
/-- Single-slot wire-OT-CCA reduction `lWireRed 0`. -/
lWireRed :
ReductionDsl.CostedReduction
(ReductionDsl.atomicFsOps ℓ Pt C encT)
(ReductionDsl.wireOtccaTargetIface ℓ Pt)
(AEADScheme.otccaSpec (ℕ × (Header Pt × LibsignalMsgPublicPart)) (Plain ℓ) LCt)
(ReductionDsl.slotOtccaCodec ℓ Pt)
.unit .unit .bool .booldef fsCostedBounds
Cost, program-size, query-count, and run-local size bounds for an FsCostedReds bundle at ratchet query bound qR and epoch cap qep.
omit [Zero Pt] [SampleableType Pt] in
def fsCostedBounds {C : Crypto} {codec : SignalMessageProtoCodec} {ℓ : ℕ}
{encT : Pt → PublicKey} {idOf : Party → IdentityKey}
(qR qep : ℕ) (R : FsCostedReds C codec ℓ encT idOf) : Prop :=
let B_adapt := ratchetFsAdapterBudget qR qep
let B_hyb := fsRatchetCostBudget qR qep
GRedBounded R.pubRed (fun _ => 1) (fun _ => 0) qR qR B_adapt ∧
(∀ j < fsSlotCount qR,
GTwoStageBounded (R.prgRedZero (FSAEAD.Thm5.slotToHybridHopIndex qR j)) Empty.elim (fun _ => 0) qR 0 B_hyb) ∧
(∀ la : Bool,
GTwoStageBounded (R.multiRed la) (fun _ => 1) (fun _ => 0) qR qR B_hyb) ∧
(∀ j < fsSlotCount qR,
GRedBounded (R.slotSaltRed (FSAEAD.Thm5.slotToHybridHopIndex qR j)) (fun _ => 1) (fun _ => 0) qR qR B_adapt) ∧
GRedBounded R.lSaltRed (fun _ => 1) (fun _ => 0) qR qR B_adapt ∧
(∀ j < fsSlotCount qR,
GRedBounded (R.slotWireRed (FSAEAD.Thm5.slotToHybridHopIndex qR j)) (fun _ => 1) (fun _ => 0) qR qR B_adapt) ∧
GRedBounded R.lWireRed (fun _ => 1) (fun _ => 0) qR qR B_adaptdef pubToADCosted
omit [Zero Pt] [SampleableType Pt] in
def pubToADCosted {C : Crypto} {codec : SignalMessageProtoCodec} {ℓ : ℕ}
{encT : Pt → PublicKey} {idOf : Party → IdentityKey}
(R : FsCostedReds C codec ℓ encT idOf) (A : FsAdv Pt ℓ) :=
R.pubRed.eval (fun _ => A) ()def multiSlotAdvCosted
omit [Zero Pt] [SampleableType Pt] in
def multiSlotAdvCosted {C : Crypto} {codec : SignalMessageProtoCodec} {ℓ : ℕ}
{encT : Pt → PublicKey} {idOf : Party → IdentityKey}
(qR : ℕ) (R : FsCostedReds C codec ℓ encT idOf) (la : Bool) (A : FsAdv Pt ℓ) :=
evalTwoStage1 (R.multiRed la) qR false (fun _ => pubToADCosted R A) ()def chainPRGTermCosted
Slot j chain-PRG advantage evaluated via R. and R. at query fuel qR.
omit [Zero Pt] [SampleableType Pt] in
noncomputable def chainPRGTermCosted (C : Crypto) {codec : SignalMessageProtoCodec} {ℓ : ℕ}
{encT : Pt → PublicKey} {idOf : Party → IdentityKey}
(qR : ℕ) (R : FsCostedReds C codec ℓ encT idOf) (A : FsAdv Pt ℓ) (j : ℕ) : ℝ≥0∞ :=
(lChainPRG C.F (j / 2)).prgAdvantage
(fun mt => evalTwoStage1 (R.prgRedZero j) qR false (fun _ => pubToADCosted R A) mt)def saltPRFTermCosted
Slot j salt-PRF advantage evaluated on an FsCostedReds bundle.
omit [Zero Pt] [SampleableType Pt] in
noncomputable def saltPRFTermCosted (C : Crypto) {codec : SignalMessageProtoCodec} {ℓ : ℕ}
{encT : Pt → PublicKey} {idOf : Party → IdentityKey}
(qR : ℕ) (R : FsCostedReds C codec ℓ encT idOf) (A : FsAdv Pt ℓ) (j : ℕ) : ℝ≥0∞ :=
let la := FSAEAD.Thm5.isLookaheadHop j
(lSaltPRF32 C.F).prfAdvantage
(R.lSaltRed.eval
(fun _ => (R.slotSaltRed j).eval (fun _ => multiSlotAdvCosted qR R la A) ()) ())def wireOtccaTermCosted
Slot j wire-AEAD OT-CCA advantage evaluated on an FsCostedReds bundle.
omit [Zero Pt] [SampleableType Pt] in
noncomputable def wireOtccaTermCosted (C : Crypto) (codec : SignalMessageProtoCodec) (ℓ : ℕ)
{encT : Pt → PublicKey} {idOf : Party → IdentityKey}
(qR : ℕ) (R : FsCostedReds C codec ℓ encT idOf) (A : FsAdv Pt ℓ) (j : ℕ) : ℝ≥0∞ :=
let la := FSAEAD.Thm5.isLookaheadHop j
(lWire C codec ℓ).wireOtccaAdvantage
(R.lWireRed.eval
(fun _ => (R.slotWireRed j).eval (fun _ => multiSlotAdvCosted qR R la A) ()) ())structure Fig8CostedReds
Costed reduction programs for ACD19 Theorem 1, Lemma 18, Theorem 8, and Theorem 12 on the Fig. 8 SM instance (fig8ShortBound).
structure Fig8CostedReds (Dh : DHFun (BitVec 256) Pt) (encPt : Pt → List (BitVec 8))
(C : Crypto) (codec : SignalMessageProtoCodec) (ℓ : ℕ) (encT : Pt → PublicKey)
(idOf : Party → IdentityKey) (lam : Pt) where
/-- Thm 1 authenticity reduction `Thm1.challSim` (`Δ_SM = 3`). -/
challSim :
ReductionDsl.CostedReduction
(ReductionDsl.atomicFig8Ops ℓ Pt C Dh encPt encT lam)
(ReductionDsl.fig8SmIface ℓ Pt)
(SM.spec (LibsignalSim.Fig8St Pt) (LibsignalMsgPublicPart × Plain ℓ) (BitVec 256) (LibsignalSim.Fig8C Pt))
(ReductionDsl.fig8SmCodec ℓ Pt)
.unit .unit .bool .bool
/-- Lemma 18 blanked privacy reduction `ThmB.privRedB` (`Δ_SM = 3`) at epoch `i`. -/
privRedB : (i : ℕ) →
ReductionDsl.CostedReduction
(ReductionDsl.atomicFig8Ops ℓ Pt C Dh encPt encT lam)
(ReductionDsl.fig8SmIface ℓ Pt)
(SM.spec (LibsignalSim.Fig8St Pt) (LibsignalMsgPublicPart × Plain ℓ) (BitVec 256) (LibsignalSim.Fig8C Pt))
(ReductionDsl.fig8SmCodec ℓ Pt)
.unit .unit .bool .bool
/-- Thm 8 CKA authenticity reduction `redCKAAuth` at `(tL, t)`. -/
redCKAAuth : (tL : Option ℕ) → (t : ℕ) →
ReductionDsl.CostedReduction
(ReductionDsl.atomicFig8Ops ℓ Pt C Dh encPt encT lam)
(ReductionDsl.ckaTargetIface ℓ Pt)
(SM.spec (LibsignalSim.Fig8St Pt) (LibsignalMsgPublicPart × Plain ℓ) (BitVec 256) (LibsignalSim.Fig8C Pt))
(ReductionDsl.fig8SmCodec ℓ Pt)
.unit .unit .bool .bool
/-- Thm 8 PRF-PRNG authenticity reduction `redPRNGAuth` at `(tL, t)`. -/
redPRNGAuth : (tL : Option ℕ) → (t : ℕ) →
ReductionDsl.CostedReduction
(ReductionDsl.atomicFig8Ops ℓ Pt C Dh encPt encT lam)
(ReductionDsl.prngTargetIface ℓ Pt)
(SM.spec (LibsignalSim.Fig8St Pt) (LibsignalMsgPublicPart × Plain ℓ) (BitVec 256) (LibsignalSim.Fig8C Pt))
(ReductionDsl.fig8SmCodec ℓ Pt)
.unit .unit .bool .bool
/-- Thm 8 FS-AEAD authenticity reduction `redFSAuth` at `(j, tL, t)`. -/
redFSAuth : (j : ℕ) → (tL : Option ℕ) → (t : ℕ) →
ReductionDsl.CostedReduction
(ReductionDsl.atomicFig8Ops ℓ Pt C Dh encPt encT lam)
(ReductionDsl.fsaeadHeaderIface ℓ Pt)
(SM.spec (LibsignalSim.Fig8St Pt) (LibsignalMsgPublicPart × Plain ℓ) (BitVec 256) (LibsignalSim.Fig8C Pt))
(ReductionDsl.fig8SmCodec ℓ Pt)
.unit .unit .bool .bool
/-- Thm 12 CKA privacy reduction `redCKAPriv` at `(tL, i)`. -/
redCKAPriv : (tL : Option ℕ) → (i : ℕ) →
ReductionDsl.CostedReduction
(ReductionDsl.atomicFig8Ops ℓ Pt C Dh encPt encT lam)
(ReductionDsl.ckaTargetIface ℓ Pt)
(SM.spec (LibsignalSim.Fig8St Pt) (LibsignalMsgPublicPart × Plain ℓ) (BitVec 256) (LibsignalSim.Fig8C Pt))
(ReductionDsl.fig8SmCodec ℓ Pt)
.unit .unit .bool .bool
/-- Thm 12 PRF-PRNG privacy reduction `redPRNGPriv` at `(tL, i)`. -/
redPRNGPriv : (tL : Option ℕ) → (i : ℕ) →
ReductionDsl.CostedReduction
(ReductionDsl.atomicFig8Ops ℓ Pt C Dh encPt encT lam)
(ReductionDsl.prngTargetIface ℓ Pt)
(SM.spec (LibsignalSim.Fig8St Pt) (LibsignalMsgPublicPart × Plain ℓ) (BitVec 256) (LibsignalSim.Fig8C Pt))
(ReductionDsl.fig8SmCodec ℓ Pt)
.unit .unit .bool .bool
/-- Thm 12 FS-AEAD privacy reduction `redFSPriv` at `(tL, i)`. -/
redFSPriv : (tL : Option ℕ) → (i : ℕ) →
ReductionDsl.CostedReduction
(ReductionDsl.atomicFig8Ops ℓ Pt C Dh encPt encT lam)
(ReductionDsl.fsaeadHeaderIface ℓ Pt)
(SM.spec (LibsignalSim.Fig8St Pt) (LibsignalMsgPublicPart × Plain ℓ) (BitVec 256) (LibsignalSim.Fig8C Pt))
(ReductionDsl.fig8SmCodec ℓ Pt)
.unit .unit .bool .bool
/-- Thm 12 FS-AEAD coin-privacy reduction `redFSPrivCoin` at `(tL, i)`. -/
redFSPrivCoin : (tL : Option ℕ) → (i : ℕ) →
ReductionDsl.CostedReduction
(ReductionDsl.atomicFig8Ops ℓ Pt C Dh encPt encT lam)
(ReductionDsl.fsaeadHeaderIface ℓ Pt)
(SM.spec (LibsignalSim.Fig8St Pt) (LibsignalMsgPublicPart × Plain ℓ) (BitVec 256) (LibsignalSim.Fig8C Pt))
(ReductionDsl.fig8SmCodec ℓ Pt)
.unit .unit .bool .booldef fig8CostedBounds
Step-cost, program-size, query-count, run-local size-honesty, and semantic target-query bounds for a Fig8CostedReds bundle R at SM query bound q and epoch cap qep.
def fig8CostedBounds {Dh : DHFun (BitVec 256) Pt} {encPt : Pt → List (BitVec 8)}
{C : Crypto} {codec : SignalMessageProtoCodec} {ℓ : ℕ} {encT : Pt → PublicKey}
{idOf : Party → IdentityKey} {lam : Pt}
(q qep : ℕ) (R : Fig8CostedReds Dh encPt C codec ℓ encT idOf lam) : Prop :=
let B := ratchetCostBudget q qep
GRedBounded R.challSim (fun _ => 1) (fun _ => 0) q q B ∧
(∀ i < qep + 1,
GRedBounded (R.privRedB i) (fun _ => 1) (fun _ => 0) q q B) ∧
(∀ t < qep + 2, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) t,
GRedBounded (R.redCKAAuth tL t) (fun _ => 1) (fun _ => 0) q (2 * q) B) ∧
(∀ t < qep + 2, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) t,
GRedBounded (R.redPRNGAuth tL t) (fun _ => 1) (fun _ => 0) q (2 + 2 * q) B) ∧
(∀ t < qep + 2, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) t, ∀ j < q,
GRedBounded (R.redFSAuth j tL t) (fun _ => 1) (fun _ => 0) q (2 * q) B) ∧
(∀ i < qep + 1, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) i,
GRedBounded (R.redCKAPriv tL i) (fun _ => 1) (fun _ => 0) q (2 * q) B) ∧
(∀ i < qep + 1, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) i,
GRedBounded (R.redPRNGPriv tL i) (fun _ => 1) (fun _ => 0) q (2 + 2 * q) B) ∧
(∀ i < qep + 1, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) i,
GRedBounded (R.redFSPriv tL i) (fun _ => 1) (fun _ => 0) q (2 * q) B) ∧
(∀ i < qep + 1, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) i,
GRedBounded (R.redFSPrivCoin tL i) (fun _ => 1) (fun _ => 0) q (2 * q) B) ∧
(∀ t < qep + 2, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) t,
∀ A : Fig8Adv Pt ℓ, SM.MakesAtMostQueries A q →
CKA.MakesAtMostQueries ((R.redCKAAuth tL t).eval (fun _ => A) ()) (min (2 * q) (q + 2))) ∧
(∀ i < qep + 1, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) i,
∀ A : Fig8Adv Pt ℓ, SM.MakesAtMostQueries A q →
CKA.MakesAtMostQueries ((R.redCKAPriv tL i).eval (fun _ => A) ()) (min (2 * q) (q + 2))) ∧
(∀ t < qep + 2, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) t,
∀ A : Fig8Adv Pt ℓ, SM.MakesAtMostQueries A q →
PRFPRNG.MakesAtMostQueries ((R.redPRNGAuth tL t).eval (fun _ => A) ())
(min (2 + 2 * q) (q + 3))) ∧
(∀ i < qep + 1, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) i,
∀ A : Fig8Adv Pt ℓ, SM.MakesAtMostQueries A q →
PRFPRNG.MakesAtMostQueries ((R.redPRNGPriv tL i).eval (fun _ => A) ())
(min (2 + 2 * q) (min (q + 3) (2 * qep + 2)))) ∧
(∀ t < qep + 2, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) t, ∀ j < q,
∀ A : Fig8Adv Pt ℓ, SM.MakesAtMostQueries A q →
FSAEAD.MakesAtMostQueries ((R.redFSAuth j tL t).eval (fun _ => A) ())
(min (2 * q) (q + 2))) ∧
(∀ i < qep + 1, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) i,
∀ A : Fig8Adv Pt ℓ, SM.MakesAtMostQueries A q →
FSAEAD.MakesAtMostQueries ((R.redFSPriv tL i).eval (fun _ => A) ())
(min (2 * q) (q + 2))) ∧
(∀ i < qep + 1, ∀ tL ∈ admissibleLastLeakGuesses (2 + 1) i,
∀ A : Fig8Adv Pt ℓ, SM.MakesAtMostQueries A q →
FSAEAD.MakesAtMostQueries ((R.redFSPrivCoin tL i).eval (fun _ => A) ())
(min (2 * q) (q + 2)))end Boundsend CryptoVerification.LibsignalSession