Skip to content

Crypto-TII/arm-shuffling-codegen

Repository files navigation

Supplementary files for "Runtime Code Generation for Constant-Time Secret-Indexed Array Accesses: Applications to PERK and NTRU" paper submission

This project contains the source code relative to the "Runtime Code Generation for Constant-Time Secret-Indexed Array Accesses: Applications to PERK and NTRU" paper published in LATINCRYPT 2025.

It requires either an STM32F407G-DISC1 or NUCLEO-L4R5ZI evaluation board to execute the binaries.

Prerequisites

  • arm-none-eabi-gcc or clang toolchains.
  • OpenOCD to flash binaries into the NUCLEO-L4R5ZI board, and also for debugging.
  • stlink to flash binaries into the STM32F4DISCOVERY board.
  • standard development tools: CMake, make or ninja, git
  • python and python3 (both command must be present and running on the development machine).
  • Suggested VS Code extensions: CMake Tools, Cortex-Debug. The project is compatible with Remote - SSH as well.

Configure and build

# From the main project directory
rm -rf build
cmake -DBOARD=NUCLEO-L4R5ZI-FULLRAM -DCMAKE_BUILD_TYPE=Release --toolchain cmake/arm-none-eabi-gcc-libopencm3.toolchain \
      -G Ninja -S. -Bbuild
ninja -C build

Flash to board and monitor via UART with ctest

# From the main project directory
[TARGET_SERIAL=<board serial from "st-info --probe">] SERIAL_DEVICE=/dev/<uart device> ctest --test-dir build -VV

TARGET_SERIAL is the serial-number of the board (*). It can be checked with the st-info --probe command.
SERIAL_DEVICE is the host serial-device (tty or cu) connected to the uart of the board (usually /dev/ttyACM0 on Linux)

(*) it can be omitted if only one board is connected to the host.

Advanced options

Build and emulate with QEMU (mostly to run unit tests)

qemu emulation is supported only when built with -DBOARD=STM32F4DISCOVERY. It does not report benchmark results correctly, but is useful to run tests.

# From the main project directory
rm -rf build
cmake -DBOARD=STM32F4DISCOVERY -DCMAKE_BUILD_TYPE=Release --toolchain cmake/arm-none-eabi-gcc-libopencm3.toolchain \
      -DRUN_WITH_QEMU=True -G Ninja -S. -Bbuild
ninja -C build

ctest --test-dir build -VV
# or calling qemu directly
qemu-system-arm -M olimex-stm32-h405 -semihosting -nographic -serial null -serial stdio -monitor null -kernel <ELF file>

Build, flash to board and monitor via SWO

# From the main project directory
rm -rf build
cmake -DBOARD=NUCLEO-L4R5ZI -DCMAKE_BUILD_TYPE=Release --toolchain cmake/arm-none-eabi-gcc-libopencm3.toolchain \
      -DUSE_SWO=True -G Ninja -S. -Bbuild
ninja -C build

st-flash [--serial <board serial from "st-info --probe">] --reset write <path to BIN file> 0x08000000
st-trace [--serial <board serial from "st-info --probe">] -c20m

st-trace 1.8.0 seems to have issues on Ubuntu. Need to be built from sources at at least commit b149e24. --serial parameter can be omitted if only one board is connected to the host.
use -c24m for the STM32F407G-DISC1 evaluation board.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published