Computational PRF and MAC Security for CBC-MAC and Length-Prepended CBC-MAC #
This module lifts the finite uniform-random-function bounds of
CslibFrontier.Crypto.Primitives.BlockCipher.CBCMAC and
CslibFrontier.Crypto.Primitives.BlockCipher.LengthPrependedCBCMAC to uniform computational
pseudorandom-function (PRF) and adaptive chosen-message MAC (SUFCMA, EUFCMA) security over a
length-preserving keyed block-function family (PseudorandomFunction), completing #6046:
- Prefix-free CBC-MAC is a computational prefix-free PRF ([BS23], Section 6.4.1,
Theorem 6.3, printed pp. 226–229): for any
PseudorandomFunction familyand unary polynomial-time block-count capℓ : ℕ → ℕ, basic zero-IV CBC-MAC (cbcMacFamily family) is indistinguishable from a uniform random function on nonempty whole-block messages of at mostℓ nblocks (cbcBlockValid ℓ) against every uniform strict oracle-PPT prefix-free distinguisher (PseudorandomFunction.prefixFreePRF_cbcMac), via the certified reductioncbcMacToPrfDistinguisherand concrete game-hop boundadvantage_cbcMac_le. Specializing to fixedℓ n-block messages (0 < ℓ n) gives standardPseudorandomFunctionOversecurity (PseudorandomFunction.prfOver_cbcMac) andMACSchemeSUFCMAsecurity (PseudorandomFunction.sufCma_cbcFixedBlockMAC, withEUFCMAviaMACScheme.SUFCMA.eufCma). As a CBC-MAC step toward #5801's open cascade / extendable-PRF / extension-attack item (after [BS23], Section 6.4.3, pp. 230–231; cascadeF*and Definition 6.4 remain open), the 1-query length-extension forgercbcExtensionForgerbreaks variable-lengthMACSUFCMAOnandPseudorandomFunctionOnfor every length-preserving family (not_macSufCmaOn_cbcMacFamily,not_prfOn_cbcMacFamily). - Length-prepended CBC-MAC is a variable-length PRF and adaptive MAC ([BS23],
Section 6.4.1 Theorem 6.3, pp. 226–229, Section 6.6.1 Method 1 via Section 6.6 Theorem 6.8,
pp. 235–236, and Section 6.3 Theorem 6.2, p. 224):
prepending the
n-bit little-endian binary block countBitString.lowBits n (msg.length / n)makes whole-block messages of0toL nblocks (empty message included) prefix-free wheneverL n < 2 ^ n, which holds eventually for every unary polynomial-time scheduleL. UnderPseudorandomFunction familyandComputableInPolyTime L encUnary encUnaryalone,lengthPrependedCbcMacFamily familyis a full variable-length computational PRF onlpBlockValid L(PseudorandomFunction.prfOn_lengthPrependedCbcMac) and satisfies adaptive chosen-message unforgeability onlpBlockValid L(PseudorandomFunction.macSufCmaOn_lengthPrependedCbcMac, equivalent toMACEUFCMAOnviamacSufCmaOn_iff_macEufCmaOn), as well asMACScheme.SUFCMAat any unary polynomial-time block-count schedulekincludingk n = 0(PseudorandomFunction.sufCma_lengthPrependedBlockMAC).
Deviations from [BS23] Theorems 6.2, 6.3, and 6.8 #
- Concrete Method 1 specialization of Theorem 6.8. [BS23], Section 6.6, Theorem 6.8
(printed p. 235) states PRF security for an arbitrary prefix-free PRF composed with an arbitrary
prefix-free encoding (see
Cslib.Crypto.PRF.IsPrefixFreeEncodinginCslibFrontier.Crypto.Primitives.PRF.PrefixFreeEncoding). HerelengthPrependedCbcMacFamilyformalizes the concrete Section 6.6.1 Method 1 composition (prependLengthWordfollowed by basic CBC-MAC) over{0,1}^nwhole-block messages of0toL nblocks (including the0-block empty message, so the prepended chain has1toL n + 1blocks). - Uniform strict oracle-PPT adversaries and flat bit-word messages. Following the asymptotic
reading of [BS23], Sections 2.3 and 4.4.5, adversaries are uniform strict
IsOraclePPTprograms overList Boolwithn-bit keys and blocks (|X| = 2 ^ n), and queries outside the declared whole-block domain (cbcBlockValid ℓorlpBlockValid L) receive[]without invoking the keyed family or recording a MAC query, matchingprfRealGameandMACScheme.sufCmaGame. - Execution-based prefix-freeness on valid queries. [BS23], Section 4.6.1,
Definition 4.5 (printed p. 152) and Section 6.4 (p. 226) require all queries of a prefix-free PRF
adversary to lie in
X_{>0}^{≤ ℓ}with no query a proper prefix of another (repeated identical queries permitted). Because invalid word queries are answered with[]in both worlds without reaching CBC-MAC,IsPrefixFreeOn valid outLenimposes no-proper-prefix among valid queries along runs against deterministic oracles that map valid queries tooutLen-bit words and invalid words to[]. On adversaries whose queries all lie incbcBlockValid ℓ n, the two conditions coincide. - Little-endian block-count block.
prependLengthWordwritesv = msg.length / nasBitString.lowBits n v, matchingList.ofFn (blockCountBlock h v)where [BS23], Section 6.6.1, Method 1 (p. 235) writes ann-bit binary representation ofv.
Main definitions #
cbcMacWord,cbcMacFamily,prependLengthWord,lengthPrependedCbcMacWord,lengthPrependedCbcMacFamily: polynomial-time word-level basic and length-prepended CBC-MAC.cbcBlockValid,lpBlockValid: the word-level query domains for both forms of CBC-MAC.cbcInputCodec,lengthPrependedCodec:OracleCodecbridges toCBCOracleSpecandLengthPrependedSpec.cbcMacStep,cbcMacQueries,cbcMacQuery,cbcMacToPrfDistinguisher,lengthPrependedQuery,lengthPrependedToPrfDistinguisher: certified word-oracle PRF reductions.macSigningPairOracleOn,macSigningOracleOn,macSufCmaGameOn,macEufCmaGameOn,MACSUFCMAOn,MACEUFCMAOn,macToPrfOnDistinguisher,lengthPrependedMacToPrfDistinguisher,cbcExtensionForger,cbcFixedBlockMAC,cbcFixedBlockMacToPrfDistinguisher,lengthPrependedBlockMAC: domain-restricted andMACSchemeadaptive chosen-message security games, certified reductions, and extension forger.
Main results #
cbcMacWord_append_block: one-step chaining on aligned words, which preserves equal tags under a common block extension.computableInPolyTime_cbcMacFamily,computableInPolyTime_lengthPrependedCbcMacFamily,ofFn_blockCountBlock: polynomial-time evaluation and exact bit-level agreement withblockCountBlock.isOraclePPT_cbcMacToPrfDistinguisher,advantage_cbcMac_le,PseudorandomFunction.prefixFreePRF_cbcMac,PseudorandomFunction.prfOver_cbcMac: certified reduction, concrete advantage bound, and asymptotic prefix-free / fixed-block PRF security for basic CBC-MAC ([BS23], Theorem 6.3, pp. 226–229).isOraclePPT_lengthPrependedToPrfDistinguisher,advantage_lengthPrependedCbcMac_le,PseudorandomFunction.prfOn_lengthPrependedCbcMac,PseudorandomFunction.prfOver_lengthPrependedCbcMac: certified reduction, concrete advantage bound, and variable-length / fixed-block PRF security for length-prepended CBC-MAC ([BS23], Theorems 6.3 and 6.8, pp. 226–229 and 235–236).eval_macSufCmaGameOn_eq_macEufCmaGameOn,macSufCmaOn_iff_macEufCmaOn,isOraclePPT_macToPrfOnDistinguisher,succProbability_macSufCmaGameOn_le,PseudorandomFunctionOn.macSufCmaOn,isOraclePPT_lengthPrependedMacToPrfDistinguisher,succProbability_macSufCmaGameOn_lengthPrependedCbcMac_le,PseudorandomFunction.macSufCmaOn_lengthPrependedCbcMac: certified forger-to-PRF reductions, concrete forgery bounds, and adaptiveMACSUFCMAOnsecurity on variable-length whole-block messages ([BS23], Theorems 6.2, 6.3, and 6.8).isOraclePPT_cbcExtensionForger,eval_macSufCmaGameOn_cbcMacFamily_cbcExtensionForger,not_macSufCmaOn_cbcMacFamily,not_prfOn_cbcMacFamily: CBC-MAC length-extension step toward #5801 after [BS23], Section 6.4.3 (pp. 230–231; cascadeF*and Definition 6.4 remain open).isOraclePPT_cbcFixedBlockMacToPrfDistinguisher,succProbability_sufCmaGame_cbcFixedBlockMAC_le,PseudorandomFunction.sufCma_cbcFixedBlockMAC,PseudorandomFunction.sufCma_lengthPrependedBlockMAC:MACSchemeSUFCMAcorollaries.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 4.4.1 (Attack Game 4.2 and Definition 4.2, pp. 132–133), Section 4.6.1 (Definition 4.5, p. 152), Section 6.1 (Attack Game 6.1 and Definition 6.2, pp. 218–219), Section 6.3 (Theorem 6.2, p. 224), Section 6.4.1 (Figure 6.3a and Theorem 6.3, pp. 226–229), Section 6.4.3 (pp. 230–231), and Sections 6.6–6.6.1 (Theorem 6.8 and Method 1, pp. 235–236).
Section 1: Word-Level Basic and Length-Prepended CBC-MAC #
Word-level basic CBC-MAC ([BS23], Section 6.4.1, Figure 6.3a, printed p. 226):
starting from the n-bit zero block List.replicate n false, XOR the chaining block with each
n-bit block of msg and apply family key truncated to n bits. Truncating step outputs keeps
the chaining state bounded on all inputs while leaving n-bit block evaluations unchanged.
Appending one full block to an aligned word advances the CBC-MAC state by one step. In particular, equal tags stay equal after appending the same block, the CBC-MAC extension property used in [BS23], v0.6, §7.2.2, printed p. 258.
When family key maps n-bit blocks to n-bit blocks, lengthPrependedCbcMacWord outputs n
bits.
When family is length-preserving, lengthPrependedCbcMacFamily family key msg has
key.length bits.
cbcMacFamily family is computable in deterministic polynomial time whenever family is.
lengthPrependedCbcMacFamily family is computable in deterministic polynomial time whenever
family is.
Section 2: CBC-MAC Query Domains #
cbcBlockValid ℓ is computable in polynomial time whenever ℓ is computable in polynomial time
in unary.
lpBlockValid L is computable in polynomial time whenever L is computable in polynomial time
in unary.
Section 3: Typed Codec Bridges to CBCOracleSpec and LengthPrependedSpec #
Word-to-typed codec identifying cbcBlockValid (fun _ => ℓ) n word queries (0 < n) with
CBCInput n ℓ and n-bit replies.
Word-to-typed codec identifying lpBlockValid (fun _ => L) n word queries (L < 2 ^ n) with
LengthPrependedInput n L and n-bit replies, including [] and n = 0, L = 0.
Section 4: Certified PRF Reductions and Concrete & Asymptotic PRF Security #
One CBC-MAC oracle query step: XOR the n-bit chaining block state with the next message
block, query the external block-function oracle, and truncate the reply to n bits.
Compute cbcMacWord of msg from a word oracle using one n-truncated oracle query per
n-bit block of msg, starting from List.replicate n false.
Against any deterministic oracle g, cbcMacQueries n msg computes cbcMacWord for g.
Answer a word request to basic CBC-MAC on cbcBlockValid ℓ n: valid nonempty bounded
whole-block messages are evaluated block-by-block via cbcMacQueries n, and invalid requests
receive [] without querying.
Certified PRF reduction for basic CBC-MAC ([BS23], Section 6.4.1, proof of Theorem
6.3, adversary B, printed pp. 227–228): run adversary n aux, answering each cbcBlockValid ℓ n
message with cbcMacQueries n.
Answer a word request to length-prepended CBC-MAC on lpBlockValid L n: valid whole-block
messages of at most L n blocks prepend BitString.lowBits n (msg.length / n) and run
cbcMacQueries n; invalid requests receive [] without querying.
Certified PRF reduction for length-prepended CBC-MAC ([BS23], Sections 6.4.1 and
6.6.1, Theorems 6.3 and 6.8, printed pp. 226–229 and 235–236): run adversary n aux, answering
each lpBlockValid L n message with cbcMacQueries n (prependLengthWord n msg).
cbcMacToPrfDistinguisher ℓ adversary is uniform strict oracle PPT whenever ℓ is unary
polynomial-time and adversary is uniform strict oracle PPT.
lengthPrependedToPrfDistinguisher L adversary is uniform strict oracle PPT whenever L is
unary polynomial-time and adversary is uniform strict oracle PPT.
Against prfRealGame id family, cbcMacToPrfDistinguisher ℓ adversary has the exact output law
of prfRealGameOn (cbcBlockValid ℓ) (cbcMacFamily family) adversary.
Against prfRealGame id family, lengthPrependedToPrfDistinguisher L adversary has the exact
output law of prfRealGameOn (lpBlockValid L) (lengthPrependedCbcMacFamily family) adversary.
Concrete computational PRF bound for prefix-free CBC-MAC ([BS23], Section 6.4.1,
Theorem 6.3, printed pp. 226–229): for any length-preserving family, block-count bound ℓ, and
distinguisher adversary that at parameter n makes at most Q queries and is prefix-free on
cbcBlockValid ℓ n, the domain-restricted PRF advantage of cbcMacFamily family is at most the
length-preserving PRF advantage of cbcMacToPrfDistinguisher ℓ adversary plus
Q ^ 2 * (ℓ n) ^ 2 / (2 * 2 ^ n) (equation (6.7) with |X| = 2 ^ n).
Concrete computational PRF bound for length-prepended CBC-MAC ([BS23], Section
6.4.1 Theorem 6.3 and Section 6.6.1 Method 1 via Section 6.6 Theorem 6.8, printed pp. 226–229 and
235–236): whenever L n < 2 ^ n and adversary makes at most Q queries at parameter
n, the variable-length PRF advantage of lengthPrependedCbcMacFamily family on lpBlockValid L
is at most the length-preserving PRF advantage of lengthPrependedToPrfDistinguisher L adversary
plus Q ^ 2 * (L n + 1) ^ 2 / (2 * 2 ^ n).
Prefix-free CBC-MAC is a prefix-free pseudorandom function ([BS23], Section
6.4.1, Theorem 6.3, printed pp. 226–229): for any PseudorandomFunction family and unary
polynomial-time block-count cap ℓ : ℕ → ℕ, basic CBC-MAC cbcMacFamily family is a
PrefixFreePseudorandomFunctionOn (cbcBlockValid ℓ) id.
Variable-length length-prepended CBC-MAC is a pseudorandom function ([BS23],
Section 6.4.1 Theorem 6.3, pp. 226–229, and Section 6.6.1 Method 1 via Section 6.6 Theorem 6.8,
pp. 235–236): for any PseudorandomFunction family and unary polynomial-time block-count cap
L : ℕ → ℕ, lengthPrependedCbcMacFamily family is a PseudorandomFunctionOn (lpBlockValid L) id
over whole-block messages of 0 to L n blocks (empty message included).
Fixed-block-count CBC-MAC is a pseudorandom function ([BS23], Section 6.4.1,
Theorem 6.3, printed pp. 226–229, specialized to fixed positive block count ℓ n): for any
PseudorandomFunction family and unary polynomial-time ℓ with ∀ n, 0 < ℓ n, cbcMacFamily family satisfies PseudorandomFunctionOver (fun n => ℓ n * n) id.
Fixed-block-count length-prepended CBC-MAC is a pseudorandom function: for any
PseudorandomFunction family and unary polynomial-time block-count schedule k : ℕ → ℕ (including
k n = 0 empty messages), lengthPrependedCbcMacFamily family satisfies
PseudorandomFunctionOver (fun n => k n * n) id.
Section 5: Adaptive Chosen-Message MAC Security (SUFCMA and EUFCMA) #
Pair-logging tagging oracle for a deterministic keyed family tagFamily on message domain
valid n ([BS23], Section 6.1, Attack Game 6.1, printed p. 218): valid messages return
tagFamily sk msg and record (msg, tag); invalid requests receive [] without recording.
Message-logging tagging oracle for a deterministic keyed family tagFamily on valid n: valid
messages return tagFamily sk msg and record msg, while invalid requests receive [] without
recording.
Strong (fresh-pair) adaptive chosen-message experiment on message domain valid
([BS23], Section 6.1, Attack Game 6.1 and Definition 6.2, printed pp. 218–219): sample
sk ← BitString.sampleList n, run adversary n [] with macSigningPairOracleOn, and accept a
valid (msg, tag) pair never returned by the tagging oracle such that tagFamily sk msg == tag.
Ordinary (fresh-message) adaptive chosen-message experiment on message domain valid: sample
sk ← BitString.sampleList n, run adversary n [] with macSigningOracleOn, and accept a valid
message msg never queried to the tagging oracle together with tag = tagFamily sk msg.
Ordinary (fresh-message) existential unforgeability under adaptive chosen-message attack on
message domain valid ([BS23], Attack Game 6.1 and Definition 6.2, printed pp. 218–219,
fresh-message form).
Because tagFamily is deterministic with a unique valid tag tagFamily sk msg per (sk, msg),
macSufCmaGameOn and macEufCmaGameOn have identical output distributions.
macToPrfOnDistinguisher valid adversary is uniform strict oracle PPT whenever valid is
computable in polynomial time on (1ⁿ, msg) and adversary is uniform strict oracle PPT.
A forger making at most Q signing queries yields a PRF distinguisher making at most Q + 1
queries (Q signing queries plus one verification query).
Against prfRealGameOn valid tagFamily, macToPrfOnDistinguisher valid adversary has the exact
output law of macEufCmaGameOn valid tagFamily adversary (and macSufCmaGameOn).
Helper step after [BS23], Section 6.3, proof of Theorem 6.2 (printed p. 224), not the
standalone Theorem 6.2 endpoint (see Cslib.Crypto.PseudorandomFunction.sufCma_prfMAC): in
prfIdealGameOn valid id, macToPrfOnDistinguisher valid adversary succeeds with probability at
most 1 / 2 ^ n.
Helper step after [BS23], Section 6.3, proof of Theorem 6.2 (printed p. 224), not the
standalone Theorem 6.2 endpoint (see Cslib.Crypto.PseudorandomFunction.sufCma_prfMAC): for every
adaptive MAC forger adversary on valid, the strong SUFCMA forgery probability against
tagFamily is at most the prfRealGameOn/prfIdealGameOn advantage of
macToPrfOnDistinguisher valid adversary plus 1 / 2 ^ n.
Helper step after [BS23], Section 6.3, Theorem 6.2 (printed p. 224), not the
standalone Theorem 6.2 endpoint (see Cslib.Crypto.PseudorandomFunction.sufCma_prfMAC): any
PseudorandomFunctionOn valid id with polynomial-time domain predicate valid satisfies
MACSUFCMAOn valid.
Certified reduction from an adaptive variable-length MAC forger against length-prepended
CBC-MAC (lpBlockValid L) to a length-preserving PRF distinguisher ([BS23], Theorems
6.2, 6.3, and 6.8): compose macToPrfOnDistinguisher (lpBlockValid L) with
lengthPrependedToPrfDistinguisher L.
lengthPrependedMacToPrfDistinguisher L adversary is uniform strict oracle PPT whenever L is
unary polynomial-time and adversary is uniform strict oracle PPT.
Concrete adaptive SUFCMA forgery bound for variable-length length-prepended CBC-MAC
([BS23], Section 6.3 Theorem 6.2, Section 6.4.1 Theorem 6.3, and Section 6.6.1 Method 1
via Section 6.6 Theorem 6.8, printed pp. 224, 226–229, and 235–236): whenever L n < 2 ^ n and
adversary makes at most Q signing queries at parameter n, its strong forgery probability on
lpBlockValid L is at most the PRF advantage of lengthPrependedMacToPrfDistinguisher L adversary
plus (Q + 1) ^ 2 * (L n + 1) ^ 2 / (2 * 2 ^ n) + 1 / 2 ^ n.
Variable-length length-prepended CBC-MAC is strongly unforgeable (MACSUFCMAOn)
([BS23], Section 6.3 Theorem 6.2, Section 6.4.1 Theorem 6.3, and Section 6.6.1 Method 1
via Section 6.6 Theorem 6.8, printed pp. 224, 226–229, and 235–236): for any
PseudorandomFunction family and unary polynomial-time block-count cap L : ℕ → ℕ,
lengthPrependedCbcMacFamily family satisfies MACSUFCMAOn (lpBlockValid L) over whole-block
messages of 0 to L n blocks (empty message included).
Length-Extension Attack on Unmodified Zero-IV CBC-MAC #
Classic 1-query length-extension forger against unmodified zero-IV CBC-MAC ([BS23],
Section 6.4.3, printed pp. 230–231): sign the 1-block zero message 0^n, receive t = F_k(0^n),
and output the fresh 2-block forgery (0^n ++ t, t).
Helper step of [BS23], Section 6.4.3 (printed pp. 230–231): at every n ≥ 1,
cbcExtensionForger wins macSufCmaGameOn (lpBlockValid (fun _ => 2)) (cbcMacFamily family) with
probability 1.
CBC-MAC step toward #5801 after [BS23], Section 6.4.3 (printed pp. 230–231), not the
full Section 6.4.2–6.4.3 / Definition 6.4 cascade and extendable-PRF endpoint: for every
length-preserving family (including any PseudorandomFunction), unmodified cbcMacFamily family
fails MACSUFCMAOn (lpBlockValid (fun _ => 2)) (and hence MACEUFCMAOn by
macSufCmaOn_iff_macEufCmaOn).
CBC-MAC step toward #5801 after [BS23], Section 6.4.3 (printed p. 231), not the full
Section 6.4.2–6.4.3 / Definition 6.4 cascade and extendable-PRF endpoint: for every
length-preserving family, unmodified cbcMacFamily family fails
PseudorandomFunctionOn (lpBlockValid (fun _ => 2)) id.
MACScheme Instances for Fixed-Block-Count Schedules #
Deterministic MACScheme authenticating ℓ n * n-bit (ℓ n-block) messages via basic zero-IV
CBC-MAC cbcMacFamily family ([BS23], Section 6.3, p. 223, and Section 6.4.1, Figure
6.3a, printed p. 226).
Certified reduction from an adaptive forger against cbcFixedBlockMAC ℓ to a length-preserving
PRF distinguisher ([BS23], Section 6.3 Theorem 6.2 and Section 6.4.1 Theorem 6.3).
cbcFixedBlockMacToPrfDistinguisher ℓ adversary is uniform strict oracle PPT whenever ℓ is
unary polynomial-time and adversary is uniform strict oracle PPT.
Concrete SUFCMA forgery bound for fixed-block-count basic CBC-MAC ([BS23],
Section 6.3 Theorem 6.2 and Section 6.4.1 Theorem 6.3, printed pp. 224 and 226–229): for 0 < ℓ n,
0 < n, and a forger making at most Q signing queries, the SUFCMA forgery probability against
cbcFixedBlockMAC ℓ hℓ family hpoly is at most the PRF advantage of
cbcFixedBlockMacToPrfDistinguisher ℓ adversary plus
(Q + 1) ^ 2 * (ℓ n) ^ 2 / (2 * 2 ^ n) + 1 / 2 ^ n.
Fixed-block-count basic CBC-MAC is SUFCMA-secure ([BS23], Section 6.3 Theorem
6.2 and Section 6.4.1 Theorem 6.3, printed pp. 224 and 226–229, specialized to fixed positive block
count ℓ n): for any PseudorandomFunction family and unary polynomial-time ℓ with
∀ n, 0 < ℓ n, cbcFixedBlockMAC ℓ hℓ family hF.polyTime satisfies MACScheme.SUFCMA.
Deterministic MACScheme authenticating k n * n-bit (k n-block, k n = 0 permitted)
messages via length-prepended CBC-MAC lengthPrependedCbcMacFamily family.
lengthPrependedBlockMAC is SUFCMA-secure at every unary polynomial-time block-count
schedule k (including k n = 0 empty messages).