To build mlkem-native, you need make
and a C90 compiler. To use the test scripts, you need Python3 (>= 3.7).
You can build and test mlkem-native as follows:
make test # With native code backend (if available)
make OPT=0 test # With C backend
To merely build test components, use the following make
targets:
make func
make nistkat
make kat
make acvp
To run them, add run_
:
make run_func
make run_nistkat
make run_kat
make run_acvp
The resulting binaries can be found in test/build
(their full path is printed by make
).
For benchmarking, specify the cycle counting method. Currently, mlkem-native is supporting PERF, PMU (AArch64 and x86 only), M1 (Apple Silicon only):
# CYCLES has to be on of PERF, PMU, M1, NO
make run_bench CYCLES=PERF
make run_bench_components CYCLES=PERF
For convenience, you can also use the ./scripts/tests
script as a wrapper around make
. For
example,
./scripts/tests func
will compile and run functionality tests. For detailed information on how to use the script, please refer to
./scripts/tests --help
.
You can also build mlkem-native on Windows using nmake
and an MSVC compiler.
To build and run the tests (only support functional testing for non-opt implementation for now), use the following nmake
targets:
nmke /f .\Makefile.Microsoft_nmake quickcheck
To run the CBMC proofs, you need the CBMC version as specified in our nix
development environment. Please setup nix
as described in CONTRIBUTING.md.
To check the CBMC proofs, enter the nix
development environment and use tests cbmc
.