Documentation

CslibFrontier.Crypto.Computational.FuzzyExtractor.DecodeThenExtract

LWE decode-then-extract computational fuzzy extractor #

Construction 4.1 of Fuller, Meng, and Reyzin ([FMR20], Section 4) builds a computational fuzzy extractor over the Hamming space (Fin m → ZMod q, hammingDist) by reversing the role of the noisy source reading w: rather than extracting randomness from w, Gen(w) samples a uniform matrix A : Matrix (Fin m) (Fin n) (ZMod q) and secret s : Fin n → ZMod q and uses w as the error vector in an LWE-style code-offset sample c = A s + w.

Given a close reading w' with hammingDist w w' ≤ t, Rep(w', p) subtracts w' from c to form c - w' = A s + (w - w'), where the residual error e = w - w' has Hamming weight hammingNorm (w - w') = hammingDist w w' ≤ t, runs a t-error decoder decode A (c - w') to recover s, and derives the key from s.

Main definitions #

Main results #

What is not proved #

References #

The public helper p = (A, c, x) of the decode-then-extract construction ([FMR20], Construction 4.1), pairing the LWE sample (A, c) with the public extractor seed x.

  • matrix : Matrix (Fin m) (Fin n) (ZMod q)

    The public random matrix A ∈ Z_q^{m × n}.

  • cipher : Fin m → ZMod q

    The code-offset vector c = A s + w ∈ Z_q^m.

  • seed : Seed

    The public extractor seed x.

@[instance_reducible]
instance Cslib.Crypto.FuzzyExtractor.instDecidableEqDecodeHelper {m✝ n✝ q✝ : ℕ} {Seed✝ : Type} [DecidableEq Seed✝] :
DecidableEq (DecodeHelper m✝ n✝ q✝ Seed✝)
def Cslib.Crypto.FuzzyExtractor.instDecidableEqDecodeHelper.decEq {m✝ n✝ q✝ : ℕ} {Seed✝ : Type} [DecidableEq Seed✝] (x✝ x✝¹ : DecodeHelper m✝ n✝ q✝ Seed✝) :
Decidable (x✝ = x✝¹)

Construction 4.1: Decode-then-extract fuzzy extractor #

noncomputable def Cslib.Crypto.FuzzyExtractor.decodeThenExtract (m n q : ℕ) [NeZero q] {Seed Key : Type} [Fintype Seed] [Nonempty Seed] [Inhabited Key] (decode : Matrix (Fin m) (Fin n) (ZMod q) → (Fin m → ZMod q) → ProbComp (Option (Fin n → ZMod q))) (ext : (Fin n → ZMod q) → Seed → Key) :
FuzzyExtractor (Fin m → ZMod q) Key (DecodeHelper m n q Seed)

The decode-then-extract computational fuzzy extractor ([FMR20], Construction 4.1):

  • Gen(w) samples uniform A : Matrix (Fin m) (Fin n) (ZMod q), uniform secret s : Fin n → ZMod q, and uniform seed x : Seed, and outputs (ext s x, ⟨A, A s + w, x⟩);
  • Rep(w', p) computes p.cipher - w', runs decode p.matrix (p.cipher - w'), and outputs ext s' p.seed when the decoder returns some s' (or default on none).

Algebraic code-offset identities and reproduction correctness #

noncomputable def Cslib.Crypto.FuzzyExtractor.decodeCheck {m n q : ℕ} [NeZero q] (decode : Matrix (Fin m) (Fin n) (ZMod q) → (Fin m → ZMod q) → ProbComp (Option (Fin n → ZMod q))) (s : Fin n → ZMod q) (e : Fin m → ZMod q) :

The average-case decoding check on secret s and error e over a uniform matrix A: sample A ← Matrix (Fin m) (Fin n) (ZMod q), run decode A (A s + e), and test whether the output equals some s.

noncomputable def Cslib.Crypto.FuzzyExtractor.decodeGame {m n q : ℕ} [NeZero q] (decode : Matrix (Fin m) (Fin n) (ZMod q) → (Fin m → ZMod q) → ProbComp (Option (Fin n → ZMod q))) (s : Fin n → ZMod q) (e : Fin m → ZMod q) :

The average-case decoding experiment on (s, e) as a Boolean Game.

def Cslib.Crypto.FuzzyExtractor.DecoderCorrectWithError {m n q : ℕ} [NeZero q] (decode : Matrix (Fin m) (Fin n) (ZMod q) → (Fin m → ZMod q) → ProbComp (Option (Fin n → ZMod q))) (t : ℕ) (δ : NNReal) :

Average-case decoder correctness with failure probability at most δ up to Hamming weight t (abstracting the conclusion of [FMR20], Lemma 4.10, p. 16): for every secret s and error e with hammingNorm e ≤ t, decode A (A s + e) fails to output some s with probability at most δ over uniform A and the coins of decode.

No concrete random-subset LWE decoder ([FMR20], Construction 4.9 and Lemma 4.10, pp. 15–16, over prime q) is formalized in the library yet (#6040).

theorem Cslib.Crypto.FuzzyExtractor.uniform_bind_decode_bind_apply_false_le {m n q : ℕ} [NeZero q] (decode : Matrix (Fin m) (Fin n) (ZMod q) → (Fin m → ZMod q) → ProbComp (Option (Fin n → ZMod q))) (s : Fin n → ZMod q) (e : Fin m → ZMod q) (k : Matrix (Fin m) (Fin n) (ZMod q) → Option (Fin n → ZMod q) → PMF Bool) (hk : ∀ (A : Matrix (Fin m) (Fin n) (ZMod q)), k A (some s) = PMF.pure true) :
((Probability.PMF.uniformOfFintype (Matrix (Fin m) (Fin n) (ZMod q))).bind fun (A : Matrix (Fin m) (Fin n) (ZMod q)) => (decode A (A.mulVec s + e)).eval.bind (k A)) false ≤ (decodeGame decode s e) false

The decode-failure step shared by the correctness proofs of the decode-based fuzzy extractors: run decode A (A s + e) on a uniform matrix A, then a continuation k A that returns true with certainty when the decoder outputs some s. The result is false with probability at most the decoding failure probability decodeGame decode s e false.

theorem Cslib.Crypto.FuzzyExtractor.uniform_bind_decode_bind_apply_false_le_of_failProbability_le {m n q : ℕ} [NeZero q] (decode : Matrix (Fin m) (Fin n) (ZMod q) → (Fin m → ZMod q) → ProbComp (Option (Fin n → ZMod q))) (s : Fin n → ZMod q) (e : Fin m → ZMod q) (k : Matrix (Fin m) (Fin n) (ZMod q) → Option (Fin n → ZMod q) → PMF Bool) (hk : ∀ (A : Matrix (Fin m) (Fin n) (ZMod q)), k A (some s) = PMF.pure true) {δ : NNReal} (hδ : (decodeGame decode s e).failProbability ≤ δ) :
((Probability.PMF.uniformOfFintype (Matrix (Fin m) (Fin n) (ZMod q))).bind fun (A : Matrix (Fin m) (Fin n) (ZMod q)) => (decode A (A.mulVec s + e)).eval.bind (k A)) false ≤ ↑δ

uniform_bind_decode_bind_apply_false_le with the decoding failure probability bounded by δ.

theorem Cslib.Crypto.FuzzyExtractor.failProbability_reproduceGame_decodeThenExtract_le {m n q : ℕ} [NeZero q] {Seed Key : Type} [Fintype Seed] [Nonempty Seed] [Inhabited Key] [DecidableEq Key] (decode : Matrix (Fin m) (Fin n) (ZMod q) → (Fin m → ZMod q) → ProbComp (Option (Fin n → ZMod q))) (ext : (Fin n → ZMod q) → Seed → Key) {w w' : Fin m → ZMod q} {δ : NNReal} (hδ : ∀ (s : Fin n → ZMod q), (decodeGame decode s (w - w')).failProbability ≤ δ) :
((decodeThenExtract m n q decode ext).reproduceGame w w').failProbability ≤ δ

Pointwise bound on the reproduction failure probability of decodeThenExtract: whenever decodeGame decode s (w - w') fails with probability at most δ for every secret s, reproduceGame w w' also fails with probability at most δ.

theorem Cslib.Crypto.FuzzyExtractor.correctHammingWithError_decodeThenExtract_of_decoderCorrectWithError {m n q : ℕ} [NeZero q] {Seed Key : Type} [Fintype Seed] [Nonempty Seed] [Inhabited Key] [DecidableEq Key] {decode : Matrix (Fin m) (Fin n) (ZMod q) → (Fin m → ZMod q) → ProbComp (Option (Fin n → ZMod q))} {t : ℕ} {δ : NNReal} (hdec : DecoderCorrectWithError decode t δ) (ext : (Fin n → ZMod q) → Seed → Key) :

A step of [FMR20] Theorem 4.11 (p. 17) establishing δ-error Hamming reproduction correctness of decodeThenExtract relative to a caller-supplied decoder (hdec : DecoderCorrectWithError decode t δ), not the unconditional correctness part of Theorem 4.11, because the random-subset LWE decoder of Construction 4.9 and Lemma 4.10 (pp. 15–16, over prime q) is not formalized (#6040).

Exact uniformity for a uniform source #

theorem Cslib.Crypto.FuzzyExtractor.realDistribution_decodeThenExtract_add_uniform (m n q : ℕ) [NeZero q] (decode : Matrix (Fin m) (Fin n) (ZMod q) → (Fin m → ZMod q) → ProbComp (Option (Fin n → ZMod q))) :
(decodeThenExtract m n q decode fun (s x : Fin n → ZMod q) => s + x).realDistribution (Probability.PMF.uniformOfFintype (Fin m → ZMod q)) = (decodeThenExtract m n q decode fun (s x : Fin n → ZMod q) => s + x).idealDistribution (Probability.PMF.uniformOfFintype (Fin m → ZMod q))

Sanity check for a uniform source: with W uniform on Fin m → ZMod q and the additive key derivation ext s x = s + x, the real distribution (R, P) of decodeThenExtract equals the ideal distribution (U, P), because translation by A s and then by x are bijections.

theorem Cslib.Crypto.FuzzyExtractor.securityAdvantage_decodeThenExtract_add_uniform_eq_zero (m n q : ℕ) [NeZero q] (decode : Matrix (Fin m) (Fin n) (ZMod q) → (Fin m → ZMod q) → ProbComp (Option (Fin n → ZMod q))) (D : (Fin n → ZMod q) → DecodeHelper m n q (Fin n → ZMod q) → Experiment) :
(decodeThenExtract m n q decode fun (s x : Fin n → ZMod q) => s + x).securityAdvantage (Probability.PMF.uniformOfFintype (Fin m → ZMod q)) D = 0

On a uniform source with the additive key derivation ext s x = s + x, every distinguisher has advantage 0 against decodeThenExtract.

Construction 4.1 with hardcore key coordinates (Lemma 4.7) #

def Cslib.Crypto.FuzzyExtractor.joinCols {m k l q : ℕ} (A₁ : Matrix (Fin m) (Fin k) (ZMod q)) (A₂ : Matrix (Fin m) (Fin l) (ZMod q)) :
Matrix (Fin m) (Fin (k + l)) (ZMod q)

The matrix [A₁ | A₂] whose first k columns are A₁ and whose last l columns are A₂.

noncomputable def Cslib.Crypto.FuzzyExtractor.lweFuzzyExtractor (m k l q : ℕ) [NeZero q] (decode : Matrix (Fin m) (Fin (k + l)) (ZMod q) → (Fin m → ZMod q) → ProbComp (Option (Fin (k + l) → ZMod q))) :
FuzzyExtractor (Fin m → ZMod q) (Fin k → ZMod q) (DecodeHelper m (k + l) q Unit)

Construction 4.1 of [FMR20] as stated in the paper: the secret is x : Fin (k + l) → ZMod q (the paper takes k = n/2), and the key is the first k coordinates r = x₁, …, x_k. There is no extractor seed (Seed = Unit).

noncomputable def Cslib.Crypto.FuzzyExtractor.hardcoreKeyReduction {m k l q : ℕ} [NeZero q] (D : (Fin k → ZMod q) → DecodeHelper m (k + l) q Unit → Experiment) (A₂ : Matrix (Fin m) (Fin l) (ZMod q)) (c₂ : Fin m → ZMod q) :

The real-key branch of the reduction behind [FMR20], Lemma 4.7 (from Akavia, Goldwasser, and Vaikuntanathan), as an LWE distinguisher: given a sample (A₂, c₂) for secret dimension l, sample A₁ and x₁ itself and run D x₁ ⟨[A₁ | A₂], A₁ x₁ + c₂, ()⟩. The reduction never sees the secret of the sample it is given.

noncomputable def Cslib.Crypto.FuzzyExtractor.hardcoreUniformReduction {m k l q : ℕ} [NeZero q] (D : (Fin k → ZMod q) → DecodeHelper m (k + l) q Unit → Experiment) (A₂ : Matrix (Fin m) (Fin l) (ZMod q)) (c₂ : Fin m → ZMod q) :

The uniform-key branch of the reduction behind [FMR20], Lemma 4.7: as hardcoreKeyReduction, but D receives an independent uniform key r in place of x₁.

Security of Construction 4.1 from decisional LWE in dimension l ([FMR20], Lemma 4.7 and the security part of Theorem 4.11): for every source W (used as the LWE error distribution) and every distinguisher D, the advantage of D against lweFuzzyExtractor is at most the sum of the decisional LWE advantages LWE.advantage, with a uniform secret in dimension l and error distribution W, of the two explicit reductions hardcoreKeyReduction D and hardcoreUniformReduction D.

This is an exact statement with no hypotheses; it does not bound the running time of the reductions, and it does not prove that LWE with error distribution W is hard (the paper obtains this from Theorem 4.6 for uniform-interval errors). The asymptotic step built on it, at modulus 2 ^ w κ, is computationallySecure_lweFuzzyExtractor_of_decisionLWEWithErrors, whose reductions are certified strict PPT.