Documentation

CslibFrontier.Crypto.Computational.Encryption.BlockModeWord

Word requests as block-mode queries #

In the asymptotic CPA game symmetricCPAGameOn blockPairValid, an adversary at parameter n submits pairs of words. blockModeWordAdversary adversary n reads it as a BlockModeAdversary n for the typed experiments of RandomFunctionHybrid.lean. An admissible request (m₀, m₁) becomes the query made of their n-bit blocks (BitString.toBlocks); the answer (iv, cs) is flattened back into the word iv ++ cs. Inadmissible requests are answered with [] and no query. Word-level reductions for block modes are compared with the typed reductions through this adapter, which inherits a block budget from the word adversary's query budget.

Main definitions #

Main results #

One word request as a block-mode query: an admissible pair is sent as the n-bit blocks of both messages, and the answer (iv, cs) is returned as the word iv ++ cs. An inadmissible request is answered with [] and no query.

A word CPA adversary at parameter n, with empty auxiliary input, as a block-mode adversary.

theorem Cslib.Crypto.blockModeSelect_toBlocks {n ℓ : ℕ} {m₀ m₁ : List Bool} (bit : Bool) (hvalid : blockPairValid n m₀ m₁ = true) (hℓ : m₀.length / n ≤ ℓ) :

An admissible pair whose messages have at most ℓ blocks selects the blocks of the message chosen by bit.

If the word adversary makes at most Q requests, the block-mode adversary asks for at most Q * ℓ blocks, counting each query's blocks only up to the cap ℓ as blockModeCost ℓ does.