Documentation

CslibFrontier.Crypto.Protocols.KEM.FujisakiOkamoto.WordBridge

The word-level FO games at one parameter, as the typed FO games #

The ROM IND-CCA bounds for FO-notbot and FO^⊥, Scheme.indCcaRomAdvantage_le in CslibFrontier.Crypto.Protocols.KEM.FujisakiOkamoto.NotBot and Scheme.indCcaBotAdvantage_le in CslibFrontier.Crypto.Protocols.KEM.FujisakiOkamoto.Bot, hold for one scheme over finite message, coin, ciphertext and key types, against randomized adversaries that draw their coins first. The word-level family WordPKE has native games WordPKE.romIndCcaGameWord and WordPKE.romIndCcaBotGameWord against programs with private coins, and native IND-CPA reductions WordPKE.romCpaReductionWord and WordPKE.romBotCpaReductionWord. This module identifies the two at each parameter.

The scheme at one parameter. WordPKE.finiteScheme P keyLen n is the FO bundle of P at n over finite types: uniform bit strings of lengths msgLen n, coinLen n and keyLen n, and the ciphertext space WordPKE.Ciphertext P n of words of length at most ctLen n. Its explicit-coin scheme WordPKE.finitePKE P n reads encDet as a ciphertext with WordPKE.toCiphertext, which keeps a word that fits and replaces a longer one by the empty word.

Properties of the PKE family. WordPKE.DeltaCorrect and WordPKE.GammaSpread are the δ-correctness and γ-spreadness of [HHK17] at every parameter, stated for finitePKE. For a family whose ciphertexts fit (WordPKE.CiphertextFits, in CslibFrontier.Crypto.Protocols.KEM.FujisakiOkamoto.Word), finitePKE encrypts exactly as P on generated keys.

The typed view of a native adversary. A uniform strict oracle PPT adversary has a coin-tape machine whose replay on a uniform tape of polynomial length has the joint law of the adversary against every stateful oracle (IsOraclePPT.exists_savedCoins_of_keyGen), with the tape length bounded on the challenge words of the games. WordPKE.savedCoinAdversary is that replay as a RandomizedROAdversary of finiteScheme n: it sends each request through WordPKE.typedQuery, which answers out-of-domain requests with the empty word, as the word game and the native simulator do.

The bridge. WordPKE.IsEfficient.exists_typedAdversary gives, for an efficient family and a polynomial-time key length, a typed adversary at each parameter with polynomially many G, H and decapsulation queries. When the ciphertexts of P fit, each word game has the law of the corresponding typed game (Scheme.roIndCcaGame, Scheme.roIndCcaBotGame) played by it, and the advantage of each native reduction in the IND-CPA game of P is the two-stage IND-CPA advantage ExplicitCoinPKE.cpaAdvantage of the typed reduction (Scheme.romCpaReduction, Scheme.romBotCpaReduction). The proofs represent typed caches as word caches: one lazy call of the typed game or simulator gives the word call on the represented cache (memoize_map), and replaying the machine against the typed oracles gives its replay against the word oracles. The game is identified once for the experiment WordPKE.romIndCcaExperimentWord, given a typed decapsulation program that represents the native one, and the reduction once for a pair of filters that agree on represented caches.

Main definitions #

Main results #

References #

The scheme at one parameter over finite spaces #

@[reducible, inline]

The ciphertext space of P at parameter n: the words of length at most ctLen n.

Instances For

    A word as a ciphertext at parameter n: the word itself when it has length at most ctLen n, and the empty word otherwise.

    The explicit-coin scheme of P at parameter n over finite spaces: messages and coins are bit strings of lengths msgLen n and coinLen n, coins are uniform, and ciphertexts lie in Ciphertext n. Encryption is encDet read with toCiphertext; decryption reports only results of length msgLen n. When the ciphertexts of P fit its ciphertext space (CiphertextFits), encryption under a generated key is encDet itself.

    noncomputable def Cslib.Crypto.Protocols.FujisakiOkamoto.WordPKE.finiteScheme (P : WordPKE) (keyLen : ℕ → ℕ) (n : ℕ) :
    Scheme (List Bool) (List Bool) (BitString (P.msgLen n)) (BitString (P.coinLen n)) (P.Ciphertext n) (BitString (keyLen n))

    The FO parameter bundle of P at parameter n over finite spaces: the explicit-coin scheme finitePKE n, uniform messages and uniform keys of length keyLen n.

    @[simp]

    The explicit-coin scheme of finiteScheme n is finitePKE n.

    @[simp]

    Keys of finiteScheme n are uniform.

    @[simp]

    Key generation of finitePKE n is that of P at n.

    Properties of the PKE family #

    δ-correctness of P ([HHK17], ePrint 2017/604 (2 Nov 2021), §2.1): at every parameter n, the expectation over generated key pairs of the worst-message probability that decryption of an encryption under uniform coins fails is at most δ n. It is ExplicitCoinPKE.DeltaCorrect of the scheme at parameter n.

    γ-spreadness of P ([HHK17], ePrint 2017/604 (2 Nov 2021), §2.1, p. 8): at every parameter n, for every generated key pair, message and ciphertext of the ciphertext space, encrypting the message under uniform coins gives that ciphertext with probability at most 2 ^ (-γ n). It is ExplicitCoinPKE.GammaSpread of the scheme at parameter n.

    The typed view of a native adversary #

    The H request of the typed interface at parameter n named by a word: the triple (false, m, c) that the word encodes, when it is in the H domain (isHQuery).

    noncomputable def Cslib.Crypto.Protocols.FujisakiOkamoto.WordPKE.typedQuery (P : WordPKE) (keyLen : ℕ → ℕ) (n : ℕ) :
    CCAOp → List Bool → OracleComp (ROResp (BitString (P.coinLen n)) (BitString (keyLen n))) (List Bool)

    A request of a native adversary at parameter n as a query of the typed ROM IND-CCA interface of finiteScheme n, with the typed answer returned as a word: G on messages of length msgLen n, H on requests in the H domain, and decapsulation on words of length at most ctLen n, whose answer is encoded with encOption encBits. Every other request is answered with the empty word and makes no query. These are the answers of the word game romIndCcaGameWord and of the native simulator simFilterWordHandler.

    noncomputable def Cslib.Crypto.Protocols.FujisakiOkamoto.WordPKE.savedCoinAdversary (P : WordPKE) (keyLen : ℕ → ℕ) {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control CCAOp) (c d keyC keyD n : ℕ) :

    The saved-coin view of a native adversary at parameter n, as a randomized adversary of the typed ROM IND-CCA game of finiteScheme n. Its coins are a uniform tape of savedCoinBudget c d keyC keyD n bits. On the challenge (pk, c*, k*) it replays the coin-tape machine machine on (1ⁿ, encKEMChallenge (pk, k*, c*)) with the tape cut at the machine's clock, sends each request through typedQuery, and decodes the output bit. A challenge word longer than keyC (n + 1) ^ keyD gets false without any query.

    Represented executions #

    Typed calls as word calls #

    A word that fits the ciphertext space is its own ciphertext.

    Two words that fit the ciphertext space are equal as ciphertexts exactly when they are equal.

    The native simulator, typed #

    Replaying the saved coins #

    theorem Cslib.Crypto.Protocols.FujisakiOkamoto.WordPKE.savedCoinAdversary_fullQueryBounds {P : WordPKE} {keyLen : ℕ → ℕ} {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control CCAOp) (c d keyC keyD n : ℕ) :
    (P.savedCoinAdversary keyLen machine c d keyC keyD n).FullQueryBounds (Probability.savedCoinBudget c d keyC keyD n) (Probability.savedCoinBudget c d keyC keyD n) (Probability.savedCoinBudget c d keyC keyD n)

    Query bounds of the saved-coin view. Every coin value and challenge makes at most savedCoinBudget c d keyC keyD n queries to G, as many to H and as many to decapsulation.

    The word game as the typed game #

    The reduction's IND-CPA game as the typed IND-CPA game #

    The bridge #

    The typed bridge of the word-level FO family. For an efficient PKE family and a polynomial-time key length, every uniform strict oracle PPT ROM IND-CCA adversary A has a typed view: at each parameter n, a randomized adversary B n of the typed ROM IND-CCA games of finiteScheme n, with a polynomial bound q on its G, H and decapsulation queries. When the ciphertexts of P fit its ciphertext space,

    • the word games romIndCcaGameWord A b n of FO-notbot and romIndCcaBotGameWord A b n of FO^⊥ have the laws of B n playing the typed games roIndCcaGame and roIndCcaBotGame of finiteScheme n, for both challenge bits;
    • the advantages of the native reductions romCpaReductionWord A and romBotCpaReductionWord A in the IND-CPA game of P at n are the two-stage IND-CPA advantages of the typed reductions romCpaReduction (B n) and romBotCpaReduction (B n) against finitePKE n.

    B n replays A on a saved coin tape of polynomial length (savedCoinAdversary).