summaryrefslogtreecommitdiffstats
path: root/crypto/curve25519_openssl.cc
diff options
context:
space:
mode:
authordavidben <davidben@chromium.org>2015-11-18 19:06:33 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-19 03:07:25 +0000
commit952ee79c0a17c2ed3ceeb4e22b7eafa0da41bbad (patch)
tree16fe4d0d9836e8e7884ae9417975277755cb1ebd /crypto/curve25519_openssl.cc
parent026b848a61b86043b471d694303684781741ed17 (diff)
downloadchromium_src-952ee79c0a17c2ed3ceeb4e22b7eafa0da41bbad.zip
chromium_src-952ee79c0a17c2ed3ceeb4e22b7eafa0da41bbad.tar.gz
chromium_src-952ee79c0a17c2ed3ceeb4e22b7eafa0da41bbad.tar.bz2
Roll src/third_party/boringssl/src d7421ebf6..3ac32b1ed
https://boringssl.googlesource.com/boringssl/+log/d7421ebf6cae07051caf657016f160585b64f8a6..3ac32b1eda0da7a99d9c2b6c605fe50af80ccd90 In doing so, switch crypto/curve25519.h to use the new BoringSSL curve25510 code to avoid shipping two copies. This includes a small subgroup check, so callers need to be tweaked slightly. BUG=none Review URL: https://codereview.chromium.org/1459783002 Cr-Commit-Position: refs/heads/master@{#360507}
Diffstat (limited to 'crypto/curve25519_openssl.cc')
-rw-r--r--crypto/curve25519_openssl.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/crypto/curve25519_openssl.cc b/crypto/curve25519_openssl.cc
new file mode 100644
index 0000000..067e19c
--- /dev/null
+++ b/crypto/curve25519_openssl.cc
@@ -0,0 +1,25 @@
+// Copyright 2015 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.
+
+#include "crypto/curve25519.h"
+
+#include <openssl/curve25519.h>
+
+namespace crypto {
+
+namespace curve25519 {
+
+bool ScalarMult(const uint8_t* private_key,
+ const uint8_t* peer_public_key,
+ uint8_t* shared_key) {
+ return !!X25519(shared_key, private_key, peer_public_key);
+}
+
+void ScalarBaseMult(const uint8_t* private_key, uint8_t* public_key) {
+ X25519_public_from_private(public_key, private_key);
+}
+
+} // namespace curve25519
+
+} // namespace crypto