OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CRYPTO_CURVE25519_H | |
6 #define CRYPTO_CURVE25519_H | |
7 | |
8 #include <string> | |
wtc
2013/03/06 21:26:44
Remove this header. It is no longer necessary.
ramant (doing other things)
2013/03/08 00:10:15
Done.
| |
9 | |
10 #include "base/basictypes.h" | |
11 #include "crypto/crypto_export.h" | |
12 | |
13 namespace crypto { | |
14 | |
15 // Curve25519 implements an elliptic curve group, commonly known as Curve25519 | |
Ryan Sleevi
2013/03/06 21:18:32
The comma here is weird, when you read just the pa
ramant (doing other things)
2013/03/08 00:10:15
Done.
| |
16 // and defined in http://cr.yp.to/ecdh.html. | |
17 namespace curve25519 { | |
18 | |
19 static const size_t kBytes = 32; | |
20 static const size_t kScalarBytes = 32; | |
Ryan Sleevi
2013/03/06 21:18:32
nit: Comments explaining what these constants are
wtc
2013/03/06 21:26:44
Please document what these two constants are.
agl
2013/03/06 21:47:50
They can be moved into the .cc as well, now that I
ramant (doing other things)
2013/03/08 00:10:15
Thanks very much agl. Added the above comments.
D
| |
21 | |
22 // ScalarMult computes the |shared_key| from |private_key| and | |
23 // |peer_public_key|. See "Computing shared secrets" section of | |
24 // http://cr.yp.to/ecdh.html. | |
Ryan Sleevi
2013/03/06 21:18:32
I don't know if this is really a good comment desc
ramant (doing other things)
2013/03/08 00:10:15
Done.
| |
25 void CRYPTO_EXPORT ScalarMult(const uint8* private_key, | |
26 const uint8* peer_public_key, | |
27 uint8* shared_key); | |
28 | |
29 // ScalarBaseMult computes the |public_key| from |private_key| and a basepoint | |
30 // as specified in "Computing public keys" section of | |
31 // http://cr.yp.to/ecdh.html. | |
32 void CRYPTO_EXPORT ScalarBaseMult(const uint8* private_key, uint8* public_key); | |
33 | |
34 // ConvertToPrivateKey converts |secret| into a private key, suitable | |
wtc
2013/03/06 21:26:44
Please note that the conversion is done in place,
ramant (doing other things)
2013/03/08 00:10:15
Done.
| |
35 // for passing to |ScalarBaseMult|. See "Computing secret keys" section of | |
36 // http://cr.yp.to/ecdh.html. | |
37 void CRYPTO_EXPORT ConvertToPrivateKey(uint8* secret); | |
Ryan Sleevi
2013/03/06 21:18:32
For all of these functions, you could provide clea
ramant (doing other things)
2013/03/08 00:10:15
Done.
| |
38 | |
39 } // namespace curve25519 | |
40 | |
41 } // namespace crypto | |
42 | |
43 #endif // CRYPTO_CURVE25519_H | |
OLD | NEW |