Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: crypto/third_party/curve25519-donna/README

Issue 12457004: Curve25519-donna changes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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, generate 32 random bytes and:
29
30 mysecret[0] &= 248;
31 mysecret[31] &= 127;
32 mysecret[31] |= 64;
33
34 To generate the public key, just do
35
36 static const uint8_t basepoint[32] = {9};
37 curve25519_donna(mypublic, mysecret, basepoint);
38
39 To generate an agreed key do:
40 uint8_t shared_key[32];
41 curve25519_donna(shared_key, mysecret, theirpublic);
42
43 And hash the shared_key with a cryptographic hash function before using.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698