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)
Loading...
Searching...
No Matches
whitebox_encoded.py File Reference

Secret nonlinear I/O encoding layer over the base multiplication on the real NTT-domain secret; measures it against the NTT-linearity algebraic attack. More...

Go to the source code of this file.

Namespaces

namespace  whitebox_encoded
 

Functions

 whitebox_encoded._bitrev7 (k)
 Bit-reversal of a 7-bit index (FIPS-203 NTT twiddle order).
 
 whitebox_encoded._gauss_solve_modq (rows, rhs)
 Solve the over-determined linear system rows*x = rhs mod Q for x in Z_q^2.
 
 whitebox_encoded._zeta_powers ()
 Powers of zeta mod q for the NTT.
 
 whitebox_encoded.base_mul_direct (s0, s1, c0, c1, gamma)
 Base multiply for one degree-2 factor from full-range operands.
 
 whitebox_encoded.base_mul_encoded (s0, s1, c0, c1, gamma, E, i)
 Encoded output E_{i,0}(p0), E_{i,1}(p1) of the plain product.
 
 whitebox_encoded.build_encodings (rng)
 Secret nonlinear I/O encodings: two random bijections on Z_q per component plus their inverses.
 
 whitebox_encoded.main ()
 Build encodings over the real full-range secret, verify decode correctness, measure encoding footprint, run the algebraic attack.
 
 whitebox_encoded.ntt_forward (poly)
 Forward NTT: coefficient domain to NTT domain (full-range image).
 
 whitebox_encoded.solve_component (observations, gamma, encoding_inverse=None)
 Recover full-range (s0,s1) for one component from chosen-ciphertext observations by linear solve over Z_q.
 

Variables

list whitebox_encoded.GAMMAS = [pow(ZETA, 2 * _bitrev7(i) + 1, Q) for i in range(NUM_COMPONENTS)]
 
int whitebox_encoded.K = 3
 
int whitebox_encoded.N = 256
 
int whitebox_encoded.NUM_COMPONENTS = N // 2
 
int whitebox_encoded.Q = 3329
 
int whitebox_encoded.SEED = 42
 
int whitebox_encoded.ZETA = 17
 
 whitebox_encoded.ZETA_POWERS = _zeta_powers()
 

Detailed Description

Secret nonlinear I/O encoding layer over the base multiplication on the real NTT-domain secret; measures it against the NTT-linearity algebraic attack.

Per NTT component i, two secret random bijections E_{i,0}, E_{i,1}: Z_q -> Z_q encode the two output coordinates of the base multiply p0 = shat0*c0 + gamma_i*shat1*c1, p1 = shat0*c1 + shat1*c0, where the stored secret shat = NTT(s) is full-range over Z_q. The plain product is computed internally and the encoded pair is emitted; the next pipeline stage decodes with the matching inverse. The encoding acts on the (full-range) output coordinates, so its footprint is independent of the base-table construction (see whitebox_reference.py for constructions A and B).

Note
MEASURED: encoded outputs defeat the plain linear-solve attack (encoding- unaware, mixing-aware) plus the encoding-table storage cost.
CONDITIONAL/OPEN: security holds only if the secret encodings resist structural cryptanalysis. For AES this class of assumption was falsified by the Billet-Gilbert-Ech-Chatbi (BGE) attack; the lattice/NTT analogue is open. This is an empirical negative result for the tested attacker, not a proof of security.
Deterministic (seed 42); writes results/whitebox_encoded.json.

Output Files

Usage

Author
Ugur Coruh

Definition in file whitebox_encoded.py.