Documentation

CslibFrontier.Crypto.Computational.CBCMAC

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:

  1. 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 family and 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 ℓ n blocks (cbcBlockValid ℓ) against every uniform strict oracle-PPT prefix-free distinguisher (PseudorandomFunction.prefixFreePRF_cbcMac), via the certified reduction cbcMacToPrfDistinguisher and concrete game-hop bound advantage_cbcMac_le. Specializing to fixed ℓ n-block messages (0 < ℓ n) gives standard PseudorandomFunctionOver security (PseudorandomFunction.prfOver_cbcMac) and MACScheme SUFCMA security (PseudorandomFunction.sufCma_cbcFixedBlockMAC, with EUFCMA via MACScheme.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; cascade F* and Definition 6.4 remain open), the 1-query length-extension forger cbcExtensionForger breaks variable-length MACSUFCMAOn and PseudorandomFunctionOn for every length-preserving family (not_macSufCmaOn_cbcMacFamily, not_prfOn_cbcMacFamily).
  2. 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 count BitString.lowBits n (msg.length / n) makes whole-block messages of 0 to L n blocks (empty message included) prefix-free whenever L n < 2 ^ n, which holds eventually for every unary polynomial-time schedule L. Under PseudorandomFunction family and ComputableInPolyTime L encUnary encUnary alone, lengthPrependedCbcMacFamily family is a full variable-length computational PRF on lpBlockValid L (PseudorandomFunction.prfOn_lengthPrependedCbcMac) and satisfies adaptive chosen-message unforgeability on lpBlockValid L (PseudorandomFunction.macSufCmaOn_lengthPrependedCbcMac, equivalent to MACEUFCMAOn via macSufCmaOn_iff_macEufCmaOn), as well as MACScheme.SUFCMA at any unary polynomial-time block-count schedule k including k n = 0 (PseudorandomFunction.sufCma_lengthPrependedBlockMAC).

Deviations from [BS23] Theorems 6.2, 6.3, and 6.8 #

Main definitions #

Main results #

References #

Section 1: Word-Level Basic and Length-Prepended CBC-MAC #

def Cslib.Crypto.cbcMacWord (family : List Bool → List Bool → List Bool) (n : ℕ) (key msg : List Bool) :

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.

theorem Cslib.Crypto.cbcMacWord_append_block (family : List Bool → List Bool → List Bool) {n : ℕ} (hn : 0 < n) (key : List Bool) {msg block : List Bool} (hmsg : n ∣ msg.length) (hblock : block.length = n) :
cbcMacWord family n key (msg ++ block) = List.take n (family key (List.zipWith xor (cbcMacWord family n key msg) block))

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.

def Cslib.Crypto.cbcMacFamily (family : List Bool → List Bool → List Bool) (key msg : List Bool) :

Keyed-family presentation of basic CBC-MAC at block width key.length.

Prepend the n-bit little-endian binary block count BitString.lowBits n (msg.length / n) to msg ([BS23], Section 6.6.1, Method 1, printed p. 235).

Word-level length-prepended CBC-MAC ([BS23], Section 6.6.1, Method 1, printed p. 235): prepend the n-bit binary block count msg.length / n and evaluate cbcMacWord.

Keyed-family presentation of length-prepended CBC-MAC at block width key.length.

theorem Cslib.Crypto.length_cbcMacWord {family : List Bool → List Bool → List Bool} {n : ℕ} {key : List Bool} (hlen : ∀ (x : List Bool), x.length = n → (family key x).length = n) (msg : List Bool) :
(cbcMacWord family n key msg).length = n

When family key maps n-bit blocks to n-bit blocks, cbcMacWord always outputs n bits.

theorem Cslib.Crypto.length_cbcMacFamily {family : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) (key msg : List Bool) :
(cbcMacFamily family key msg).length = key.length

When family is length-preserving, cbcMacFamily family key msg has key.length bits.

theorem Cslib.Crypto.length_lengthPrependedCbcMacWord {family : List Bool → List Bool → List Bool} {n : ℕ} {key : List Bool} (hlen : ∀ (x : List Bool), x.length = n → (family key x).length = n) (msg : List Bool) :
(lengthPrependedCbcMacWord family n key msg).length = n

When family key maps n-bit blocks to n-bit blocks, lengthPrependedCbcMacWord outputs n bits.

theorem Cslib.Crypto.length_lengthPrependedCbcMacFamily {family : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) (key msg : List Bool) :

When family is length-preserving, lengthPrependedCbcMacFamily family key msg has key.length bits.

theorem Cslib.Crypto.ofFn_blockCountBlock {n L : ℕ} (h : L < 2 ^ n) (k : Fin (L + 1)) :

The n-bit block blockCountBlock h k flattens to BitString.lowBits n k.val.

Section 2: CBC-MAC Query Domains #

def Cslib.Crypto.cbcBlockValid (ℓ : ℕ → ℕ) (n : ℕ) (msg : List Bool) :

Nonempty whole-block messages of at most ℓ n blocks (X_{>0}^{≤ ℓ n} in [BS23], Section 6.4, printed p. 226). At n = 0, ℓ 0 * 0 = 0, so every message is rejected.

def Cslib.Crypto.lpBlockValid (L : ℕ → ℕ) (n : ℕ) (msg : List Bool) :

Whole-block messages of at most L n blocks, including the empty message [] (X^{≤ L n} in [BS23], Section 6.6, printed p. 235).

theorem Cslib.Crypto.lpBlockValid_spec {L : ℕ → ℕ} {n : ℕ} {word : List Bool} (hWord : lpBlockValid L n word = true) :
n ∣ word.length ∧ word.length ≤ L n * n

A valid bounded block word is aligned and respects its cap in bits, including at width zero.

Section 3: Typed Codec Bridges to CBCOracleSpec and LengthPrependedSpec #

def Cslib.Crypto.cbcInputCodec (n ℓ : ℕ) (hn : 0 < n) :

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.

theorem Cslib.Crypto.run_cbcMacQueries {n : ℕ} (g : List Bool → List Bool) (msg : List Bool) :
(ProbOracleComp.run (cbcMacQueries n msg) fun (request : Unit × List Bool) => pure (g request.2)) = pure (cbcMacWord (fun (x x_1 : List Bool) => g x_1) n [] msg)

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.

theorem Cslib.Crypto.eval_prfRealGame_cbcMacToPrfDistinguisher {family : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) (ℓ : ℕ → ℕ) (adversary : OracleDistinguisher) (n : ℕ) :
(prfRealGame id family (cbcMacToPrfDistinguisher ℓ adversary) n).eval = (prfRealGameOn (cbcBlockValid ℓ) (cbcMacFamily family) adversary n).eval

Against prfRealGame id family, cbcMacToPrfDistinguisher ℓ adversary has the exact output law of prfRealGameOn (cbcBlockValid ℓ) (cbcMacFamily family) adversary.

theorem Cslib.Crypto.eval_prfRealGame_lengthPrependedToPrfDistinguisher {family : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) (L : ℕ → ℕ) (adversary : OracleDistinguisher) (n : ℕ) :

Against prfRealGame id family, lengthPrependedToPrfDistinguisher L adversary has the exact output law of prfRealGameOn (lpBlockValid L) (lengthPrependedCbcMacFamily family) adversary.

theorem Cslib.Crypto.advantage_cbcMac_le {family : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) (ℓ : ℕ → ℕ) (adversary : OracleDistinguisher) {n Q : ℕ} (hQ : ProbOracleComp.IsQueryBounded (adversary n []) Q) (hpf : IsPrefixFreeOn (cbcBlockValid ℓ n) n (adversary n [])) :
Game.advantage (prfRealGameOn (cbcBlockValid ℓ) (cbcMacFamily family) adversary n).eval (prfIdealGameOn (cbcBlockValid ℓ) id adversary n).eval ≤ Game.advantage (prfRealGame id family (cbcMacToPrfDistinguisher ℓ adversary) n).eval (prfIdealGame id id (cbcMacToPrfDistinguisher ℓ adversary) n).eval + ↑Q ^ 2 * ↑(ℓ n) ^ 2 / (2 * 2 ^ n)

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).

theorem Cslib.Crypto.advantage_lengthPrependedCbcMac_le {family : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) (L : ℕ → ℕ) (adversary : OracleDistinguisher) {n Q : ℕ} (hL : L n < 2 ^ n) (hQ : ProbOracleComp.IsQueryBounded (adversary n []) Q) :

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) #

def Cslib.Crypto.macSigningPairOracleOn (valid : ℕ → List Bool → Bool) (tagFamily : List Bool → List Bool → List Bool) (n : ℕ) (sk : List Bool) (request : Unit × List Bool) :

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.

def Cslib.Crypto.macSigningOracleOn (valid : ℕ → List Bool → Bool) (tagFamily : List Bool → List Bool → List Bool) (n : ℕ) (sk : List Bool) (request : Unit × List Bool) :

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.

noncomputable def Cslib.Crypto.macSufCmaGameOn (valid : ℕ → List Bool → Bool) (tagFamily : List Bool → List Bool → List Bool) (adversary : Forger) (n : ℕ) :

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.

noncomputable def Cslib.Crypto.macEufCmaGameOn (valid : ℕ → List Bool → Bool) (tagFamily : List Bool → List Bool → List Bool) (adversary : Forger) (n : ℕ) :

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.

def Cslib.Crypto.MACSUFCMAOn (valid : ℕ → List Bool → Bool) (tagFamily : List Bool → List Bool → List Bool) :

Strong existential unforgeability under adaptive chosen-message attack on message domain valid ([BS23], Attack Game 6.1 and Definition 6.2, printed pp. 218–219).

def Cslib.Crypto.MACEUFCMAOn (valid : ℕ → List Bool → Bool) (tagFamily : List Bool → List Bool → List Bool) :

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).

theorem Cslib.Crypto.eval_macSufCmaGameOn_eq_macEufCmaGameOn (valid : ℕ → List Bool → Bool) (tagFamily : List Bool → List Bool → List Bool) (adversary : Forger) (n : ℕ) :
(macSufCmaGameOn valid tagFamily adversary n).eval = (macEufCmaGameOn valid tagFamily adversary n).eval

Because tagFamily is deterministic with a unique valid tag tagFamily sk msg per (sk, msg), macSufCmaGameOn and macEufCmaGameOn have identical output distributions.

theorem Cslib.Crypto.macSufCmaOn_iff_macEufCmaOn (valid : ℕ → List Bool → Bool) (tagFamily : List Bool → List Bool → List Bool) :
MACSUFCMAOn valid tagFamily ↔ MACEUFCMAOn valid tagFamily

Because tagFamily is deterministic with a unique valid tag per (sk, msg), strong and ordinary adaptive chosen-message unforgeability on valid coincide.

Certified reduction turning an adaptive MAC forger on valid into a domain-restricted PRF distinguisher ([BS23], Section 6.3, Theorem 6.2, printed p. 224).

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.

theorem Cslib.Crypto.isQueryBounded_macToPrfOnDistinguisher (valid : ℕ → List Bool → Bool) (adversary : Forger) {n Q : ℕ} (hQ : ProbOracleComp.IsQueryBounded (adversary n []) Q) :

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).

theorem Cslib.Crypto.eval_prfRealGameOn_macToPrfOnDistinguisher {valid : ℕ → List Bool → Bool} {tagFamily : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), valid key.length query = true → (tagFamily key query).length = key.length) (adversary : Forger) (n : ℕ) :
(prfRealGameOn valid tagFamily (macToPrfOnDistinguisher valid adversary) n).eval = (macEufCmaGameOn valid tagFamily adversary n).eval

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.

theorem Cslib.Crypto.succProbability_macSufCmaGameOn_le {valid : ℕ → List Bool → Bool} {tagFamily : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), valid key.length query = true → (tagFamily key query).length = key.length) (adversary : Forger) (n : ℕ) :
Game.succProbability (macSufCmaGameOn valid tagFamily adversary n).eval ≤ Game.advantage (prfRealGameOn valid tagFamily (macToPrfOnDistinguisher valid adversary) n).eval (prfIdealGameOn valid id (macToPrfOnDistinguisher valid adversary) n).eval + 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.

theorem Cslib.Crypto.succProbability_macSufCmaGameOn_lengthPrependedCbcMac_le {family : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) (L : ℕ → ℕ) (adversary : Forger) {n Q : ℕ} (hL : L n < 2 ^ n) (hQ : ProbOracleComp.IsQueryBounded (adversary n []) Q) :

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).

theorem Cslib.Crypto.eval_macSufCmaGameOn_cbcMacFamily_cbcExtensionForger {family : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) {n : ℕ} (hn : 0 < n) :

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.

theorem Cslib.Crypto.not_macSufCmaOn_cbcMacFamily {family : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) :
¬MACSUFCMAOn (lpBlockValid fun (x : ℕ) => 2) (cbcMacFamily family)

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).

theorem Cslib.Crypto.not_prfOn_cbcMacFamily {family : List Bool → List Bool → List Bool} (hlen : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) :

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).

theorem Cslib.Crypto.succProbability_sufCmaGame_cbcFixedBlockMAC_le (ℓ : ℕ → ℕ) (hℓ : Turing.MultiTapeTM.ComputableInPolyTime ℓ Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) {family : List Bool → List Bool → List Bool} (hpoly : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : List Bool × List Bool) => family p.1 p.2) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) (hlen : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) (adversary : Forger) {n Q : ℕ} (hn : 0 < n) (hpos : 0 < ℓ n) (hQ : ProbOracleComp.IsQueryBounded (adversary n []) Q) :
Game.succProbability ((cbcFixedBlockMAC ℓ hℓ family hpoly).sufCmaGame adversary n).eval ≤ Game.advantage (prfRealGame id family (cbcFixedBlockMacToPrfDistinguisher ℓ adversary) n).eval (prfIdealGame id id (cbcFixedBlockMacToPrfDistinguisher ℓ adversary) n).eval + (↑Q + 1) ^ 2 * ↑(ℓ n) ^ 2 / (2 * 2 ^ n) + 1 / 2 ^ n

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).