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
primitive_bench.c File Reference

Protected/direct timing ratio of the PQ-WB-KEM base multiplication on x86-64 and aarch64. More...

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
+ Include dependency graph for primitive_bench.c:

Go to the source code of this file.

Macros

#define NUM_COMPONENTS   128
 
#define Q   3329
 
#define ZETA   17
 

Functions

int main (int argc, char **argv)
 
static double now_sec (void)
 
static uint32_t nxt (void)
 
static int pw (int b, int e, int m)
 

Variables

static uint64_t st = 42
 

Detailed Description

Protected/direct timing ratio of the PQ-WB-KEM base multiplication on x86-64 and aarch64.

direct = arithmetic product (p0=s0c0+g s1c1, p1=s0c1+s1c0); protected = same product via per-component baked table lookups (construction B, full-range NTT-domain secret) plus 3-share masking of both output coordinates, over the 2.56 MB per-poly tables (k=3 -> 7.67 MB). Deterministic (LCG seed 42); build gcc / aarch64-linux-gnu-gcc -O2 -static; writes JSON to stdout.

Note
qemu-aarch64 is functional emulation, not cycle-accurate; absolute aarch64 timings do not reflect real silicon. Both variants run under the identical emulator, so the ratio is the comparable metric.

Definition in file primitive_bench.c.

Macro Definition Documentation

◆ NUM_COMPONENTS

#define NUM_COMPONENTS   128

Definition at line 19 of file primitive_bench.c.

◆ Q

#define Q   3329

Definition at line 18 of file primitive_bench.c.

◆ ZETA

#define ZETA   17

Definition at line 20 of file primitive_bench.c.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 33 of file primitive_bench.c.

References now_sec(), NUM_COMPONENTS, nxt(), pw(), Q, and ZETA.

+ Here is the call graph for this function:

◆ now_sec()

static double now_sec ( void  )
static

Definition at line 22 of file primitive_bench.c.

Referenced by main().

+ Here is the caller graph for this function:

◆ nxt()

static uint32_t nxt ( void  )
static

Definition at line 29 of file primitive_bench.c.

References st.

Referenced by main().

+ Here is the caller graph for this function:

◆ pw()

static int pw ( int  b,
int  e,
int  m 
)
static

Definition at line 31 of file primitive_bench.c.

Referenced by main().

+ Here is the caller graph for this function:

Variable Documentation

◆ st

uint64_t st = 42
static

Definition at line 28 of file primitive_bench.c.

Referenced by nxt().