Skip to content

Benchmarking framework for cryptographic workloads on AArch64

License

Notifications You must be signed in to change notification settings

slothy-optimizer/pqax

Repository files navigation

pqax: Post-Quantum Cryptography on A-profile Arm CPUs

This repository is a fork of the pqax repository, adding further examples from public-key cryptography (both classical and post-quantum). Along with pqmx and SLOTHY, it accompanies the paper Fast and Clean: Auditable high-performance assembly via constraint-solving by Abdulrahman, Becker, Kannwischer and Klein.

It contains implementations of SPHINCS+ described in Hybrid scalar/vector implementations of Keccak and SPHINCS+ on AArch64. See sphincsplus for more details.

Structure

The main components of the repository are the following:

  • asm: Core primitives in optimized assembly, auto-generated or handwritten.
  • tests: C-based tests for core primitives using a minimal hardware abstraction layer (HAL).
  • envs: Test environments implementing the HAL.
  • sphincsplus: Supporting material for the paper "Hybrid scalar/vector implementations of Keccak on AArch64"
  • nelight: Submodule for the SLOTHY superoptimizer.

The following sections explain each component in greater detail.

Optimized assembly routines

The heart of the repository are optimized assembly routines for core components of the post quantum primitives under consideration, such as the NTT or Keccak. All optimized assembly is contained in the asm directory, which is structured as follows:

  • asm/manual contains assembly that has been written by hand.
  • asm/scripts contains code generation scripts for various algorithms around polynomial multiplication or the PQC schemes they're relevant for, as well as other tests and examples.
  • asm/auto/ contains the assembly auto-generated by the examples in asm/scripts. Its structure mirrors that of asm/scripts.

Tests

The core assembly routines are accompanied by C test programs contained in tests/. For example, the Keccak implementations from asm/manual/keccak_f1600 are tested in tests/keccak_neon/. The test files platform-independent and only rely on a small hardware abstraction layer tests/inc/hal.h which declares stubs for debugging, measuring, and random sources.

Test environments

As mentioned above, the tests from tests/ can be run in any environment defining the hardware abstraction layer interface tests/inc/hal.h.

The supported test environments are located in envs. There are currently two test environments: native for builds on an Arm host, and cross for cross-compilation. For the cross test environment, you can specific the environment variable CYCLES as one of NO, PMU, PERF to indicate the source of cycle counts, and PLATFORM as one of v8a or v84a to control the compilation target.

License

pqax is licensed under the MIT license. See LICENSE for details.

pqax contains some third party sources, some of which are licensed differently:

Usage

To build/run tests, use make build-{cross,native}-{testname}, where test is one of the tests in tests. For example, to cross-compile the Keccak tests for simulation in QEMU, use CYCLES=NO make build-cross-keccak_neon.

About

Benchmarking framework for cryptographic workloads on AArch64

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published