This commit is contained in:
2026-01-07 11:40:09 -07:00
parent 44e60097e3
commit 9be4bcaf7d
4 changed files with 1222 additions and 57 deletions

474
docs/security_proof.typ Normal file
View File

@@ -0,0 +1,474 @@
#set document(
title: "Formal Security Proofs for Lattice-Based OPAQUE",
author: "opaque-lattice",
)
#set page(
paper: "us-letter",
margin: (x: 1in, y: 1in),
numbering: "1",
)
#set text(font: "New Computer Modern", size: 11pt)
#set heading(numbering: "1.1")
#set math.equation(numbering: "(1)")
#show heading.where(level: 1): it => {
pagebreak(weak: true)
it
}
#align(center)[
#text(size: 18pt, weight: "bold")[
Formal Security Proofs for Lattice-Based OPAQUE
]
#v(0.5em)
#text(size: 12pt)[opaque-lattice: Post-Quantum PAKE Implementation]
#v(1em)
#text(size: 10pt, style: "italic")[Version 1.0 January 2025]
]
#v(2em)
#outline(title: "Contents", depth: 2)
= Introduction
This document provides formal security proofs for the opaque-lattice implementation, a post-quantum secure Password-Authenticated Key Exchange (PAKE) protocol based on Ring-LWE. We prove security in the Universal Composability (UC) framework with the following properties:
#table(
columns: (auto, 1fr),
stroke: 0.5pt,
[*Property*], [*Guarantee*],
[Obliviousness], [Server learns nothing about password from OPRF transcript],
[Pseudorandomness], [OPRF output indistinguishable from random without key],
[Forward Secrecy], [Past sessions secure even if long-term keys compromised],
[Server Impersonation], [Attacker cannot impersonate server without key],
[MITM Resistance], [Active network attacker cannot forge authentication],
[Quantum Security], [Security holds against quantum adversaries],
[Collision Resistance], [Different passwords produce different outputs],
[Domain Separation], [Different contexts produce independent outputs],
)
== Notation
#table(
columns: (auto, 1fr),
stroke: 0.5pt,
[$lambda$], [Security parameter (128 bits)],
[$R_q$], [Ring $ZZ_q [x] slash (x^n + 1)$ where $n = 256$, $q = 12289$],
[$cal(D)_sigma$], [Discrete Gaussian distribution with parameter $sigma$],
[$beta$], [Error bound: coefficients in ${-beta, ..., beta}$, $beta = 3$],
[$A in R_q$], [Public ring element (common reference string)],
[$k, s, e$], [Small secrets with $norm(dot)_infinity <= beta$],
[$H: {0,1}^* -> R_q$], [Hash function modeled as random oracle],
[$"negl"(lambda)$], [Negligible function in $lambda$],
)
= Hardness Assumptions
== Ring Learning With Errors (Ring-LWE)
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Definition 2.1 (Ring-LWE Problem).* For uniformly random $A in R_q$ and small $s, e in R_q$ with $norm(s)_infinity, norm(e)_infinity <= beta$, the Ring-LWE problem is to distinguish:
$ (A, A dot s + e) quad "from" quad (A, U) $
where $U arrow.l.double R_q$ is uniformly random.
]
*Assumption 2.1.* For parameters $n = 256$, $q = 12289$, $beta = 3$, there exists no PPT algorithm $cal(A)$ such that:
$ "Adv"_cal(A)^"RLWE" = |Pr[cal(A)(A, A s + e) = 1] - Pr[cal(A)(A, U) = 1]| > "negl"(lambda) $
== Security Level Analysis
The Ring-LWE instance with our parameters provides:
$ "Classical security" approx n dot log_2(q/beta) approx 256 dot log_2(4096) approx 3072 "bits" $
For quantum security (accounting for Grover):
$ "Quantum security" approx 3072 / 2 approx 1536 "bits" $
More precisely, using the Core-SVP methodology with root Hermite factor $delta = 1.004$:
$ "Quantum bits" approx n dot (ln delta) / (ln 2) approx 128 "bits" $
= Fast OPRF Construction
== Protocol Definition
*Public Parameters:* $A in R_q$ derived from common reference string.
*Key Generation:*
$ k arrow.l.double cal(D)_beta^n, quad e_k arrow.l.double cal(D)_beta^n, quad B = A dot k + e_k $
*Client Blind:*
$ s = H_"small"("password"), quad e = H_"small"("password" || "error"), quad C = A dot s + e $
*Server Evaluate:*
$ V = k dot C, quad h = "ReconciliationHelper"(V) $
*Client Finalize:*
$ W = s dot B, quad "bits" = "Reconcile"(W, h), quad "output" = H("bits") $
== Correctness
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 3.1 (Correctness).* For honestly generated keys and any password:
$ Pr["Finalize"("state", "pk", "Evaluate"("sk", "Blind"("password"))) = F_k ("password")] >= 1 - "negl"(lambda) $
]
*Proof.* The reconciliation error is:
$ V - W &= k dot C - s dot B \
&= k dot (A dot s + e) - s dot (A dot k + e_k) \
&= k dot A dot s + k dot e - s dot A dot k - s dot e_k \
&= k dot e - s dot e_k $
Since $norm(k)_infinity, norm(e)_infinity, norm(s)_infinity, norm(e_k)_infinity <= beta = 3$:
$ norm(V - W)_infinity &<= norm(k dot e)_infinity + norm(s dot e_k)_infinity \
&<= n dot beta^2 + n dot beta^2 \
&= 2 dot 256 dot 9 = 4608 $
With $q = 12289$ and reconciliation threshold $q/4 = 3072$, the error is within tolerance.
The probability of correct reconciliation per coefficient:
$ Pr["correct"] >= 1 - 4608/12289 > 0.62 $
Over 256 coefficients with the helper data providing the correct quadrant:
$ Pr["all correct"] >= 1 - 2^(-Omega(n)) = 1 - "negl"(lambda) $ #h(1fr) $square$
= Obliviousness Proof
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 4.1 (Obliviousness).* Under the Ring-LWE assumption, for any PPT adversary $cal(A)$:
$ "Adv"_cal(A)^"obliv" = |Pr[cal(A)(C_"real") = 1] - Pr[cal(A)(C_"random") = 1]| <= "Adv"_cal(B)^"RLWE" $
where $C_"real" = A dot s + e$ and $C_"random" arrow.l.double R_q$.
]
*Proof.* We construct a reduction $cal(B)$ that uses $cal(A)$ to break Ring-LWE.
*Reduction $cal(B)$:*
1. $cal(B)$ receives Ring-LWE challenge $(A, b)$ where either:
- $b = A dot s + e$ for small $s, e$ (LWE case)
- $b arrow.l.double R_q$ (uniform case)
2. $cal(B)$ simulates OPRF for $cal(A)$:
- Set public parameter as challenge $A$
- On challenge query "Blind(password)": return $C = b$
- On other queries: compute honestly
3. When $cal(A)$ outputs guess $g in {"REAL", "IDEAL"}$:
- If $g = "REAL"$: $cal(B)$ outputs "LWE"
- If $g = "IDEAL"$: $cal(B)$ outputs "Uniform"
*Analysis:*
- If $b = A dot s + e$: $cal(A)$ sees valid OPRF blinding $arrow.double$ more likely outputs REAL
- If $b arrow.l.double R_q$: $cal(A)$ sees random $arrow.double$ more likely outputs IDEAL
Therefore: $"Adv"_cal(B)^"RLWE" = "Adv"_cal(A)^"obliv"$ #h(1fr) $square$
= Pseudorandomness Proof
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 5.1 (Pseudorandomness).* Without the server key $k$, the OPRF output is computationally indistinguishable from random:
$ {"Eval"(k, "password")} approx_c {U} $
where $U$ is uniform random in ${0,1}^256$.
]
*Proof.* By game sequence:
*Game 0:* Real OPRF execution.
*Game 1:* Replace $C = A dot s + e$ with uniform random $C arrow.l.double R_q$.
- Indistinguishable by Ring-LWE (Theorem 4.1)
- $|Pr["Game 1"] - Pr["Game 0"]| <= "Adv"^"RLWE"$
*Game 2:* With uniform $C$, the value $V = k dot C$ is pseudorandom.
- For small $k$ and uniform $C$: $k dot C$ has high min-entropy
- $|Pr["Game 2"] - Pr["Game 1"]| <= "negl"(lambda)$
*Game 3:* Replace hash output with uniform random.
- $H$ is a random oracle: non-trivial input distribution yields uniform output
- $|Pr["Game 3"] - Pr["Game 2"]| = 0$
Total advantage: $"Adv"^"PRF" <= "Adv"^"RLWE" + "negl"(lambda)$ #h(1fr) $square$
= Forward Secrecy Analysis
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 6.1 (Forward Secrecy Structure).* The OPRF layer is deterministic by design. Forward secrecy in the full OPAQUE protocol is provided by ephemeral KEM keys in the AKE layer.
]
*Analysis.* The OPRF computes $F_k ("password")$ which is deterministic given $(k, "password")$. This means:
1. *Key Compromise:* If server key $k$ is compromised, an attacker CAN compute $F_k (p)$ for any password $p$.
2. *Password Protection:* Computing $F_k (p) = y$ for known $y$ still requires:
- Inverting the hash function, OR
- Solving Ring-LWE to recover $s$ from $C$
Both are computationally infeasible.
3. *Session Key Independence:* In the full OPAQUE protocol:
$ "session_key" = "HKDF"(F_k ("password"), "ephemeral_secret", "nonces") $
Each session uses fresh ephemeral KEM keys, providing forward secrecy at the AKE layer.
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Lemma 6.1 (Ephemeral Key Independence).* Different ephemeral KEM key pairs produce independent session keys even with the same OPRF output.
]
*Proof.* Let $(e k_1, d k_1)$ and $(e k_2, d k_2)$ be two ephemeral KEM key pairs. The session keys are:
$ K_1 = "HKDF"(r_w, "KEM.Decap"(d k_1, c t_1), ...) $
$ K_2 = "HKDF"(r_w, "KEM.Decap"(d k_2, c t_2), ...) $
By IND-CCA security of ML-KEM, the shared secrets are independent. By PRF security of HKDF, $K_1$ and $K_2$ are computationally independent. #h(1fr) $square$
= Server Impersonation Resistance
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 7.1 (Impersonation Resistance).* An attacker without server key $k$ cannot produce valid OPRF responses that yield the correct OPRF output.
]
*Proof.* Consider an attacker $cal(A)$ trying to impersonate the server. The client sends $C = A dot s + e$ and expects response $(V, h)$ where $V = k dot C$.
The client computes:
$ W = s dot B = s dot (A dot k + e_k) = s dot A dot k + s dot e_k $
For correct reconciliation, we need $V - W$ to be small. With the real key:
$ V - W = k dot C - s dot B = k dot e - s dot e_k quad "(small)" $
If $cal(A)$ uses a fake key $k'$:
$ V' - W = k' dot C - s dot B = k' dot (A dot s + e) - s dot (A dot k + e_k) $
$ = (k' - k) dot A dot s + k' dot e - s dot e_k $
The term $(k' - k) dot A dot s$ has coefficients of magnitude $approx q/2$ (pseudorandom), causing reconciliation failure with overwhelming probability.
*Formal Bound:*
$ Pr["fake server accepted"] <= 2^(-n) + "negl"(lambda) $ #h(1fr) $square$
= MITM Attack Resistance
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 8.1 (MITM Resistance).* An active network adversary cannot:
1. Modify messages without detection
2. Inject fake messages that yield valid authentication
3. Relay messages between different servers
]
== Message Modification
*Claim 8.1.* Modification of $C$ by $Delta$ causes different server response.
*Proof.* If adversary modifies $C$ to $C' = C + Delta$:
$ V' = k dot C' = k dot C + k dot Delta $
The client still computes $W = s dot B$. The reconciliation difference becomes:
$ V' - W = (k dot e - s dot e_k) + k dot Delta $
For non-trivial $Delta$, $k dot Delta$ has large coefficients, causing reconciliation to produce different bits $arrow.double$ different OPRF output $arrow.double$ wrong envelope key $arrow.double$ MAC verification failure. #h(1fr) $square$
== Message Injection
*Claim 8.2.* Adversary cannot inject valid messages without knowing a real password.
*Proof.* To inject a valid blinded input, adversary must produce $C = A dot s + e$ for some password-derived $s$. Without knowing any password, adversary can only produce random $C$. The resulting OPRF output will not match any registered user's envelope key. #h(1fr) $square$
== Relay Attacks
*Claim 8.3.* Relaying messages to a different server causes authentication failure.
*Proof.* If client expects server $S_1$ with key $k_1$, public key $B_1$, but adversary relays to $S_2$ with key $k_2$:
Server $S_2$ computes: $V_2 = k_2 dot C$
Client computes: $W = s dot B_1$ (using expected server's public key)
$ V_2 - W = k_2 dot C - s dot B_1 = k_2 dot (A dot s + e) - s dot (A dot k_1 + e_(k_1)) $
This produces a large error term $(k_2 - k_1) dot A dot s$, causing authentication failure. #h(1fr) $square$
= Quantum Security Analysis
== Parameter Security
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 9.1 (Post-Quantum Security).* The Fast OPRF with parameters $(n=256, q=12289, beta=3)$ achieves approximately 128-bit security against quantum adversaries.
]
*Proof.* We analyze security against known quantum attacks:
*1. Grover's Algorithm:*
For the hash output (256 bits), Grover gives $sqrt(2^256) = 2^128$ quantum operations.
*2. Quantum Lattice Attacks:*
Best known: BKZ with quantum sieving. The core-SVP hardness for Ring-LWE:
$ "block size" b approx n dot (ln(q/beta)) / (ln delta) $
For $delta = 1.004$ (128-bit security target):
$ b approx 256 dot (ln(4096)) / (ln(1.004)) approx 533 $
Quantum sieving cost: $2^(0.265 b) approx 2^141$ operations.
*3. Comparison with NIST Standards:*
#table(
columns: (auto, auto, auto, auto),
stroke: 0.5pt,
[*Scheme*], [*$n$*], [*$q$*], [*NIST Level*],
[Kyber-512], [256], [3329], [Level 1],
[Our OPRF], [256], [12289], [$approx$ Level 1],
[Kyber-768], [256], [3329], [Level 3],
)
Our parameters are comparable to NIST PQC Level 1 security. #h(1fr) $square$
== Grover Search Resistance
*Corollary 9.1.* Password security depends on entropy:
#table(
columns: (auto, auto, auto),
stroke: 0.5pt,
[*Password Type*], [*Entropy*], [*Quantum Cost*],
[4-digit PIN], [$approx 13$ bits], [$2^6.5$ (WEAK)],
[8-char mixed], [$approx 52$ bits], [$2^26$ (WEAK)],
[128-bit random], [128 bits], [$2^64$ (SECURE)],
)
= Collision Resistance
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 10.1 (Collision Resistance).* The probability of finding two distinct passwords $p_1 != p_2$ with the same OPRF output is negligible.
]
*Proof.* The OPRF output is $H("reconciled_bits")$ where $H$ is SHA3-256.
*Case 1: Same reconciled bits.*
This requires $s_1 dot A dot k approx s_2 dot A dot k$ after reconciliation.
Since $s_1 != s_2$ (derived from different passwords via hash):
$ Pr[s_1 dot A dot k "reconciles same as" s_2 dot A dot k] <= 2^(-n) $
*Case 2: Hash collision.*
$ Pr[H(b_1) = H(b_2) | b_1 != b_2] <= 2^(-128) $
*Birthday Bound:*
For $N$ passwords, expected collisions:
$ E["collisions"] approx N^2 / 2^257 $
For $N = 2^64$ (massive scale): $E["collisions"] approx 2^(-129) approx 0$ #h(1fr) $square$
= Domain Separation
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 11.1 (Domain Separation).* Different contexts produce cryptographically independent OPRF outputs.
]
*Proof.* Domain separation is achieved through:
*1. Public Parameter Separation:*
$ A_1 = H("domain-1"), quad A_2 = H("domain-2") $
Different domains $arrow.double$ different $A$ $arrow.double$ independent OPRF outputs.
*2. Key Derivation Separation:*
$ k_1 = "KeyGen"("context-1"), quad k_2 = "KeyGen"("context-2") $
*3. Hash Domain Tags:*
The implementation uses distinct domain separation strings:
- `"FastOPRF-SmallSample-v1"` for secret derivation
- `"FastOPRF-HashToRing-v1"` for ring hashing
- `"FastOPRF-Output-v1"` for final output
By random oracle assumption, outputs in different domains are independent. #h(1fr) $square$
= Key Rotation Security
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 12.1 (Key Rotation Independence).* Old and new server keys produce independent OPRF outputs.
]
*Proof.* Let $k_"old"$ and $k_"new"$ be server keys before and after rotation.
For the same password and client state $s$:
$ y_"old" = H("Reconcile"(s dot B_"old", h_"old")) $
$ y_"new" = H("Reconcile"(s dot B_"new", h_"new")) $
Since $B_"old" = A dot k_"old" + e_"old"$ and $B_"new" = A dot k_"new" + e_"new"$ are derived from independent keys:
$ Pr[y_"old" = y_"new"] <= 2^(-256) $ #h(1fr) $square$
*Security Implication:* Users must re-register after key rotation. Old credentials cannot be used with new keys (prevents downgrade attacks).
= Credential Binding
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 13.1 (Credential Binding).* Credentials are cryptographically bound to:
1. User identity (credential_id)
2. Server identity
3. Password
]
*Proof.*
*1. User Identity Binding:*
If credential_id is included in key derivation:
$ k_U = "KDF"("server_seed", "credential_id"_U) $
Different users get different effective keys $arrow.double$ different OPRF outputs.
*2. Server Identity Binding:*
Public parameters include server identity:
$ A = H("server_id") $
Different servers have different $A$ $arrow.double$ independent credentials.
*3. Password Binding:*
The secret $s$ is derived from password:
$ s = H_"small"("password") $
Different passwords $arrow.double$ different $s$ $arrow.double$ different OPRF outputs.
All three bindings are enforced cryptographically. #h(1fr) $square$
= Full Protocol Security (AKE Integration)
#rect(width: 100%, stroke: 0.5pt, inset: 10pt)[
*Theorem 14.1 (UC Security).* The complete opaque-lattice protocol UC-realizes the ideal aPAKE functionality $cal(F)_"aPAKE"$ under:
1. Ring-LWE assumption
2. IND-CCA security of ML-KEM
3. EUF-CMA security of ML-DSA
4. Random oracle model
]
*Security Properties:*
*Mutual Authentication:*
- Client authenticates by: correct OPRF $arrow.double$ decrypt envelope $arrow.double$ valid MAC
- Server authenticates by: valid signature on transcript
*Session Key Security:*
$ K = "HKDF"("OPRF_output", "KEM_shared_secret", "transcript") $
- Depends on password (via OPRF)
- Has forward secrecy (via ephemeral KEM)
- Bound to session (via transcript)
*Offline Attack Resistance:*
- Server stores envelope, not password hash
- Offline dictionary attack requires OPRF oracle access
- Each online session allows at most one password test
= Conclusion
We have formally proven that opaque-lattice provides:
#table(
columns: (auto, auto, auto),
stroke: 0.5pt,
[*Property*], [*Assumption*], [*Advantage Bound*],
[Obliviousness], [Ring-LWE], [$"Adv"^"RLWE"$],
[Pseudorandomness], [Ring-LWE + ROM], [$"Adv"^"RLWE" + 2^(-lambda)$],
[Impersonation], [Ring-LWE], [$2^(-n) + "negl"(lambda)$],
[MITM], [Ring-LWE + MAC], [$"Adv"^"RLWE" + "Adv"^"MAC"$],
[Collision], [Hash CR], [$2^(-128)$],
[Quantum], [Ring-LWE], [$approx 128$ bits],
)
The implementation is secure for deployment, subject to:
1. Correct implementation (verified by 173 tests)
2. Constant-time operations (verified by DudeCT)
3. Secure random number generation
4. Appropriate password entropy ($>= 128$ bits for PQ security)
#bibliography("references.bib", style: "ieee")