|
PQ-WB-KEM: White-Box ML-KEM-768 1.0
PQ-WB-KEM: Toward a White-Box Construction of ML-KEM-768 with Arithmetic Masking for M2M Communications - Mathematics (MDPI)
|
If you use this software in your research, please cite:
PQ-WB-KEM is a feasibility study of table-based white-boxing for a lattice-based NIST post-quantum standard (ML-KEM-768, FIPS 203): a design-space exploration with measured footprints and delimiting negative results, for environments where adversaries have complete access to the implementation. No white-box key confidentiality is claimed against the full adversary.
The work is motivated by key protection in M2M (Machine-to-Machine) communications, where devices operate in hostile environments without trusted hardware support, and it maps the lattice white-box design space rather than delivering a fully white-box KEM.
| Contribution | Description |
|---|---|
| Lattice White-Box Feasibility | First systematic exploration of the table-based white-box design space for a NIST-standardized lattice KEM |
| NTT Domain Characterization | Formal proof of 128 degree-2 polynomial extensions |
| Design-Space Mapping | Two verified lookup-only constructions, measured cores of 25.57 MB (A) and 11.08 MB (B) |
| Arithmetic Masking | Three-share masking with second-order DCA resistance of share observation |
| Division-Timing Freedom | No division-timing leak introduced in the protected base multiply |
| Parameter | ML-KEM-512 | ML-KEM-768 | ML-KEM-1024 |
|---|---|---|---|
| Security Level | NIST Level 1 | NIST Level 3 | NIST Level 5 |
| n (degree) | 256 | 256 | 256 |
| q (modulus) | 3329 | 3329 | 3329 |
| k (rank) | 2 | 3 | 4 |
| Public Key | 800 B | 1,184 B | 1,568 B |
| Ciphertext | 768 B | 1,088 B | 1,568 B |
| Shared Secret | 32 B | 32 B | 32 B |
The white-box implementation processes decapsulation through four main stages:
For \(q = 3329 = 2^8 \cdot 13 + 1\) and \(n = 256\):
\[ X^{256} + 1 \equiv \prod_{i=0}^{127} (X^2 - \zeta^{2i+1}) \pmod{q} \]
where \(\zeta = 17\) is a primitive 256th root of unity, and each factor is irreducible over \(\mathbb{Z}_q\).
\[ R_q \cong \prod_{i=0}^{127} \mathbb{Z}_q[X]/(X^2 - \zeta^{2i+1}) \]
Each component is a degree-2 extension, not a scalar field.
For component \(i\) with \(\gamma_i = \zeta^{2i+1}\):
\[ (a_0, a_1) \cdot (b_0, b_1) = (a_0 b_0 + \gamma_i a_1 b_1, a_0 b_1 + a_1 b_0) \pmod{q} \]
The white-box adversary possesses:
| Capability | Description | Countermeasure |
|---|---|---|
| Complete Code Access | Full binary/source of implementation | Obfuscation via tables |
| Arbitrary Execution | Can run on any chosen input | IND-CCA2 security |
| Memory Observation | Can read all RAM during execution | Arithmetic masking |
| Trace Collection | Unlimited execution traces | 3-share DCA resistance |
| No External Access | Cannot query external oracles | Offline security model |
Against the full white-box adversary the construction provides no key confidentiality: the base multiply forms the clear product coordinates before masking, and these yield linear equations for the secret. The two properties it does deliver are each scoped to a strictly weaker adversary, and neither is a level of the DLPR hierarchy.
| Property | Status | Scope |
|---|---|---|
| Second-Order DCA Resistance | Achieved | Share observation: no key leakage from observing any two of the three shares |
| Division-Timing Freedom | Achieved | The protected base multiply; cache-line constant-time is not claimed |
Placed against the DLPR hierarchy:
| Level | Status | Description |
|---|---|---|
| Strong Incompressibility | Impossible | Proven impossible for key-fixing encryption schemes |
| Weak Incompressibility | Not attained | 1,536 bytes of table reads regenerate the Construction-B baked set bit-exactly; Construction A needs no read at all |
| Unbreakability | Not attained | The clear product coordinates yield linear equations for the secret |
| One-Wayness | Inherited | Black-box property of ML-KEM-768 IND-CCA2, not a white-box guarantee |
| \(s_i\) | -2 | -1 | 0 | 1 | 2 |
|---|---|---|---|---|---|
| \(\Pr[s_i]\) | 1/16 | 4/16 | 6/16 | 4/16 | 1/16 |
| Approach | Storage per Component | Total Storage | Practical |
|---|---|---|---|
| Naive Pair Tabulation | ~368 TB | >10^5 TB (all 384 = k x 128 component multiplies) | No |
| Galissant-Goubin HFE | ~2 GB | 256 GB | No |
| PQ-WB-KEM (Construction A) | k-independent | 22.16 MB base / 25.57 MB core | Yes |
| PQ-WB-KEM (Construction B) | ~60 KB | 7.67 MB base / 11.08 MB core | Yes |
The reduction comes from the degree-2 extension structure of the NTT domain, which replaces pair-by-pair tabulation with \(q\)-indexed scalar tables, not from any smallness of the secret. The measured base tables are about 11,600x (A) and 33,400x (B) smaller than the 2022 Galissant-Goubin HFE white-box.
A nonlinear output encoding is applied to the base-multiply result, at a measured 3.41 MB table cost, giving the cores of 25.57 MB (A) and 11.08 MB (B). This storage figure must not be read as key material: of the 512 stored encoding tables only 256 are independent, each inverse being reconstructible from its forward map, so the layer carries \(256\log_2(q!) \approx 1.09\) MB \(= 2^{20.06}\) bytes of entropy. The stored size overstates the secret-bearing material by a factor of 3.12 (results/encoding_layer_entropy.json).
The secret \(s\) is split into three shares:
\[ s = s_1 + s_2 + s_3 \pmod{q} \]
where \(s_1, s_2\) are uniformly random and \(s_3 = s - s_1 - s_2 \pmod{q}\).
| Attack Order | 2-Share Masking | 3-Share Masking |
|---|---|---|
| First-Order DCA | Resistant | Resistant |
| Second-Order DCA | Vulnerable | Resistant |
| Third-Order DCA | Vulnerable | Vulnerable |
For \(n\)-share arithmetic masking, the mutual information between any \(n-1\) shares and the secret is zero:
\[ I(S; S_1, S_2, \ldots, S_{n-1}) = 0 \]
| Aspect | Galissant-Goubin | Bicakci et al. | PQ-WB-KEM |
|---|---|---|---|
| PQC Type | Multivariate (HFE) | Hash-based | Lattice (M-LWE) |
| NIST Standard | None | FIPS 205 | FIPS 203 |
| Primitive | Encryption | Signature | KEM |
| Storage | 256 GB | Medium | 25.57 MB (A) / 11.08 MB (B) core |
| Practical | No | Moderate | Yes |
| DCA Resistance | Not addressed | N/A | 3-share masking |
| Timing Safe | Unknown | N/A | No division-timing leak in the base multiply |
| Target Platform | Theoretical | General | M2M Devices |
| Implementation | Traces | Correlation (rho_max) | Attack |
|---|---|---|---|
| Unmasked | 1,000 | 0.866 | Success |
| Unmasked | 10,000 | 0.853 | Success |
| 3-Share Masked | 1,000 | 0.031 | Fail |
| 3-Share Masked | 5,000 | 0.005 | Fail |
| 3-Share Masked | 10,000 | 0.011 | Fail |
\(\rho_{\max}\) is the correct-key correlation. At 10,000 traces the masked value of 0.011 is about \(1.1\times\) the \(1/\sqrt{N} = 0.01\) sampling-noise floor and below the 0.031 maximum over wrong-key hypotheses, so the attack fails. The masked values are non-monotone because all three are noise-floor samples rather than a decaying signal, and the reduction ratio is taken against that floor rather than being a security level. The simulation certifies the masked shares of the product: the clear product coordinate formed before masking still leaks at the unmasked \(\rho \approx 0.85\) level.
| Platform | Baseline Decaps | White-Box Decaps (projected) | Overhead |
|---|---|---|---|
| x86_64 (liboqs 0.15.0) | 0.213 ms (N=20 portable mean) | ~10 ms (7–14 band) | ~47x deployment (proj.); 17x RNG-excluded floor |
| ARM64 (QEMU) | 0.310 ms (instruction-level only) | not projected (no ARM-device measurement) | – |
The \(17\times\) factor is a projection ( \(\approx 1.55\times\) protected primitive \(\times \approx 11\times\) cache), not an end-to-end white-box measurement; the \(1.55\times\) term excludes mask-generation randomness and so is a lower bound, the faithful native-C protected primitive measuring \(4.30\times\) (x86-64) and \(2.85\times\) (aarch64). Only decapsulation is protected: key generation and encapsulation run unprotected at baseline. The ARM64 row was obtained by running AArch64 binaries under qemu-aarch64 user-mode emulation on the same x86-64 host: QEMU emulates the ARM64 instruction set while the host CPU performs the work, so the figures characterise instruction-level behaviour and are not any ARM device's wall-clock. No measurement on physical ARM hardware is claimed.
| Component | A (shared) | B (baked) | Basis |
|---|---|---|---|
| Base-multiply tables | 22.16 MB | 7.67 MB | measured |
| Output-encoding sublayer | 3.41 MB | 3.41 MB | measured |
| Measured core | 25.57 MB | 11.08 MB | measured |
| Coefficient shuffle ( \(\pi\), \(\pi^{-1}\)) | 3 KB | 3 KB | measured |
| Masking support | 0 | 0 | runtime |
| Deployment total | 25.58 MB | 11.08 MB | measured |
The base-multiply tables are stored once, unmasked: masking is applied to lookup outputs at runtime with fresh per-decapsulation randomness, so no masked tables are stored. Construction A uses one secret-independent table shared across all components and polynomials; Construction B bakes the fixed secret into per-component tables, scaling with the module rank \(k\). The coefficient shuffle stores a permutation of the 256 secret coefficients and its inverse, per polynomial, at a measured 3 KB (results/obfuscation_storage.json); masking stores nothing because the three shares are generated at runtime. The obfuscation layers therefore add only a few kilobytes, so the deployment total equals the measured core: 25.58 MB (A) and 11.08 MB (B).
This archive ships the generated HTML and PDF under code/docs/. To regenerate them, run Doxygen from the development repository, whose code/Doxyfile is the build configuration:
The following table documents which scripts produce which output files:
| Script | Output File | Description |
|---|---|---|
ntt_verification.sage | results/ntt_verification.json | NTT factorization proof verification |
| Extension | Format | Usage |
|---|---|---|
.json | JSON | Primary result format with full metadata |
.log | Text | Detailed execution logs with timestamps |
.sage | SageMath | Mathematical verification scripts |
Each Python experiment produces JSON with consistent structure:
| Symbol | Definition | Value/Description |
|---|---|---|
| \(R_q\) | \(\mathbb{Z}_q[X]/(X^n+1)\) | Polynomial ring |
| \(q\) | Prime modulus | 3329 |
| \(n\) | Polynomial degree | 256 |
| \(k\) | Module rank | 3 (ML-KEM-768) |
| \(\zeta\) | Primitive 256th root of unity | 17 |
| \(\gamma_i\) | \(\zeta^{2i+1}\) | Reduction constant for component \(i\) |
Ring Factorization:
\[ R_q \cong \prod_{i=0}^{127} \mathbb{Z}_q[X]/(X^2 - \zeta^{2i+1}) \]
Coefficient-Pair Multiplication:
\[ (a_0, a_1) \cdot (b_0, b_1) = (a_0 b_0 + \gamma_i a_1 b_1, a_0 b_1 + a_1 b_0) \pmod{q} \]
Three-Share Split:
\[ s = s_1 + s_2 + s_3 \pmod{q} \]
Information-Theoretic Security:
\[ I(S; S_1, S_2, \ldots, S_{n-1}) = 0 \]
Binomial Coefficient Probability (eta=2):
\[ \Pr[s_i = k] = \binom{2\eta}{\eta + k} \cdot 2^{-2\eta}, \quad k \in \{-\eta, \ldots, \eta\} \]
DCA Correlation:
\[ \rho = \frac{\text{Cov}(L, H)}{\sigma_L \cdot \sigma_H} \]
where \(L\) is the leakage (intermediate value) and \(H\) is the hypothesis.
Table Footprint (a size, not a security parameter):
\[ \log_2(\text{core size in bytes}) \approx 24 \;(\text{A}), \qquad \approx 23 \;(\text{B}) \]
This counts the byte-reads needed to copy the core. It is not an extraction cost: the measured budget that regenerates the tables is \(1{,}536\) bytes (Construction B) and \(0\) (Construction A).
| Module | File | Description |
|---|---|---|
| ntt_module | whitebox_reference.py | NTT-domain base multiply and table construction |
| tables_module | whitebox_encoded.py | Nonlinear output-encoding sublayer |
| masking_module | share_statistics.py | Three-share arithmetic masking statistics |
| Module | File | Description |
|---|---|---|
| dca_module | dca_simulation.py | DCA attack simulation |
| algebraic_module | algebraic_attack_analysis.py | BGE-style attack analysis |
| benchmarks_module | baseline_benchmark.py | Performance benchmarking |
| scaling_module | scaling_analysis.py | ML-KEM variant scaling |
| security_module | concrete_security_bounds.py | Bit-security estimation |
| tables_module | entry_determinacy.py | Entry-determinacy degree measurement |
| tables_module | table_extraction_witness.py | Measured extraction budget |
| Module | File | Description |
|---|---|---|
| sage_ntt | ntt_verification.sage | NTT factorization proof |
| Limitation | Description | Mitigation |
|---|---|---|
| Key Confidentiality | The base multiply forms the clear product coordinates before masking, and these yield linear equations for the secret, so no key confidentiality holds against the full white-box adversary | None; every positive result is scoped to a strictly weaker adversary |
| Strong Incompressibility | Proven impossible for key-fixing encryption | None available |
| Weak Incompressibility | Not attained: each baked table is \(\mathbb{Z}_q\)-linear in its public index, so 1,536 bytes of reads regenerate the Construction-B set bit-exactly and Construction A needs no read at all. Enlarging the tables cannot repair this, the budget carrying no table-size term | Make the key-to-table map one-way rather than \(\mathbb{Z}_q\)-linear |
| Algebraic Attacks | NTT linearity may enable BGE-style attacks | Shuffle + masking combination |
| Third-Order DCA | 3-share masking does not protect against 3rd-order | Use 4+ shares if needed |
| Cache-Line Timing | Division-timing freedom is claimed for the protected base multiply; cache-line constant-time is not | Out of scope |
| Memory Requirements | 11-26 MB measured deployment total | Target gateway-class devices with >= 64 MB RAM; M-profile microcontrollers are out of scope |
| Fault Injection | Hardware countermeasures required | Out of scope (software-only) |
| Dependency | Version | Purpose |
|---|---|---|
| liboqs | 0.15.0+ | Baseline ML-KEM benchmarks |
| SageMath | 9.0+ | Mathematical proof verification |
| Matplotlib | 3.5+ | Result visualization |
| Doxygen | 1.9+ | Documentation generation |
| Graphviz | 2.40+ | DOT diagram rendering |
This software is provided for academic and research purposes. See the LICENSE file in the repository for details.
Asst. Prof. Dr. Ugur CORUH |
|