Index: components/certificate_reporting/error_reporter.cc |
diff --git a/components/certificate_reporting/error_reporter.cc b/components/certificate_reporting/error_reporter.cc |
index a013063558037f82326f16e07d5ed61151e7c29d..877d272329c44b90113aad890305958c1e198bb0 100644 |
--- a/components/certificate_reporting/error_reporter.cc |
+++ b/components/certificate_reporting/error_reporter.cc |
@@ -4,6 +4,8 @@ |
#include "components/certificate_reporting/error_reporter.h" |
+#include <stddef.h> |
+ |
#include <set> |
#include "base/logging.h" |
@@ -24,21 +26,21 @@ namespace { |
// Constants used for crypto. The corresponding private key is used by |
// the SafeBrowsing client-side detection server to decrypt reports. |
-static const uint8 kServerPublicKey[] = { |
+static const uint8_t kServerPublicKey[] = { |
0x51, 0xcc, 0x52, 0x67, 0x42, 0x47, 0x3b, 0x10, 0xe8, 0x63, 0x18, |
0x3c, 0x61, 0xa7, 0x96, 0x76, 0x86, 0x91, 0x40, 0x71, 0x39, 0x5f, |
0x31, 0x1a, 0x39, 0x5b, 0x76, 0xb1, 0x6b, 0x3d, 0x6a, 0x2b}; |
-static const uint32 kServerPublicKeyVersion = 1; |
+static const uint32_t kServerPublicKeyVersion = 1; |
#if defined(USE_OPENSSL) |
static const char kHkdfLabel[] = "certificate report"; |
bool GetHkdfSubkeySecret(size_t subkey_length, |
- const uint8* private_key, |
- const uint8* public_key, |
+ const uint8_t* private_key, |
+ const uint8_t* public_key, |
std::string* secret) { |
- uint8 shared_secret[crypto::curve25519::kBytes]; |
+ uint8_t shared_secret[crypto::curve25519::kBytes]; |
if (!crypto::curve25519::ScalarMult(private_key, public_key, shared_secret)) |
return false; |
@@ -61,13 +63,13 @@ bool GetHkdfSubkeySecret(size_t subkey_length, |
return true; |
} |
-bool EncryptSerializedReport(const uint8* server_public_key, |
- uint32 server_public_key_version, |
+bool EncryptSerializedReport(const uint8_t* server_public_key, |
+ uint32_t server_public_key_version, |
const std::string& report, |
EncryptedCertLoggerRequest* encrypted_report) { |
// Generate an ephemeral key pair to generate a shared secret. |
- uint8 public_key[crypto::curve25519::kBytes]; |
- uint8 private_key[crypto::curve25519::kScalarBytes]; |
+ uint8_t public_key[crypto::curve25519::kBytes]; |
+ uint8_t private_key[crypto::curve25519::kScalarBytes]; |
crypto::RandBytes(private_key, sizeof(private_key)); |
crypto::curve25519::ScalarBaseMult(private_key, public_key); |
@@ -75,7 +77,7 @@ bool EncryptSerializedReport(const uint8* server_public_key, |
crypto::Aead aead(crypto::Aead::AES_128_CTR_HMAC_SHA256); |
std::string key; |
if (!GetHkdfSubkeySecret(aead.KeyLength(), private_key, |
- reinterpret_cast<const uint8*>(server_public_key), |
+ reinterpret_cast<const uint8_t*>(server_public_key), |
&key)) { |
LOG(ERROR) << "Error getting subkey secret."; |
return false; |
@@ -116,8 +118,8 @@ ErrorReporter::ErrorReporter( |
ErrorReporter::ErrorReporter( |
const GURL& upload_url, |
- const uint8 server_public_key[/* 32 */], |
- const uint32 server_public_key_version, |
+ const uint8_t server_public_key[/* 32 */], |
+ const uint32_t server_public_key_version, |
scoped_ptr<net::CertificateReportSender> certificate_report_sender) |
: certificate_report_sender_(certificate_report_sender.Pass()), |
upload_url_(upload_url), |
@@ -160,13 +162,13 @@ bool ErrorReporter::IsHttpUploadUrlSupported() { |
// Used only by tests. |
#if defined(USE_OPENSSL) |
bool ErrorReporter::DecryptErrorReport( |
- const uint8 server_private_key[32], |
+ const uint8_t server_private_key[32], |
const EncryptedCertLoggerRequest& encrypted_report, |
std::string* decrypted_serialized_report) { |
crypto::Aead aead(crypto::Aead::AES_128_CTR_HMAC_SHA256); |
std::string key; |
if (!GetHkdfSubkeySecret(aead.KeyLength(), server_private_key, |
- reinterpret_cast<const uint8*>( |
+ reinterpret_cast<const uint8_t*>( |
encrypted_report.client_public_key().data()), |
&key)) { |
LOG(ERROR) << "Error getting subkey secret."; |