Documentation

CslibFrontier.Crypto.Primitives.IdealCipher.Compression

Collision Resistance in the Ideal Cipher Model #

We define the collision-resistance game (collisionGame) for a compression function built from an ideal block cipher over Key and Block, played by a CollisionFinder, record the inverse-query break of cipherOutput ([KL20], Exercise 7.23(a)), and prove the Ideal-Cipher collision-resistance upper bound for the Davies–Meyer construction daviesMeyer ([KL20], Section 7.3.1, Figure 7.11, Theorem 7.5). The bound proved is that of [BS23], Section 8.5.3, Theorem 8.4, p. 302.

Specifically, for every randomized adaptive finder A (CollisionFinder, a ProbOracleComp with private coins) making at most Q forward and inverse ideal-cipher queries (A.IsQueryBounded Q), daviesMeyer_collisionGame_le fixes private coins via ProbOracleComp.coinLaw, reduces each coin-fixed run to the forgetful ideal-cipher oracle via abs_sub_uniformPerm_forgetful_le, and bounds the forgetful collision probability via OracleComp.toOuterMeasure_bad_choose_two_le, yielding Pr[collisionGame daviesMeyer A] ≤ 2 * ((Q + 2).choose 2 : ℝ) * (Fintype.card Block)⁻¹ (equivalently ((Q + 2) * (Q + 1) : ℝ) * (Fintype.card Block)⁻¹), Boneh–Shoup's (q + 1)(q + 2)/|X| with q = Q. The + 2 counts the two forward queries on the finder's output pair that daviesMeyerCollisionProgram appends. daviesMeyer F (k, x) = F k x + x is Boneh–Shoup's h_DM(x, y) = E(y, x) ⊕ x (Section 8.5.2, p. 300) with its arguments swapped, over any finite additive group of blocks in place of {0, 1}ⁿ under XOR.

Main definitions #

Main results #

References #

@[reducible, inline]

A collision finder against a compression function Key × Block → Block built from an ideal cipher: an adaptive oracle program with private coins (ProbOracleComp) and forward and inverse ideal-cipher queries that outputs two candidate inputs.

def Cslib.IdealCipher.collides {α β : Type} [DecidableEq α] [DecidableEq β] (x₁ x₂ : α) (h₁ h₂ : β) :

The winning test: the inputs x₁ and x₂ differ and their digests h₁ and h₂ agree.

noncomputable def Cslib.IdealCipher.daviesMeyerCollisionProgram {Key Block : Type} [DecidableEq Key] [DecidableEq Block] [Add Block] (A : OracleComp (Spec Key Block) ((Key × Block) × Key × Block)) :
OracleComp (Spec Key Block) Bool

Wrap a coin-fixed adversary A with two final forward queries on its candidate pair and test the Davies–Meyer digests E_k(x) + x with collides.

theorem Cslib.IdealCipher.isQueryBounded_daviesMeyerCollisionProgram {Key Block : Type} [DecidableEq Key] [DecidableEq Block] [Add Block] {A : OracleComp (Spec Key Block) ((Key × Block) × Key × Block)} {Q : ℕ} (hQ : A.IsQueryBounded Q) :

Appending two forward queries adds 2 to a coin-fixed adversary's query bound.

noncomputable def Cslib.IdealCipher.collisionGame {Key Block : Type} [DecidableEq Key] [Fintype Key] [DecidableEq Block] [Fintype Block] (H : (Key → Equiv.Perm Block) → Key × Block → Block) (A : CollisionFinder Key Block) :

The collision-resistance game for a compression function H built from a block cipher. The randomized adversary A has private coins and oracle access to the ideal cipher E and its inverse, and wins when its candidates x₁ and x₂ collide under H E.

def Cslib.IdealCipher.cipherOutputAdversary {Key Block : Type} (k1 k2 : Key) (y : Block) :
ProbOracleComp (Spec Key Block) ((Key × Block) × Key × Block)

An adversary that finds a collision in cipherOutput using two inverse queries.

Exercise 7.23(a) ([KL20], Section 7.3.1): cipherOutputAdversary finds a collision for cipherOutput with probability 1.

For daviesMeyer, collisionGame averages over A's private coins (ProbOracleComp.coinLaw) the execution of daviesMeyerCollisionProgram (ProbOracleComp.fixCoins A ω) against uniformly chosen independent permutations E : Key → Equiv.Perm Block.

theorem Cslib.IdealCipher.daviesMeyer_collision_difference_bound {Key Block : Type} [DecidableEq Key] [Fintype Key] [DecidableEq Block] [Fintype Block] [Nonempty Block] [AddGroup Block] {A : OracleComp (Spec Key Block) ((Key × Block) × Key × Block)} {Q : ℕ} (hQ : A.IsQueryBounded Q) :

Switching bound between the real ideal cipher and the forgetful sampler on daviesMeyerCollisionProgram A for a coin-fixed finder A.

Davies–Meyer Ideal-Cipher Collision Resistance ([KL20], Section 7.3.1, Theorem 7.5): every randomized adaptive collision finder A (CollisionFinder, with private coins) making at most Q forward and inverse ideal-cipher queries on every path (A.IsQueryBounded Q) finds a collision in daviesMeyer with probability at most 2 * ((Q + 2).choose 2) * (Fintype.card Block)⁻¹. This is the bound (q + 1)(q + 2)/|X| of [BS23], Section 8.5.3, Theorem 8.4, p. 302, with q = Q, written as 2 · C(Q + 2, 2)/|X|; daviesMeyer_collisionGame_mul_le writes it as a product.

collisionGame evaluates the two digests itself, without charging them to A. The Q + 2 is the query count of the proof's daviesMeyerCollisionProgram, which appends two forward queries on each coin-fixed execution's outputs: Boneh–Shoup's "reasonable" adversary, with q' = q + 2 queries. No bound on local running time is required.

Equivalent product form ((Q + 2) * (Q + 1) : ℝ) * (Fintype.card Block)⁻¹ of daviesMeyer_collisionGame_le ([KL20], Theorem 7.5), for randomized adaptive finders making at most Q queries. It is the bound (q + 1)(q + 2)/|X| of [BS23], Section 8.5.3, Theorem 8.4, p. 302, with q = Q.