MAC security with verification queries #
This module formalizes [BS23], Section 6.2 (Attack Game 6.2 and Theorem 6.1,
pp. 220–223) and Section 6.14 (Exercise 6.2, p. 246), in the computational word-level MACScheme
model against uniform strict IsOraclePPT adversaries.
In Attack Game 6.2 (MACScheme.sufCmaVqGame), an adversary VqForger interacts over a
Bool-tagged word channel:
(false, msg)is a signing query: ifmsg.length == M.msgLen n, the challenger runsM.sign sk msg, prepends(msg, tag)to its query log, and returnstag; otherwise it returns[]without signing or logging (matchingMACScheme.signingPairOracle).(true, raw)is a verification query, decoding(msg, tag) := (unframe raw, dropFrame raw): the challenger evaluatesok := (msg.length == M.msgLen n) && M.verify sk msg tag, latcheswonwhenok && !log.contains (msg, tag)holds, and replies[ok]. As inCslibFrontier.Crypto.Game.Forgery.VerificationQueries, replaying a previously signed pair(msg, tag) ∈ logreturns[true](byM.verify_sign) without counting as a fresh forgery, and wrong-length messages return[false]without latchingwon.
Main definitions #
Cslib.Crypto.VqForger,Cslib.Crypto.VqForger.toTyped,Cslib.Crypto.IsWordSigningQueryBounded,Cslib.Crypto.IsWordVerificationQueryBounded: word-level Attack Game 6.2 adversaries, typed view adapter, and pathwise signing/verification query budgets.Cslib.Crypto.encVqState: multi-tape encoding ofVqOracleState (List Bool) (List Bool)as the framed pair(log, won)underencPair (encList (encPair encBits encBits)) encBool.Cslib.Crypto.MACScheme.sufCmaVqOracle,Cslib.Crypto.MACScheme.sufCmaVqGame,Cslib.Crypto.MACScheme.SUFCMAVq: the Attack Game 6.2 challenger, experiment, and security predicate onMACScheme.Cslib.Crypto.sufToVqForger: embeds aForgerintoVqForgerusing one verification query.Cslib.Crypto.MACScheme.vqToSufForger: the uniform guessing reduction of Theorem 6.1, sampling its planted verification-query index viaProbComp.sampleModIndex (width n) (Qv n)and truncating external signing replies totagBound nbits.Cslib.Crypto.vqMacToPrfDistinguisher: the direct PRF distinguisher of Exercise 6.2 forprfMAC.
Main results #
Cslib.Crypto.MACScheme.sufCmaVqGame_eq_vqForgeExperiment:sufCmaVqGamehas the exact law ofvqForgeExperimentwithPK = Unitand(Signer.ofSign M.sign).restrict (·.length == M.msgLen n).Cslib.Crypto.isOraclePPT_sufToVqForger,Cslib.Crypto.MACScheme.SUFCMAVq.sufCma: Attack Game 6.2 security impliesSUFCMA.Cslib.Crypto.MACScheme.isOraclePPT_vqToSufForger,Cslib.Crypto.MACScheme.isQueryBounded_vqToSufForger,Cslib.Crypto.MACScheme.succProbability_sufCmaVqGame_le_mul_add,Cslib.Crypto.MACScheme.succProbability_sufCmaVqGame_le_mul,Cslib.Crypto.MACScheme.SUFCMA.sufCmaVq,Cslib.Crypto.MACScheme.sufCmaVq_iff_sufCma: Theorem 6.1 (efficiency certificate, signing-query bound, concrete fair-coin and exact dyadic loss bounds, andM.SUFCMAVq ↔ M.SUFCMA).Cslib.Crypto.isOraclePPT_vqMacToPrfDistinguisher,Cslib.Crypto.isQueryBounded_vqMacToPrfDistinguisher,Cslib.Crypto.succProbability_sufCmaVqGame_prfMAC_le,Cslib.Crypto.PseudorandomFunction.sufCmaVq_prfMAC: Exercise 6.2 (prfMACsecurity with verification queries with concrete boundprfAdv + Q_v / 2 ^ n, avoiding aQ_vfactor on the PRF advantage).
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 6.2 (Attack Game 6.2 and Theorem 6.1, pp. 220–223) and Section 6.14 (Exercise 6.2, p. 246).
Word-level Attack Game 6.2 adversaries and query budgets #
Pathwise budget of at most Q_s signing queries ((false, msg)) on a Bool-tagged word
channel.
Pathwise budget of at most Q_v verification queries ((true, raw)) on a Bool-tagged word
channel.
One word-level signing query (false, msg) costs 1 signing query.
One word-level verification query (true, raw) costs 0 signing queries.
One word-level signing query (false, msg) costs 0 verification queries.
One word-level verification query (true, raw) costs 1 verification query.
A total external query budget bounds the number of signing queries.
A total external query budget bounds the number of verification queries.
Separate word signing and verification query budgets yield a total external query budget of
Q_s + Q_v.
Adapt a word-level VqForger at (n, aux) into a typed Attack Game 6.2 program over
forgeVqSpec (List Bool) (List Bool): (false, msg) becomes Sum.inl msg, and (true, raw)
becomes Sum.inr (unframe raw, dropFrame raw) with its Bool verdict encoded as [ok].
VqForger.toTyped preserves signing query budgets.
VqForger.toTyped preserves verification query budgets.
Multi-tape encoding of VqOracleState (List Bool) (List Bool) as the framed pair
encPair (encList (encPair encBits encBits)) encBool of the chronological (msg, tag) signing
log and the won latch.
Attack Game 6.2 on MACScheme (sufCmaVqGame, SUFCMAVq) #
Stateful Attack Game 6.2 challenger oracle for M at security parameter n under secret key
sk ([BS23], Section 6.2, p. 221):
(false, msg): ifmsg.length == M.msgLen n, signsmsgundersk, prepends(msg, tag)tost.log, and returnstag; otherwise returns[]without signing or logging.(true, raw): decodes(msg, tag) := (unframe raw, dropFrame raw), checksok := (msg.length == M.msgLen n) && M.verify sk msg tag, latchesst.wonwhenok && !st.log.contains (msg, tag)holds, and replies[ok].
The strong MAC experiment with verification queries ([BS23], Section 6.2, Attack Game
6.2, p. 221): draw sk ← M.keyGen n, run adversary n [] against M.sufCmaVqOracle n sk from
⟨[], false⟩, and accept iff won latched true on some fresh valid verification query.
Running an oracle-PPT VqForger against sufCmaVqOracle is uniformly strict PPT in the unary
security parameter and secret key.
Run the complete MAC Attack Game 6.2 experiment on its unary security parameter for any oracle-PPT adversary.
The MAC Attack Game 6.2 experiment is uniformly strict PPT, independently of unused auxiliary input.
Strong MAC unforgeability under adaptive chosen-message and verification-query attack
(SUFCMAVq) against uniform strict oracle-PPT adversaries ([BS23], Section 6.2, Attack
Game 6.2, p. 221), on M.msgLen n-bit messages:
- signing queries
(false, msg)withmsg.length ≠ M.msgLen nreturn[]without signing or recordingmsginlog; - verification queries
(true, raw)decode(msg, tag) := (unframe raw, dropFrame raw), return[false]without latchingwonwhenmsg.length ≠ M.msgLen n, and return[true](byM.verify_sign) without latchingwonwhen(msg, tag) ∈ log.
SUFCMAVq security gives negligible sufCmaVqGame winning probability for every oracle-PPT
VqForger.
Establish SUFCMAVq security by bounding every oracle-PPT VqForger's winning probability.
At each security parameter n, M.sufCmaVqGame adversary n has the exact Boolean law of
vqForgeExperiment with PK = Unit, policy (Signer.ofSign M.sign).restrict (·.length == M.msgLen n), and verifier fun () sk msg tag => (msg.length == M.msgLen n) && M.verify sk msg tag.
An adversary making 0 verification queries at security parameter n wins sufCmaVqGame with
probability 0.
Direction 1: SUFCMAVq implies SUFCMA (sufToVqForger) #
Embed a standard Attack Game 6.1 Forger into Attack Game 6.2 (VqForger): forward every
signing query ((), msg) to (false, msg) (truncating the reply to tagBound n bits) and submit
the final candidate (msg, tag) as a single verification query (true, encPair encBits encBits (msg, tag)).
sufToVqForger tagBound adversary is uniformly strict oracle-PPT whenever tagBound is
polynomial-time computable in unary and adversary is oracle-PPT.
When tagBound n upper-bounds honest tag lengths on M.msgLen n-bit messages, running
sufToVqForger tagBound adversary in M.sufCmaVqGame has the exact Boolean law of
M.sufCmaGame adversary n (and of vqForgeExperiment ... (forgerToVq ...)).
Direction 2: Theorem 6.1 (SUFCMA implies SUFCMAVq, vqToSufForger) #
Uniform Attack Game 6.2 to Attack Game 6.1 reduction ([BS23], Section 6.2, Theorem
6.1, pp. 221–223): sample a target verification-query index j via
ProbComp.sampleModIndex (width n) (Qv n), simulate adversary n [], and output the captured
(msg, tag) candidate.
M.vqToSufForger tagBound width Qv adversary preserves uniform strict oracle-PPT admissibility
(IsOraclePPT) whenever tagBound, width, and Qv are computable in polynomial time in unary
and adversary is oracle-PPT.
M.vqToSufForger makes at most Q_s signing queries whenever adversary n [] makes at most
Q_s signing queries.
Equality witness linking M.vqToSufForger in M.sufCmaGame to the finite planted-query
reduction vqToForgerOn in forgeExperiment.
Theorem 6.1, quantitative fair-coin loss bound ([BS23], Section 6.2, Theorem 6.1,
pp. 221–223): when tagBound n bounds honest tag lengths on M.msgLen n-bit messages and
adversary n [] makes at most Qv n verification queries, M.sufCmaVqGame adversary n succeeds
with probability at most Qv n times the sufCmaGame success probability of
M.vqToSufForger tagBound width Qv adversary, plus the fair-coin residue bias
Qv n / 2 ^ width n.
Theorem 6.1, exact dyadic loss bound ([BS23], Section 6.2, Theorem 6.1,
pp. 221–223): proves the textbook bound ≤ Qv n * succProbability (M.sufCmaGame ...) with no
additive error term when Qv n = 0 (where 0 verification queries give winning probability 0
via M.succProbability_sufCmaVqGame_zero) or when Qv n divides 2 ^ width n (for instance a
power of two at most 2 ^ width n, where 0 < Qv n and
ProbComp.sampleModIndex (width n) (Qv n) is uniform below Qv n).
Equivalence of MAC security with and without verification queries ([BS23],
Section 6.2, Theorem 6.1, pp. 221–223): for every MACScheme, strong unforgeability with
verification queries (SUFCMAVq, Attack Game 6.2) is equivalent to strong unforgeability without
verification queries (SUFCMA, Attack Game 6.1).
Exercise 6.2: prfMAC security with verification queries (vqMacToPrfDistinguisher) #
Direct oracle reduction turning a VqForger against prfMAC family into a PRF
OracleDistinguisher ([BS23], Section 6.14, Exercise 6.2, p. 246): forwards n-bit
signing queries (false, msg) and fresh (n, n)-bit verification queries (true, raw) directly to
the PRF oracle (truncating replies to n bits), answers replayed (msg, tag) ∈ log pairs with
[true] and wrong-length requests with [] / [false] locally, and outputs won.
vqMacToPrfDistinguisher preserves uniform strict oracle-PPT admissibility (IsOraclePPT).
vqMacToPrfDistinguisher queries the external PRF oracle only on n-bit signing messages and
(n, n)-bit verification pairs, so its PRF query count is bounded by any budget Q on those
well-formed requests.
vqMacToPrfDistinguisher makes at most Q_s + Q_v PRF queries when adversary n [] makes at
most Q_s signing queries and at most Q_v verification queries.
Running vqMacToPrfDistinguisher adversary in prfRealGame id family produces the exact same
Boolean law as (prfMAC family hpoly).sufCmaVqGame adversary n.
Quantitative PRF-to-SUFCMAVq bound for prfMAC ([BS23], Section 6.14, Exercise
6.2, p. 246): for every length-preserving keyed function family and every VqForger making at
most Q_v verification queries at security parameter n, the sufCmaVqGame winning probability
against prfMAC family is at most the PRF distinguishing advantage of
vqMacToPrfDistinguisher adversary plus Q_v / 2 ^ n (without a Q_v factor on the PRF
advantage).
Every pseudorandom function yields an SUFCMAVq-secure MAC via Exercise 6.2
([BS23], Section 6.14, Exercise 6.2, p. 246): proved directly via
vqMacToPrfDistinguisher and succProbability_sufCmaVqGame_prfMAC_le without incurring a Q_v
factor on the PRF advantage.