μNaCl – The Networking and Cryptography library for microcontrollers


Curve25519 for AVR ATmega


The software described below is a standalone Curve25519 implementation optimized for speed. We are planning to integrate it into AVRNaCl. It includes two versions, one called "small" and one called "fast". Both of those are optimized for speed, but the small implementation uses slightly slower (and considerably smaller) implementations of multiprecision multiplication and squaring.


Build instructions

Installing an AVR GNU toolchain

In order to build Curve25519 for AVR you need an AVR GNU toolchain installed. On a Debian (jessie) systems this is easily achieved by adding the following line to the file /etc/apt/sources.list:

deb http://www.emdebian.org/debian jessie main

and then the following commands (as root):

apt-get update
apt-get install gcc-avr binutils-avr avr-libc avrdude

Building Curve25519 for AVR ATmega

To download and build the software for ATmega2560, run the following commands:

wget http://munacl.cryptojedi.org/data/curve25519-atmega-20150304.tar.bz2
tar xjvf curve25519-atmega-20150304.tar.bz2
cd curve25519-atmega-20150304/fast
make
cd ../small
make

Running tests and benchmarks

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

We use the Arduino MEGA development board with an ATmega2560 to run those tests and benchmarks. Each of those scripts will program the ATmega2560 on the Arduino board (connected on /dev/ttyACM0) and print the output through USB-serial to standard out. Note that test_atmega2560.sh does not print anything if the test is successful.