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

Side by Side Diff: crypto/curve25519.h

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 // 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>
9
10 #include "base/basictypes.h"
11 #include "crypto/crypto_export.h"
12
13 #define crypto_scalarmult_curve25519_BYTES 32
14 #define crypto_scalarmult_curve25519_SCALARBYTES 32
wtc 2013/03/06 00:55:58 In a C++ header, these should be defined as enum c
ramant (doing other things) 2013/03/06 19:01:05 Done.
15
16 namespace crypto {
17
18 class CRYPTO_EXPORT Curve25519 {
19 public:
20 // ScalarMultiply computes the |shared_key| from |private_key| and
21 // |peer_public_key|. See "Computing shared secrets" section of
22 // http://cr.yp.to/ecdh.html.
23 static int ScalarMultiply(uint8* shared_key,
24 const uint8* private_key,
25 const uint8* peer_public_key);
wtc 2013/03/06 00:55:58 This class should follow the recommendation of our
ramant (doing other things) 2013/03/06 19:01:05 Made ScalarMult* methods look similar to p224's me
26
27 // ScalarMultiply computes the |public_key| from |private_key| and a basepoint
28 // as specified in "Computing public keys" section of
29 // http://cr.yp.to/ecdh.html.
30 static int ScalarMultiplyBase(uint8* public_key, const uint8* private_key);
31
32 // ConvertToPrivateKey returns |private_key|, generated from |mysecret|,
33 // suitable for passing to |ScalarMultiplyBase|. If |mysecret_size| is not
34 // equal to |crypto_scalarmult_curve25519_SCALARBYTES|, then it returns false
35 // and |private_key| is not updated. See "Computing secret keys" section of
36 // http://cr.yp.to/ecdh.html.
37 static bool ConvertToPrivateKey(uint8* mysecret,
38 size_t mysecret_size,
39 std::string* private_key);
wtc 2013/03/06 00:55:58 This function should operate on |mysecret| in plac
ramant (doing other things) 2013/03/06 19:01:05 Done.
40 };
41
42 } // namespace crypto
43
44 #endif // CRYPTO_CURVE25519_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698