Skip to content

KMU-CSE/kpqm4

Repository files navigation

kpqm4

Collection of Korean post-quantum cryptographic alrogithms for the ARM Cortex-M4

Introduction

This project is inpired by pqm4 project. KPQM4 provides executable KpqC Competition Round 2 candidates code on Cortex-M4. We used NUCLEO-l4r5zi which has 640KB SRAM and 2MB flash memory.

Dependency

How to build

All of build steps work well on Ubuntu 22.04LTS with NUCLEO-l4r5zi board.

Install dependencies.

sudo apt install gcc-arm-none-eabi build-essential libusb-1.0-0-dev cmake make python3-pip

Install stlink.

git clone https://github.com/stlink-org/stlink .
cmake .
make
# If you fail here, install additional dependencies according to error message.
sudo cp bin/* /usr/local/bin
sudo cp lib/*.so* /lib32
sudo cp config/udev/rules.d/49-stlinkv* /etc/udev/rules.d/

Now connect your board with your PC, and check it is connected well.

lsusb
# Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
# Bus 001 Device 003: ID 0483:374b STMicroelectronics ST-LINK/V2.1
# Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
st-info --probe
# Found 1 stlink programmers
#   version:    V2J35S26
#   serial:     0670FF363947423043132622
#   flash:      2097152 (pagesize: 4096)
#   sram:       655360
#   chipid:     0x470
#   dev-type:   STM32L4Rx

Clone the repository into your workspace.

git clone https://github.com/COALA-5/kpqm4

Move to kpqm4 workspace, and build it.

make -j16 PLATFORM=nucleo-l4r5zi
# If you do not use -j option, it will take lots of times.

Integrity Check

You can flash the HMAC-SHA-256 value of the binary(.bin) for integrity check. The key is hard-coded as all zero, and the HMAC value is flashed into the address 0x081FF000. To flash the integrity check value, run ./integrity_test/flash_hmac.sh at the top directory, then input the name of binary file except .bin.

Documents

The presentation metarials of the 8, 9th KpqC workshops, and implementation guide on Cortex-M4 are available in documents directory.

Future Works

  • Make a table contains each size of pk, sk, ct/sig
  • Add max/min/median clock cycles (only shows average clock cycles for now)
  • ... and more

Contributors

Other KpqC Project