The PRF reduction for random-IV modes #
A random-IV mode encrypts as the envelope ivModeEncrypt body of IVStream.lean: it draws a
uniform n-bit initial value iv and outputs iv followed by a body computed from the key,
iv and the message. Randomized counter mode and output feedback mode are the stream case, whose
body XORs the message with a keystream. The reduction of the proof of [BS23],
Theorem 5.3, written there for counter mode, works for any such mode built from a pseudorandom
function: the PRF distinguisher runs the CPA adversary and answers each admissible left-or-right
request itself, drawing the initial value and computing the body with queries to its own function
oracle. The modes differ only in the program bodyQueries n iv msg that computes the body of
message msg from initial value iv; the program may depend on the message, as CBC mode's does.
ivModeToPrfDistinguisher bodyQueries is the reduction for any such program.
- The distinguisher is uniform strict oracle PPT whenever the adversary is,
bodyQueriesis strict oracle PPT on(1ⁿ, iv, msg)and no output ofbodyQueriesis longer than the message (isOraclePPT_ivModeToPrfDistinguisher). - Against the keyed oracle, if the body queries compute
body n k iv msgfrom everyn-bit initial value on whole-block messages, its output law is that of the adversary in the CPA game ofivModeEncrypt body(eval_prfRealGame_ivModeToPrfDistinguisher). - Against a uniform random function, if the body queries compute the bits of the blocks that a
typed per-query program computes, it is that program simulated on the adversary read as a
block-mode adversary (
blockModeWordAdversary) (eval_prfIdealGame_ivModeToPrfDistinguisher). The typed collision bounds of each mode then apply.
The stream case ivStreamToPrfDistinguisher keystreamQueries takes a program
keystreamQueries n iv blocks that obtains the keystream of blocks blocks; its three results
(isOraclePPT_ivStreamToPrfDistinguisher, eval_prfRealGame_ivStreamToPrfDistinguisher,
eval_prfIdealGame_ivStreamToPrfDistinguisher) are instances of the three above.
Main definitions #
Cslib.Crypto.ivModeToPrfDistinguisher: the PRF distinguisher built from a CPA adversary.Cslib.Crypto.ivStreamToPrfDistinguisher: the stream case, for keystream queries.
Main results #
Cslib.Crypto.isOraclePPT_ivModeToPrfDistinguisher,Cslib.Crypto.isOraclePPT_ivModeToPrfDistinguisher_blockLen,Cslib.Crypto.isOraclePPT_ivStreamToPrfDistinguisher: the reduction is uniform strict oracle PPT.Cslib.Crypto.eval_prfRealGame_ivModeToPrfDistinguisher,Cslib.Crypto.eval_prfRealGame_ivStreamToPrfDistinguisher: the real PRF game of the reduction is the CPA game.Cslib.Crypto.eval_prfIdealGame_ivModeToPrfDistinguisher,Cslib.Crypto.eval_prfIdealGame_ivStreamToPrfDistinguisher: the ideal PRF game of the reduction is a typed block-mode reduction against a random function.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Theorem 5.3 (printed p. 191).
The PRF distinguisher built from a left-or-right CPA adversary against a random-IV mode with
body queries bodyQueries ([BS23], proof of Theorem 5.3): run the adversary and answer
every request itself. On an admissible pair it draws a uniform n-bit initial value and answers
with that value followed by the body that bodyQueries computes, with queries to the function
oracle, for the message selected by bit; it answers an inadmissible request with [] and no
query.
Efficiency #
Efficiency of the reduction at a reindexed block length. When blockLen is computable in
polynomial time in unary, running ivModeToPrfDistinguisher at block width blockLen n on
adversary n [] is uniform strict oracle PPT whenever adversary is.
Efficiency of the reduction. If the body queries are strict oracle PPT on
(1ⁿ, iv, msg) and none of their outputs is longer than the message, then for every uniform
strict oracle-PPT adversary, ivModeToPrfDistinguisher bodyQueries adversary bit is uniform
strict oracle PPT. The length condition is sufficient, not necessary: a mode whose body is longer
than the message is not covered.
The real game #
Real game. If, under every key of length n, the body queries answered by the keyed
oracle compute body n k iv msg from every n-bit initial value iv on every whole-block
message msg, then against the keyed oracle ivModeToPrfDistinguisher bodyQueries adversary bit
has the output law of adversary in the CPA game of ivModeEncrypt body with challenge bit
bit.
The ideal game #
Ideal game. Suppose that against every function f, the typed program program q
answers each block-mode query as the block-mode oracle of bodyBlocks f with cap ℓ and
challenge bit bit does, and the body queries from the bits of iv, answered by the
random-function oracle of f, compute on every whole-block message m the bits of
bodyBlocks f iv applied to the blocks of m. Then against a uniform random function, the
reduction is program simulated on the block-mode adversary, for an adversary whose requests
have left messages of at most ℓ blocks. The hypothesis hℓ constrains every request,
admissible or not.
Stream encryption #
The PRF distinguisher built from a left-or-right CPA adversary against stream encryption with
keystream queries keystreamQueries ([BS23], proof of Theorem 5.3): the random-IV
reduction ivModeToPrfDistinguisher whose body obtains the keystream of msg.length / n blocks
and XORs it with the message.
Efficiency of the reduction. If the keystream queries are strict oracle PPT on
(1ⁿ, iv, 1^blocks), then for every uniform strict oracle-PPT adversary,
ivStreamToPrfDistinguisher keystreamQueries adversary bit is uniform strict oracle PPT.
Real game. If, under every key of length n, the keystream queries answered by the keyed
oracle compute keystream n k iv blocks from every n-bit initial value iv, then against the
keyed oracle ivStreamToPrfDistinguisher keystreamQueries adversary bit has the output law of
adversary in the CPA game of ivStreamEncrypt keystream with challenge bit bit.
Ideal game. Suppose that against every function f, the typed keystream program
typedQueries iv blocks computes the blocks blocks keystreamBlocks f iv blocks, and the
keystream queries from the bits of iv, answered by the random-function oracle of f, compute
the bits of those blocks. Then against a uniform random function, the reduction for an adversary
whose requests have at most ℓ bits is the typed reduction blockModeReduction typedQueries ℓ bit
for the block-mode adversary.