Electronic codebook (ECB) mode #
The ℓ-wise ECB cipher derived from a block cipher E encrypts a sequence of at most ℓ data
blocks block by block, E′(k, m) = (E(k, m[0]), …, E(k, m[v-1])) ([BS23], §4.1.4,
pp. 102–106). This file gives the concrete single-cipher analysis underlying Section 4.1.4; the
asymptotic statements for a uniform block cipher are in
CslibFrontier.Crypto.Computational.Encryption.ECB.
- Concrete two-block attack: on two-block messages,
m₀with two equal blocks andm₁with two distinct blocks, the adversary that checks whether the two ciphertext blocks are equal has advantage1(ECB.advantage_twoBlockAdversary) against the ECB cipher of every fixed block cipher and key law (the attack of [BS23], §4.1.4, pp. 103–104 for one fixed cipher; the asymptotic statement isBlockCipher.not_demOneTimeKeyINDCPAOn_ecbEncrypt). - Theorem 4.1, equation (4.3): with the message space restricted to sequences of at most
ℓdistinct blocks, every adversaryAin Attack Game 2.1 against ECB has advantage exactly twice the block-cipher advantage of the explicit adversaryECB.reduction ℓ A(ECB.advantage_eq_two_mul_prpAdvantage), which makes at mostℓqueries (ECB.isQueryBounded_reduction).
Main definitions #
Cslib.Crypto.Cipher.ecb E: the ECB cipher of the block cipherE : Key → Equiv.Perm D, on lists of blocks of any length.Cslib.Crypto.ECB.admissible ℓ: the challenge pairs of Attack Game 2.1 for the message spaceX^{≤ℓ}, two messages of the same length at mostℓ;ECB.distinctAdmissible ℓalso asks that each message consist of distinct blocks, the message spaceX_*^{≤ℓ}of Theorem 4.1.Cslib.Crypto.ECB.twoBlockAdversary x y: the two-block attack.Cslib.Crypto.ECB.reduction ℓ A: the block-cipher adversary of the proof of Theorem 4.1. It draws the hidden bit itself, answersA's challenge by querying its oracle on the blocks of the selected message, and outputs whetherAguessed the bit.
Main results #
Cslib.Crypto.Cipher.ecb_correct: ECB decrypts every encryption.Cslib.Crypto.ECB.advantage_twoBlockAdversary: the two-block attack has advantage1, for2 ≤ ℓand two distinct blocksx ≠ y.Cslib.Crypto.ECB.advantage_eq_two_mul_prpAdvantage:SSadv[A, E′] = 2 · BCadv[B, E]forB = ECB.reduction ℓ A, equation (4.3).Cslib.Crypto.ECB.isQueryBounded_reduction:ECB.reduction ℓ Amakes at mostℓqueries.
The statements are for a fixed block cipher (the concrete attack and equation (4.3)); the
asymptotic statements (BlockCipher.PRP.ecb_demOneTimeKeyINDCPAOn,
BlockCipher.PRP.ecb_demOneTimeKeyINDCPAOn_one, and
BlockCipher.not_demOneTimeKeyINDCPAOn_ecbEncrypt) are proved in
CslibFrontier.Crypto.Computational.Encryption.ECB. The block-cipher advantage is PRP.advantage
(Attack Game 4.1), against a uniform key and a uniform permutation.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, version 0.6, §4.1.4 (pp. 102–106) and Theorem 4.1 (pp. 104–105).
The ECB cipher of a block cipher E ([BS23], §4.1.4, p. 102): encrypt and decrypt
every block separately under the same key. The book's ℓ-wise cipher is defined on X^{≤ℓ}; here
encryption is defined on lists of any length, and the bound ℓ enters through the admissible
challenge pairs (ECB.admissible).
ECB decrypts every encryption.
The challenge pairs of Attack Game 2.1 for the message space X_*^{≤ℓ} of Theorem 4.1: two
messages of the same length, at most ℓ, each consisting of distinct blocks.
The two-block attack #
The two-block attack on ECB ([BS23], §4.1.4, pp. 103–104): submit m₀ = (x, x) and
m₁ = (x, y) and output true exactly when the two ciphertext blocks are equal.
The typed two-block attack has advantage 1 against the ECB cipher of every fixed block
cipher and key law, for 2 ≤ ℓ and distinct blocks: the attack of [BS23] §4.1.4
(pp. 103–104) for one fixed cipher; the asymptotic statement is
BlockCipher.not_demOneTimeKeyINDCPAOn_ecbEncrypt in
CslibFrontier.Crypto.Computational.Encryption.ECB.
Theorem 4.1 #
The block-cipher adversary of the proof of Theorem 4.1 ([BS23], p. 106). It draws
the hidden bit b, runs A's first stage, and on an admissible pair answers the challenge by
querying its oracle on the blocks of m_b; it outputs whether A's guess equals b. On an
inadmissible pair it outputs whether false equals b, as the challenger of Attack Game 2.1
returns false there.
ECB.reduction ℓ A makes at most ℓ queries, one per block of the challenge message.
Theorem 4.1, equation (4.3) ([BS23], pp. 104–105): for the ECB cipher of a
block cipher E over finite types, with challenge pairs restricted to sequences of at most ℓ
distinct blocks, every one-time adversary A has semantic-security advantage exactly twice the
block-cipher advantage of ECB.reduction ℓ A, which makes at most ℓ queries
(ECB.isQueryBounded_reduction). Keys are uniform. This is the concrete identity for a fixed
block cipher; the asymptotic statement is BlockCipher.PRP.ecb_demOneTimeKeyINDCPAOn in
CslibFrontier.Crypto.Computational.Encryption.ECB.