Documentation

CslibFrontier.Crypto.Computational.Signature.Bridge

Word-level signature games as typed forgery experiments #

At each security parameter n, every word-level signature game is a typed forgery experiment of one fixed scheme, played by the word forger with its requests decoded.

The word games keep the list of queried messages, newest first; the typed experiment keeps the log of answered pairs, oldest first, and the two agree up to that representation.

Main definitions #

Main results #

The typed indexed forger played by the word forger adversary at parameter n: each request word is decoded to the pair (u, m) that the word oracle reads from it, and the candidate (u, m, σ) becomes ((u, m), σ).

One signing request of Forger.toCounter against a signer of capacity cap, with the number j of answered requests as state: while j < cap it forwards the message and returns the answer (j, σ) as the word encPair encUnary encBits (j, σ); afterwards it returns the empty word without querying. These are the replies of the word counter oracle.

noncomputable def Cslib.Crypto.Forger.toCounter (adversary : Forger) (cap n : ℕ) :

The typed counter forger played by the word forger adversary at parameter n against a signer of capacity cap: it answers the word forger's requests with counterRelay cap, counting them, and decodes its candidate signature word to (u, σ), as the word counter game does.

theorem Cslib.Crypto.Forger.eval_eufCmaExperiment_toTyped (S : Signature.Scheme (List Bool) (List Bool) (List Bool) (List Bool)) (adversary : Forger) (n : ℕ) :
ProbComp.eval (S.eufCmaExperiment (adversary.toTyped n)) = (do let __x ← S.keyGen match __x with | (pk, sk) => do let __x ← (OracleComp.interpret (OracleComp.sumHandler (fun (k : ℕ) => StateT.lift (ProbComp.unifFin k)) (SignatureScheme.signingOracleOf S.sign sk)) (adversary n pk)).run [] match __x with | ((msg, sig), queried) => pure (!queried.contains msg && S.verify pk msg sig)).eval

The EUF-CMA experiment of a typed scheme on words, played by adversary.toTyped n, is the word-level game: run the word forger against the signing oracle that records the queried messages, newest first, and accept a valid signature on a message that was never queried.

theorem Cslib.Crypto.Forger.eval_eufCmaExperiment_restrict_toTyped (S : Signature.Scheme (List Bool) (List Bool) (List Bool) (List Bool)) (adm : List Bool → Bool) (adversary : Forger) (n : ℕ) :
ProbComp.eval ((S.restrict adm).eufCmaExperiment (adversary.toTyped n)) = (do let __x ← S.keyGen match __x with | (pk, sk) => do let __x ← (OracleComp.interpret (OracleComp.sumHandler (fun (k : ℕ) => StateT.lift (ProbComp.unifFin k)) (SignatureScheme.signingOracleOn adm S.sign sk)) (adversary n pk)).run [] match __x with | ((msg, sig), queried) => pure (adm msg && !queried.contains msg && S.verify pk msg sig)).eval

The EUF-CMA experiment of a scheme on words restricted to the message space adm, played by adversary.toTyped n, is the word-level game against the signing oracle on adm, which also requires the forged message to be admissible. The typed signer answers a query outside adm with [] and logs it; the word oracle answers [] without recording it. The laws agree because such a log entry never names an admissible forgery.

The typed scheme of S at parameter n: the same algorithms at n, on the message space of n-bit words, as in the word-level games. Signing a word of another length returns [].

@[simp]
theorem Cslib.Crypto.SignatureScheme.toScheme_sign (S : SignatureScheme) (n : ℕ) (sk msg : List Bool) :
(S.toScheme n).sign sk msg = if (msg.length == n) = true then S.sign sk msg else pure []
@[simp]
theorem Cslib.Crypto.SignatureScheme.toScheme_verify (S : SignatureScheme) (n : ℕ) (pk msg sig : List Bool) :
(S.toScheme n).verify pk msg sig = (msg.length == n && S.verify pk msg sig)

At each parameter n, the word-level EUF-CMA game is the typed EUF-CMA experiment of S.toScheme n played by adversary.toTyped n.

At each parameter n, the word-level one-time EUF-CMA game is the forgery experiment of S.toScheme n against the signer that answers the first n-bit query and refuses every other query, played by adversary.toTyped n. A refused query is not logged, so it does not use up the one answer; in the typed one-time experiment of S.toScheme n (oneTimeEufCmaExperiment) a query of another length would be answered with [] and would use it up.

The success probability of the word-level EUF-CMA game at n is that of the typed experiment.

The success probability of the word-level one-time EUF-CMA game at n is that of the typed experiment.

The typed scheme of S at parameter n: the same algorithms at n, on all messages.

At each parameter n, the unrestricted word-level EUF-CMA game is the typed EUF-CMA experiment of S.toScheme n played by adversary.toTyped n.

The typed indexed scheme of S at parameter n: the same algorithms and the capacity at n.

At each parameter n, the word-level indexed EUF-CMA game is the typed indexed experiment of S.toScheme n played by adversary.toTyped n.

At each parameter n, the word-level counter EUF-CMA game is the typed counter experiment of S.toScheme n played by adversary.toCounter (S.capacity n) n.