Counter-stateful MACs from nonce-based MACs #
A nonce-based MAC becomes a stateful MAC once the signer chooses the nonces itself. It keeps a
counter j, tags its j-th message under the nonce BitString.lowBits L j, the L-bit
little-endian binary representation of j for L = M.nonceLen n, and returns that nonce with the
tag. The nonces stay distinct as long as the signer tags at most 2 ^ L messages, so it refuses
every request after that. This is how [BS23], Section 7.5, suggests implementing nonces
when the signer can keep state, and the remark after Theorem 7.10 (p. 274) says that for
Carter–Wegman the only requirement is that the signer tags at most as many messages as there are
nonces. The signer is stateful, so the construction is not a NonceMACScheme. Its state lives in
the signing oracle of a dedicated game, as for IndexedSignatureScheme.counterEufCmaGame.
The counter signing oracle (counterSigningOracle) at security parameter n holds the counter
and the issued triples. While j < 2 ^ L, it tags a requested M.msgLen n-bit message under the
j-th nonce, answers with the word encPair encBits encBits (nonce, tag), records
((msg, nonce), tag) and advances. It answers a request of any other length, and every request
once the counter is spent, with the empty word, recording nothing; a refused request uses no
counter value. In counterSufCmaGame, the forger outputs a nonce-tagged message
((msg, nonce), tag) and wins when the lengths are right, the triple was never issued, and the
nonce-based verifier accepts it. This is strong
unforgeability, as in Attack Game 7.4; a nonce word of length L stands for the counter it
encodes.
The reduction is exact. counterForger runs a counter forger and answers its j-th request with
one query (msg, lowBits L j) to the nonce-based signing oracle, and refuses the requests that the
counter signing oracle refuses without querying. Distinct counters give distinct nonces, so the
nonce-respecting condition of NonceMACScheme.sufCmaGame always holds, and the
simulation is perfect: the counter forger's success is at most the nonce forger's
(succProbability_counterSufCmaGame_le). Replies are truncated to a bound on the tag length, which
honest tags never exceed, so that the reduction is strict oracle PPT for every external oracle
(isOraclePPT_counterForger).
Main definitions #
Cslib.Crypto.NonceMACScheme.counterSigningOracle,Cslib.Crypto.NonceMACScheme.counterSufCmaGame,Cslib.Crypto.NonceMACScheme.CounterSUFCMA: the counter-stateful game and predicate.Cslib.Crypto.NonceMACScheme.counterHandler,Cslib.Crypto.NonceMACScheme.counterForger: the reduction to nonce-based forgery.
Main results #
Cslib.Crypto.NonceMACScheme.exists_sign_length_bound: tags have polynomially bounded length.Cslib.Crypto.NonceMACScheme.succProbability_counterSufCmaGame_le: the exact bound.Cslib.Crypto.NonceMACScheme.isOraclePPT_counterForger: the reduction is efficient.Cslib.Crypto.NonceMACScheme.SUFCMA.counterSufCma: nonce-based SUF-CMA security gives counter SUF-CMA security.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Section 7.5 and Theorem 7.10.
Tags have polynomially bounded length: some plain polynomial-time bound n ℓ bounds every tag
on an ℓ-bit message under a M.nonceLen n-bit nonce and a key sampled at parameter n.
The counter signing oracle and its game #
The counter signing oracle at security parameter n. Its state is the number j of tags
issued so far and the issued triples ((msg, nonce), tag), most recent first. While
j < 2 ^ M.nonceLen n, a requested M.msgLen n-bit message is tagged under the nonce
BitString.lowBits (M.nonceLen n) j, the reply is the word encPair encBits encBits (nonce, tag),
and the state advances. A request of any other length, and every request once the counter is
spent, receives the empty word and changes nothing.
The counter SUF-CMA experiment: sample sk ← keyGen n, run the forger on (n, []) with the
counter signing oracle started at (0, []), and accept a candidate ((msg, nonce), tag) with a
M.msgLen n-bit message and a M.nonceLen n-bit nonce that was never issued and that the
nonce-based verifier accepts.
Strong existential unforgeability of the counter-stateful use of a nonce-based MAC under
adaptive chosen-message attack, against uniform strict oracle-PPT forgers. It is
[BS23], Attack Game 7.4 (p. 274) with the nonces chosen by the signer as a counter, the
implementation of nonces by a stateful signer that Section 7.5 suggests (p. 273). The forger does
not choose the nonces, so NonceMACScheme.SUFCMA implies this notion (SUFCMA.counterSufCma).
Tagging queries and the forgery lie in the message space of msgLen n-bit words: the oracle
answers a query of any other length with the empty word, without tagging, recording it or using a
counter value.
Counter SUF-CMA security gives negligible forging probability for every oracle-PPT forger.
Establish counter SUF-CMA security by bounding every oracle-PPT forger's success probability.
The reduction to nonce-based forgery #
The nonce forger's answer to a counter forger's signing request, with the counter j as its
state: below 2 ^ M.nonceLen n and on a M.msgLen n-bit message, tag the message under the
j-th nonce by one external query, truncate the reply to bound n msg.length bits, answer with
the word encPair encBits encBits (nonce, tag) and advance; otherwise answer the empty word and
keep the counter, as the counter signing oracle does.
The nonce forger built from a counter forger: run it with counterHandler from counter 0
and forward its forgery unchanged.
Exact simulation #
The exact bound #
Counter forgery reduces to nonce-based forgery without loss. For every forger and every
security parameter n, the forging probability in the counter game is at most the forging
probability of counterForger in the nonce-based SUF-CMA game. The bound bound n ℓ must cover
the length of every tag on an ℓ-bit message under a M.nonceLen n-bit nonce and a supported
key; the nonce forger truncates replies to it.
Efficiency of the reduction #
The counter forger's reduction is uniformly strict oracle PPT for every oracle-PPT forger and every polynomial-time truncation bound.
Security #
Nonce-based SUF-CMA security gives counter SUF-CMA security: the signer of a SUF-CMA
nonce-based MAC may choose its nonces with an L-bit counter, tagging at most 2 ^ L messages.
This states the suggestion of [BS23], Section 7.5 (p. 273), that a stateful signer may
implement nonces as a counter; the source states no theorem for it, so this is not a cited
result. The reduction is counterForger, with loss 1
(succProbability_counterSufCmaGame_le).