ZeroTierOne/third_party/kyber/tests
2022-07-13 20:12:32 -04:00
..
KATs More session work, cleanup, AES in core crypto, and vendor the kyber library so we can remove no_std. 2022-07-13 20:12:32 -04:00
load More session work, cleanup, AES in core crypto, and vendor the kyber library so we can remove no_std. 2022-07-13 20:12:32 -04:00
rand_bufs More session work, cleanup, AES in core crypto, and vendor the kyber library so we can remove no_std. 2022-07-13 20:12:32 -04:00
kat.rs More session work, cleanup, AES in core crypto, and vendor the kyber library so we can remove no_std. 2022-07-13 20:12:32 -04:00
kem.rs More session work, cleanup, AES in core crypto, and vendor the kyber library so we can remove no_std. 2022-07-13 20:12:32 -04:00
kex.rs More session work, cleanup, AES in core crypto, and vendor the kyber library so we can remove no_std. 2022-07-13 20:12:32 -04:00
readme.md More session work, cleanup, AES in core crypto, and vendor the kyber library so we can remove no_std. 2022-07-13 20:12:32 -04:00
run_all_tests.sh More session work, cleanup, AES in core crypto, and vendor the kyber library so we can remove no_std. 2022-07-13 20:12:32 -04:00

Testing

Without any feature flags cargo test will run through the key exchange functions and some doctests for the selected security level and mode. Running the Known Answer Tests require deterministic rng buffers from the test vector files. These files are quite large, you will need to generate them yourself. Instructions for building the KAT files are here. Otherwise you can run:

cd KATs
./build_kats.sh

Which will clone the C reference repo, generate the KAT files, then rename and put them in the correct folder for testing.

To run the known answer tests you will need to use the KATs feature flag and only test that module by itself. To check different Kyber levels or 90's mode you will need to include those flags also. eg:

cargo test --test kat --features "KATs kyber1024 90s"

To run a matrix of all possible tests use the helper script from this folder:

./run_all_tests.sh

Test files:

  • kat.rs - Runs a battery of test vectors using the Known Answer Test file of the selected security level and mode. There are 10,000 KATs per file.

  • kex.rs - Goes through a full key exchange procedure for both the UAKE and AKE functions.

  • kem.rs - A single run of random key generation, encapsulation and decapsulation.