Post-Quantum Software Research Center

The following instructions are for Debian/Ubuntu systems. Other modern Linux/BSD/UNIX systems should work with minor adjustments to the instructions. These instructions need the following packages:

Download, unpack, compile, test, install

In a root terminal, create an nttcompiler user:

    adduser --disabled-password --gecos nttcompiler nttcompiler

Run a shell as that user:

    su - nttcompiler
    chmod 755 $HOME
    umask 022

As that user, download and unpack the latest version of nttcompiler:

    wget -m https://pqsrc.cr.yp.to/nttcompiler-latest-version.txt
    version=$(cat pqsrc.cr.yp.to/nttcompiler-latest-version.txt)
    wget -m https://pqsrc.cr.yp.to/nttcompiler-$version.tar.gz
    tar -xzf pqsrc.cr.yp.to/nttcompiler-$version.tar.gz
    cd nttcompiler-$version
    ln -s $HOME link-build
    ln -s $HOME link-install

Compile, test, and install:

    ./do

The last line of a successful compile-test-install run is "benchmark finishing successfully". Exit the user shell:

    exit

That's it.

Verify

Currently the verification supports only the AVX2 code.

Start a new shell as the nttcompiler user. Install angr in a Python 3 virtual environment:

    cd
    . /usr/share/virtualenvwrapper/virtualenvwrapper.sh
    mkvirtualenv -p /usr/bin/python3 angr
    pip install angr
    pip install pyparsing

Run the verifyall script to verify each of the provided NTTs:

    workon angr
    env PATH=$HOME/command:$PATH verifyall

The verifyall script stops with an error message if it encounters any failures.

Options

Compiler options

./do tries a list of compilers in compilers/c, keeping the fastest working implementation of each target. Before running ./do you can edit compilers/c to adjust compiler options or to try additional compilers.

Multi-ABI support

If you put both 32-bit and 64-bit compilers into compilers/c then ./do will produce both 32-bit and 64-bit libraries, available through lib-x86 and lib-amd64 (on Intel/AMD CPUs) or lib-armeabi and lib-aarch64 (on ARM CPUs). You should put the 64-bit compilers first so that they are used (if possible) for the command-line tools.


Version: This is version 2022.04.11 of the "NTT compiler" web page.