CRYSTALS

Cryptographic Suite for Algebraic Lattices

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

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

with i equal to 0, 1, 2, 3 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, an 80 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, an intermediate masking vector y corresponding to seed and nonce 0, the high bits w1 of the vector w = Ay and the challenge c for last 48 bytes of seed and w1. This binary is meant to help to ensure compatibility of different independent implementations.
  • test_dilithium tests 5000 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 key gen, sign and verify and the corresponding times in milliseconds assuming that the cycle counter ticks at 2.6 Ghz.

Tarball packaged for SUPERCOP integration

We also have a tarball of the latest version of Dilithium packaged for integration into the SUPERCOP benchmarking framework.