Software
Public git repository
The primary source to obtain the Dilithium software is the public GitHub repository. To download and build the software, follow the following steps:
git clone https://github.com/pq-crystals/dilithium.git
cd dilithium/ref && make
cd ../avx2 && make
cd dilithium/ref && make
cd ../avx2 && make
In each of the subdirectories ref/ and avx2/ this will build the binaries PQCgenKAT_sign, test/test_vectors and test/test_dilithium for the recommended parameter set. In order to build the binaries for one of the other parameter sets go to ref/ or avx2/ and run
make clean
CFLAGS="-DMODE=i" make
CFLAGS="-DMODE=i" make
with i equal to 1, 2, 3, 4 for the weak, medium, recommended and very high parameter sets, respectively.
- PQCgenKAT_sign is the KAT generation program provided by NIST. It computes the known answer tests with deterministically generated keys and signatures and writes them to the files PQCsignKAT_$(CRYPTO_SECRETKEYBYTES).{req,rsp}. The official known answer tests are included in the KAT/ folder of the submission package.
- test_vectors prints deterministically generated test vectors for several intermediate values occurring in the Dilithium algorithms. Namely, a 48 byte seed, the matrix A corresponding to the first 32 bytes of seed, a short vector s corresponding to the first 32 bytes of seed and nonce 0, a masking vector y corresponding to the seed and nonce 0, the high bits w1 and the low bits w0 of the vector w = Ay, the power-of-two rounding t1 of w and the corresponding low part t0, and the challenge c for the seed and w1. This binary is meant to help to ensure compatibility of different independent implementations.
- test_dilithium tests 1000 times to generate keys, sign a random message of 59 bytes and verify the signature. It will abort with an error message and return -1 if there is an error. Otherwise it will return 0 and print the average and median cycle counts of the three operations keygen, sign and verify.