CPA Security of Output Feedback (OFB) Mode #
Output Feedback mode ([KL20], Section 3.6.3, Figure 3.8) encrypts a message of k
blocks under a block function f and a uniform initialization vector iv by adding the keystream
f iv, f (f iv), … to the message blocks. [KL20] (Section 3.6.3, p. 92) states that
OFB mode is CPA-secure whenever f is a pseudorandom function; this file proves a concrete
version of that statement.
The security notion is the left-or-right multiple-encryption experiment of [KL20],
Definition 3.22, using the shared block-mode query/cost/ideal-experiment interface
(BlockModeQuery, BlockModeAdversary, blockModeSelect, blockModeBlocks, blockModeCost,
blockModeIdealExperiment) from RandomFunctionHybrid.lean. By [KL20], Theorem 3.23,
this is equivalent to CPA security.
The proof follows the template of [KL20], Theorem 3.33 (CTR mode):
- The OFB experiment is the real PRF experiment for a reduction that encrypts with its oracle
(
ofbCpaGame_eq_realExperiment); the reduction makes one oracle call per encrypted block (isQueryBounded_ofbReduction). - Against a uniform random function, sampled lazily, the reduction's view differs from fresh
uniform ciphertexts only when some keystream input repeats an earlier input. The chain
collision bound
toOuterMeasure_badChain_lelimits this event to probabilityK (K + ℓ) / 2 ^ nwhen the queries ask at mostKblocks in total and at mostℓblocks each (advantage_idealExperiment_ofbReduction_le). - Fresh uniform ciphertexts do not depend on the challenge bit, so the hybrids and the two PRF
advantages give the final bound (
advantage_ofbCpaGame_le).
The PRF experiments are the concrete ones of Cslib.Crypto.PRF ([BS23], Chapter 4). The
reductions here are typed ProbOracleComp programs without an efficiency certificate. The uniform
statement, with a certified word-level reduction and the asymptotic theorem
PseudorandomFunction.indcpa_ofbWordEncrypt, is in
CslibFrontier/Crypto/Computational/Encryption/OFBMode/Uniform.lean, which reuses
advantage_idealExperiment_ofbReduction_le.
Main definitions #
Cslib.Crypto.ofbOracle,Cslib.Crypto.ofbCpaGame: the OFB encryption oracle and left-or-right experiment.Cslib.Crypto.ofbChainQueries,Cslib.Crypto.ofbQueryProgram,Cslib.Crypto.ofbReduction: the PRF distinguisher built from aBlockModeAdversary.
Main results #
Cslib.Crypto.ofbCpaGame_eq_realExperiment: the OFB experiment is the real PRF experiment for the reduction.Cslib.Crypto.isQueryBounded_ofbReduction: the reduction makes at mostKoracle calls.Cslib.Crypto.advantage_idealExperiment_ofbReduction_le: with a uniform random function, the reduction's view is withinK (K + ℓ) / 2 ^ nofblockModeIdealExperiment.Cslib.Crypto.advantage_ofbCpaGame_randomFunction_le: OFB mode with a uniform random function has left-or-right advantage at most2 K (K + ℓ) / 2 ^ n.Cslib.Crypto.advantage_ofbCpaGame_le: OFB mode with a keyed functionFhas left-or-right advantage at most the PRF advantages of two reductions plus2 K (K + ℓ) / 2 ^ n.
References #
- J. Katz, Y. Lindell, Introduction to Modern Cryptography, 3rd ed., Section 3.6.3 (Figure 3.8, p. 92), Definition 3.22 (p. 74), Theorem 3.23 (p. 75) and Theorem 3.33 (p. 93).
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Chapter 4.
Section 1: The OFB Left-or-Right Experiment #
The OFB left-or-right oracle for the block function f and the challenge bit b: a fresh
uniform initialization vector and the OFB encryption of the selected plaintext
([KL20], Section 3.6.3, Figure 3.8).
The OFB left-or-right experiment for the keyed block function F with challenge bit b
([KL20], Definition 3.22): a uniform key, then the adversary with oracle access to OFB
encryption under that key.
Section 2: The Reduction to a Pseudorandom Function #
The OFB keystream of length k from x, computed with k calls to a function oracle.
One OFB encryption computed with a function oracle: a private uniform initialization vector, then the keystream from the oracle, added to the selected plaintext.
The PRF distinguisher built from a left-or-right adversary ([KL20], proof of
Theorem 3.33): run the adversary and answer each query by OFB encryption with the oracle, under
the challenge bit b.
The OFB experiment for the keyed block function F is the real PRF experiment for F and
the reduction ofbReduction ℓ b adversary.
The keystream program makes exactly k oracle calls.
If the queries of adversary ask at most K blocks in total, the reduction makes at most
K oracle calls.
Section 3: The Collision Bound for Fresh Sampling #
Section 4: Security of OFB Mode #
The reduction against a uniform random function. If the queries of adversary ask at
most K blocks in total, then with a uniform random function the output of the reduction
ofbReduction ℓ b adversary is within K (K + ℓ) / 2 ^ n of blockModeIdealExperiment, whatever
the challenge bit b.
OFB mode with a uniform random function ([KL20], Section 3.6.3). If the
queries of adversary ask at most K blocks in total and at most ℓ blocks each, its
left-or-right advantage against OFB mode with a uniform random block function is at most
2 K (K + ℓ) / 2 ^ n.
OFB mode is CPA-secure for a pseudorandom function ([KL20], Section 3.6.3,
following the proof of Theorem 3.33). If the queries of adversary ask at most K blocks in
total and at most ℓ blocks each, its left-or-right advantage against OFB mode with the keyed
function F is at most the PRF advantages of the reductions ofbReduction ℓ false adversary and
ofbReduction ℓ true adversary, each making at most K oracle calls
(isQueryBounded_ofbReduction), plus 2 K (K + ℓ) / 2 ^ n.