Documentation

Cryptlib.Primitives.KEM.Combiner

Security preserving KEM combiner #

splitPRF is the PRF-then-XOR core function of Giacon, Heuer & Poettering ("KEM Combiners", https://eprint.iacr.org/2018/024.pdf, Lemma 8), for any number of KEMs. With BLAKE2b-256 as the PRF:

  key_i  := BLAKE2b-256(unkeyed)(ss_i)
  hash_i := BLAKE2b-256(
               key = key_i,
               msg = "splitprf-v1" || u32be(n) ||
                     u32be(len(cct_1)) || cct_1 ||
                     ...                ||
                     u32be(len(cct_n)) || cct_n
           )
  return hash_1 XOR hash_2 XOR ... XOR hash_n

Each shared secret keys the PRF, and every component hash binds the full, unambiguously encoded ciphertext vector. By Theorem 1 of the paper the combined KEM is IND-CCA2 if at least one component is.

Split PRF #

An unkeyed hash for key derivation and a keyed hash as the per-component PRF.

Instances For

    Hash a shared secret of any length to a 32-byte PRF key.

    Equations
    Instances For

      Label, component count, then each ciphertext with a 32-bit length prefix.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        XOR of the per-component keyed hashes; zero32 on the empty list.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Split PRF over one or more (shared secret, ciphertext) components.

          Equations
          Instances For
            Instances For
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                splitPRF over separate secret and ciphertext lists, rejecting malformed input.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem Cryptlib.Primitives.KEM.Combiner.splitPRF_pair (F : PRF) (s₁ c₁ s₂ c₂ : ByteArray) :
                  splitPRF F (s₁, c₁) [(s₂, c₂)] = xorBytes (F.keyed (F.deriveKey s₁) (transcript [c₁, c₂])) (F.keyed (F.deriveKey s₂) (transcript [c₁, c₂]))

                  splitPRF on two components.

                  The combined KEM #

                  combineKEM F k₀ ks combines a head KEM with a possibly empty list of more. Combined keys, ciphertexts and states for ks are nested products ending in PUnit.

                  Wire encoding #

                  Components are concatenated as ByteArrays and converted to Vector only in combineKEM.

                  Equations
                  Instances For
                    Equations
                    Instances For
                      Equations
                      Instances For

                        Encapsulation and decapsulation over the tail list #

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Each tail component's encoded (shared secret, ciphertext).

                            Equations
                            Instances For
                              Equations
                              Instances For
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For

                                    Correctness #

                                    Every tail component round-trips for its (pk, sk) pair.

                                    Equations
                                    Instances For
                                      theorem Cryptlib.Primitives.KEM.Combiner.encapAllM_decapAllM (ks : List KEM.KEM) (pks : CombinedPublicKey ks) (sks : CombinedPrivateKey ks) :
                                      AllHonestFor ks pks sks → ∀ (s : CombinedState ks), ReliableN ks s → ∀ (ct : CombinedCiphertext ks) (comps : List (ByteArray × ByteArray)) (s' : CombinedState ks), encapAllM ks pks s = EStateM.Result.ok (ct, comps) s' → ∀ (t : CombinedState ks), ∃ (t' : CombinedState ks), decapAllM ks sks ct t = EStateM.Result.ok comps t'

                                      decapAllM recovers the (shared secret, ciphertext) list encapAllM produced.

                                      theorem Cryptlib.Primitives.KEM.Combiner.combinedRoundTrip (F : PRF) (k₀ : KEM.KEM) (ks : List KEM.KEM) (pk₀ : k₀.PublicKey) (pks : CombinedPublicKey ks) (sk₀ : k₀.PrivateKey) (sks : CombinedPrivateKey ks) (h₀ : ∀ (s : k₀.State), k₀.Reliable s → ∀ (c : k₀.Ciphertext) (p : k₀.Plaintext) (s' : k₀.State), k₀.encap pk₀ s = EStateM.Result.ok (c, p) s' → ∀ (t : k₀.State), ∃ (t' : k₀.State), k₀.decap sk₀ c t = EStateM.Result.ok p t') (hs : AllHonestFor ks pks sks) (s : k₀.State × CombinedState ks) :
                                      k₀.Reliable s.fst ∧ ReliableN ks s.snd → ∀ (ct : k₀.Ciphertext × CombinedCiphertext ks) (key : Bytes32) (s' : k₀.State × CombinedState ks), encapM F k₀ ks (pk₀, pks) s = EStateM.Result.ok (ct, key) s' → ∀ (t : k₀.State × CombinedState ks), ∃ (t' : k₀.State × CombinedState ks), decapM F k₀ ks (sk₀, sks) ct t = EStateM.Result.ok key t'

                                      If the head and every tail KEM round-trip for the given (pk, sk) pairs, so does the combination.

                                      Key pairs for the tail list, with their AllHonestFor witness.

                                      Equations
                                      Instances For

                                        One KEM plus a possibly empty list of more, combined with the split PRF.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For