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

liboqs ML-KEM-768 KeyGen/Encaps/Decaps wall-clock benchmark; emits the full arm64_benchmark.json / baseline schema to stdout so every field is measured or computed, never transcribed. More...

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <oqs/oqs.h>
+ Include dependency graph for bench_liboqs.c:

Go to the source code of this file.

Classes

struct  opstat
 
struct  samples
 Grow-on-demand sample buffer so the loop is bounded by wall-clock, not a fixed count. More...
 

Macros

#define BENCH_COMPILER   "unknown"
 
#define BENCH_OPENSSL   0
 
#define BENCH_PLATFORM   "unknown"
 
#define BENCH_TARGET   "unknown"
 
#define WARMUP   1000
 Warmup iterations discarded before timing.
 

Functions

static void emit_op (const char *name, opstat o, int last)
 
int main (int argc, char **argv)
 
static double now_sec (void)
 
static void push (samples *s, double v)
 
static opstat reduce (const samples *s)
 

Detailed Description

liboqs ML-KEM-768 KeyGen/Encaps/Decaps wall-clock benchmark; emits the full arm64_benchmark.json / baseline schema to stdout so every field is measured or computed, never transcribed.

Each operation runs a fixed wall-clock budget (default 3.0 s, argv[1]) after a warmup, and the per-iteration times are reduced to iteration count, mean and standard deviation. A time budget rather than a fixed iteration count keeps the aarch64/QEMU and x86-64 runs at equal wall-clock per operation, so the iteration count itself reports relative op cost. An unavailable ML-KEM-768 is a hard error: the harness never substitutes a different algorithm or emits a partial result. cpu_extensions is read from liboqs runtime detection; compiler and openssl_enabled are the build facts passed in as macros; oqs_version is the linked library's own string.

Note
Under qemu-aarch64 the absolute times are functional-emulation figures dependent on host load and CPU frequency, not real silicon; provenance says so and the comparable metric is the ratio.
Author
Ugur Coruh

Definition in file bench_liboqs.c.


Class Documentation

◆ opstat

struct opstat

Definition at line 56 of file bench_liboqs.c.

+ Collaboration diagram for opstat:
Class Members
double mean_us
long n
double stdev_us

◆ samples

struct samples

Grow-on-demand sample buffer so the loop is bounded by wall-clock, not a fixed count.

Definition at line 50 of file bench_liboqs.c.

+ Collaboration diagram for samples:
Class Members
long cap
long n
double * t

Macro Definition Documentation

◆ BENCH_COMPILER

#define BENCH_COMPILER   "unknown"

Definition at line 28 of file bench_liboqs.c.

◆ BENCH_OPENSSL

#define BENCH_OPENSSL   0

Definition at line 37 of file bench_liboqs.c.

◆ BENCH_PLATFORM

#define BENCH_PLATFORM   "unknown"

Definition at line 34 of file bench_liboqs.c.

◆ BENCH_TARGET

#define BENCH_TARGET   "unknown"

Definition at line 31 of file bench_liboqs.c.

◆ WARMUP

#define WARMUP   1000

Warmup iterations discarded before timing.

Definition at line 41 of file bench_liboqs.c.

Function Documentation

◆ emit_op()

static void emit_op ( const char *  name,
opstat  o,
int  last 
)
static

Definition at line 68 of file bench_liboqs.c.

References opstat::mean_us, opstat::n, and opstat::stdev_us.

Referenced by main().

+ Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 77 of file bench_liboqs.c.

References BENCH_COMPILER, BENCH_OPENSSL, BENCH_PLATFORM, BENCH_TARGET, emit_op(), now_sec(), push(), reduce(), samples::t, and WARMUP.

+ Here is the call graph for this function:

◆ now_sec()

static double now_sec ( void  )
static

Definition at line 43 of file bench_liboqs.c.

Referenced by main().

+ Here is the caller graph for this function:

◆ push()

static void push ( samples *  s,
double  v 
)
static

Definition at line 51 of file bench_liboqs.c.

References samples::cap, samples::n, and samples::t.

Referenced by main().

+ Here is the caller graph for this function:

◆ reduce()

static opstat reduce ( const samples *  s)
static

Definition at line 57 of file bench_liboqs.c.

References opstat::mean_us, samples::n, opstat::stdev_us, and samples::t.

Referenced by main().

+ Here is the caller graph for this function: