To build mldsa-native, you need make and a C90 compiler. To use the test scripts, you need Python3 (>= 3.7).
See mldsa.
You can build and test mldsa-native as follows:
make test # With native code backend (if available)
make OPT=0 test # With C backendTo merely build test components, use the following make targets:
make func
make kat
make acvpTo run them, add run_:
make run_func
make run_kat
make run_acvpThe resulting binaries can be found in test/build (their full path is printed by make).
For benchmarking, specify the cycle counting method. Currently, mldsa-native is supporting NO, PERF, PMU, and MAC:
NOmeans that no cycle counting will be used; this can be used to confirm that benchmarks compile fine.PERFuses theperfkernel module for cycle counting. Does not work on Apple platforms.PMUuses direct PMU access if available. On AArch64, this may require you to load a kernel module first, see here. Does not work on Apple platforms.MACisperf-based and works on some Apple platforms, at least Apple M1.
# CYCLES has to be one of PERF, PMU, MAC, NO
sudo make run_bench CYCLES=PERF
sudo 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 funcwill compile and run functionality tests. Similarly,
./scripts/tests bench -c PERF -rwill compile and run benchmarks, using PERF for cycle counting (-c PERF) and running as root (-r).
For detailed information on how to use the script, please refer to
./scripts/tests --help.
You can also build mldsa-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 quickcheckTo run the CBMC proofs, you need specific versions of CBMC and the underlying solvers, e.g. as specified in our nix environment; see nix/cbmc.
See CONTRIBUTING.md for instructions on how to setup and use nix.
Once you are in the nix shell or have all tools setup by hand, use ./scripts/tests cbmc (or just tests cbmc in the nix shell) to re-check the CBMC proofs.
See tests cbmc --help for details on the command line options, and proofs/cbmc for more details on the CBMC proofs in general.
To run the HOL-Light proofs, you need recent versions of HOL-Light and s2n-bignum, e.g. as specified in our nix environment; see nix/s2n_bignum and nix/hol_light.
See CONTRIBUTING.md for instructions on how to setup and use nix.
Once you are in the nix shell or have all tools setup by hand, use ./scripts/tests hol_light (or just tests hol_light in the nix shell) to re-check the HOL-Light proofs. Note that depending on the function, they will take a long time. See tests hol_light --help for details on the command line options, and proofs/hol_light for more details on the HOL-Light proofs in general.