• Stars
    star
    323
  • Rank 130,051 (Top 3 %)
  • Language
    C
  • License
    Other
  • Created about 16 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Implementations of a fast Elliptic-curve Diffie-Hellman primitive

curve25519-donna

Note: this code is from 2008. Since that time, many more, great implementations of curve25519 have been written, including several amd64 assembly versions by djb. You are probably better served now by NaCl or libsodium.

curve25519 is an elliptic curve, developed by Dan Bernstein, for fast Diffie-Hellman key agreement. DJB's original implementation was written in a language of his own devising called qhasm. The original qhasm source isn't available, only the x86 32-bit assembly output.

Since many x86 systems are now 64-bit, and portability is important, this project provides alternative implementations for other platforms.

Implementation Platform Author 32-bit speed 64-bit speed Constant Time
curve25519 x86 32-bit djb 265µs N/A yes
curve25519-donna-c64 64-bit C agl N/A 215µs yes
curve25591-donna Portable C agl 2179µs 610µs

(All tests run on a 2.33GHz Intel Core2)

Usage

The usage is exactly the same as djb's code (as described at http://cr.yp.to/ecdh.html) except that the function is called curve25519\_donna.

To generate a private key, generate 32 random bytes and:

mysecret[0] &= 248;
mysecret[31] &= 127;
mysecret[31] |= 64;

To generate the public key, just do:

static const uint8_t basepoint[32] = {9};
curve25519_donna(mypublic, mysecret, basepoint);

To generate a shared key do:

uint8_t shared_key[32];
curve25519_donna(shared_key, mysecret, theirpublic);

And hash the shared\_key with a cryptographic hash function before using.

For more information, see djb's page.

Building

If you run make, two .a archives will be built, similar to djb's curve25519 code. Alternatively, read on:

ESP8266

If you're interested in running curve25519 on an ESP8266, see this project.

More Repositories

1

pond

Pond
Go
910
star
2

xmpp-client

An XMPP client with OTR support
Go
366
star
3

critbit

Critbit trees in C
C
319
star
4

ed25519

ed25519 for Go
179
star
5

ctgrind

Checking that functions are constant time with Valgrind
C
147
star
6

crlset-tools

Tools for dealing with Chrome's CRLSets
Go
137
star
7

extract-nss-root-certs

Go
134
star
8

dnssec-tls-tools

DNSSEC/TLS tools
Python
35
star
9

dnscurve

Tools for DNS curve implementation
C
23
star
10

certificatetransparency

Certificate Transparency stuff
Go
18
star
11

rwb0fuz1024

This is example code for a Rabin-Williams public-key signature scheme designed to provide high speed verification and small signatures.
C
16
star
12

shamirsplit

The shamirsplit package implements Shamir's cryptographic secret sharing algorithm
Go
16
star
13

libdjb

A massaging of DJB's various client libraries into something that's easy to build and use
C
14
star
14

dclxvi

Naehrig, Niederhagen and Schwabe's pairings code, massaged into a shared library.
Assembly
12
star
15

obstcp

Obfuscated TCP
C
11
star
16

gcmsiv

draft-irtf-cfrg-gcmsiv-00
Go
11
star
17

nullok

Scripts that I used to write a blog post about section 7.24.1(2) of C11
Shell
10
star
18

local-dns-cache

DJB's dnscache made to play nicely with modern distributions
C
10
star
19

panda

PANDA key agreement experiment
Go
8
star
20

transport-security-state-generate

7
star
21

lsmsb

Linux Security Modules based sandboxing scheme
C++
7
star
22

tlsclient

C++
5
star
23

cfrgcurve

CFRG document on elliptic curves
XSLT
5
star
24

tls-chacha20poly1305

IETF draft for ChaCha20+Poly1305 in TLS
HTML
4
star
25

tls-padding

TLS padding draft
XML
4
star
26

harfbuzz

Harfbuzz is a unification of the shaping engines from Pango and Qt4 (fork)
3
star
27

spdy-compliance

SPDY compliance tests (mirror)
Go
3
star
28

aweb

Literate programming scheme targetting C and HTML
Haskell
3
star
29

ACVP-wiki

3
star
30

jbig2enc

JBIG2 Encoder
C++
3
star
31

otc

OpenType Condom
C++
2
star
32

technotes

Automatically exported from code.google.com/p/technotes
HTML
1
star
33

pkits-go

PKI testsuite for Go.
Go
1
star