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
entry_determinacy Namespace Reference

Functions

 bijection_determinacy (perm)
 Entry-determinacy of a Z_q bijection by completion: with one entry omitted the missing image is the unique unused value; with two omitted the completions can be swapped.
 
 build_encoding_sublayer (rng)
 Output-encoding sublayer: per factor two secret Z_q bijections plus their inverses (only the two forward maps are independent).
 
 build_prf_table (key)
 SPACE-style control: q-entry table whose entries are AES-128(key, index) truncated into Z_q.
 
 linear_attack (table, M, inv)
 Read one entry at each candidate index, invert the linear model s = T[x0]*x0^-1, regenerate the whole table and score it.
 
 main ()
 Build both constructions plus the encoding sublayer and the AES-128 PRF control, measure entry-determinacy degrees, M* budgets and the key-determinism separator, and write JSON.
 
 modular_inverses ()
 Multiplicative inverses of 1..q-1 mod q (Fermat; q is prime).
 

Variables

int AES_BLOCK_BYTES = 16
 
int AES_KEY_BITS = 128
 
int EXPECTED_D_BAKED = 1
 
int EXPECTED_D_BIJECTION = Q - 1
 
int EXPECTED_D_SHARED = 0
 
int EXPECTED_M_STAR_BAKED_BYTES = 1536
 
int EXPECTED_M_STAR_SHARED_BYTES = 0
 
int EXPECTED_PRF_LINEAR_REGENERATIONS = 0
 
str PRIOR_FOOTPRINT_RANGE_TEXT = "7.59 MB to 17.02 GB"
 
tuple REJECTION_BOUND = (1 << 16) // Q * Q
 
int REJECTION_RETRY_LIMIT = 64
 

Function Documentation

◆ bijection_determinacy()

entry_determinacy.bijection_determinacy (   perm)

Entry-determinacy of a Z_q bijection by completion: with one entry omitted the missing image is the unique unused value; with two omitted the completions can be swapped.

Parameters
permq-entry uint16 permutation table.
Returns
(max_omitted_determined, completions_at_one_omitted, completions_at_two_omitted).

Definition at line 203 of file entry_determinacy.py.

Referenced by main().

+ Here is the caller graph for this function:

◆ build_encoding_sublayer()

entry_determinacy.build_encoding_sublayer (   rng)

Output-encoding sublayer: per factor two secret Z_q bijections plus their inverses (only the two forward maps are independent).

Parameters
rngSeeded NumPy generator.
Returns
(E, Einv) uint16 arrays of shape (NUM_COMPONENTS, 2, q).

Definition at line 107 of file entry_determinacy.py.

Referenced by main().

+ Here is the caller graph for this function:

◆ build_prf_table()

entry_determinacy.build_prf_table (   key)

SPACE-style control: q-entry table whose entries are AES-128(key, index) truncated into Z_q.

Same shape and dtype as a Construction-B h-table.

Parameters
key16-byte AES key.
Returns
uint16 array of q entries.

Definition at line 126 of file entry_determinacy.py.

Referenced by main().

+ Here is the caller graph for this function:

◆ linear_attack()

entry_determinacy.linear_attack (   table,
  M,
  inv 
)

Read one entry at each candidate index, invert the linear model s = T[x0]*x0^-1, regenerate the whole table and score it.

Row s of the shared table M is exactly the candidate model x -> s*x, so M enumerates every linear hypothesis without recomputing one.

Parameters
tableq-entry uint16 table under attack.
MShared multiply table from build_shared_table().
invModular inverse array.
Returns
dict with regeneration count, informative index count and the extrapolation accuracy (mean/max over read positions).

Definition at line 167 of file entry_determinacy.py.

Referenced by main().

+ Here is the caller graph for this function:

◆ main()

entry_determinacy.main ( void  )

Build both constructions plus the encoding sublayer and the AES-128 PRF control, measure entry-determinacy degrees, M* budgets and the key-determinism separator, and write JSON.

Definition at line 243 of file entry_determinacy.py.

References bijection_determinacy(), build_encoding_sublayer(), build_prf_table(), linear_attack(), main(), and modular_inverses().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modular_inverses()

entry_determinacy.modular_inverses ( )

Multiplicative inverses of 1..q-1 mod q (Fermat; q is prime).

Returns
int64 array inv[x] with x*inv[x] == 1 mod q for x != 0, inv[0] = 0.

Definition at line 88 of file entry_determinacy.py.

Referenced by main().

+ Here is the caller graph for this function:

Variable Documentation

◆ AES_BLOCK_BYTES

int entry_determinacy.AES_BLOCK_BYTES = 16

Definition at line 77 of file entry_determinacy.py.

◆ AES_KEY_BITS

int entry_determinacy.AES_KEY_BITS = 128

Definition at line 76 of file entry_determinacy.py.

◆ EXPECTED_D_BAKED

int entry_determinacy.EXPECTED_D_BAKED = 1

Definition at line 69 of file entry_determinacy.py.

◆ EXPECTED_D_BIJECTION

int entry_determinacy.EXPECTED_D_BIJECTION = Q - 1

Definition at line 71 of file entry_determinacy.py.

◆ EXPECTED_D_SHARED

int entry_determinacy.EXPECTED_D_SHARED = 0

Definition at line 70 of file entry_determinacy.py.

◆ EXPECTED_M_STAR_BAKED_BYTES

int entry_determinacy.EXPECTED_M_STAR_BAKED_BYTES = 1536

Definition at line 72 of file entry_determinacy.py.

◆ EXPECTED_M_STAR_SHARED_BYTES

int entry_determinacy.EXPECTED_M_STAR_SHARED_BYTES = 0

Definition at line 73 of file entry_determinacy.py.

◆ EXPECTED_PRF_LINEAR_REGENERATIONS

int entry_determinacy.EXPECTED_PRF_LINEAR_REGENERATIONS = 0

Definition at line 74 of file entry_determinacy.py.

◆ PRIOR_FOOTPRINT_RANGE_TEXT

str entry_determinacy.PRIOR_FOOTPRINT_RANGE_TEXT = "7.59 MB to 17.02 GB"

Definition at line 85 of file entry_determinacy.py.

◆ REJECTION_BOUND

tuple entry_determinacy.REJECTION_BOUND = (1 << 16) // Q * Q

Definition at line 81 of file entry_determinacy.py.

◆ REJECTION_RETRY_LIMIT

int entry_determinacy.REJECTION_RETRY_LIMIT = 64

Definition at line 82 of file entry_determinacy.py.