In cryptography, Curve25519 is an elliptic curve offering 128 bits of security and designed for use with the elliptic curve Diffie–Hellman (ECDH) key agreement scheme. It is one of the fastest ECC curves and is not covered by any known patents.[1] The reference implementation is public domain software.[2]
The original Curve25519 paper defined it as a Diffie–Hellman (DH) function. Daniel J. Bernstein has since proposed that the name Curve25519 be used for the underlying curve, and the name X25519 for the DH function.[3]
LIKE THIS :
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
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:
- 3.3V → 3.3V
- TXD → PA3
- RXD → PA2
- GND → GND
- 5V → DO NOT CONNECT
The setup should look like in the following picture:
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
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:
- test/test_stm32f0.sh
- test/speed_stm32f0.sh
- test/stack_stm32f0.sh
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.