Installation

pyecsca consists of three repositories:

Core

The core repository contains the core of the functionality, except the code generation and notebooks.

Codegen

The codegen repository contains the code generation functionality.

Notebook

The notebook repository contains example notebooks that showcase functionality of the toolkit.

Core

The core package can be installed either from pypi or from the source repository. There are several extras that can be installed:

  • picoscope_sdk to enable support for PicoScope oscilloscopes using the picosdk package.

  • picoscope_alt to enable support for PicoScope oscilloscopes using the picoscope package.

  • chipwhisperer to enable support for ChipWhisperer targets and oscilloscopes.

  • smartcard to enable support for smartcard targets using the pyscard package.

  • leia to enable support for smartcard targets using the leia (smartleia) package.

  • gmp to enable arithmetic via gmpy2 (which may or may not be faster).

  • flint to enable arithmetic via python-flint (which may or may not be faster).

  • pari to enable faster division polynomial computation using cypari2.

  • dev to install several packages used in development.

  • test to install several packages used for testing.

  • doc to install several packages used for building documentation.

You can install these extras like this:

pip install pyecsca[smartcard,gmp]

Note

The core repository uses git submodules, make sure to check them out after cloning with: git submodule update --init.

The core package contains data from the Explicit-Formulas Database by Daniel J. Bernstein and Tanja Lange. The data was partially changed, to make working with it easier. It is available on Github at crocs-muni/efd.

It uses ChipWhisperer as one of its targets. It also supports working with Riscure Inspector trace sets, which are of a proprietary format.

Optionally, you can Cythonize the pyecsca/ec/mod subpackage and sometimes gain a performance benefit, YMMV.

Requirements

General
Testing & Development

See the Makefile for tests, performance measurement, codestyle and type checking commands. Use black for code-formatting.

Docs

Codegen

The codegen package requires (and bundles in ext/libtommath as a git submodule) a version of the libtommath library. The package can be either installed from pypi or from the source repository. Note that currently, the pypi project contains the built package for x86_64 Linux only. Thus, installation from source is preferable.

Assuming you have make, a C compiler and a C cross-compiler for `arm-none-eabi you can just run:

pip install .

inside the codegen repository and it should be built and installed automatically.

Note

The codegen repository uses git submodules, make sure to check them out after cloning with: git submodule update --init.

Notebooks

The notebook repository is included as a submodule in the core repository. However, this version can get outdated during active development. Note that the notebooks have some additional requirements that are specified in the requirements.txt file, which you can install with:

pip install -r requirements.txt

inside the notebook repository.