ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/curve25519.C
(Generate patch)

Comparing gvpe/src/curve25519.C (file contents):
Revision 1.2 by root, Wed Jul 17 04:36:03 2013 UTC vs.
Revision 1.5 by root, Sat Jan 17 08:35:16 2015 UTC

34#include <cstring> 34#include <cstring>
35#include <openssl/rand.h> 35#include <openssl/rand.h>
36 36
37#include "util.h" 37#include "util.h"
38#include "curve25519.h" 38#include "curve25519.h"
39
40#if __GNUC__ >= 4 && __SIZEOF_LONG__ == 8
41#include "curve25519-donna-c64.c"
42#else
39#include "curve25519-donna.c" 43#include "curve25519-donna.c"
44#endif
40 45
41static void 46static void
42curve25519_derive (const curve25519_key &a, curve25519_key &b) 47curve25519_derive (const curve25519_key &a, curve25519_key &b)
43{ 48{
44 static const curve25519_key basepoint = { 9 }; 49 static const curve25519_key basepoint = { 9 };
45 curve25519_donna (b, a, basepoint); 50 curve25519_donna (b, a, basepoint);
46} 51}
47 52
48void curve25519_generate (curve25519_key &a, curve25519_key &b) 53void curve25519_generate (curve25519_key &a, curve25519_key &b)
49{ 54{
50 RAND_bytes (a, sizeof a); 55 rand_fill (a);
51 56
57#if 0
52 a [ 0] &= 0xf8; 58 a [ 0] &= 0xf8;
53 a [31] &= 0x7f; 59 a [31] &= 0x7f;
54 a [31] |= 0x40; 60 a [31] |= 0x40;
61#endif
55 62
56 curve25519_derive (a, b); 63 curve25519_derive (a, b);
57} 64}
58 65
59void curve25519_combine (const curve25519_key &a, const curve25519_key &b, curve25519_key &s) 66void curve25519_combine (const curve25519_key &a, const curve25519_key &b, curve25519_key &s)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines