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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/crypto.gyp ('k') | crypto/curve25519.cc » ('j') | crypto/curve25519.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/curve25519.h
===================================================================
--- crypto/curve25519.h (revision 0)
+++ crypto/curve25519.h (revision 0)
@@ -0,0 +1,45 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CRYPTO_CURVE25519_H
+#define CRYPTO_CURVE25519_H
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "crypto/crypto_export.h"
+
+namespace crypto {
+
+// Curve25519 implements an elliptic curve group, commonly known as Curve25519
+// and defined in http://cr.yp.to/ecdh.html.
+namespace curve25519 {
+
+static const size_t kCryptoScalarMultCurve25519Bytes = 32;
+static const size_t kCryptoScalarMultCurve25519ScalarBytes = 32;
wtc 2013/03/06 19:21:07 Shorten these constants to just kBytes and kScalar
ramant (doing other things) 2013/03/06 20:03:12 Done.
+
+// ScalarMultiply computes the |shared_key| from |private_key| and
wtc 2013/03/06 19:21:07 Typo: ScalarMultiply => ScalarMult
ramant (doing other things) 2013/03/06 20:03:12 Done.
+// |peer_public_key|. See "Computing shared secrets" section of
+// http://cr.yp.to/ecdh.html.
+void CRYPTO_EXPORT ScalarMult(const uint8* private_key,
+ const uint8* peer_public_key,
+ uint8* shared_key);
+
+// ScalarMultiply computes the |public_key| from |private_key| and a basepoint
wtc 2013/03/06 19:21:07 Typo: ScalarMultiply => ScalarBaseMult
ramant (doing other things) 2013/03/06 20:03:12 Done.
+// as specified in "Computing public keys" section of
+// http://cr.yp.to/ecdh.html.
+void CRYPTO_EXPORT ScalarBaseMult(const uint8* private_key, uint8* public_key);
+
+// ConvertToPrivateKey converts |secret| into a private key, suitable
+// for passing to |ScalarBaseMult|. If |secret_size| is not equal to
+// |kCryptoScalarMultCurve25519ScalarBytes|, then it returns false and
+// |private_key| is not updated. See "Computing secret keys" section of
+// http://cr.yp.to/ecdh.html.
+bool CRYPTO_EXPORT ConvertToPrivateKey(uint8* secret, size_t secret_size);
wtc 2013/03/06 19:21:07 Although it is a good idea to require the caller t
ramant (doing other things) 2013/03/06 20:03:12 Made it consistent with rest of the code. Removed
+
+} // namespace curve25519
+
+} // namespace crypto
+
+#endif // CRYPTO_CURVE25519_H
« no previous file with comments | « crypto/crypto.gyp ('k') | crypto/curve25519.cc » ('j') | crypto/curve25519.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698