μNaCl – The Networking and Cryptography library for microcontrollers


Curve25519 for ARM Cortex-M0

The software described below is a standalone Curve25519 implementation optimized for speed.

Build instructions

Installing llvm, clang, and st-link

To install llvm/clang and an ARM gcc cross-compiler on a Debian system, run the following commands (as root):

apt-get install llvm clang gcc-arm-none-eabi

Also, you will probably have to install libc6-dev-i386:

apt-get install libc6-dev-i386

To program the Cortex-M0 chip on the development board we need st-link. To download and build this tool, first install the libusb headers (as root):

apt-get install libusb-1.0-0-dev
run the following commands:

git clone https://github.com/texane/stlink.git
cd stlink
./autogen.sh
./configure
make && make install

Connecting the STM32F0Discovery development board

For our tests and benchmark we use the STM32F0Discovery development board. To read serial output from this board you will need a USB-TTL converter, which needs to be connected as follows:

The setup should look like in the following picture:

Picture of a connected STM32F0Discovery Board

Building Curve25519 for ARM Cortex-M0

To download and build the software for ARM Cortex-M0, run the following commands:

wget http://munacl.cryptojedi.org/data/curve25519-cortexm0-20150813.tar.bz2
tar xjvf curve25519-cortexm0-20150813.tar.bz2
cd curve25519-cortexm0-20150813
make

Copyright warning: The software package contains a subdirectory named stm32f0xx which contains software copyrighted by ARM Ltd. The files in this subdirectory are thus not in the public domain.


Running tests and benchmarks

Each of the two versions of the software comes with 3 testing and benchmarking routines:

Each of those scripts will program the Cortex-M0 on the STM32F0Discovery board (see above) and print the output through USB-serial (also see above) to standard out. Note that test_stm32f0.sh does not print anything if the test is successful.