]> gitweb.ps.run Git - matrix_esp_thesis/blob - ext/olm/lib/curve25519-donna/README
remove newline
[matrix_esp_thesis] / ext / olm / lib / curve25519-donna / README
1 See http://code.google.com/p/curve25519-donna/ for details.
2
3 BUILDING:
4
5 If you run `make`, two .a archives will be built, similar to djb's curve25519
6 code. Alternatively, read on:
7
8 The C implementation is contained within curve25519-donna.c. It has no external
9 dependancies and is BSD licenced. You can copy/include/link it directly in with
10 your program. Recommended C flags: -O2
11
12 The x86-64 bit implementation is contained within curve25519-donna-x86-64.c and
13 curve25519-donna-x86-64.s. Build like this:
14
15 % cpp curve25519-donna-x86-64.s > curve25519-donna-x86-64.s.pp
16 % as -o curve25519-donna-x86-64.s.o curve25519-donna-x86-64.s.pp
17 % gcc -O2 -c curve25519-donna-x86-64.c
18
19 Then the two .o files can be linked in
20
21 USAGE:
22
23 The usage is exactly the same as djb's code (as described at
24 http://cr.yp.to/ecdh.html) expect that the function is called curve25519_donna.
25
26 In short,
27
28 To generate a private key just generate 32 random bytes.
29
30 To generate the public key, just do:
31
32   static const uint8_t basepoint[32] = {9};
33   curve25519_donna(mypublic, mysecret, basepoint);
34
35 To generate an agreed key do:
36
37   uint8_t shared_key[32];
38   curve25519_donna(shared_key, mysecret, theirpublic);
39
40 And hash the shared_key with a cryptographic hash function before using.