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

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
« no previous file with comments | « crypto/crypto.gyp ('k') | crypto/curve25519.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h"
9 #include "crypto/crypto_export.h"
10
11 namespace crypto {
12
13 // Curve25519 implements the elliptic curve group known as Curve25519, as
14 // described in "Curve 25519: new Diffie-Hellman Speed Records",
15 // by D.J. Bernstein. Additional information is available at
16 // http://cr.yp.to/ecdh.html.
17 namespace curve25519 {
18
19 // kBytes is the number of bytes in the result of the Diffie-Hellman operation,
20 // which is an element of GF(2^255-19).
21 static const size_t kBytes = 32;
22
23 // kScalarBytes is the number of bytes in an element of the scalar field:
24 // GF(2^252 + 27742317777372353535851937790883648493).
25 static const size_t kScalarBytes = 32;
26
27 // ScalarMult computes the |shared_key| from |private_key| and
28 // |peer_public_key|. This method is a wrapper for |curve25519_donna()|. It
29 // calls that function with |private_key| as |secret| and |peer_public_key| as
30 // basepoint. |private_key| should be of length |kScalarBytes| and
31 // |peer_public_key| should be of length |kBytes|.
32 // See "Computing shared secrets" section of/ http://cr.yp.to/ecdh.html.
33 CRYPTO_EXPORT void ScalarMult(const uint8* private_key,
34 const uint8* peer_public_key,
35 uint8* shared_key);
36
37 // ScalarBaseMult computes the |public_key| from |private_key|. This method is a
38 // wrapper for |curve25519_donna()|. It calls that function with |private_key|
39 // as |secret| and |kBasePoint| as basepoint. |private_key| should be of length
40 // |kScalarBytes|. See "Computing public keys" section of
41 // http://cr.yp.to/ecdh.html.
42 CRYPTO_EXPORT void ScalarBaseMult(const uint8* private_key, uint8* public_key);
43
44 } // namespace curve25519
45
46 } // namespace crypto
47
48 #endif // CRYPTO_CURVE25519_H
OLDNEW
« no previous file with comments | « crypto/crypto.gyp ('k') | crypto/curve25519.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698