ECB mode of a word-level block cipher #
The asymptotic form of Boneh–Shoup §4.1.4 ([BS23], pp. 102–106) for a uniform block
cipher E : BlockCipher. A message word is cut into blockLen n-bit blocks, each block is
encrypted under the key, and the results are concatenated (BlockCipher.ecbEncrypt). Security is
one-time semantic security, Attack Game 2.1 with a uniform keyLen n-bit key
(Encryption.DEMOneTimeKeyINDCPAOn), against uniform strict PPT adversaries.
- Theorem 4.1 (pp. 104–106): if
Eis a secure block cipher (BlockCipher.PRP), ECB on messages of at mostℓ ndistinct blocks is semantically secure (BlockCipher.PRP.ecb_demOneTimeKeyINDCPAOn). The reductionBlockCipher.ecbToPrpDistinguisherruns the typed reductionECB.reductionofCslibFrontier.Crypto.Primitives.BlockCipher.ECBagainst the word oracle, and it is uniform strict oracle PPT (BlockCipher.isOraclePPT_ecbToPrpDistinguisher). At each parameter the advantage is exactly twice the block-cipher advantage of that reduction (BlockCipher.advantage_demKeyGameOn_ecbEncrypt), from the typed equation (4.3). - Single-block security (pp. 102, 104): when
ℓ n ≤ 1, every admissible message has at most one block, soecbValidcoincides withecbAdmissible(BlockCipher.ecbValid_eq_ecbAdmissible_of_le_one), and atℓ = 1a secure block cipher gives semantically secure ECB encryption onX^{≤1}(BlockCipher.PRP.ecb_demOneTimeKeyINDCPAOn_one). - Two-block attack (pp. 103–104): on
X^{≤ℓ}, the uniform strict PPT adversaryBlockCipher.ecbTwoBlockAdversary(BlockCipher.isPPT_ecbTwoBlockAdversary) submits0^{2 · blockLen n}and0^{blockLen n} ‖ 1^{blockLen n}and tests whether the twoblockLen n-bit ciphertext halves agree. Whenever2 ≤ ℓ nand1 ≤ E.blockLen nits advantage is1(BlockCipher.advantage_demKeyGameOn_ecbTwoBlockAdversary), soecbEncryptfailsEncryption.DEMOneTimeKeyINDCPAOn (E.ecbAdmissible ℓ)whenever2 ≤ ℓ nand1 ≤ E.blockLen nhold infinitely often (BlockCipher.not_demOneTimeKeyINDCPAOn_ecbEncrypt).
The reduction certificate rewrites the distinguisher as a word program that sends the blocks of the
challenge message to the oracle in one list traversal, certified by
Cslib.Probability.IsOraclePPTOn.mapM_query_take.
Main definitions #
Cslib.Crypto.BlockCipher.ecbEncrypt: ECB encryption of a message word.Cslib.Crypto.BlockCipher.ecbAdmissible,Cslib.Crypto.BlockCipher.ecbValid: the challenge pairs onX^{≤ℓ}(equal lengths, a multiple of the block length, at mostℓ nblocks) and onX_*^{≤ℓ}(also distinct blocks in each message).Cslib.Crypto.BlockCipher.ecbToPrpDistinguisher: the word block-cipher distinguisher.Cslib.Crypto.BlockCipher.ecbTwoBlockAdversary: the word-level two-block attack on ECB.
Main results #
Cslib.Crypto.BlockCipher.PRP.ecb_demOneTimeKeyINDCPAOn: Theorem 4.1.Cslib.Crypto.BlockCipher.PRP.ecb_demOneTimeKeyINDCPAOn_one: single-block (ℓ = 1) ECB semantic security (§4.1.4, pp. 102, 104).Cslib.Crypto.BlockCipher.advantage_demKeyGameOn_ecbEncrypt: equation (4.3) on words.Cslib.Crypto.BlockCipher.isOraclePPT_ecbToPrpDistinguisher: efficiency of the reduction.Cslib.Crypto.BlockCipher.isPPT_ecbTwoBlockAdversary: efficiency ofecbTwoBlockAdversary.Cslib.Crypto.BlockCipher.advantage_demKeyGameOn_ecbTwoBlockAdversary: the two-block attack has advantage1when2 ≤ ℓ nand1 ≤ E.blockLen n.Cslib.Crypto.BlockCipher.not_demOneTimeKeyINDCPAOn_ecbEncrypt: word-level ECB is not semantically secure onecbAdmissible E ℓwhen2 ≤ ℓ nand1 ≤ E.blockLen nhold infinitely often (§4.1.4, pp. 103–104).
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, version 0.6, §4.1.4 and Theorem 4.1 (pp. 102–106).
The blockLen n-bit blocks of a message word: the rows of BitString.listRows, dropping a
final partial block.
ECB encryption of a message word: encrypt each blockLen n-bit block under the key and
concatenate.
The challenge pairs of Attack Game 2.1 for word ECB on X^{≤ℓ}: two messages of the same
length, a multiple of the block length (blockPairValid), of at most ℓ n blocks.
The challenge pairs of Theorem 4.1 on words (X_*^{≤ℓ}): admissible pairs on X^{≤ℓ} whose
two messages each consist of distinct blocks.
The block-cipher distinguisher of Theorem 4.1 on words: the typed reduction ECB.reduction,
for the typed one-time adversary that A induces (its messages cut into blockLen n-bit blocks,
its challenge flattened back into a word), run against the word oracle, each block query sent as
its blockLen n bits and each reply read back as a block.
Admissible pairs #
When the block bound is at most 1, every admissible pair on X^{≤ℓ} has at most one block in
each message, so ecbValid coincides with ecbAdmissible.
The real and ideal experiments #
Theorem 4.1, equation (4.3), on words: at each parameter, the one-time advantage of a word
adversary against word ECB with challenge pairs ecbValid E ℓ is twice the block-cipher advantage
of ecbToPrpDistinguisher E ℓ A.
Efficiency of the distinguisher #
Efficiency of the distinguisher. For a polynomial-time block bound ℓ and every uniform
strict PPT one-time adversary A, ecbToPrpDistinguisher E ℓ A is uniform strict oracle PPT.
Theorem 4.1 on words #
Theorem 4.1 ([BS23], pp. 104–106): if E is a secure block cipher, its ECB
cipher restricted to messages of at most ℓ n distinct blocks is semantically secure (Attack
Game 2.1 with a uniform keyLen n-bit key), for every block bound ℓ computable in unary in
polynomial time.
Single-block ECB semantic security ([BS23], §4.1.4, pp. 102, 104): if E is a
secure block cipher, its ECB cipher on messages of at most one blockLen n-bit block
(ecbAdmissible E (fun _ => 1)) is semantically secure. Here X^{≤1} admits pairs of empty
messages (which are equal) and pairs of single blockLen n-bit blocks (the data block space).
The two-block attack on words #
The word-level two-block attack on ECB ([BS23], §4.1.4, pp. 103–104): submit
m₀ = 0^{2 · blockLen n} (two equal 0^{blockLen n} blocks) and
m₁ = 0^{blockLen n} ‖ 1^{blockLen n} (two unequal blocks when 1 ≤ blockLen n), and output
true when the first blockLen n bits of the challenge ciphertext equal the remaining bits.
The two-block attack ecbTwoBlockAdversary is uniform strict PPT for every block cipher E.
At any parameter n with 2 ≤ ℓ n and 1 ≤ E.blockLen n, the word-level two-block attack
ecbTwoBlockAdversary has one-time semantic-security advantage 1 against ecbEncrypt on
ecbAdmissible E ℓ ([BS23], §4.1.4, pp. 103–104).
Word-level ECB is not semantically secure ([BS23], §4.1.4, pp. 103–104): for
every block cipher E and block bound ℓ, if 2 ≤ ℓ n and 1 ≤ E.blockLen n hold for
infinitely many parameters n, then ecbEncrypt does not satisfy one-time semantic security on
ecbAdmissible E ℓ.