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

Unified Diff: crypto/curve25519.h

Issue 1459783002: Roll src/third_party/boringssl/src d7421ebf6..3ac32b1ed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build, estark comments Created 5 years, 1 month 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.gypi ('k') | crypto/curve25519.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/curve25519.h
diff --git a/crypto/curve25519.h b/crypto/curve25519.h
index ba24c92a8778e55911f426c19b43f98a27a9f775..534f0bfaf1318122eed218474b40a309893c7460 100644
--- a/crypto/curve25519.h
+++ b/crypto/curve25519.h
@@ -5,7 +5,9 @@
#ifndef CRYPTO_CURVE25519_H
#define CRYPTO_CURVE25519_H
-#include "base/basictypes.h"
+#include <stddef.h>
+#include <stdint.h>
+
#include "crypto/crypto_export.h"
namespace crypto {
@@ -14,6 +16,10 @@ namespace crypto {
// described in "Curve 25519: new Diffie-Hellman Speed Records",
// by D.J. Bernstein. Additional information is available at
// http://cr.yp.to/ecdh.html.
+//
+// TODO(davidben): Once iOS is switched to BoringSSL (https://crbug.com/338886),
+// remove this file altogether and switch callers to using BoringSSL's
+// curve25519.h directly.
namespace curve25519 {
// kBytes is the number of bytes in the result of the Diffie-Hellman operation,
@@ -28,18 +34,20 @@ static const size_t kScalarBytes = 32;
// |peer_public_key|. This method is a wrapper for |curve25519_donna()|. It
// calls that function with |private_key| as |secret| and |peer_public_key| as
// basepoint. |private_key| should be of length |kScalarBytes| and
-// |peer_public_key| should be of length |kBytes|.
-// See "Computing shared secrets" section of/ http://cr.yp.to/ecdh.html.
-CRYPTO_EXPORT void ScalarMult(const uint8* private_key,
- const uint8* peer_public_key,
- uint8* shared_key);
+// |peer_public_key| should be of length |kBytes|. It returns true on success
+// and false if |peer_public_key| was invalid.
+// See the "Computing shared secrets" section of http://cr.yp.to/ecdh.html.
+CRYPTO_EXPORT bool ScalarMult(const uint8_t* private_key,
+ const uint8_t* peer_public_key,
+ uint8_t* shared_key);
// ScalarBaseMult computes the |public_key| from |private_key|. This method is a
// wrapper for |curve25519_donna()|. It calls that function with |private_key|
// as |secret| and |kBasePoint| as basepoint. |private_key| should be of length
// |kScalarBytes|. See "Computing public keys" section of
// http://cr.yp.to/ecdh.html.
-CRYPTO_EXPORT void ScalarBaseMult(const uint8* private_key, uint8* public_key);
+CRYPTO_EXPORT void ScalarBaseMult(const uint8_t* private_key,
+ uint8_t* public_key);
} // namespace curve25519
« no previous file with comments | « crypto/crypto.gypi ('k') | crypto/curve25519.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698