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

Functions

 _load_measured_footprints ()
 Read the measured construction footprints from the committed experiment JSONs.
 
tuple calculate_decaps_time_ms (int k)
 Estimated decapsulation time in ms for module rank k.
 
Dict[str, Any] calculate_higher_order_masking (int base_shares, int target_shares)
 Overhead of raising masking order for table-based white-box.
 
int calculate_ntt_tables (int k)
 NTT table count for module rank k.
 
float calculate_overhead_factor (int k)
 White-box overhead factor for module rank k.
 
tuple calculate_table_size_mb (int k)
 Deployment core-footprint envelope in MB for module rank k.
 
int calculate_target_ram_mb (int k)
 Minimum recommended RAM (MB) for deployment.
 
 main ()
 Compute scaling analysis, print tables, and write JSON output.
 

Variables

 _FP_A
 
 _FP_B
 
dict ML_KEM_PARAMS
 
dict WB_CONSTANTS
 

Function Documentation

◆ _load_measured_footprints()

scaling_analysis._load_measured_footprints ( )
protected

Read the measured construction footprints from the committed experiment JSONs.

Returns
(A_shared_mb, B_baked_mb): base tables plus the 3.41 MB encoding sublayer.

Raises if the producers have not run – no footprint is hardcoded here.

Definition at line 75 of file scaling_analysis.py.

◆ calculate_decaps_time_ms()

tuple scaling_analysis.calculate_decaps_time_ms ( int  k)

Estimated decapsulation time in ms for module rank k.

Parameters
kModule rank.
Returns
(min_ms, max_ms) tuple.

Definition at line 167 of file scaling_analysis.py.

References calculate_overhead_factor().

Referenced by main().

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

◆ calculate_higher_order_masking()

Dict[str, Any] scaling_analysis.calculate_higher_order_masking ( int  base_shares,
int   target_shares 
)

Overhead of raising masking order for table-based white-box.

Parameters
base_sharesBaseline share count.
target_sharesTarget share count.
Returns
Dict of memory/performance factors and security bits.
Note
Memory and performance both O(n^2) via ISW-style gadgets (Ishai-Sahai-Wagner, Private Circuits, Crypto 2003).

Definition at line 215 of file scaling_analysis.py.

Referenced by main().

+ Here is the caller graph for this function:

◆ calculate_ntt_tables()

int scaling_analysis.calculate_ntt_tables ( int  k)

NTT table count for module rank k.

Parameters
kModule rank.
Returns
Table count (128, parameter-independent).

Definition at line 115 of file scaling_analysis.py.

Referenced by main().

+ Here is the caller graph for this function:

◆ calculate_overhead_factor()

float scaling_analysis.calculate_overhead_factor ( int  k)

White-box overhead factor for module rank k.

Parameters
kModule rank.
Returns
Overhead factor (rounded).
Note
Superlinear (k^1.1): more polynomial multiplications and larger intermediate state.

Definition at line 149 of file scaling_analysis.py.

Referenced by calculate_decaps_time_ms(), and main().

+ Here is the caller graph for this function:

◆ calculate_table_size_mb()

tuple scaling_analysis.calculate_table_size_mb ( int  k)

Deployment core-footprint envelope in MB for module rank k.

Parameters
kModule rank.
Returns
(b_core_mb, a_core_mb) tuple: the k-scaling Construction-B core and the k-independent Construction-A core.

Definition at line 131 of file scaling_analysis.py.

Referenced by calculate_target_ram_mb(), and main().

+ Here is the caller graph for this function:

◆ calculate_target_ram_mb()

int scaling_analysis.calculate_target_ram_mb ( int  k)

Minimum recommended RAM (MB) for deployment.

Parameters
kModule rank.
Returns
RAM size rounded up to a common value.
Note
Targets at least 2x table size.

Definition at line 194 of file scaling_analysis.py.

References calculate_table_size_mb().

Referenced by main().

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

◆ main()

scaling_analysis.main ( void  )

Compute scaling analysis, print tables, and write JSON output.

Definition at line 262 of file scaling_analysis.py.

References calculate_decaps_time_ms(), calculate_higher_order_masking(), calculate_ntt_tables(), calculate_overhead_factor(), calculate_table_size_mb(), calculate_target_ram_mb(), and main().

Referenced by main().

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

Variable Documentation

◆ _FP_A

scaling_analysis._FP_A
protected

Definition at line 97 of file scaling_analysis.py.

◆ _FP_B

scaling_analysis._FP_B
protected

Definition at line 97 of file scaling_analysis.py.

◆ ML_KEM_PARAMS

dict scaling_analysis.ML_KEM_PARAMS
Initial value:
1= {
2 "ML-KEM-512": {
3 "n": 256,
4 "k": 2,
5 "q": 3329,
6 "eta1": 3,
7 "eta2": 2,
8 "du": 10,
9 "dv": 4,
10 "nist_level": 1,
11 "pk_bytes": 800,
12 "sk_bytes": 1632,
13 "ct_bytes": 768,
14 },
15 "ML-KEM-768": {
16 "n": 256,
17 "k": 3,
18 "q": 3329,
19 "eta1": 2,
20 "eta2": 2,
21 "du": 10,
22 "dv": 4,
23 "nist_level": 3,
24 "pk_bytes": 1184,
25 "sk_bytes": 2400,
26 "ct_bytes": 1088,
27 },
28 "ML-KEM-1024": {
29 "n": 256,
30 "k": 4,
31 "q": 3329,
32 "eta1": 2,
33 "eta2": 2,
34 "du": 11,
35 "dv": 5,
36 "nist_level": 5,
37 "pk_bytes": 1568,
38 "sk_bytes": 3168,
39 "ct_bytes": 1568,
40 },
41}

Definition at line 32 of file scaling_analysis.py.

◆ WB_CONSTANTS

dict scaling_analysis.WB_CONSTANTS
Initial value:
1= {
2 "ntt_factors": 128, # X^256+1 factors over Z_q
3 "bytes_per_table_entry": 2, # uint16 per entry; q = 3329 fits in 12 bits
4 "table_entries_per_coeff": 3329, # q possible values
5 "base_tables_per_factor": 3, # h0, h1, h2 per irreducible factor
6 "masking_shares": 3, # Default 3-share masking
7 "assumed_overhead_768": 47, # construction B deployment: native-C 4.30x protected primitive x ~11x cache
8 "floor_overhead_768": 17, # RNG-excluded lower bound: ~1.55x masking floor x ~11x cache; A is not projected
9 "measured_core_768_mb_B_baked": _FP_B, # B: 7.67 base + 3.41 encoding (from whitebox_reference/encoded JSON)
10 "measured_core_768_mb_A_shared": _FP_A, # A: 22.16 base + 3.41 encoding (from whitebox_reference/encoded JSON)
11 "assumed_table_size_768_mb": 11, # construction B measured core (k=3)
12 "assumed_decaps_time_768_ms": 10.0, # x86-64 host 0.213 ms x ~47x deployment (B); no ARM-device measurement
13}

Definition at line 100 of file scaling_analysis.py.