International Association for Cryptologic Research

International Association
for Cryptologic Research

Transactions on Cryptographic Hardware and Embedded Systems 2025

Algebraic Linear Analysis for Number Theoretic Transform in Lattice-Based Cryptography


README

CryptoLine

CryptoLine is a tool and a language for the verification of low-level
implementations of mathematical constructs. It has been used to verify
implementations in
OpenSSL,
BoringSSL,
mbed TLS,
pqm4,
ntt-polymul, etc.

Prerequisite

To compile and run CryptoLine, the following packages need to be installed.

Installation

On Linux

See misc/Dockerfile.apt or misc/Dockerfile.opam for instructions to install
CryptoLine on Ubuntu 23.04.

Run the following command to see the available command-line arguments.

$ cv -help

To uninstall CryptoLine, run the following command.

$ dune uninstall

Using Docker

Two dockerfiles are provided in CryptoLine. Run the following commands to build
a docker image and run a new container from the image.

$ docker build -t cryptoline - < misc/Dockerfile.apt
$ docker run -it --name cryptoline cryptoline bash -l

Replace misc/Dockerfile.apt with misc/Dockerfile.opam if you want to manage
OCaml packages using opam.

Simple Test

To test the installation of CryptoLine, run the following command in the
project root.

$ ./run_experiments -simple

Below is the expected output (time may vary).

Verifying examples/qhasm/fe25519_add.cl: 0 seconds                          [OK]
Verifying examples/qhasm/fe25519_sub.cl: 1 seconds                          [OK]
Verifying examples/qhasm/fe25519r64_add.cl: 0 seconds                       [OK]
Verifying examples/qhasm/fe25519r64_addsub.cl: 0 seconds                    [OK]
Verifying examples/qhasm/fe25519r64_sub.cl: 0 seconds                       [OK]

Basic Usage

Verify a CryptoLine program program.cl.

$ cv program.cl

Parse a CryptoLine program program.cl.

$ cv -p program.cl

Output the SSA (Static Single Assignment) form of a CryptoLine program
program.cl.

$ cv -pssa program.cl

Verify a CryptoLine program program.cl with at most 2 parallel jobs (-jobs 2),
verbose outputs (-v), incremental checking of algebraic soundness (-isafety),
and program slicing (-slicing).

$ cv -v -jobs 2 -isafety -slicing program.cl

CryptoLine Language

Read doc/cryptoline.pdf for the details of the CryptoLine language.

Tutorial

A tutorial of CryptoLine is available in doc/tutorial.pdf.

Syntax Highlight

Syntax highlighting in Emacs is provided by misc/cryptoLine-mode.el.

; Change [PATH_TO_CRYPTOLINE] to the right location
(add-to-list 'load-path "[PATH_TO_CRYPTOLINE]/misc")
(autoload 'cryptoline-mode "cryptoline-mode" "Major mode for CryptoLine files." t)
(add-to-list 'auto-mode-alist '("\\.cl\\'" . cryptoline-mode))

Syntax highlighting in Visual Studio Code is provided by the extension
misc/cryptoline-vscode-extension/cryptoline-x.y.z.vsix where x.y.z is
the version of the extension.

Reference