Skip to content

Efficient Implementation of Polynomial Multiplication in Post Quantum Cryptography

License

Notifications You must be signed in to change notification settings

TeumessianFox/pmpq

Repository files navigation

Efficient Implementation of Polynomial Multiplication in Post Quantum Cryptography

Install

  1. git clone https://github.com/TeumessianFox/pmpq.git
  2. cd pmpq

arm-none-eabi toolchain:

On Linux systems:

  1. sudo apt install arm-none-eabi-gcc

Libopencm3:

  1. git submodule update --init
  2. make -C libopencm3

stlink:

  1. Install st-link

serial:

  1. python3 -m pip3 install pyserial

Usage

The main objective of this library is to provide different implementations of polynomial multiplication for post-quantum crypto algorithms.

Target

The STM32F407G-DISCOVERY is used for the pqm4 contest and also the main target for this library.

Flashable .hex files can also be generated for the Chipwhisperer.

Python

Python >= 3.7 needed

Run

Run host/main.py to try every supported polynomial multiplication on the STM32F407G-DISCOVERY once and gather results & cycle count.

pm_algo

Access pm_algo.POLYMUL_ALGOS to gather all viable algo_names

PolymulAlgo class

Function Parameter Description
init(...) self, name: str, chain_size: int, chain: str array, degree: int, opt: char Flashing PolymulAlgo code to the M4 and setting up serial communication
build(...) self Make and flashing PolymulAlgo code to the M4
log_to_file(...) self, key, text, result, cycles Log results to file
run_polymul(...) self, key, text, log: boolean Run specific PolymulAlgo for specific testset

Makefile

STM32F407G-DISCOVERY

Recommended: Use python PolymulAlgo.build() to make & flash

For manual use in m4/

Command Description
make Compile and create .elf & .bin
make flash Flash .bin on the board
make dump Using OBJDUMP to create dump
make clean Remove created files

Chipwhisperer

To generate .hex file for cw use in cw/

Command Description
make Compile and create .elf & .hex
make clean Remove created files

Coding style

C language: coding style

Python: PEP8 using Flake8

Authors

Patrick Gersch

Credits

Based on https://github.com/libopencm3/libopencm3-template.git

About

Efficient Implementation of Polynomial Multiplication in Post Quantum Cryptography

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published