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

Unified Diff: components/certificate_reporting/error_reporter.cc

Issue 2457153003: Remove crypto/curve25519.h in favor of BoringSSL's. (Closed)
Patch Set: \ Created 4 years, 2 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
Index: components/certificate_reporting/error_reporter.cc
diff --git a/components/certificate_reporting/error_reporter.cc b/components/certificate_reporting/error_reporter.cc
index 3e639ea5d70637da221dfca00d44210a70e601d8..5cd909612804856d6b719e396fec7a2b9acf83b2 100644
--- a/components/certificate_reporting/error_reporter.cc
+++ b/components/certificate_reporting/error_reporter.cc
@@ -15,10 +15,10 @@
#include "base/metrics/sparse_histogram.h"
#include "components/certificate_reporting/encrypted_cert_logger.pb.h"
#include "crypto/aead.h"
-#include "crypto/curve25519.h"
#include "crypto/hkdf.h"
#include "crypto/random.h"
#include "net/url_request/report_sender.h"
+#include "third_party/boringssl/src/include/openssl/curve25519.h"
namespace certificate_reporting {
@@ -38,8 +38,8 @@ bool GetHkdfSubkeySecret(size_t subkey_length,
const uint8_t* private_key,
const uint8_t* public_key,
std::string* secret) {
- uint8_t shared_secret[crypto::curve25519::kBytes];
- if (!crypto::curve25519::ScalarMult(private_key, public_key, shared_secret))
+ uint8_t shared_secret[32];
+ if (!X25519(shared_secret, private_key, public_key))
return false;
// By mistake, the HKDF label here ends up with an extra null byte on
@@ -66,11 +66,11 @@ bool EncryptSerializedReport(const uint8_t* server_public_key,
const std::string& report,
EncryptedCertLoggerRequest* encrypted_report) {
// Generate an ephemeral key pair to generate a shared secret.
- uint8_t public_key[crypto::curve25519::kBytes];
- uint8_t private_key[crypto::curve25519::kScalarBytes];
+ uint8_t public_key[32];
+ uint8_t private_key[32];
crypto::RandBytes(private_key, sizeof(private_key));
- crypto::curve25519::ScalarBaseMult(private_key, public_key);
+ X25519_public_from_private(public_key, private_key);
crypto::Aead aead(crypto::Aead::AES_128_CTR_HMAC_SHA256);
std::string key;

Powered by Google App Engine
This is Rietveld 408576698