|
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)
|
Three C micro-benchmarks. primitive_bench.c and cache_effect.c are dependency-free (libc only) and measure the low-level cost of the white-box base multiplication; both are deterministic (LCG seed 42). bench_liboqs.c times the unprotected liboqs ML-KEM-768 baseline and links a cross-built aarch64 liboqs.
| Source | Measures | Output |
|---|---|---|
primitive_bench.c | Protected (table + 3-share masking) vs direct arithmetic timing ratio | JSON to stdout |
cache_effect.c | L1 / L3 / DRAM access-penalty of the Construction-B baked tables (2.56 MB per secret polynomial; 7.67 MB across k=3) | results/cache_effect.json |
bench_liboqs.c | liboqs ML-KEM-768 KeyGen/Encaps/Decaps wall-clock under qemu-aarch64 (time-budgeted) | results/arm64_benchmark.json (via build_arm64_benchmark.sh) |
The absolute nanosecond figures are host-specific; the ratio is the comparable metric.
aarch64runs are functional QEMU emulation (not cycle-accurate).
Run these from the repository root so that results/ resolves correctly.
Requires gcc-aarch64-linux-gnu and qemu-user-static:
cache_effect also compiles on Windows (MSVC or MinGW); it has a _WIN32 timing path and creates results/ if missing.
One command cross-builds liboqs 0.15.0 for aarch64 (ML-KEM-768 only, static, no OpenSSL), compiles bench_liboqs.c against it, runs it under qemu-aarch64 for n_runs independent runs, and reduces them to mean +/- 95% CI with arm64_aggregate.py, writing results/arm64_benchmark.json. A single QEMU run drifts run-to-run, so the interval over N runs is the reported statistic:
Requires gcc-aarch64-linux-gnu, qemu-user-static, cmake, ninja, git; a missing tool is a hard error naming the apt package, never a silent fallback. The liboqs build tree lives outside the repo ($HOME/.cache/pqwbkem_arm64_build, override with ARM64_BUILD_DIR) so a run leaves git status clean and repeats skip the rebuild. Every field in the JSON is measured by bench_liboqs.c or read from the linked library; absolute times are qemu functional-emulation figures that depend on host load and CPU frequency, so the comparable metric is the ratio, not any ARM device's wall-clock.
primitive_bench and cache_effect take no external libraries beyond the C standard library; bench_liboqs links liboqs (cross-built by the script above).primitive_bench takes the architecture label as its first argument (x86_64 or aarch64); it only tags the JSON, it does not change the code path.results/primitive_bench_*.json and results/cache_effect.json were produced with the commands above.