Replace QuicString with std::string, pass 1
This replaces QuicString with std::string in all of the "QUIC proper". I will
delete QuicString once all code using it is gone.
gfe-relnote: n/a (no functional change)
PiperOrigin-RevId: 237872023
Change-Id: I82de62c9855516b15039734d05155917e68ff4ee
diff --git a/quic/core/crypto/aead_base_decrypter.cc b/quic/core/crypto/aead_base_decrypter.cc
index 53bd0f0..474c443 100644
--- a/quic/core/crypto/aead_base_decrypter.cc
+++ b/quic/core/crypto/aead_base_decrypter.cc
@@ -125,7 +125,7 @@
return true;
}
- QuicString key, nonce_prefix;
+ std::string key, nonce_prefix;
size_t prefix_size = nonce_size_ - sizeof(QuicPacketNumber);
DiversifyPreliminaryKey(
QuicStringPiece(reinterpret_cast<const char*>(key_), key_size_),
diff --git a/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc b/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc
index 6513e45..d9b2e8d 100644
--- a/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc
+++ b/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc
@@ -232,12 +232,12 @@
bool has_pt = test_vectors[j].pt;
// Decode the test vector.
- QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key);
- QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
- QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
- QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
- QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
- QuicString pt;
+ std::string key = QuicTextUtils::HexDecode(test_vectors[j].key);
+ std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
+ std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
+ std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
+ std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
+ std::string pt;
if (has_pt) {
pt = QuicTextUtils::HexDecode(test_vectors[j].pt);
}
@@ -258,7 +258,7 @@
ASSERT_LE(static_cast<size_t>(Aes128Gcm12Decrypter::kAuthTagSize),
tag.length());
tag.resize(Aes128Gcm12Decrypter::kAuthTagSize);
- QuicString ciphertext = ct + tag;
+ std::string ciphertext = ct + tag;
Aes128Gcm12Decrypter decrypter;
ASSERT_TRUE(decrypter.SetKey(key));
diff --git a/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc b/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc
index 67660cf..7aa1cf9 100644
--- a/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc
+++ b/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc
@@ -181,12 +181,12 @@
const TestGroupInfo& test_info = test_group_info[i];
for (size_t j = 0; test_vectors[j].key != nullptr; j++) {
// Decode the test vector.
- QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key);
- QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
- QuicString pt = QuicTextUtils::HexDecode(test_vectors[j].pt);
- QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
- QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
- QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
+ std::string key = QuicTextUtils::HexDecode(test_vectors[j].key);
+ std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
+ std::string pt = QuicTextUtils::HexDecode(test_vectors[j].pt);
+ std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
+ std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
+ std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
// The test vector's lengths should look sane. Note that the lengths
// in |test_info| are in bits.
diff --git a/quic/core/crypto/aes_128_gcm_decrypter_test.cc b/quic/core/crypto/aes_128_gcm_decrypter_test.cc
index 300e8a2..1ef986f 100644
--- a/quic/core/crypto/aes_128_gcm_decrypter_test.cc
+++ b/quic/core/crypto/aes_128_gcm_decrypter_test.cc
@@ -227,12 +227,12 @@
bool has_pt = test_vectors[j].pt;
// Decode the test vector.
- QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key);
- QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
- QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
- QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
- QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
- QuicString pt;
+ std::string key = QuicTextUtils::HexDecode(test_vectors[j].key);
+ std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
+ std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
+ std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
+ std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
+ std::string pt;
if (has_pt) {
pt = QuicTextUtils::HexDecode(test_vectors[j].pt);
}
@@ -247,7 +247,7 @@
if (has_pt) {
EXPECT_EQ(test_info.pt_len, pt.length() * 8);
}
- QuicString ciphertext = ct + tag;
+ std::string ciphertext = ct + tag;
Aes128GcmDecrypter decrypter;
ASSERT_TRUE(decrypter.SetKey(key));
diff --git a/quic/core/crypto/aes_128_gcm_encrypter_test.cc b/quic/core/crypto/aes_128_gcm_encrypter_test.cc
index 959cb9d..e2e425e 100644
--- a/quic/core/crypto/aes_128_gcm_encrypter_test.cc
+++ b/quic/core/crypto/aes_128_gcm_encrypter_test.cc
@@ -181,12 +181,12 @@
const TestGroupInfo& test_info = test_group_info[i];
for (size_t j = 0; test_vectors[j].key != nullptr; j++) {
// Decode the test vector.
- QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key);
- QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
- QuicString pt = QuicTextUtils::HexDecode(test_vectors[j].pt);
- QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
- QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
- QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
+ std::string key = QuicTextUtils::HexDecode(test_vectors[j].key);
+ std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
+ std::string pt = QuicTextUtils::HexDecode(test_vectors[j].pt);
+ std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
+ std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
+ std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
// The test vector's lengths should look sane. Note that the lengths
// in |test_info| are in bits.
@@ -218,13 +218,14 @@
}
TEST_F(Aes128GcmEncrypterTest, EncryptPacket) {
- QuicString key = QuicTextUtils::HexDecode("d95a145250826c25a77b6a84fd4d34fc");
- QuicString iv = QuicTextUtils::HexDecode("50c4431ebb18283448e276e2");
+ std::string key =
+ QuicTextUtils::HexDecode("d95a145250826c25a77b6a84fd4d34fc");
+ std::string iv = QuicTextUtils::HexDecode("50c4431ebb18283448e276e2");
uint64_t packet_num = 0x13278f44;
- QuicString aad =
+ std::string aad =
QuicTextUtils::HexDecode("875d49f64a70c9cbe713278f44ff000005");
- QuicString pt = QuicTextUtils::HexDecode("aa0003a250bd000000000001");
- QuicString ct = QuicTextUtils::HexDecode(
+ std::string pt = QuicTextUtils::HexDecode("aa0003a250bd000000000001");
+ std::string ct = QuicTextUtils::HexDecode(
"7dd4708b989ee7d38a013e3656e9b37beefd05808fe1ab41e3b4f2c0");
std::vector<char> out(ct.size());
diff --git a/quic/core/crypto/aes_256_gcm_decrypter_test.cc b/quic/core/crypto/aes_256_gcm_decrypter_test.cc
index cb5f702..16e2428 100644
--- a/quic/core/crypto/aes_256_gcm_decrypter_test.cc
+++ b/quic/core/crypto/aes_256_gcm_decrypter_test.cc
@@ -231,12 +231,12 @@
bool has_pt = test_vectors[j].pt;
// Decode the test vector.
- QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key);
- QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
- QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
- QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
- QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
- QuicString pt;
+ std::string key = QuicTextUtils::HexDecode(test_vectors[j].key);
+ std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
+ std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
+ std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
+ std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
+ std::string pt;
if (has_pt) {
pt = QuicTextUtils::HexDecode(test_vectors[j].pt);
}
@@ -251,7 +251,7 @@
if (has_pt) {
EXPECT_EQ(test_info.pt_len, pt.length() * 8);
}
- QuicString ciphertext = ct + tag;
+ std::string ciphertext = ct + tag;
Aes256GcmDecrypter decrypter;
ASSERT_TRUE(decrypter.SetKey(key));
diff --git a/quic/core/crypto/aes_256_gcm_encrypter_test.cc b/quic/core/crypto/aes_256_gcm_encrypter_test.cc
index 0472986..f70edbc 100644
--- a/quic/core/crypto/aes_256_gcm_encrypter_test.cc
+++ b/quic/core/crypto/aes_256_gcm_encrypter_test.cc
@@ -188,12 +188,12 @@
const TestGroupInfo& test_info = test_group_info[i];
for (size_t j = 0; test_vectors[j].key != nullptr; j++) {
// Decode the test vector.
- QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key);
- QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
- QuicString pt = QuicTextUtils::HexDecode(test_vectors[j].pt);
- QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
- QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
- QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
+ std::string key = QuicTextUtils::HexDecode(test_vectors[j].key);
+ std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv);
+ std::string pt = QuicTextUtils::HexDecode(test_vectors[j].pt);
+ std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad);
+ std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct);
+ std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag);
// The test vector's lengths should look sane. Note that the lengths
// in |test_info| are in bits.
diff --git a/quic/core/crypto/cert_compressor.cc b/quic/core/crypto/cert_compressor.cc
index 204539b..53c6117 100644
--- a/quic/core/crypto/cert_compressor.cc
+++ b/quic/core/crypto/cert_compressor.cc
@@ -174,7 +174,7 @@
// efficiently represent |certs| to a peer who has the common sets identified
// by |client_common_set_hashes| and who has cached the certificates with the
// 64-bit, FNV-1a hashes in |client_cached_cert_hashes|.
-std::vector<CertEntry> MatchCerts(const std::vector<QuicString>& certs,
+std::vector<CertEntry> MatchCerts(const std::vector<std::string>& certs,
QuicStringPiece client_common_set_hashes,
QuicStringPiece client_cached_cert_hashes,
const CommonCertSets* common_sets) {
@@ -281,9 +281,9 @@
// dictionary to use in order to decompress a zlib block following |entries|.
// |certs| is one-to-one with |entries| and contains the certificates for those
// entries that are CACHED or COMMON.
-QuicString ZlibDictForEntries(const std::vector<CertEntry>& entries,
- const std::vector<QuicString>& certs) {
- QuicString zlib_dict;
+std::string ZlibDictForEntries(const std::vector<CertEntry>& entries,
+ const std::vector<std::string>& certs) {
+ std::string zlib_dict;
// The dictionary starts with the common and cached certs in reverse order.
size_t zlib_dict_size = 0;
@@ -304,8 +304,8 @@
}
}
- zlib_dict += QuicString(reinterpret_cast<const char*>(kCommonCertSubstrings),
- sizeof(kCommonCertSubstrings));
+ zlib_dict += std::string(reinterpret_cast<const char*>(kCommonCertSubstrings),
+ sizeof(kCommonCertSubstrings));
DCHECK_EQ(zlib_dict.size(), zlib_dict_size);
@@ -313,7 +313,7 @@
}
// HashCerts returns the FNV-1a hashes of |certs|.
-std::vector<uint64_t> HashCerts(const std::vector<QuicString>& certs) {
+std::vector<uint64_t> HashCerts(const std::vector<std::string>& certs) {
std::vector<uint64_t> ret;
ret.reserve(certs.size());
@@ -329,10 +329,10 @@
// resolved using |cached_certs| and |common_sets| and written to |out_certs|.
// |in_out| is updated to contain the trailing data.
bool ParseEntries(QuicStringPiece* in_out,
- const std::vector<QuicString>& cached_certs,
+ const std::vector<std::string>& cached_certs,
const CommonCertSets* common_sets,
std::vector<CertEntry>* out_entries,
- std::vector<QuicString>* out_certs) {
+ std::vector<std::string>* out_certs) {
QuicStringPiece in = *in_out;
std::vector<uint64_t> cached_hashes;
@@ -355,7 +355,7 @@
switch (entry.type) {
case CertEntry::COMPRESSED:
- out_certs->push_back(QuicString());
+ out_certs->push_back(std::string());
break;
case CertEntry::CACHED: {
if (in.size() < sizeof(uint64_t)) {
@@ -397,7 +397,7 @@
if (cert.empty()) {
return false;
}
- out_certs->push_back(QuicString(cert));
+ out_certs->push_back(std::string(cert));
break;
}
default:
@@ -448,8 +448,8 @@
} // anonymous namespace
// static
-QuicString CertCompressor::CompressChain(
- const std::vector<QuicString>& certs,
+std::string CertCompressor::CompressChain(
+ const std::vector<std::string>& certs,
QuicStringPiece client_common_set_hashes,
QuicStringPiece client_cached_cert_hashes,
const CommonCertSets* common_sets) {
@@ -477,7 +477,7 @@
}
scoped_z.reset(&z);
- QuicString zlib_dict = ZlibDictForEntries(entries, certs);
+ std::string zlib_dict = ZlibDictForEntries(entries, certs);
rv = deflateSetDictionary(
&z, reinterpret_cast<const uint8_t*>(&zlib_dict[0]), zlib_dict.size());
@@ -491,7 +491,7 @@
const size_t entries_size = CertEntriesSize(entries);
- QuicString result;
+ std::string result;
result.resize(entries_size + (uncompressed_size > 0 ? 4 : 0) +
compressed_size);
@@ -552,9 +552,9 @@
// static
bool CertCompressor::DecompressChain(
QuicStringPiece in,
- const std::vector<QuicString>& cached_certs,
+ const std::vector<std::string>& cached_certs,
const CommonCertSets* common_sets,
- std::vector<QuicString>* out_certs) {
+ std::vector<std::string>* out_certs) {
std::vector<CertEntry> entries;
if (!ParseEntries(&in, cached_certs, common_sets, &entries, out_certs)) {
return false;
@@ -595,7 +595,7 @@
int rv = inflate(&z, Z_FINISH);
if (rv == Z_NEED_DICT) {
- QuicString zlib_dict = ZlibDictForEntries(entries, *out_certs);
+ std::string zlib_dict = ZlibDictForEntries(entries, *out_certs);
const uint8_t* dict = reinterpret_cast<const uint8_t*>(zlib_dict.data());
if (Z_OK != inflateSetDictionary(&z, dict, zlib_dict.size())) {
return false;
@@ -623,7 +623,7 @@
if (uncompressed.size() < cert_len) {
return false;
}
- (*out_certs)[i] = QuicString(uncompressed.substr(0, cert_len));
+ (*out_certs)[i] = std::string(uncompressed.substr(0, cert_len));
uncompressed.remove_prefix(cert_len);
break;
case CertEntry::CACHED:
diff --git a/quic/core/crypto/cert_compressor.h b/quic/core/crypto/cert_compressor.h
index 624ac71..fd73e6e 100644
--- a/quic/core/crypto/cert_compressor.h
+++ b/quic/core/crypto/cert_compressor.h
@@ -37,19 +37,19 @@
// sets known locally and |client_common_set_hashes| contains the hashes of
// the common sets known to the peer. |client_cached_cert_hashes| contains
// 64-bit, FNV-1a hashes of certificates that the peer already possesses.
- static QuicString CompressChain(const std::vector<QuicString>& certs,
- QuicStringPiece client_common_set_hashes,
- QuicStringPiece client_cached_cert_hashes,
- const CommonCertSets* common_sets);
+ static std::string CompressChain(const std::vector<std::string>& certs,
+ QuicStringPiece client_common_set_hashes,
+ QuicStringPiece client_cached_cert_hashes,
+ const CommonCertSets* common_sets);
// DecompressChain decompresses the result of |CompressChain|, given in |in|,
// into a series of certificates that are written to |out_certs|.
// |cached_certs| contains certificates that the peer may have omitted and
// |common_sets| contains the common certificate sets known locally.
static bool DecompressChain(QuicStringPiece in,
- const std::vector<QuicString>& cached_certs,
+ const std::vector<std::string>& cached_certs,
const CommonCertSets* common_sets,
- std::vector<QuicString>* out_certs);
+ std::vector<std::string>* out_certs);
};
} // namespace quic
diff --git a/quic/core/crypto/cert_compressor_test.cc b/quic/core/crypto/cert_compressor_test.cc
index 87b330a..e3ac2f1 100644
--- a/quic/core/crypto/cert_compressor_test.cc
+++ b/quic/core/crypto/cert_compressor_test.cc
@@ -18,26 +18,26 @@
class CertCompressorTest : public QuicTest {};
TEST_F(CertCompressorTest, EmptyChain) {
- std::vector<QuicString> chain;
- const QuicString compressed = CertCompressor::CompressChain(
+ std::vector<std::string> chain;
+ const std::string compressed = CertCompressor::CompressChain(
chain, QuicStringPiece(), QuicStringPiece(), nullptr);
EXPECT_EQ("00", QuicTextUtils::HexEncode(compressed));
- std::vector<QuicString> chain2, cached_certs;
+ std::vector<std::string> chain2, cached_certs;
ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs, nullptr,
&chain2));
EXPECT_EQ(chain.size(), chain2.size());
}
TEST_F(CertCompressorTest, Compressed) {
- std::vector<QuicString> chain;
+ std::vector<std::string> chain;
chain.push_back("testcert");
- const QuicString compressed = CertCompressor::CompressChain(
+ const std::string compressed = CertCompressor::CompressChain(
chain, QuicStringPiece(), QuicStringPiece(), nullptr);
ASSERT_GE(compressed.size(), 2u);
EXPECT_EQ("0100", QuicTextUtils::HexEncode(compressed.substr(0, 2)));
- std::vector<QuicString> chain2, cached_certs;
+ std::vector<std::string> chain2, cached_certs;
ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs, nullptr,
&chain2));
EXPECT_EQ(chain.size(), chain2.size());
@@ -45,12 +45,12 @@
}
TEST_F(CertCompressorTest, Common) {
- std::vector<QuicString> chain;
+ std::vector<std::string> chain;
chain.push_back("testcert");
static const uint64_t set_hash = 42;
std::unique_ptr<CommonCertSets> common_sets(
crypto_test_utils::MockCommonCertSets(chain[0], set_hash, 1));
- const QuicString compressed = CertCompressor::CompressChain(
+ const std::string compressed = CertCompressor::CompressChain(
chain,
QuicStringPiece(reinterpret_cast<const char*>(&set_hash),
sizeof(set_hash)),
@@ -62,7 +62,7 @@
"00" /* end of list */,
QuicTextUtils::HexEncode(compressed));
- std::vector<QuicString> chain2, cached_certs;
+ std::vector<std::string> chain2, cached_certs;
ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs,
common_sets.get(), &chain2));
EXPECT_EQ(chain.size(), chain2.size());
@@ -70,18 +70,18 @@
}
TEST_F(CertCompressorTest, Cached) {
- std::vector<QuicString> chain;
+ std::vector<std::string> chain;
chain.push_back("testcert");
uint64_t hash = QuicUtils::FNV1a_64_Hash(chain[0]);
QuicStringPiece hash_bytes(reinterpret_cast<char*>(&hash), sizeof(hash));
- const QuicString compressed = CertCompressor::CompressChain(
+ const std::string compressed = CertCompressor::CompressChain(
chain, QuicStringPiece(), hash_bytes, nullptr);
EXPECT_EQ("02" /* cached */ + QuicTextUtils::HexEncode(hash_bytes) +
"00" /* end of list */,
QuicTextUtils::HexEncode(compressed));
- std::vector<QuicString> cached_certs, chain2;
+ std::vector<std::string> cached_certs, chain2;
cached_certs.push_back(chain[0]);
ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs, nullptr,
&chain2));
@@ -90,7 +90,7 @@
}
TEST_F(CertCompressorTest, BadInputs) {
- std::vector<QuicString> cached_certs, chain;
+ std::vector<std::string> cached_certs, chain;
EXPECT_FALSE(CertCompressor::DecompressChain(
QuicTextUtils::HexEncode("04") /* bad entry type */, cached_certs,
diff --git a/quic/core/crypto/chacha20_poly1305_decrypter_test.cc b/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
index 5f5ae01..d1c8d74 100644
--- a/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
+++ b/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
@@ -141,12 +141,12 @@
bool has_pt = test_vectors[i].pt;
// Decode the test vector.
- QuicString key = QuicTextUtils::HexDecode(test_vectors[i].key);
- QuicString iv = QuicTextUtils::HexDecode(test_vectors[i].iv);
- QuicString fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed);
- QuicString aad = QuicTextUtils::HexDecode(test_vectors[i].aad);
- QuicString ct = QuicTextUtils::HexDecode(test_vectors[i].ct);
- QuicString pt;
+ std::string key = QuicTextUtils::HexDecode(test_vectors[i].key);
+ std::string iv = QuicTextUtils::HexDecode(test_vectors[i].iv);
+ std::string fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed);
+ std::string aad = QuicTextUtils::HexDecode(test_vectors[i].aad);
+ std::string ct = QuicTextUtils::HexDecode(test_vectors[i].ct);
+ std::string pt;
if (has_pt) {
pt = QuicTextUtils::HexDecode(test_vectors[i].pt);
}
diff --git a/quic/core/crypto/chacha20_poly1305_encrypter_test.cc b/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
index d8c27bf..05f8274 100644
--- a/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
+++ b/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
@@ -90,15 +90,15 @@
ChaCha20Poly1305Encrypter encrypter;
ChaCha20Poly1305Decrypter decrypter;
- QuicString key = QuicTextUtils::HexDecode(test_vectors[0].key);
+ std::string key = QuicTextUtils::HexDecode(test_vectors[0].key);
ASSERT_TRUE(encrypter.SetKey(key));
ASSERT_TRUE(decrypter.SetKey(key));
ASSERT_TRUE(encrypter.SetNoncePrefix("abcd"));
ASSERT_TRUE(decrypter.SetNoncePrefix("abcd"));
uint64_t packet_number = UINT64_C(0x123456789ABC);
- QuicString associated_data = "associated_data";
- QuicString plaintext = "plaintext";
+ std::string associated_data = "associated_data";
+ std::string plaintext = "plaintext";
char encrypted[1024];
size_t len;
ASSERT_TRUE(encrypter.EncryptPacket(packet_number, associated_data, plaintext,
@@ -114,12 +114,12 @@
TEST_F(ChaCha20Poly1305EncrypterTest, Encrypt) {
for (size_t i = 0; test_vectors[i].key != nullptr; i++) {
// Decode the test vector.
- QuicString key = QuicTextUtils::HexDecode(test_vectors[i].key);
- QuicString pt = QuicTextUtils::HexDecode(test_vectors[i].pt);
- QuicString iv = QuicTextUtils::HexDecode(test_vectors[i].iv);
- QuicString fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed);
- QuicString aad = QuicTextUtils::HexDecode(test_vectors[i].aad);
- QuicString ct = QuicTextUtils::HexDecode(test_vectors[i].ct);
+ std::string key = QuicTextUtils::HexDecode(test_vectors[i].key);
+ std::string pt = QuicTextUtils::HexDecode(test_vectors[i].pt);
+ std::string iv = QuicTextUtils::HexDecode(test_vectors[i].iv);
+ std::string fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed);
+ std::string aad = QuicTextUtils::HexDecode(test_vectors[i].aad);
+ std::string ct = QuicTextUtils::HexDecode(test_vectors[i].ct);
ChaCha20Poly1305Encrypter encrypter;
ASSERT_TRUE(encrypter.SetKey(key));
diff --git a/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc b/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc
index dd74539..664abe2 100644
--- a/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc
+++ b/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc
@@ -136,12 +136,12 @@
bool has_pt = test_vectors[i].pt;
// Decode the test vector.
- QuicString key = QuicTextUtils::HexDecode(test_vectors[i].key);
- QuicString iv = QuicTextUtils::HexDecode(test_vectors[i].iv);
- QuicString fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed);
- QuicString aad = QuicTextUtils::HexDecode(test_vectors[i].aad);
- QuicString ct = QuicTextUtils::HexDecode(test_vectors[i].ct);
- QuicString pt;
+ std::string key = QuicTextUtils::HexDecode(test_vectors[i].key);
+ std::string iv = QuicTextUtils::HexDecode(test_vectors[i].iv);
+ std::string fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed);
+ std::string aad = QuicTextUtils::HexDecode(test_vectors[i].aad);
+ std::string ct = QuicTextUtils::HexDecode(test_vectors[i].ct);
+ std::string pt;
if (has_pt) {
pt = QuicTextUtils::HexDecode(test_vectors[i].pt);
}
diff --git a/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc b/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc
index 905472b..6ac4810 100644
--- a/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc
+++ b/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc
@@ -89,15 +89,15 @@
ChaCha20Poly1305TlsEncrypter encrypter;
ChaCha20Poly1305TlsDecrypter decrypter;
- QuicString key = QuicTextUtils::HexDecode(test_vectors[0].key);
+ std::string key = QuicTextUtils::HexDecode(test_vectors[0].key);
ASSERT_TRUE(encrypter.SetKey(key));
ASSERT_TRUE(decrypter.SetKey(key));
ASSERT_TRUE(encrypter.SetIV("abcdefghijkl"));
ASSERT_TRUE(decrypter.SetIV("abcdefghijkl"));
uint64_t packet_number = UINT64_C(0x123456789ABC);
- QuicString associated_data = "associated_data";
- QuicString plaintext = "plaintext";
+ std::string associated_data = "associated_data";
+ std::string plaintext = "plaintext";
char encrypted[1024];
size_t len;
ASSERT_TRUE(encrypter.EncryptPacket(packet_number, associated_data, plaintext,
@@ -113,12 +113,12 @@
TEST_F(ChaCha20Poly1305TlsEncrypterTest, Encrypt) {
for (size_t i = 0; test_vectors[i].key != nullptr; i++) {
// Decode the test vector.
- QuicString key = QuicTextUtils::HexDecode(test_vectors[i].key);
- QuicString pt = QuicTextUtils::HexDecode(test_vectors[i].pt);
- QuicString iv = QuicTextUtils::HexDecode(test_vectors[i].iv);
- QuicString fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed);
- QuicString aad = QuicTextUtils::HexDecode(test_vectors[i].aad);
- QuicString ct = QuicTextUtils::HexDecode(test_vectors[i].ct);
+ std::string key = QuicTextUtils::HexDecode(test_vectors[i].key);
+ std::string pt = QuicTextUtils::HexDecode(test_vectors[i].pt);
+ std::string iv = QuicTextUtils::HexDecode(test_vectors[i].iv);
+ std::string fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed);
+ std::string aad = QuicTextUtils::HexDecode(test_vectors[i].aad);
+ std::string ct = QuicTextUtils::HexDecode(test_vectors[i].ct);
ChaCha20Poly1305TlsEncrypter encrypter;
ASSERT_TRUE(encrypter.SetKey(key));
diff --git a/quic/core/crypto/channel_id.h b/quic/core/crypto/channel_id.h
index a6c8de5..d94293c 100644
--- a/quic/core/crypto/channel_id.h
+++ b/quic/core/crypto/channel_id.h
@@ -24,10 +24,10 @@
// Sign signs |signed_data| using the ChannelID private key and puts the
// signature into |out_signature|. It returns true on success.
virtual bool Sign(QuicStringPiece signed_data,
- QuicString* out_signature) const = 0;
+ std::string* out_signature) const = 0;
// SerializeKey returns the serialized ChannelID public key.
- virtual QuicString SerializeKey() const = 0;
+ virtual std::string SerializeKey() const = 0;
};
// ChannelIDSourceCallback provides a generic mechanism for a ChannelIDSource
@@ -58,7 +58,7 @@
// when complete. In this case, the ChannelIDSource will take ownership of
// |callback|.
virtual QuicAsyncStatus GetChannelIDKey(
- const QuicString& hostname,
+ const std::string& hostname,
std::unique_ptr<ChannelIDKey>* channel_id_key,
ChannelIDSourceCallback* callback) = 0;
};
diff --git a/quic/core/crypto/channel_id_test.cc b/quic/core/crypto/channel_id_test.cc
index 3e03580..d904bcb 100644
--- a/quic/core/crypto/channel_id_test.cc
+++ b/quic/core/crypto/channel_id_test.cc
@@ -286,17 +286,17 @@
std::unique_ptr<ChannelIDSource> source(
crypto_test_utils::ChannelIDSourceForTesting());
- const QuicString signed_data = "signed data";
- const QuicString hostname = "foo.example.com";
+ const std::string signed_data = "signed data";
+ const std::string hostname = "foo.example.com";
std::unique_ptr<ChannelIDKey> channel_id_key;
QuicAsyncStatus status =
source->GetChannelIDKey(hostname, &channel_id_key, nullptr);
ASSERT_EQ(QUIC_SUCCESS, status);
- QuicString signature;
+ std::string signature;
ASSERT_TRUE(channel_id_key->Sign(signed_data, &signature));
- QuicString key = channel_id_key->SerializeKey();
+ std::string key = channel_id_key->SerializeKey();
EXPECT_TRUE(ChannelIDVerifier::Verify(key, signed_data, signature));
EXPECT_FALSE(ChannelIDVerifier::Verify("a" + key, signed_data, signature));
@@ -305,14 +305,14 @@
std::unique_ptr<char[]> bad_key(new char[key.size()]);
memcpy(bad_key.get(), key.data(), key.size());
bad_key[1] ^= 0x80;
- EXPECT_FALSE(ChannelIDVerifier::Verify(QuicString(bad_key.get(), key.size()),
+ EXPECT_FALSE(ChannelIDVerifier::Verify(std::string(bad_key.get(), key.size()),
signed_data, signature));
std::unique_ptr<char[]> bad_signature(new char[signature.size()]);
memcpy(bad_signature.get(), signature.data(), signature.size());
bad_signature[1] ^= 0x80;
EXPECT_FALSE(ChannelIDVerifier::Verify(
- key, signed_data, QuicString(bad_signature.get(), signature.size())));
+ key, signed_data, std::string(bad_signature.get(), signature.size())));
EXPECT_FALSE(ChannelIDVerifier::Verify(key, "wrong signed data", signature));
}
diff --git a/quic/core/crypto/crypto_framer.cc b/quic/core/crypto/crypto_framer.cc
index dfd9eab..d8a32bc 100644
--- a/quic/core/crypto/crypto_framer.cc
+++ b/quic/core/crypto/crypto_framer.cc
@@ -75,7 +75,7 @@
return error_;
}
-const QuicString& CryptoFramer::error_detail() const {
+const std::string& CryptoFramer::error_detail() const {
return error_detail_;
}
@@ -329,7 +329,7 @@
break;
}
// Save any remaining data.
- buffer_ = QuicString(reader.PeekRemainingPayload());
+ buffer_ = std::string(reader.PeekRemainingPayload());
return QUIC_NO_ERROR;
}
diff --git a/quic/core/crypto/crypto_framer.h b/quic/core/crypto/crypto_framer.h
index e83e6a6..34234e2 100644
--- a/quic/core/crypto/crypto_framer.h
+++ b/quic/core/crypto/crypto_framer.h
@@ -58,7 +58,7 @@
}
QuicErrorCode error() const override;
- const QuicString& error_detail() const override;
+ const std::string& error_detail() const override;
// Processes input data, which must be delivered in order. Returns
// false if there was an error, and true otherwise. ProcessInput optionally
@@ -115,13 +115,13 @@
// Last error.
QuicErrorCode error_;
// Remaining unparsed data.
- QuicString buffer_;
+ std::string buffer_;
// Current state of the parsing.
CryptoFramerState state_;
// The message currently being parsed.
CryptoHandshakeMessage message_;
// The issue which caused |error_|
- QuicString error_detail_;
+ std::string error_detail_;
// Number of entires in the message currently being parsed.
uint16_t num_entries_;
// tags_and_lengths_ contains the tags that are currently being parsed and
diff --git a/quic/core/crypto/crypto_handshake.h b/quic/core/crypto/crypto_handshake.h
index 9b148c8..1e3d668 100644
--- a/quic/core/crypto/crypto_handshake.h
+++ b/quic/core/crypto/crypto_handshake.h
@@ -104,28 +104,28 @@
QuicTag key_exchange;
QuicTag aead;
- QuicString initial_premaster_secret;
- QuicString forward_secure_premaster_secret;
+ std::string initial_premaster_secret;
+ std::string forward_secure_premaster_secret;
// initial_subkey_secret is used as the PRK input to the HKDF used when
// performing key extraction that needs to happen before forward-secure keys
// are available.
- QuicString initial_subkey_secret;
+ std::string initial_subkey_secret;
// subkey_secret is used as the PRK input to the HKDF used for key extraction.
- QuicString subkey_secret;
+ std::string subkey_secret;
CrypterPair initial_crypters;
CrypterPair forward_secure_crypters;
// Normalized SNI: converted to lower case and trailing '.' removed.
- QuicString sni;
- QuicString client_nonce;
- QuicString server_nonce;
+ std::string sni;
+ std::string client_nonce;
+ std::string server_nonce;
// hkdf_input_suffix contains the HKDF input following the label: the
// ConnectionId, client hello and server config. This is only populated in the
// client because only the client needs to derive the forward secure keys at a
// later time from the initial keys.
- QuicString hkdf_input_suffix;
+ std::string hkdf_input_suffix;
// cached_certs contains the cached certificates that a client used when
// sending a client hello.
- std::vector<QuicString> cached_certs;
+ std::vector<std::string> cached_certs;
// client_key_exchange is used by clients to store the ephemeral KeyExchange
// for the connection.
std::unique_ptr<KeyExchange> client_key_exchange;
@@ -133,14 +133,14 @@
// proves possession of the corresponding private key. It consists of 32
// bytes of x coordinate, followed by 32 bytes of y coordinate. Both values
// are big-endian and the pair is a P-256 public key.
- QuicString channel_id;
+ std::string channel_id;
QuicTag token_binding_key_param;
// Used when generating proof signature when sending server config updates.
// Used to generate cert chain when sending server config updates.
- QuicString client_common_set_hashes;
- QuicString client_cached_cert_hashes;
+ std::string client_common_set_hashes;
+ std::string client_cached_cert_hashes;
// Default to false; set to true if the client indicates that it supports sct
// by sending CSCT tag with an empty value in client hello.
diff --git a/quic/core/crypto/crypto_handshake_message.cc b/quic/core/crypto/crypto_handshake_message.cc
index a057254..46577b3 100644
--- a/quic/core/crypto/crypto_handshake_message.cc
+++ b/quic/core/crypto/crypto_handshake_message.cc
@@ -85,7 +85,7 @@
void CryptoHandshakeMessage::SetStringPiece(QuicTag tag,
QuicStringPiece value) {
- tag_value_map_[tag] = QuicString(value);
+ tag_value_map_[tag] = std::string(value);
}
void CryptoHandshakeMessage::Erase(QuicTag tag) {
@@ -236,7 +236,7 @@
return minimum_size_;
}
-QuicString CryptoHandshakeMessage::DebugString() const {
+std::string CryptoHandshakeMessage::DebugString() const {
return DebugStringInternal(0);
}
@@ -261,11 +261,12 @@
return ret;
}
-QuicString CryptoHandshakeMessage::DebugStringInternal(size_t indent) const {
- QuicString ret = QuicString(2 * indent, ' ') + QuicTagToString(tag_) + "<\n";
+std::string CryptoHandshakeMessage::DebugStringInternal(size_t indent) const {
+ std::string ret =
+ std::string(2 * indent, ' ') + QuicTagToString(tag_) + "<\n";
++indent;
for (auto it = tag_value_map_.begin(); it != tag_value_map_.end(); ++it) {
- ret += QuicString(2 * indent, ' ') + QuicTagToString(it->first) + ": ";
+ ret += std::string(2 * indent, ' ') + QuicTagToString(it->first) + ": ";
bool done = false;
switch (it->first) {
@@ -371,7 +372,7 @@
ret += "\n";
}
--indent;
- ret += QuicString(2 * indent, ' ') + ">";
+ ret += std::string(2 * indent, ' ') + ">";
return ret;
}
diff --git a/quic/core/crypto/crypto_handshake_message.h b/quic/core/crypto/crypto_handshake_message.h
index 1f6e8b6..8a75436 100644
--- a/quic/core/crypto/crypto_handshake_message.h
+++ b/quic/core/crypto/crypto_handshake_message.h
@@ -45,7 +45,7 @@
template <class T>
void SetValue(QuicTag tag, const T& v) {
tag_value_map_[tag] =
- QuicString(reinterpret_cast<const char*>(&v), sizeof(v));
+ std::string(reinterpret_cast<const char*>(&v), sizeof(v));
}
// SetVector sets an element with the given tag to the raw contents of an
@@ -53,10 +53,10 @@
template <class T>
void SetVector(QuicTag tag, const std::vector<T>& v) {
if (v.empty()) {
- tag_value_map_[tag] = QuicString();
+ tag_value_map_[tag] = std::string();
} else {
- tag_value_map_[tag] = QuicString(reinterpret_cast<const char*>(&v[0]),
- v.size() * sizeof(T));
+ tag_value_map_[tag] = std::string(reinterpret_cast<const char*>(&v[0]),
+ v.size() * sizeof(T));
}
}
@@ -126,7 +126,7 @@
// DebugString returns a multi-line, string representation of the message
// suitable for including in debug output.
- QuicString DebugString() const;
+ std::string DebugString() const;
private:
// GetPOD is a utility function for extracting a plain-old-data value. If
@@ -138,7 +138,7 @@
// little-endian.
QuicErrorCode GetPOD(QuicTag tag, void* out, size_t len) const;
- QuicString DebugStringInternal(size_t indent) const;
+ std::string DebugStringInternal(size_t indent) const;
QuicTag tag_;
QuicTagValueMap tag_value_map_;
diff --git a/quic/core/crypto/crypto_message_parser.h b/quic/core/crypto/crypto_message_parser.h
index 8b9fa4a..3c70e6e 100644
--- a/quic/core/crypto/crypto_message_parser.h
+++ b/quic/core/crypto/crypto_message_parser.h
@@ -17,7 +17,7 @@
virtual ~CryptoMessageParser() {}
virtual QuicErrorCode error() const = 0;
- virtual const QuicString& error_detail() const = 0;
+ virtual const std::string& error_detail() const = 0;
// Processes input data, which must be delivered in order. The input data
// being processed was received at encryption level |level|. Returns
diff --git a/quic/core/crypto/crypto_message_printer_bin.cc b/quic/core/crypto/crypto_message_printer_bin.cc
index f14abb0..66fa7e4 100644
--- a/quic/core/crypto/crypto_message_printer_bin.cc
+++ b/quic/core/crypto/crypto_message_printer_bin.cc
@@ -16,7 +16,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
using quic::Perspective;
-using quic::QuicString;
using std::cerr;
using std::cout;
using std::endl;
@@ -44,7 +43,7 @@
quic::CryptoFramer framer;
framer.set_visitor(&printer);
framer.set_process_truncated_messages(true);
- QuicString input = quic::QuicTextUtils::HexDecode(argv[1]);
+ std::string input = quic::QuicTextUtils::HexDecode(argv[1]);
if (!framer.ProcessInput(input)) {
return 1;
}
diff --git a/quic/core/crypto/crypto_protocol.h b/quic/core/crypto/crypto_protocol.h
index e5a4048..d3304ba 100644
--- a/quic/core/crypto/crypto_protocol.h
+++ b/quic/core/crypto/crypto_protocol.h
@@ -24,7 +24,7 @@
namespace quic {
-typedef QuicString ServerConfigID;
+typedef std::string ServerConfigID;
// clang-format off
const QuicTag kCHLO = TAG('C', 'H', 'L', 'O'); // Client hello
diff --git a/quic/core/crypto/crypto_secret_boxer.cc b/quic/core/crypto/crypto_secret_boxer.cc
index ada12ad..16e9d0c 100644
--- a/quic/core/crypto/crypto_secret_boxer.cc
+++ b/quic/core/crypto/crypto_secret_boxer.cc
@@ -43,12 +43,12 @@
// kAEAD is the AEAD used for boxing: AES-256-GCM-SIV.
static const EVP_AEAD* (*const kAEAD)() = EVP_aead_aes_256_gcm_siv;
-void CryptoSecretBoxer::SetKeys(const std::vector<QuicString>& keys) {
+void CryptoSecretBoxer::SetKeys(const std::vector<std::string>& keys) {
DCHECK(!keys.empty());
const EVP_AEAD* const aead = kAEAD();
std::unique_ptr<State> new_state(new State);
- for (const QuicString& key : keys) {
+ for (const std::string& key : keys) {
DCHECK_EQ(kBoxKeySize, key.size());
bssl::UniquePtr<EVP_AEAD_CTX> ctx(
EVP_AEAD_CTX_new(aead, reinterpret_cast<const uint8_t*>(key.data()),
@@ -66,8 +66,8 @@
state_ = std::move(new_state);
}
-QuicString CryptoSecretBoxer::Box(QuicRandom* rand,
- QuicStringPiece plaintext) const {
+std::string CryptoSecretBoxer::Box(QuicRandom* rand,
+ QuicStringPiece plaintext) const {
// The box is formatted as:
// 12 bytes of random nonce
// n bytes of ciphertext
@@ -75,7 +75,7 @@
size_t out_len =
kSIVNonceSize + plaintext.size() + EVP_AEAD_max_overhead(kAEAD());
- QuicString ret;
+ std::string ret;
ret.resize(out_len);
uint8_t* out = reinterpret_cast<uint8_t*>(const_cast<char*>(ret.data()));
@@ -104,7 +104,7 @@
}
bool CryptoSecretBoxer::Unbox(QuicStringPiece in_ciphertext,
- QuicString* out_storage,
+ std::string* out_storage,
QuicStringPiece* out) const {
if (in_ciphertext.size() < kSIVNonceSize) {
return false;
diff --git a/quic/core/crypto/crypto_secret_boxer.h b/quic/core/crypto/crypto_secret_boxer.h
index de470b1..13e0469 100644
--- a/quic/core/crypto/crypto_secret_boxer.h
+++ b/quic/core/crypto/crypto_secret_boxer.h
@@ -36,13 +36,13 @@
// used by |Box|, but all supplied keys will be tried by |Unbox|, to handle
// key skew across the fleet. This must be called before |Box| or |Unbox|.
// Keys must be |GetKeySize()| bytes long.
- void SetKeys(const std::vector<QuicString>& keys);
+ void SetKeys(const std::vector<std::string>& keys);
// Box encrypts |plaintext| using a random nonce generated from |rand| and
// returns the resulting ciphertext. Since an authenticator and nonce are
// included, the result will be slightly larger than |plaintext|. The first
// key in the vector supplied to |SetKeys| will be used.
- QuicString Box(QuicRandom* rand, QuicStringPiece plaintext) const;
+ std::string Box(QuicRandom* rand, QuicStringPiece plaintext) const;
// Unbox takes the result of a previous call to |Box| in |ciphertext| and
// authenticates+decrypts it. If |ciphertext| cannot be decrypted with any of
@@ -50,7 +50,7 @@
// used to store the result and |out| is set to point into |out_storage| and
// contains the original plaintext.
bool Unbox(QuicStringPiece ciphertext,
- QuicString* out_storage,
+ std::string* out_storage,
QuicStringPiece* out) const;
private:
diff --git a/quic/core/crypto/crypto_secret_boxer_test.cc b/quic/core/crypto/crypto_secret_boxer_test.cc
index d060051..8739977 100644
--- a/quic/core/crypto/crypto_secret_boxer_test.cc
+++ b/quic/core/crypto/crypto_secret_boxer_test.cc
@@ -17,29 +17,30 @@
QuicStringPiece message("hello world");
CryptoSecretBoxer boxer;
- boxer.SetKeys({QuicString(CryptoSecretBoxer::GetKeySize(), 0x11)});
+ boxer.SetKeys({std::string(CryptoSecretBoxer::GetKeySize(), 0x11)});
- const QuicString box = boxer.Box(QuicRandom::GetInstance(), message);
+ const std::string box = boxer.Box(QuicRandom::GetInstance(), message);
- QuicString storage;
+ std::string storage;
QuicStringPiece result;
EXPECT_TRUE(boxer.Unbox(box, &storage, &result));
EXPECT_EQ(result, message);
- EXPECT_FALSE(boxer.Unbox(QuicString(1, 'X') + box, &storage, &result));
- EXPECT_FALSE(boxer.Unbox(box.substr(1, QuicString::npos), &storage, &result));
- EXPECT_FALSE(boxer.Unbox(QuicString(), &storage, &result));
+ EXPECT_FALSE(boxer.Unbox(std::string(1, 'X') + box, &storage, &result));
+ EXPECT_FALSE(
+ boxer.Unbox(box.substr(1, std::string::npos), &storage, &result));
+ EXPECT_FALSE(boxer.Unbox(std::string(), &storage, &result));
EXPECT_FALSE(boxer.Unbox(
- QuicString(1, box[0] ^ 0x80) + box.substr(1, QuicString::npos), &storage,
- &result));
+ std::string(1, box[0] ^ 0x80) + box.substr(1, std::string::npos),
+ &storage, &result));
}
// Helper function to test whether one boxer can decode the output of another.
static bool CanDecode(const CryptoSecretBoxer& decoder,
const CryptoSecretBoxer& encoder) {
QuicStringPiece message("hello world");
- const QuicString boxed = encoder.Box(QuicRandom::GetInstance(), message);
- QuicString storage;
+ const std::string boxed = encoder.Box(QuicRandom::GetInstance(), message);
+ std::string storage;
QuicStringPiece result;
bool ok = decoder.Unbox(boxed, &storage, &result);
if (ok) {
@@ -49,8 +50,8 @@
}
TEST_F(CryptoSecretBoxerTest, MultipleKeys) {
- QuicString key_11(CryptoSecretBoxer::GetKeySize(), 0x11);
- QuicString key_12(CryptoSecretBoxer::GetKeySize(), 0x12);
+ std::string key_11(CryptoSecretBoxer::GetKeySize(), 0x11);
+ std::string key_12(CryptoSecretBoxer::GetKeySize(), 0x12);
CryptoSecretBoxer boxer_11, boxer_12, boxer;
boxer_11.SetKeys({key_11});
diff --git a/quic/core/crypto/crypto_server_test.cc b/quic/core/crypto/crypto_server_test.cc
index 11615c2..b6740e9 100644
--- a/quic/core/crypto/crypto_server_test.cc
+++ b/quic/core/crypto/crypto_server_test.cc
@@ -46,7 +46,7 @@
~DummyProofVerifierCallback() override {}
void Run(bool ok,
- const QuicString& error_details,
+ const std::string& error_details,
std::unique_ptr<ProofVerifyDetails>* details) override {
DCHECK(false);
}
@@ -279,7 +279,7 @@
void Run(
QuicErrorCode error,
- const QuicString& error_details,
+ const std::string& error_details,
std::unique_ptr<CryptoHandshakeMessage> message,
std::unique_ptr<DiversificationNonce> diversification_nonce,
std::unique_ptr<ProofSource::Details> proof_source_details) override {
@@ -291,7 +291,7 @@
ASSERT_NE(error, QUIC_NO_ERROR)
<< "Message didn't fail: " << result_->client_hello.DebugString();
- EXPECT_TRUE(error_details.find(error_substr_) != QuicString::npos)
+ EXPECT_TRUE(error_details.find(error_substr_) != std::string::npos)
<< error_substr_ << " not in " << error_details;
}
if (message != nullptr) {
@@ -328,8 +328,8 @@
EXPECT_TRUE(called);
}
- QuicString GenerateNonce() {
- QuicString nonce;
+ std::string GenerateNonce() {
+ std::string nonce;
CryptoUtils::GenerateNonce(
clock_.WallNow(), rand_,
QuicStringPiece(reinterpret_cast<const char*>(orbit_), sizeof(orbit_)),
@@ -384,7 +384,7 @@
GetParam().use_stateless_rejects;
}
- QuicString XlctHexString() {
+ std::string XlctHexString() {
uint64_t xlct = crypto_test_utils::LeafCertHashForTesting();
return "#" + QuicTextUtils::HexEncode(reinterpret_cast<char*>(&xlct),
sizeof(xlct));
@@ -397,7 +397,7 @@
QuicSocketAddress client_address_;
ParsedQuicVersionVector supported_versions_;
ParsedQuicVersion client_version_;
- QuicString client_version_string_;
+ std::string client_version_string_;
QuicCryptoServerConfig config_;
QuicCryptoServerConfigPeer peer_;
QuicCompressedCertsCache compressed_certs_cache_;
@@ -411,11 +411,12 @@
// These strings contain hex escaped values from the server suitable for using
// when constructing client hello messages.
- QuicString nonce_hex_, pub_hex_, srct_hex_, scid_hex_;
+ std::string nonce_hex_, pub_hex_, srct_hex_, scid_hex_;
std::unique_ptr<CryptoHandshakeMessage> server_config_;
};
-INSTANTIATE_TEST_SUITE_P(CryptoServerTests, CryptoServerTest,
+INSTANTIATE_TEST_SUITE_P(CryptoServerTests,
+ CryptoServerTest,
::testing::ValuesIn(GetTestParams()));
TEST_P(CryptoServerTest, BadSNI) {
@@ -669,7 +670,7 @@
}
// Set the client's preferred version to a supported version that
// is not the "current" version (supported_versions_.front()).
- QuicString bad_version =
+ std::string bad_version =
ParsedQuicVersionToString(supported_versions_.back());
CryptoHandshakeMessage msg = crypto_test_utils::CreateCHLO(
@@ -683,16 +684,16 @@
TEST_P(CryptoServerTest, CorruptServerConfig) {
// This tests corrupted server config.
- CryptoHandshakeMessage msg =
- crypto_test_utils::CreateCHLO({{"PDMD", "X509"},
- {"AEAD", "AESG"},
- {"KEXS", "C255"},
- {"SCID", (QuicString(1, 'X') + scid_hex_)},
- {"#004b5453", srct_hex_},
- {"PUBS", pub_hex_},
- {"NONC", nonce_hex_},
- {"VER\0", client_version_string_}},
- kClientHelloMinimumSize);
+ CryptoHandshakeMessage msg = crypto_test_utils::CreateCHLO(
+ {{"PDMD", "X509"},
+ {"AEAD", "AESG"},
+ {"KEXS", "C255"},
+ {"SCID", (std::string(1, 'X') + scid_hex_)},
+ {"#004b5453", srct_hex_},
+ {"PUBS", pub_hex_},
+ {"NONC", nonce_hex_},
+ {"VER\0", client_version_string_}},
+ kClientHelloMinimumSize);
ShouldSucceed(msg);
CheckRejectTag();
@@ -708,7 +709,7 @@
{"AEAD", "AESG"},
{"KEXS", "C255"},
{"SCID", scid_hex_},
- {"#004b5453", (QuicString(1, 'X') + srct_hex_)},
+ {"#004b5453", (std::string(1, 'X') + srct_hex_)},
{"PUBS", pub_hex_},
{"NONC", nonce_hex_},
{"XLCT", XlctHexString()},
@@ -729,7 +730,7 @@
{"AEAD", "AESG"},
{"KEXS", "C255"},
{"SCID", scid_hex_},
- {"#004b5453", (QuicString(1, 'X') + srct_hex_)},
+ {"#004b5453", (std::string(1, 'X') + srct_hex_)},
{"PUBS", pub_hex_},
{"NONC", nonce_hex_},
{"XLCT", XlctHexString()},
@@ -749,9 +750,9 @@
{"AEAD", "AESG"},
{"KEXS", "C255"},
{"SCID", scid_hex_},
- {"#004b5453", (QuicString(1, 'X') + srct_hex_)},
+ {"#004b5453", (std::string(1, 'X') + srct_hex_)},
{"PUBS", pub_hex_},
- {"NONC", (QuicString(1, 'X') + nonce_hex_)},
+ {"NONC", (std::string(1, 'X') + nonce_hex_)},
{"XLCT", XlctHexString()},
{"VER\0", client_version_string_}},
kClientHelloMinimumSize);
@@ -770,11 +771,11 @@
{"AEAD", "AESG"},
{"KEXS", "C255"},
{"SCID", scid_hex_},
- {"#004b5453", (QuicString(1, 'X') + srct_hex_)},
+ {"#004b5453", (std::string(1, 'X') + srct_hex_)},
{"PUBS", pub_hex_},
- {"NONC", (QuicString(1, 'X') + nonce_hex_)},
- {"NONP", (QuicString(1, 'X') + nonce_hex_)},
- {"SNO\0", (QuicString(1, 'X') + nonce_hex_)},
+ {"NONC", (std::string(1, 'X') + nonce_hex_)},
+ {"NONP", (std::string(1, 'X') + nonce_hex_)},
+ {"SNO\0", (std::string(1, 'X') + nonce_hex_)},
{"XLCT", XlctHexString()},
{"VER\0", client_version_string_}},
kClientHelloMinimumSize);
@@ -847,9 +848,9 @@
// Get certs from compressed certs.
const CommonCertSets* common_cert_sets(CommonCertSets::GetInstanceQUIC());
- std::vector<QuicString> cached_certs;
+ std::vector<std::string> cached_certs;
- std::vector<QuicString> certs;
+ std::vector<std::string> certs;
ASSERT_TRUE(CertCompressor::DecompressChain(cert, cached_certs,
common_cert_sets, &certs));
@@ -859,16 +860,16 @@
std::unique_ptr<ProofVerifyContext> verify_context(
crypto_test_utils::ProofVerifyContextForTesting());
std::unique_ptr<ProofVerifyDetails> details;
- QuicString error_details;
+ std::string error_details;
std::unique_ptr<ProofVerifierCallback> callback(
new DummyProofVerifierCallback());
- QuicString chlo_hash;
+ std::string chlo_hash;
CryptoUtils::HashHandshakeMessage(msg, &chlo_hash, Perspective::IS_SERVER);
EXPECT_EQ(QUIC_SUCCESS,
proof_verifier->VerifyProof(
- "test.example.com", 443, (QuicString(scfg_str)),
+ "test.example.com", 443, (std::string(scfg_str)),
client_version_.transport_version, chlo_hash, certs, "",
- (QuicString(proof)), verify_context.get(), &error_details,
+ (std::string(proof)), verify_context.get(), &error_details,
&details, std::move(callback)));
}
@@ -980,7 +981,7 @@
QuicStringPiece certs_compressed;
ASSERT_TRUE(out_.GetStringPiece(kCertificateTag, &certs_compressed));
ASSERT_NE(0u, certs_compressed.size());
- std::vector<QuicString> certs;
+ std::vector<std::string> certs;
ASSERT_TRUE(CertCompressor::DecompressChain(
certs_compressed, /*cached_certs=*/{}, /*common_sets=*/nullptr, &certs));
@@ -1084,7 +1085,7 @@
QuicStringPiece scid;
EXPECT_TRUE(scfg->GetStringPiece(kSCID, &scid));
// Need to take a copy of |scid| has we're about to call |Erase|.
- const QuicString scid_str(scid);
+ const std::string scid_str(scid);
scfg->Erase(kSCID);
scfg->MarkDirty();
diff --git a/quic/core/crypto/crypto_utils.cc b/quic/core/crypto/crypto_utils.cc
index 4f6a61d..ff682b3 100644
--- a/quic/core/crypto/crypto_utils.cc
+++ b/quic/core/crypto/crypto_utils.cc
@@ -37,7 +37,7 @@
std::vector<uint8_t> CryptoUtils::HkdfExpandLabel(
const EVP_MD* prf,
const std::vector<uint8_t>& secret,
- const QuicString& label,
+ const std::string& label,
size_t out_len) {
bssl::ScopedCBB quic_hkdf_label;
CBB inner_label;
@@ -115,9 +115,9 @@
<< "HKDF_extract failed when creating initial crypters";
handshake_secret.resize(handshake_secret_len);
- const QuicString client_label = "client in";
- const QuicString server_label = "server in";
- QuicString encryption_label, decryption_label;
+ const std::string client_label = "client in";
+ const std::string server_label = "server in";
+ std::string encryption_label, decryption_label;
if (perspective == Perspective::IS_CLIENT) {
encryption_label = client_label;
decryption_label = server_label;
@@ -140,7 +140,7 @@
void CryptoUtils::GenerateNonce(QuicWallTime now,
QuicRandom* random_generator,
QuicStringPiece orbit,
- QuicString* nonce) {
+ std::string* nonce) {
// a 4-byte timestamp + 28 random bytes.
nonce->reserve(kNonceSize);
nonce->resize(kNonceSize);
@@ -169,11 +169,11 @@
QuicStringPiece client_nonce,
QuicStringPiece server_nonce,
QuicStringPiece pre_shared_key,
- const QuicString& hkdf_input,
+ const std::string& hkdf_input,
Perspective perspective,
Diversification diversification,
CrypterPair* crypters,
- QuicString* subkey_secret) {
+ std::string* subkey_secret) {
// If the connection is using PSK, concatenate it with the pre-master secret.
std::unique_ptr<char[]> psk_premaster_secret;
if (!pre_shared_key.empty()) {
@@ -207,9 +207,9 @@
subkey_secret == nullptr ? 0 : premaster_secret.length();
QuicStringPiece nonce = client_nonce;
- QuicString nonce_storage;
+ std::string nonce_storage;
if (!server_nonce.empty()) {
- nonce_storage = QuicString(client_nonce) + QuicString(server_nonce);
+ nonce_storage = std::string(client_nonce) + std::string(server_nonce);
nonce = nonce_storage;
}
@@ -259,7 +259,7 @@
return false;
}
- QuicString key, nonce_prefix;
+ std::string key, nonce_prefix;
QuicDecrypter::DiversifyPreliminaryKey(
hkdf.server_write_key(), hkdf.server_write_iv(),
*diversification.nonce(), key_bytes, nonce_prefix_bytes, &key,
@@ -277,7 +277,7 @@
}
if (subkey_secret != nullptr) {
- *subkey_secret = QuicString(hkdf.subkey_secret());
+ *subkey_secret = std::string(hkdf.subkey_secret());
}
return true;
@@ -288,7 +288,7 @@
QuicStringPiece label,
QuicStringPiece context,
size_t result_len,
- QuicString* result) {
+ std::string* result) {
for (size_t i = 0; i < label.length(); i++) {
if (label[i] == '\0') {
QUIC_LOG(ERROR) << "ExportKeyingMaterial label may not contain NULs";
@@ -301,14 +301,14 @@
return false;
}
uint32_t context_length = static_cast<uint32_t>(context.length());
- QuicString info = QuicString(label);
+ std::string info = std::string(label);
info.push_back('\0');
info.append(reinterpret_cast<char*>(&context_length), sizeof(context_length));
info.append(context.data(), context.length());
QuicHKDF hkdf(subkey_secret, QuicStringPiece() /* no salt */, info,
result_len, 0 /* no fixed IV */, 0 /* no subkey secret */);
- *result = QuicString(hkdf.client_write_key());
+ *result = std::string(hkdf.client_write_key());
return true;
}
@@ -320,7 +320,7 @@
QuicErrorCode CryptoUtils::ValidateServerHello(
const CryptoHandshakeMessage& server_hello,
const ParsedQuicVersionVector& negotiated_versions,
- QuicString* error_details) {
+ std::string* error_details) {
DCHECK(error_details != nullptr);
if (server_hello.tag() != kSHLO) {
@@ -342,7 +342,7 @@
QuicErrorCode CryptoUtils::ValidateServerHelloVersions(
const QuicVersionLabelVector& server_versions,
const ParsedQuicVersionVector& negotiated_versions,
- QuicString* error_details) {
+ std::string* error_details) {
if (!negotiated_versions.empty()) {
bool mismatch = server_versions.size() != negotiated_versions.size();
for (size_t i = 0; i < server_versions.size() && !mismatch; ++i) {
@@ -368,7 +368,7 @@
const CryptoHandshakeMessage& client_hello,
ParsedQuicVersion version,
const ParsedQuicVersionVector& supported_versions,
- QuicString* error_details) {
+ std::string* error_details) {
if (client_hello.tag() != kCHLO) {
*error_details = "Bad tag";
return QUIC_INVALID_CRYPTO_MESSAGE_TYPE;
@@ -392,7 +392,7 @@
QuicVersionLabel client_version,
ParsedQuicVersion connection_version,
const ParsedQuicVersionVector& supported_versions,
- QuicString* error_details) {
+ std::string* error_details) {
if (client_version != CreateQuicVersionLabel(connection_version)) {
// Check to see if |client_version| is actually on the supported versions
// list. If not, the server doesn't support that version and it's not a
@@ -456,7 +456,7 @@
// static
void CryptoUtils::HashHandshakeMessage(const CryptoHandshakeMessage& message,
- QuicString* output,
+ std::string* output,
Perspective perspective) {
const QuicData& serialized = message.GetSerialized();
uint8_t digest[SHA256_DIGEST_LENGTH];
diff --git a/quic/core/crypto/crypto_utils.h b/quic/core/crypto/crypto_utils.h
index 511bae9..f340bf4 100644
--- a/quic/core/crypto/crypto_utils.h
+++ b/quic/core/crypto/crypto_utils.h
@@ -101,7 +101,7 @@
static void GenerateNonce(QuicWallTime now,
QuicRandom* random_generator,
QuicStringPiece orbit,
- QuicString* nonce);
+ std::string* nonce);
// DeriveKeys populates |crypters->encrypter|, |crypters->decrypter|, and
// |subkey_secret| (optional -- may be null) given the contents of
@@ -127,11 +127,11 @@
QuicStringPiece client_nonce,
QuicStringPiece server_nonce,
QuicStringPiece pre_shared_key,
- const QuicString& hkdf_input,
+ const std::string& hkdf_input,
Perspective perspective,
Diversification diversification,
CrypterPair* crypters,
- QuicString* subkey_secret);
+ std::string* subkey_secret);
// Performs key extraction to derive a new secret of |result_len| bytes
// dependent on |subkey_secret|, |label|, and |context|. Returns false if the
@@ -141,7 +141,7 @@
QuicStringPiece label,
QuicStringPiece context,
size_t result_len,
- QuicString* result);
+ std::string* result);
// Computes the FNV-1a hash of the provided DER-encoded cert for use in the
// XLCT tag.
@@ -155,7 +155,7 @@
static QuicErrorCode ValidateServerHello(
const CryptoHandshakeMessage& server_hello,
const ParsedQuicVersionVector& negotiated_versions,
- QuicString* error_details);
+ std::string* error_details);
// Validates that the |server_versions| received do not indicate that the
// ServerHello is part of a downgrade attack. |negotiated_versions| must
@@ -167,7 +167,7 @@
static QuicErrorCode ValidateServerHelloVersions(
const QuicVersionLabelVector& server_versions,
const ParsedQuicVersionVector& negotiated_versions,
- QuicString* error_details);
+ std::string* error_details);
// Validates that |client_hello| is actually a CHLO and that this is not part
// of a downgrade attack.
@@ -179,7 +179,7 @@
const CryptoHandshakeMessage& client_hello,
ParsedQuicVersion version,
const ParsedQuicVersionVector& supported_versions,
- QuicString* error_details);
+ std::string* error_details);
// Validates that the |client_version| received does not indicate that a
// downgrade attack has occurred. |connection_version| is the version of the
@@ -192,7 +192,7 @@
QuicVersionLabel client_version,
ParsedQuicVersion connection_version,
const ParsedQuicVersionVector& supported_versions,
- QuicString* error_details);
+ std::string* error_details);
// Returns the name of the HandshakeFailureReason as a char*
static const char* HandshakeFailureReasonToString(
@@ -200,7 +200,7 @@
// Writes a hash of the serialized |message| into |output|.
static void HashHandshakeMessage(const CryptoHandshakeMessage& message,
- QuicString* output,
+ std::string* output,
Perspective perspective);
private:
@@ -221,7 +221,7 @@
static std::vector<uint8_t> HkdfExpandLabel(
const EVP_MD* prf,
const std::vector<uint8_t>& secret,
- const QuicString& label,
+ const std::string& label,
size_t out_len);
};
diff --git a/quic/core/crypto/crypto_utils_test.cc b/quic/core/crypto/crypto_utils_test.cc
index 90a37af..c76337d 100644
--- a/quic/core/crypto/crypto_utils_test.cc
+++ b/quic/core/crypto/crypto_utils_test.cc
@@ -50,18 +50,18 @@
for (size_t i = 0; i < QUIC_ARRAYSIZE(test_vector); i++) {
// Decode the test vector.
- QuicString subkey_secret =
+ std::string subkey_secret =
QuicTextUtils::HexDecode(test_vector[i].subkey_secret);
- QuicString label = QuicTextUtils::HexDecode(test_vector[i].label);
- QuicString context = QuicTextUtils::HexDecode(test_vector[i].context);
+ std::string label = QuicTextUtils::HexDecode(test_vector[i].label);
+ std::string context = QuicTextUtils::HexDecode(test_vector[i].context);
size_t result_len = test_vector[i].result_len;
bool expect_ok = test_vector[i].expected != nullptr;
- QuicString expected;
+ std::string expected;
if (expect_ok) {
expected = QuicTextUtils::HexDecode(test_vector[i].expected);
}
- QuicString result;
+ std::string result;
bool ok = CryptoUtils::ExportKeyingMaterial(subkey_secret, label, context,
result_len, &result);
EXPECT_EQ(expect_ok, ok);
diff --git a/quic/core/crypto/curve25519_key_exchange.cc b/quic/core/crypto/curve25519_key_exchange.cc
index 368b453..9c8e5ed 100644
--- a/quic/core/crypto/curve25519_key_exchange.cc
+++ b/quic/core/crypto/curve25519_key_exchange.cc
@@ -20,7 +20,8 @@
~Curve25519KeyExchangeFactory() override = default;
std::unique_ptr<KeyExchange> Create(QuicRandom* rand) const override {
- const QuicString private_value = Curve25519KeyExchange::NewPrivateKey(rand);
+ const std::string private_value =
+ Curve25519KeyExchange::NewPrivateKey(rand);
return Curve25519KeyExchange::New(private_value);
}
@@ -58,10 +59,10 @@
}
// static
-QuicString Curve25519KeyExchange::NewPrivateKey(QuicRandom* rand) {
+std::string Curve25519KeyExchange::NewPrivateKey(QuicRandom* rand) {
uint8_t private_key[X25519_PRIVATE_KEY_LEN];
rand->RandBytes(private_key, sizeof(private_key));
- return QuicString(reinterpret_cast<char*>(private_key), sizeof(private_key));
+ return std::string(reinterpret_cast<char*>(private_key), sizeof(private_key));
}
const Curve25519KeyExchange::Factory& Curve25519KeyExchange::GetFactory()
@@ -72,7 +73,7 @@
bool Curve25519KeyExchange::CalculateSharedKey(
QuicStringPiece peer_public_value,
- QuicString* out_result) const {
+ std::string* out_result) const {
if (peer_public_value.size() != X25519_PUBLIC_VALUE_LEN) {
return false;
}
@@ -89,7 +90,7 @@
void Curve25519KeyExchange::CalculateSharedKey(
QuicStringPiece peer_public_value,
- QuicString* shared_key,
+ std::string* shared_key,
std::unique_ptr<Callback> callback) const {
callback->Run(CalculateSharedKey(peer_public_value, shared_key));
}
diff --git a/quic/core/crypto/curve25519_key_exchange.h b/quic/core/crypto/curve25519_key_exchange.h
index a715e3e..115789c 100644
--- a/quic/core/crypto/curve25519_key_exchange.h
+++ b/quic/core/crypto/curve25519_key_exchange.h
@@ -29,14 +29,14 @@
// NewPrivateKey returns a private key, generated from |rand|, suitable for
// passing to |New|.
- static QuicString NewPrivateKey(QuicRandom* rand);
+ static std::string NewPrivateKey(QuicRandom* rand);
// KeyExchange interface.
const Factory& GetFactory() const override;
bool CalculateSharedKey(QuicStringPiece peer_public_value,
- QuicString* shared_key) const override;
+ std::string* shared_key) const override;
void CalculateSharedKey(QuicStringPiece peer_public_value,
- QuicString* shared_key,
+ std::string* shared_key,
std::unique_ptr<Callback> callback) const override;
QuicStringPiece public_value() const override;
diff --git a/quic/core/crypto/curve25519_key_exchange_test.cc b/quic/core/crypto/curve25519_key_exchange_test.cc
index e5ed6e0..0c4f735 100644
--- a/quic/core/crypto/curve25519_key_exchange_test.cc
+++ b/quic/core/crypto/curve25519_key_exchange_test.cc
@@ -46,8 +46,8 @@
QuicRandom* const rand = QuicRandom::GetInstance();
for (int i = 0; i < 5; i++) {
- const QuicString alice_key(Curve25519KeyExchange::NewPrivateKey(rand));
- const QuicString bob_key(Curve25519KeyExchange::NewPrivateKey(rand));
+ const std::string alice_key(Curve25519KeyExchange::NewPrivateKey(rand));
+ const std::string bob_key(Curve25519KeyExchange::NewPrivateKey(rand));
std::unique_ptr<Curve25519KeyExchange> alice(
Curve25519KeyExchange::New(alice_key));
@@ -57,7 +57,7 @@
const QuicStringPiece alice_public(alice->public_value());
const QuicStringPiece bob_public(bob->public_value());
- QuicString alice_shared, bob_shared;
+ std::string alice_shared, bob_shared;
ASSERT_TRUE(alice->CalculateSharedKey(bob_public, &alice_shared));
ASSERT_TRUE(bob->CalculateSharedKey(alice_public, &bob_shared));
ASSERT_EQ(alice_shared, bob_shared);
@@ -70,8 +70,8 @@
QuicRandom* const rand = QuicRandom::GetInstance();
for (int i = 0; i < 5; i++) {
- const QuicString alice_key(Curve25519KeyExchange::NewPrivateKey(rand));
- const QuicString bob_key(Curve25519KeyExchange::NewPrivateKey(rand));
+ const std::string alice_key(Curve25519KeyExchange::NewPrivateKey(rand));
+ const std::string bob_key(Curve25519KeyExchange::NewPrivateKey(rand));
std::unique_ptr<Curve25519KeyExchange> alice(
Curve25519KeyExchange::New(alice_key));
@@ -81,7 +81,7 @@
const QuicStringPiece alice_public(alice->public_value());
const QuicStringPiece bob_public(bob->public_value());
- QuicString alice_shared, bob_shared;
+ std::string alice_shared, bob_shared;
TestCallbackResult alice_result;
ASSERT_FALSE(alice_result.ok());
alice->CalculateSharedKey(bob_public, &alice_shared,
diff --git a/quic/core/crypto/key_exchange.h b/quic/core/crypto/key_exchange.h
index 84ca626..8970b62 100644
--- a/quic/core/crypto/key_exchange.h
+++ b/quic/core/crypto/key_exchange.h
@@ -65,14 +65,14 @@
// (which is implicitly known by a KeyExchange object) and a public value
// from the peer.
virtual bool CalculateSharedKey(QuicStringPiece peer_public_value,
- QuicString* shared_key) const = 0;
+ std::string* shared_key) const = 0;
// CalculateSharedKey computes the shared key between the local private key
// (which is may not be locally known to a KeyExchange object) and a public
// value from the peer.
// Callers should expect that |callback| might be invoked synchronously.
virtual void CalculateSharedKey(QuicStringPiece peer_public_value,
- QuicString* shared_key,
+ std::string* shared_key,
std::unique_ptr<Callback> callback) const = 0;
// public_value returns the local public key which can be sent to a peer in
diff --git a/quic/core/crypto/p256_key_exchange.cc b/quic/core/crypto/p256_key_exchange.cc
index 2bfbd09..a53efe5 100644
--- a/quic/core/crypto/p256_key_exchange.cc
+++ b/quic/core/crypto/p256_key_exchange.cc
@@ -26,7 +26,7 @@
std::unique_ptr<KeyExchange> Create(QuicRandom* /* rand */) const override {
// TODO(agl): avoid the serialisation/deserialisation in this function.
- const QuicString private_value = P256KeyExchange::NewPrivateKey();
+ const std::string private_value = P256KeyExchange::NewPrivateKey();
return P256KeyExchange::New(private_value);
}
@@ -72,25 +72,25 @@
}
// static
-QuicString P256KeyExchange::NewPrivateKey() {
+std::string P256KeyExchange::NewPrivateKey() {
bssl::UniquePtr<EC_KEY> key(EC_KEY_new_by_curve_name(NID_X9_62_prime256v1));
if (!key.get() || !EC_KEY_generate_key(key.get())) {
QUIC_DLOG(INFO) << "Can't generate a new private key.";
- return QuicString();
+ return std::string();
}
int key_len = i2d_ECPrivateKey(key.get(), nullptr);
if (key_len <= 0) {
QUIC_DLOG(INFO) << "Can't convert private key to string";
- return QuicString();
+ return std::string();
}
std::unique_ptr<uint8_t[]> private_key(new uint8_t[key_len]);
uint8_t* keyp = private_key.get();
if (!i2d_ECPrivateKey(key.get(), &keyp)) {
QUIC_DLOG(INFO) << "Can't convert private key to string.";
- return QuicString();
+ return std::string();
}
- return QuicString(reinterpret_cast<char*>(private_key.get()), key_len);
+ return std::string(reinterpret_cast<char*>(private_key.get()), key_len);
}
const KeyExchange::Factory& P256KeyExchange::GetFactory() const {
@@ -99,7 +99,7 @@
}
bool P256KeyExchange::CalculateSharedKey(QuicStringPiece peer_public_value,
- QuicString* out_result) const {
+ std::string* out_result) const {
if (peer_public_value.size() != kUncompressedP256PointBytes) {
QUIC_DLOG(INFO) << "Peer public value is invalid";
return false;
@@ -130,7 +130,7 @@
void P256KeyExchange::CalculateSharedKey(
QuicStringPiece peer_public_value,
- QuicString* shared_key,
+ std::string* shared_key,
std::unique_ptr<Callback> callback) const {
callback->Run(CalculateSharedKey(peer_public_value, shared_key));
}
diff --git a/quic/core/crypto/p256_key_exchange.h b/quic/core/crypto/p256_key_exchange.h
index d70d9cc..04301e4 100644
--- a/quic/core/crypto/p256_key_exchange.h
+++ b/quic/core/crypto/p256_key_exchange.h
@@ -29,14 +29,14 @@
// |NewPrivateKey| returns a private key, suitable for passing to |New|.
// If |NewPrivateKey| can't generate a private key, it returns an empty
// string.
- static QuicString NewPrivateKey();
+ static std::string NewPrivateKey();
// KeyExchange interface.
const Factory& GetFactory() const override;
bool CalculateSharedKey(QuicStringPiece peer_public_value,
- QuicString* shared_key) const override;
+ std::string* shared_key) const override;
void CalculateSharedKey(QuicStringPiece peer_public_value,
- QuicString* shared_key,
+ std::string* shared_key,
std::unique_ptr<Callback> callback) const override;
QuicStringPiece public_value() const override;
diff --git a/quic/core/crypto/p256_key_exchange_test.cc b/quic/core/crypto/p256_key_exchange_test.cc
index 5deee9d..32d6bf1 100644
--- a/quic/core/crypto/p256_key_exchange_test.cc
+++ b/quic/core/crypto/p256_key_exchange_test.cc
@@ -43,8 +43,8 @@
// holds: that both parties end up with the same key.
TEST_F(P256KeyExchangeTest, SharedKey) {
for (int i = 0; i < 5; i++) {
- QuicString alice_private(P256KeyExchange::NewPrivateKey());
- QuicString bob_private(P256KeyExchange::NewPrivateKey());
+ std::string alice_private(P256KeyExchange::NewPrivateKey());
+ std::string bob_private(P256KeyExchange::NewPrivateKey());
ASSERT_FALSE(alice_private.empty());
ASSERT_FALSE(bob_private.empty());
@@ -59,7 +59,7 @@
const QuicStringPiece alice_public(alice->public_value());
const QuicStringPiece bob_public(bob->public_value());
- QuicString alice_shared, bob_shared;
+ std::string alice_shared, bob_shared;
ASSERT_TRUE(alice->CalculateSharedKey(bob_public, &alice_shared));
ASSERT_TRUE(bob->CalculateSharedKey(alice_public, &bob_shared));
ASSERT_EQ(alice_shared, bob_shared);
@@ -70,8 +70,8 @@
// parties end up with the same key.
TEST_F(P256KeyExchangeTest, AsyncSharedKey) {
for (int i = 0; i < 5; i++) {
- QuicString alice_private(P256KeyExchange::NewPrivateKey());
- QuicString bob_private(P256KeyExchange::NewPrivateKey());
+ std::string alice_private(P256KeyExchange::NewPrivateKey());
+ std::string bob_private(P256KeyExchange::NewPrivateKey());
ASSERT_FALSE(alice_private.empty());
ASSERT_FALSE(bob_private.empty());
@@ -86,7 +86,7 @@
const QuicStringPiece alice_public(alice->public_value());
const QuicStringPiece bob_public(bob->public_value());
- QuicString alice_shared, bob_shared;
+ std::string alice_shared, bob_shared;
TestCallbackResult alice_result;
ASSERT_FALSE(alice_result.ok());
alice->CalculateSharedKey(bob_public, &alice_shared,
diff --git a/quic/core/crypto/proof_source.cc b/quic/core/crypto/proof_source.cc
index ce77d8b..4edb40d 100644
--- a/quic/core/crypto/proof_source.cc
+++ b/quic/core/crypto/proof_source.cc
@@ -7,7 +7,7 @@
namespace quic {
-ProofSource::Chain::Chain(const std::vector<QuicString>& certs)
+ProofSource::Chain::Chain(const std::vector<std::string>& certs)
: certs(certs) {}
ProofSource::Chain::~Chain() {}
diff --git a/quic/core/crypto/proof_source.h b/quic/core/crypto/proof_source.h
index 3fec32b..0f293be 100644
--- a/quic/core/crypto/proof_source.h
+++ b/quic/core/crypto/proof_source.h
@@ -25,11 +25,11 @@
// Chain is a reference-counted wrapper for a vector of stringified
// certificates.
struct QUIC_EXPORT_PRIVATE Chain : public QuicReferenceCounted {
- explicit Chain(const std::vector<QuicString>& certs);
+ explicit Chain(const std::vector<std::string>& certs);
Chain(const Chain&) = delete;
Chain& operator=(const Chain&) = delete;
- const std::vector<QuicString> certs;
+ const std::vector<std::string> certs;
protected:
~Chain() override;
@@ -85,7 +85,7 @@
//
// |signature| contains the signature of the data provided to
// ComputeTlsSignature. Its value is undefined if |ok| is false.
- virtual void Run(bool ok, QuicString signature) = 0;
+ virtual void Run(bool ok, std::string signature) = 0;
private:
SignatureCallback(const SignatureCallback&) = delete;
@@ -113,8 +113,8 @@
//
// Callers should expect that |callback| might be invoked synchronously.
virtual void GetProof(const QuicSocketAddress& server_address,
- const QuicString& hostname,
- const QuicString& server_config,
+ const std::string& hostname,
+ const std::string& server_config,
QuicTransportVersion transport_version,
QuicStringPiece chlo_hash,
std::unique_ptr<Callback> callback) = 0;
@@ -122,7 +122,7 @@
// Returns the certificate chain for |hostname| in leaf-first order.
virtual QuicReferenceCountedPointer<Chain> GetCertChain(
const QuicSocketAddress& server_address,
- const QuicString& hostname) = 0;
+ const std::string& hostname) = 0;
// Computes a signature using the private key of the certificate for
// |hostname|. The value in |in| is signed using the algorithm specified by
@@ -134,7 +134,7 @@
// Callers should expect that |callback| might be invoked synchronously.
virtual void ComputeTlsSignature(
const QuicSocketAddress& server_address,
- const QuicString& hostname,
+ const std::string& hostname,
uint16_t signature_algorithm,
QuicStringPiece in,
std::unique_ptr<SignatureCallback> callback) = 0;
diff --git a/quic/core/crypto/proof_verifier.h b/quic/core/crypto/proof_verifier.h
index 3219203..9178942 100644
--- a/quic/core/crypto/proof_verifier.h
+++ b/quic/core/crypto/proof_verifier.h
@@ -48,7 +48,7 @@
// details of the verification. |Run| may take ownership of |details| by
// calling |release| on it.
virtual void Run(bool ok,
- const QuicString& error_details,
+ const std::string& error_details,
std::unique_ptr<ProofVerifyDetails>* details) = 0;
};
@@ -75,16 +75,16 @@
// The signature uses SHA-256 as the hash function and PSS padding in the
// case of RSA.
virtual QuicAsyncStatus VerifyProof(
- const QuicString& hostname,
+ const std::string& hostname,
const uint16_t port,
- const QuicString& server_config,
+ const std::string& server_config,
QuicTransportVersion transport_version,
QuicStringPiece chlo_hash,
- const std::vector<QuicString>& certs,
- const QuicString& cert_sct,
- const QuicString& signature,
+ const std::vector<std::string>& certs,
+ const std::string& cert_sct,
+ const std::string& signature,
const ProofVerifyContext* context,
- QuicString* error_details,
+ std::string* error_details,
std::unique_ptr<ProofVerifyDetails>* details,
std::unique_ptr<ProofVerifierCallback> callback) = 0;
@@ -101,10 +101,10 @@
// will call back, on the original thread, via |callback| when complete.
// In this case, the ProofVerifier will take ownership of |callback|.
virtual QuicAsyncStatus VerifyCertChain(
- const QuicString& hostname,
- const std::vector<QuicString>& certs,
+ const std::string& hostname,
+ const std::vector<std::string>& certs,
const ProofVerifyContext* context,
- QuicString* error_details,
+ std::string* error_details,
std::unique_ptr<ProofVerifyDetails>* details,
std::unique_ptr<ProofVerifierCallback> callback) = 0;
diff --git a/quic/core/crypto/quic_compressed_certs_cache.cc b/quic/core/crypto/quic_compressed_certs_cache.cc
index 595ac31..e07e924 100644
--- a/quic/core/crypto/quic_compressed_certs_cache.cc
+++ b/quic/core/crypto/quic_compressed_certs_cache.cc
@@ -26,8 +26,8 @@
QuicCompressedCertsCache::UncompressedCerts::UncompressedCerts(
const QuicReferenceCountedPointer<ProofSource::Chain>& chain,
- const QuicString* client_common_set_hashes,
- const QuicString* client_cached_cert_hashes)
+ const std::string* client_common_set_hashes,
+ const std::string* client_cached_cert_hashes)
: chain(chain),
client_common_set_hashes(client_common_set_hashes),
client_cached_cert_hashes(client_cached_cert_hashes) {}
@@ -38,7 +38,7 @@
QuicCompressedCertsCache::CachedCerts::CachedCerts(
const UncompressedCerts& uncompressed_certs,
- const QuicString& compressed_cert)
+ const std::string& compressed_cert)
: chain_(uncompressed_certs.chain),
client_common_set_hashes_(*uncompressed_certs.client_common_set_hashes),
client_cached_cert_hashes_(*uncompressed_certs.client_cached_cert_hashes),
@@ -58,7 +58,7 @@
chain_ == uncompressed_certs.chain);
}
-const QuicString* QuicCompressedCertsCache::CachedCerts::compressed_cert()
+const std::string* QuicCompressedCertsCache::CachedCerts::compressed_cert()
const {
return &compressed_cert_;
}
@@ -71,10 +71,10 @@
certs_cache_.Clear();
}
-const QuicString* QuicCompressedCertsCache::GetCompressedCert(
+const std::string* QuicCompressedCertsCache::GetCompressedCert(
const QuicReferenceCountedPointer<ProofSource::Chain>& chain,
- const QuicString& client_common_set_hashes,
- const QuicString& client_cached_cert_hashes) {
+ const std::string& client_common_set_hashes,
+ const std::string& client_cached_cert_hashes) {
UncompressedCerts uncompressed_certs(chain, &client_common_set_hashes,
&client_cached_cert_hashes);
@@ -90,9 +90,9 @@
void QuicCompressedCertsCache::Insert(
const QuicReferenceCountedPointer<ProofSource::Chain>& chain,
- const QuicString& client_common_set_hashes,
- const QuicString& client_cached_cert_hashes,
- const QuicString& compressed_cert) {
+ const std::string& client_common_set_hashes,
+ const std::string& client_cached_cert_hashes,
+ const std::string& compressed_cert) {
UncompressedCerts uncompressed_certs(chain, &client_common_set_hashes,
&client_cached_cert_hashes);
@@ -115,9 +115,9 @@
uint64_t QuicCompressedCertsCache::ComputeUncompressedCertsHash(
const UncompressedCerts& uncompressed_certs) {
uint64_t hash =
- std::hash<QuicString>()(*uncompressed_certs.client_common_set_hashes);
+ std::hash<std::string>()(*uncompressed_certs.client_common_set_hashes);
uint64_t h =
- std::hash<QuicString>()(*uncompressed_certs.client_cached_cert_hashes);
+ std::hash<std::string>()(*uncompressed_certs.client_cached_cert_hashes);
hash_combine(&hash, h);
hash_combine(&hash,
diff --git a/quic/core/crypto/quic_compressed_certs_cache.h b/quic/core/crypto/quic_compressed_certs_cache.h
index 418bdb9..340542a 100644
--- a/quic/core/crypto/quic_compressed_certs_cache.h
+++ b/quic/core/crypto/quic_compressed_certs_cache.h
@@ -24,10 +24,10 @@
// |chain, client_common_set_hashes, client_cached_cert_hashes| hits cache.
// Otherwise, return nullptr.
// Returned pointer might become invalid on the next call to Insert().
- const QuicString* GetCompressedCert(
+ const std::string* GetCompressedCert(
const QuicReferenceCountedPointer<ProofSource::Chain>& chain,
- const QuicString& client_common_set_hashes,
- const QuicString& client_cached_cert_hashes);
+ const std::string& client_common_set_hashes,
+ const std::string& client_cached_cert_hashes);
// Inserts the specified
// |chain, client_common_set_hashes,
@@ -35,9 +35,9 @@
// If the insertion causes the cache to become overfull, entries will
// be deleted in an LRU order to make room.
void Insert(const QuicReferenceCountedPointer<ProofSource::Chain>& chain,
- const QuicString& client_common_set_hashes,
- const QuicString& client_cached_cert_hashes,
- const QuicString& compressed_cert);
+ const std::string& client_common_set_hashes,
+ const std::string& client_cached_cert_hashes,
+ const std::string& compressed_cert);
// Returns max number of cache entries the cache can carry.
size_t MaxSize();
@@ -56,13 +56,13 @@
UncompressedCerts();
UncompressedCerts(
const QuicReferenceCountedPointer<ProofSource::Chain>& chain,
- const QuicString* client_common_set_hashes,
- const QuicString* client_cached_cert_hashes);
+ const std::string* client_common_set_hashes,
+ const std::string* client_cached_cert_hashes);
~UncompressedCerts();
const QuicReferenceCountedPointer<ProofSource::Chain> chain;
- const QuicString* client_common_set_hashes;
- const QuicString* client_cached_cert_hashes;
+ const std::string* client_common_set_hashes;
+ const std::string* client_cached_cert_hashes;
};
// Certs stored by QuicCompressedCertsCache where uncompressed certs data is
@@ -72,7 +72,7 @@
public:
CachedCerts();
CachedCerts(const UncompressedCerts& uncompressed_certs,
- const QuicString& compressed_cert);
+ const std::string& compressed_cert);
CachedCerts(const CachedCerts& other);
~CachedCerts();
@@ -81,16 +81,16 @@
bool MatchesUncompressedCerts(
const UncompressedCerts& uncompressed_certs) const;
- const QuicString* compressed_cert() const;
+ const std::string* compressed_cert() const;
private:
// Uncompressed certs data.
QuicReferenceCountedPointer<ProofSource::Chain> chain_;
- const QuicString client_common_set_hashes_;
- const QuicString client_cached_cert_hashes_;
+ const std::string client_common_set_hashes_;
+ const std::string client_cached_cert_hashes_;
// Cached compressed representation derived from uncompressed certs.
- const QuicString compressed_cert_;
+ const std::string compressed_cert_;
};
// Computes a uint64_t hash for |uncompressed_certs|.
diff --git a/quic/core/crypto/quic_compressed_certs_cache_test.cc b/quic/core/crypto/quic_compressed_certs_cache_test.cc
index 432a8c0..788f1d7 100644
--- a/quic/core/crypto/quic_compressed_certs_cache_test.cc
+++ b/quic/core/crypto/quic_compressed_certs_cache_test.cc
@@ -27,31 +27,31 @@
};
TEST_F(QuicCompressedCertsCacheTest, CacheHit) {
- std::vector<QuicString> certs = {"leaf cert", "intermediate cert",
- "root cert"};
+ std::vector<std::string> certs = {"leaf cert", "intermediate cert",
+ "root cert"};
QuicReferenceCountedPointer<ProofSource::Chain> chain(
new ProofSource::Chain(certs));
- QuicString common_certs = "common certs";
- QuicString cached_certs = "cached certs";
- QuicString compressed = "compressed cert";
+ std::string common_certs = "common certs";
+ std::string cached_certs = "cached certs";
+ std::string compressed = "compressed cert";
certs_cache_.Insert(chain, common_certs, cached_certs, compressed);
- const QuicString* cached_value =
+ const std::string* cached_value =
certs_cache_.GetCompressedCert(chain, common_certs, cached_certs);
ASSERT_NE(nullptr, cached_value);
EXPECT_EQ(*cached_value, compressed);
}
TEST_F(QuicCompressedCertsCacheTest, CacheMiss) {
- std::vector<QuicString> certs = {"leaf cert", "intermediate cert",
- "root cert"};
+ std::vector<std::string> certs = {"leaf cert", "intermediate cert",
+ "root cert"};
QuicReferenceCountedPointer<ProofSource::Chain> chain(
new ProofSource::Chain(certs));
- QuicString common_certs = "common certs";
- QuicString cached_certs = "cached certs";
- QuicString compressed = "compressed cert";
+ std::string common_certs = "common certs";
+ std::string cached_certs = "cached certs";
+ std::string compressed = "compressed cert";
certs_cache_.Insert(chain, common_certs, cached_certs, compressed);
@@ -70,14 +70,14 @@
TEST_F(QuicCompressedCertsCacheTest, CacheMissDueToEviction) {
// Test cache returns a miss when a queried uncompressed certs was cached but
// then evicted.
- std::vector<QuicString> certs = {"leaf cert", "intermediate cert",
- "root cert"};
+ std::vector<std::string> certs = {"leaf cert", "intermediate cert",
+ "root cert"};
QuicReferenceCountedPointer<ProofSource::Chain> chain(
new ProofSource::Chain(certs));
- QuicString common_certs = "common certs";
- QuicString cached_certs = "cached certs";
- QuicString compressed = "compressed cert";
+ std::string common_certs = "common certs";
+ std::string cached_certs = "cached certs";
+ std::string compressed = "compressed cert";
certs_cache_.Insert(chain, common_certs, cached_certs, compressed);
// Insert another kQuicCompressedCertsCacheSize certs to evict the first
diff --git a/quic/core/crypto/quic_crypto_client_config.cc b/quic/core/crypto/quic_crypto_client_config.cc
index 0bf1b41..8d34173 100644
--- a/quic/core/crypto/quic_crypto_client_config.cc
+++ b/quic/core/crypto/quic_crypto_client_config.cc
@@ -138,7 +138,7 @@
}
void QuicCryptoClientConfig::CachedState::add_server_nonce(
- const QuicString& server_nonce) {
+ const std::string& server_nonce) {
server_nonces_.push(server_nonce);
}
@@ -151,7 +151,7 @@
QuicStringPiece server_config,
QuicWallTime now,
QuicWallTime expiry_time,
- QuicString* error_details) {
+ std::string* error_details) {
const bool matches_existing = server_config == server_config_;
// Even if the new server config matches the existing one, we still wish to
@@ -188,7 +188,7 @@
}
if (!matches_existing) {
- server_config_ = QuicString(server_config);
+ server_config_ = std::string(server_config);
SetProofInvalid();
scfg_ = std::move(new_scfg_storage);
}
@@ -205,7 +205,7 @@
}
void QuicCryptoClientConfig::CachedState::SetProof(
- const std::vector<QuicString>& certs,
+ const std::vector<std::string>& certs,
QuicStringPiece cert_sct,
QuicStringPiece chlo_hash,
QuicStringPiece signature) {
@@ -228,9 +228,9 @@
// If the proof has changed then it needs to be revalidated.
SetProofInvalid();
certs_ = certs;
- cert_sct_ = QuicString(cert_sct);
- chlo_hash_ = QuicString(chlo_hash);
- server_config_sig_ = QuicString(signature);
+ cert_sct_ = std::string(cert_sct);
+ chlo_hash_ = std::string(chlo_hash);
+ server_config_sig_ = std::string(signature);
}
void QuicCryptoClientConfig::CachedState::Clear() {
@@ -269,8 +269,8 @@
bool QuicCryptoClientConfig::CachedState::Initialize(
QuicStringPiece server_config,
QuicStringPiece source_address_token,
- const std::vector<QuicString>& certs,
- const QuicString& cert_sct,
+ const std::vector<std::string>& certs,
+ const std::string& cert_sct,
QuicStringPiece chlo_hash,
QuicStringPiece signature,
QuicWallTime now,
@@ -282,7 +282,7 @@
return false;
}
- QuicString error_details;
+ std::string error_details;
ServerConfigState state =
SetServerConfig(server_config, now, expiration_time, &error_details);
RecordDiskCacheServerConfigState(state);
@@ -300,29 +300,29 @@
return true;
}
-const QuicString& QuicCryptoClientConfig::CachedState::server_config() const {
+const std::string& QuicCryptoClientConfig::CachedState::server_config() const {
return server_config_;
}
-const QuicString& QuicCryptoClientConfig::CachedState::source_address_token()
+const std::string& QuicCryptoClientConfig::CachedState::source_address_token()
const {
return source_address_token_;
}
-const std::vector<QuicString>& QuicCryptoClientConfig::CachedState::certs()
+const std::vector<std::string>& QuicCryptoClientConfig::CachedState::certs()
const {
return certs_;
}
-const QuicString& QuicCryptoClientConfig::CachedState::cert_sct() const {
+const std::string& QuicCryptoClientConfig::CachedState::cert_sct() const {
return cert_sct_;
}
-const QuicString& QuicCryptoClientConfig::CachedState::chlo_hash() const {
+const std::string& QuicCryptoClientConfig::CachedState::chlo_hash() const {
return chlo_hash_;
}
-const QuicString& QuicCryptoClientConfig::CachedState::signature() const {
+const std::string& QuicCryptoClientConfig::CachedState::signature() const {
return server_config_sig_;
}
@@ -341,12 +341,12 @@
void QuicCryptoClientConfig::CachedState::set_source_address_token(
QuicStringPiece token) {
- source_address_token_ = QuicString(token);
+ source_address_token_ = std::string(token);
}
void QuicCryptoClientConfig::CachedState::set_cert_sct(
QuicStringPiece cert_sct) {
- cert_sct_ = QuicString(cert_sct);
+ cert_sct_ = std::string(cert_sct);
}
void QuicCryptoClientConfig::CachedState::SetProofVerifyDetails(
@@ -385,13 +385,13 @@
return next_id;
}
-QuicString QuicCryptoClientConfig::CachedState::GetNextServerNonce() {
+std::string QuicCryptoClientConfig::CachedState::GetNextServerNonce() {
if (server_nonces_.empty()) {
QUIC_BUG
<< "Attempting to consume a server nonce that was never designated.";
return "";
}
- const QuicString server_nonce = server_nonces_.front();
+ const std::string server_nonce = server_nonces_.front();
server_nonces_.pop();
return server_nonce;
}
@@ -494,7 +494,7 @@
out->SetStringPiece(kCertificateSCTTag, "");
- const std::vector<QuicString>& certs = cached->certs();
+ const std::vector<std::string>& certs = cached->certs();
// We save |certs| in the QuicCryptoNegotiatedParameters so that, if the
// client config is being used for multiple connections, another connection
// doesn't update the cached certificates and cause us to be unable to
@@ -520,7 +520,7 @@
const ChannelIDKey* channel_id_key,
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
CryptoHandshakeMessage* out,
- QuicString* error_details) const {
+ std::string* error_details) const {
DCHECK(error_details != nullptr);
QUIC_BUG_IF(!QuicUtils::IsConnectionIdValidForVersion(
connection_id, preferred_version.transport_version))
@@ -636,7 +636,7 @@
}
out->SetStringPiece(kPUBS, out_params->client_key_exchange->public_value());
- const std::vector<QuicString>& certs = cached->certs();
+ const std::vector<std::string>& certs = cached->certs();
if (certs.empty()) {
*error_details = "No certs to calculate XLCT";
return QUIC_CRYPTO_INTERNAL_ERROR;
@@ -653,17 +653,17 @@
CryptoHandshakeMessage cetv;
cetv.set_tag(kCETV);
- QuicString hkdf_input;
+ std::string hkdf_input;
const QuicData& client_hello_serialized = out->GetSerialized();
hkdf_input.append(QuicCryptoConfig::kCETVLabel,
strlen(QuicCryptoConfig::kCETVLabel) + 1);
- hkdf_input.append(connection_id.data(), connection_id.length());
+ hkdf_input.append(connection_id.data(), connection_id.length());
hkdf_input.append(client_hello_serialized.data(),
client_hello_serialized.length());
hkdf_input.append(cached->server_config());
- QuicString key = channel_id_key->SerializeKey();
- QuicString signature;
+ std::string key = channel_id_key->SerializeKey();
+ std::string signature;
if (!channel_id_key->Sign(hkdf_input, &signature)) {
*error_details = "Channel ID signature failed";
return QUIC_INVALID_CHANNEL_ID_SIGNATURE;
@@ -707,8 +707,8 @@
// out_params->hkdf_input_suffix
// out_params->initial_crypters
out_params->hkdf_input_suffix.clear();
- out_params->hkdf_input_suffix.append(connection_id.data(),
- connection_id.length());
+ out_params->hkdf_input_suffix.append(connection_id.data(),
+ connection_id.length());
const QuicData& client_hello_serialized = out->GetSerialized();
out_params->hkdf_input_suffix.append(client_hello_serialized.data(),
client_hello_serialized.length());
@@ -719,13 +719,13 @@
}
out_params->hkdf_input_suffix.append(certs[0]);
- QuicString hkdf_input;
+ std::string hkdf_input;
const size_t label_len = strlen(QuicCryptoConfig::kInitialLabel) + 1;
hkdf_input.reserve(label_len + out_params->hkdf_input_suffix.size());
hkdf_input.append(QuicCryptoConfig::kInitialLabel, label_len);
hkdf_input.append(out_params->hkdf_input_suffix);
- QuicString* subkey_secret = &out_params->initial_subkey_secret;
+ std::string* subkey_secret = &out_params->initial_subkey_secret;
if (!CryptoUtils::DeriveKeys(out_params->initial_premaster_secret,
out_params->aead, out_params->client_nonce,
@@ -745,9 +745,9 @@
QuicWallTime now,
QuicTransportVersion version,
QuicStringPiece chlo_hash,
- const std::vector<QuicString>& cached_certs,
+ const std::vector<std::string>& cached_certs,
CachedState* cached,
- QuicString* error_details) {
+ std::string* error_details) {
DCHECK(error_details != nullptr);
QuicStringPiece scfg;
@@ -784,7 +784,7 @@
bool has_proof = message.GetStringPiece(kPROF, &proof);
bool has_cert = message.GetStringPiece(kCertificateTag, &cert_bytes);
if (has_proof && has_cert) {
- std::vector<QuicString> certs;
+ std::vector<std::string> certs;
if (!CertCompressor::DecompressChain(cert_bytes, cached_certs,
common_cert_sets, &certs)) {
*error_details = "Certificate data invalid";
@@ -819,7 +819,7 @@
QuicStringPiece chlo_hash,
CachedState* cached,
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
- QuicString* error_details) {
+ std::string* error_details) {
DCHECK(error_details != nullptr);
if ((rej.tag() != kREJ) && (rej.tag() != kSREJ)) {
@@ -836,29 +836,29 @@
QuicStringPiece nonce;
if (rej.GetStringPiece(kServerNonceTag, &nonce)) {
- out_params->server_nonce = QuicString(nonce);
+ out_params->server_nonce = std::string(nonce);
}
if (rej.tag() == kSREJ) {
QuicConnectionId connection_id;
- QuicStringPiece connection_id_bytes;
- if (!rej.GetStringPiece(kRCID, &connection_id_bytes)) {
- *error_details = "Missing kRCID";
- return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND;
- }
- connection_id = QuicConnectionId(connection_id_bytes.data(),
- connection_id_bytes.length());
- if (!QuicUtils::IsConnectionIdValidForVersion(connection_id, version)) {
- QUIC_PEER_BUG << "Received server-designated connection ID "
- << connection_id << " which is invalid with version "
- << QuicVersionToString(version);
- *error_details = "Bad kRCID length";
- return QUIC_CRYPTO_INTERNAL_ERROR;
- }
+ QuicStringPiece connection_id_bytes;
+ if (!rej.GetStringPiece(kRCID, &connection_id_bytes)) {
+ *error_details = "Missing kRCID";
+ return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND;
+ }
+ connection_id = QuicConnectionId(connection_id_bytes.data(),
+ connection_id_bytes.length());
+ if (!QuicUtils::IsConnectionIdValidForVersion(connection_id, version)) {
+ QUIC_PEER_BUG << "Received server-designated connection ID "
+ << connection_id << " which is invalid with version "
+ << QuicVersionToString(version);
+ *error_details = "Bad kRCID length";
+ return QUIC_CRYPTO_INTERNAL_ERROR;
+ }
cached->add_server_designated_connection_id(connection_id);
if (!nonce.empty()) {
- cached->add_server_nonce(QuicString(nonce));
+ cached->add_server_nonce(std::string(nonce));
}
return QUIC_NO_ERROR;
}
@@ -873,7 +873,7 @@
const ParsedQuicVersionVector& negotiated_versions,
CachedState* cached,
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
- QuicString* error_details) {
+ std::string* error_details) {
DCHECK(error_details != nullptr);
QuicErrorCode valid = CryptoUtils::ValidateServerHello(
@@ -909,7 +909,7 @@
return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
}
- QuicString hkdf_input;
+ std::string hkdf_input;
const size_t label_len = strlen(QuicCryptoConfig::kForwardSecureLabel) + 1;
hkdf_input.reserve(label_len + out_params->hkdf_input_suffix.size());
hkdf_input.append(QuicCryptoConfig::kForwardSecureLabel, label_len);
@@ -936,7 +936,7 @@
QuicStringPiece chlo_hash,
CachedState* cached,
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
- QuicString* error_details) {
+ std::string* error_details) {
DCHECK(error_details != nullptr);
if (server_config_update.tag() != kSCUP) {
@@ -976,7 +976,7 @@
cached->InitializeFrom(*canonical_cached);
}
-void QuicCryptoClientConfig::AddCanonicalSuffix(const QuicString& suffix) {
+void QuicCryptoClientConfig::AddCanonicalSuffix(const std::string& suffix) {
canonical_suffixes_.push_back(suffix);
}
diff --git a/quic/core/crypto/quic_crypto_client_config.h b/quic/core/crypto/quic_crypto_client_config.h
index 32df726..4c2004d 100644
--- a/quic/core/crypto/quic_crypto_client_config.h
+++ b/quic/core/crypto/quic_crypto_client_config.h
@@ -82,13 +82,13 @@
ServerConfigState SetServerConfig(QuicStringPiece server_config,
QuicWallTime now,
QuicWallTime expiry_time,
- QuicString* error_details);
+ std::string* error_details);
// InvalidateServerConfig clears the cached server config (if any).
void InvalidateServerConfig();
// SetProof stores a cert chain, cert signed timestamp and signature.
- void SetProof(const std::vector<QuicString>& certs,
+ void SetProof(const std::vector<std::string>& certs,
QuicStringPiece cert_sct,
QuicStringPiece chlo_hash,
QuicStringPiece signature);
@@ -109,12 +109,12 @@
// generation_counter_ in sync.
void SetProofInvalid();
- const QuicString& server_config() const;
- const QuicString& source_address_token() const;
- const std::vector<QuicString>& certs() const;
- const QuicString& cert_sct() const;
- const QuicString& chlo_hash() const;
- const QuicString& signature() const;
+ const std::string& server_config() const;
+ const std::string& source_address_token() const;
+ const std::vector<std::string>& certs() const;
+ const std::string& cert_sct() const;
+ const std::string& chlo_hash() const;
+ const std::string& signature() const;
bool proof_valid() const;
uint64_t generation_counter() const;
const ProofVerifyDetails* proof_verify_details() const;
@@ -138,7 +138,7 @@
QuicConnectionId GetNextServerDesignatedConnectionId();
// Adds the servernonce to the queue of server nonces.
- void add_server_nonce(const QuicString& server_nonce);
+ void add_server_nonce(const std::string& server_nonce);
// If true, the crypto config contains at least one server nonce, and the
// client should use one of these nonces.
@@ -147,7 +147,7 @@
// This function should only be called when has_server_nonce is true.
// Returns the next server_nonce specified by the server and removes it
// from the queue of nonces.
- QuicString GetNextServerNonce();
+ std::string GetNextServerNonce();
// SetProofVerifyDetails takes ownership of |details|.
void SetProofVerifyDetails(ProofVerifyDetails* details);
@@ -162,22 +162,22 @@
// Returns false if there is a problem parsing the server config.
bool Initialize(QuicStringPiece server_config,
QuicStringPiece source_address_token,
- const std::vector<QuicString>& certs,
- const QuicString& cert_sct,
+ const std::vector<std::string>& certs,
+ const std::string& cert_sct,
QuicStringPiece chlo_hash,
QuicStringPiece signature,
QuicWallTime now,
QuicWallTime expiration_time);
private:
- QuicString server_config_; // A serialized handshake message.
- QuicString source_address_token_; // An opaque proof of IP ownership.
- std::vector<QuicString> certs_; // A list of certificates in leaf-first
- // order.
- QuicString cert_sct_; // Signed timestamp of the leaf cert.
- QuicString chlo_hash_; // Hash of the CHLO message.
- QuicString server_config_sig_; // A signature of |server_config_|.
- bool server_config_valid_; // True if |server_config_| is correctly
+ std::string server_config_; // A serialized handshake message.
+ std::string source_address_token_; // An opaque proof of IP ownership.
+ std::vector<std::string> certs_; // A list of certificates in leaf-first
+ // order.
+ std::string cert_sct_; // Signed timestamp of the leaf cert.
+ std::string chlo_hash_; // Hash of the CHLO message.
+ std::string server_config_sig_; // A signature of |server_config_|.
+ bool server_config_valid_; // True if |server_config_| is correctly
// signed and |certs_| has been validated.
QuicWallTime expiration_time_; // Time when the config is no longer valid.
// Generation counter associated with the |server_config_|, |certs_| and
@@ -194,7 +194,7 @@
// that no connection-id is added twice. Also, consider keeping the server
// nonces and connection_ids together in one queue.
QuicQueue<QuicConnectionId> server_designated_connection_ids_;
- QuicQueue<QuicString> server_nonces_;
+ QuicQueue<std::string> server_nonces_;
};
// Used to filter server ids for partial config deletion.
@@ -262,7 +262,7 @@
const ChannelIDKey* channel_id_key,
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
CryptoHandshakeMessage* out,
- QuicString* error_details) const;
+ std::string* error_details) const;
// ProcessRejection processes a REJ message from a server and updates the
// cached information about that server. After this, |IsComplete| may return
@@ -277,7 +277,7 @@
QuicStringPiece chlo_hash,
CachedState* cached,
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
- QuicString* error_details);
+ std::string* error_details);
// ProcessServerHello processes the message in |server_hello|, updates the
// cached information about that server, writes the negotiated parameters to
@@ -295,7 +295,7 @@
const ParsedQuicVersionVector& negotiated_versions,
CachedState* cached,
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
- QuicString* error_details);
+ std::string* error_details);
// Processes the message in |server_update|, updating the cached source
// address token, and server config.
@@ -309,7 +309,7 @@
QuicStringPiece chlo_hash,
CachedState* cached,
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
- QuicString* error_details);
+ std::string* error_details);
ProofVerifier* proof_verifier() const;
@@ -334,22 +334,22 @@
// is expected to be shared among servers with the domain suffix. If a server
// matches this suffix, then the server config from another server with the
// suffix will be used to initialize the cached state for this server.
- void AddCanonicalSuffix(const QuicString& suffix);
+ void AddCanonicalSuffix(const std::string& suffix);
// Saves the |user_agent_id| that will be passed in QUIC's CHLO message.
- void set_user_agent_id(const QuicString& user_agent_id) {
+ void set_user_agent_id(const std::string& user_agent_id) {
user_agent_id_ = user_agent_id;
}
// Returns the user_agent_id that will be provided in the client hello
// handshake message.
- const QuicString& user_agent_id() const { return user_agent_id_; }
+ const std::string& user_agent_id() const { return user_agent_id_; }
// Saves the |alpn| that will be passed in QUIC's CHLO message.
- void set_alpn(const QuicString& alpn) { alpn_ = alpn; }
+ void set_alpn(const std::string& alpn) { alpn_ = alpn; }
void set_pre_shared_key(QuicStringPiece psk) {
- pre_shared_key_ = QuicString(psk);
+ pre_shared_key_ = std::string(psk);
}
bool pad_inchoate_hello() const { return pad_inchoate_hello_; }
@@ -373,9 +373,9 @@
QuicWallTime now,
QuicTransportVersion version,
QuicStringPiece chlo_hash,
- const std::vector<QuicString>& cached_certs,
+ const std::vector<std::string>& cached_certs,
CachedState* cached,
- QuicString* error_details);
+ std::string* error_details);
// If the suffix of the hostname in |server_id| is in |canonical_suffixes_|,
// then populate |cached| with the canonical cached state from
@@ -396,21 +396,21 @@
// Contains list of suffixes (for exmaple ".c.youtube.com",
// ".googlevideo.com") of canonical hostnames.
- std::vector<QuicString> canonical_suffixes_;
+ std::vector<std::string> canonical_suffixes_;
std::unique_ptr<ProofVerifier> proof_verifier_;
std::unique_ptr<ChannelIDSource> channel_id_source_;
bssl::UniquePtr<SSL_CTX> ssl_ctx_;
// The |user_agent_id_| passed in QUIC's CHLO message.
- QuicString user_agent_id_;
+ std::string user_agent_id_;
// The |alpn_| passed in QUIC's CHLO message.
- QuicString alpn_;
+ std::string alpn_;
// If non-empty, the client will operate in the pre-shared key mode by
// incorporating |pre_shared_key_| into the key schedule.
- QuicString pre_shared_key_;
+ std::string pre_shared_key_;
// In QUIC, technically, client hello should be fully padded.
// However, fully padding on slow network connection (e.g. 50kbps) can add
diff --git a/quic/core/crypto/quic_crypto_client_config_test.cc b/quic/core/crypto/quic_crypto_client_config_test.cc
index 5e0ca6e..097f455 100644
--- a/quic/core/crypto/quic_crypto_client_config_test.cc
+++ b/quic/core/crypto/quic_crypto_client_config_test.cc
@@ -124,7 +124,7 @@
QuicCryptoClientConfig::CachedState state;
EXPECT_FALSE(state.has_server_nonce());
- QuicString server_nonce = "nonce_1";
+ std::string server_nonce = "nonce_1";
state.add_server_nonce(server_nonce);
EXPECT_TRUE(state.has_server_nonce());
EXPECT_EQ(server_nonce, state.GetNextServerNonce());
@@ -142,8 +142,8 @@
EXPECT_FALSE(state.has_server_nonce());
// Test FIFO behavior.
- const QuicString first_nonce = "first_nonce";
- const QuicString second_nonce = "second_nonce";
+ const std::string first_nonce = "first_nonce";
+ const std::string second_nonce = "second_nonce";
state.add_server_nonce(first_nonce);
state.add_server_nonce(second_nonce);
EXPECT_TRUE(state.has_server_nonce());
@@ -194,7 +194,7 @@
EXPECT_EQ(CreateQuicVersionLabel(QuicVersionMax()), cver);
QuicStringPiece proof_nonce;
EXPECT_TRUE(msg.GetStringPiece(kNONP, &proof_nonce));
- EXPECT_EQ(QuicString(32, 'r'), proof_nonce);
+ EXPECT_EQ(std::string(32, 'r'), proof_nonce);
QuicStringPiece user_agent_id;
EXPECT_TRUE(msg.GetStringPiece(kUAID, &user_agent_id));
EXPECT_EQ("quic-tester", user_agent_id);
@@ -261,7 +261,7 @@
CryptoHandshakeMessage scfg;
scfg.set_tag(kSCFG);
scfg.SetStringPiece(kSCID, "12345678");
- QuicString details;
+ std::string details;
QuicWallTime now = QuicWallTime::FromUNIXSeconds(1);
QuicWallTime expiry = QuicWallTime::FromUNIXSeconds(2);
state.SetServerConfig(scfg.GetSerialized().AsStringPiece(), now, expiry,
@@ -289,7 +289,7 @@
uint64_t future = 1;
scfg.SetValue(kEXPY, future);
scfg.SetStringPiece(kSCID, "12345678");
- QuicString details;
+ std::string details;
state.SetServerConfig(scfg.GetSerialized().AsStringPiece(),
QuicWallTime::FromUNIXSeconds(1),
QuicWallTime::FromUNIXSeconds(0), &details);
@@ -316,7 +316,7 @@
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params(
new QuicCryptoNegotiatedParameters);
QuicConnectionId kConnectionId = TestConnectionId(1234);
- QuicString error_details;
+ std::string error_details;
MockRandom rand;
CryptoHandshakeMessage chlo;
QuicServerId server_id("www.google.com", 443, false);
@@ -339,7 +339,7 @@
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params(
new QuicCryptoNegotiatedParameters);
QuicConnectionId kConnectionId = TestConnectionId(1234);
- QuicString error_details;
+ std::string error_details;
MockRandom rand;
CryptoHandshakeMessage chlo;
QuicServerId server_id("www.google.com", 443, false);
@@ -374,7 +374,7 @@
QuicCryptoClientConfig::CachedState cached;
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params(
new QuicCryptoNegotiatedParameters);
- QuicString error;
+ std::string error;
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting(),
TlsClientHandshaker::CreateSslCtx());
EXPECT_EQ(QUIC_VERSION_NEGOTIATION_MISMATCH,
@@ -452,7 +452,7 @@
// Create two states on different origins.
struct TestCase {
- TestCase(const QuicString& host, QuicCryptoClientConfig* config)
+ TestCase(const std::string& host, QuicCryptoClientConfig* config)
: server_id(host, 443, false),
state(config->LookupOrCreate(server_id)) {
// TODO(rch): Populate other fields of |state|.
@@ -461,12 +461,12 @@
uint64_t future = 1;
scfg.SetValue(kEXPY, future);
scfg.SetStringPiece(kSCID, "12345678");
- QuicString details;
+ std::string details;
state->SetServerConfig(scfg.GetSerialized().AsStringPiece(),
QuicWallTime::FromUNIXSeconds(0),
QuicWallTime::FromUNIXSeconds(future), &details);
- std::vector<QuicString> certs(1);
+ std::vector<std::string> certs(1);
certs[0] = "Hello Cert for " + host;
state->SetProof(certs, "cert_sct", "chlo_hash", "signature");
state->set_source_address_token("TOKEN");
@@ -542,7 +542,7 @@
QuicCryptoClientConfig::CachedState cached;
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params(
new QuicCryptoNegotiatedParameters);
- QuicString error;
+ std::string error;
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting(),
TlsClientHandshaker::CreateSslCtx());
EXPECT_EQ(QUIC_NO_ERROR,
@@ -564,7 +564,7 @@
QuicCryptoClientConfig::CachedState cached;
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params(
new QuicCryptoNegotiatedParameters);
- QuicString error;
+ std::string error;
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting(),
TlsClientHandshaker::CreateSslCtx());
EXPECT_EQ(QUIC_NO_ERROR,
@@ -584,7 +584,7 @@
CryptoHandshakeMessage rej;
crypto_test_utils::FillInDummyReject(&rej, /* stateless */ true);
const QuicConnectionId kConnectionId = TestConnectionId(0xdeadbeef);
- const QuicString server_nonce = "SERVER_NONCE";
+ const std::string server_nonce = "SERVER_NONCE";
const uint64_t kConnectionId64 = TestConnectionIdToUInt64(kConnectionId);
rej.SetValue(kRCID, kConnectionId64);
rej.SetStringPiece(kServerNonceTag, server_nonce);
@@ -593,7 +593,7 @@
QuicCryptoClientConfig::CachedState cached;
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params(
new QuicCryptoNegotiatedParameters);
- QuicString error;
+ std::string error;
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting(),
TlsClientHandshaker::CreateSslCtx());
EXPECT_EQ(QUIC_NO_ERROR,
@@ -617,7 +617,7 @@
QuicCryptoClientConfig::CachedState cached;
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params(
new QuicCryptoNegotiatedParameters);
- QuicString error;
+ std::string error;
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting(),
TlsClientHandshaker::CreateSslCtx());
EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND,
@@ -643,7 +643,7 @@
QuicCryptoClientConfig::CachedState cached;
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params(
new QuicCryptoNegotiatedParameters);
- QuicString error_details;
+ std::string error_details;
EXPECT_EQ(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER,
config.ProcessServerHello(msg, EmptyQuicConnectionId(), version,
supported_versions, &cached, out_params,
diff --git a/quic/core/crypto/quic_crypto_proof.h b/quic/core/crypto/quic_crypto_proof.h
index d70ad50..88255dc 100644
--- a/quic/core/crypto/quic_crypto_proof.h
+++ b/quic/core/crypto/quic_crypto_proof.h
@@ -15,9 +15,9 @@
QuicCryptoProof();
// Signature generated by ProofSource
- QuicString signature;
+ std::string signature;
// SCTList (RFC6962) to be sent to the client, if it supports receiving it.
- QuicString leaf_cert_scts;
+ std::string leaf_cert_scts;
// Should the Expect-CT header be sent on the connection where the
// certificate is used.
bool send_expect_ct_header;
diff --git a/quic/core/crypto/quic_crypto_server_config.cc b/quic/core/crypto/quic_crypto_server_config.cc
index 1cb0266..2b54c73 100644
--- a/quic/core/crypto/quic_crypto_server_config.cc
+++ b/quic/core/crypto/quic_crypto_server_config.cc
@@ -60,13 +60,13 @@
const int kMaxTokenAddresses = 4;
-QuicString DeriveSourceAddressTokenKey(
+std::string DeriveSourceAddressTokenKey(
QuicStringPiece source_address_token_secret) {
QuicHKDF hkdf(source_address_token_secret, QuicStringPiece() /* no salt */,
"QUIC source address token key",
CryptoSecretBoxer::GetKeySize(), 0 /* no fixed IV needed */,
0 /* no subkey secret */);
- return QuicString(hkdf.server_write_key());
+ return std::string(hkdf.server_write_key());
}
// Default source for creating KeyExchange objects.
@@ -75,7 +75,7 @@
DefaultKeyExchangeSource() = default;
~DefaultKeyExchangeSource() override = default;
- std::unique_ptr<KeyExchange> Create(QuicString /*server_config_id*/,
+ std::unique_ptr<KeyExchange> Create(std::string /*server_config_id*/,
QuicTag type,
QuicStringPiece private_key) override {
if (private_key.empty()) {
@@ -237,7 +237,7 @@
server_nonce_entropy->RandBytes(key_bytes.get(), key_size);
server_nonce_boxer_.SetKeys(
- {QuicString(reinterpret_cast<char*>(key_bytes.get()), key_size)});
+ {std::string(reinterpret_cast<char*>(key_bytes.get()), key_size)});
}
QuicCryptoServerConfig::~QuicCryptoServerConfig() {}
@@ -249,13 +249,13 @@
const ConfigOptions& options) {
CryptoHandshakeMessage msg;
- const QuicString curve25519_private_key =
+ const std::string curve25519_private_key =
Curve25519KeyExchange::NewPrivateKey(rand);
std::unique_ptr<Curve25519KeyExchange> curve25519(
Curve25519KeyExchange::New(curve25519_private_key));
QuicStringPiece curve25519_public_value = curve25519->public_value();
- QuicString encoded_public_values;
+ std::string encoded_public_values;
// First three bytes encode the length of the public value.
DCHECK_LT(curve25519_public_value.size(), (1U << 24));
encoded_public_values.push_back(
@@ -267,7 +267,7 @@
encoded_public_values.append(curve25519_public_value.data(),
curve25519_public_value.size());
- QuicString p256_private_key;
+ std::string p256_private_key;
if (options.p256) {
p256_private_key = P256KeyExchange::NewPrivateKey();
std::unique_ptr<P256KeyExchange> p256(
@@ -346,7 +346,7 @@
std::unique_ptr<QuicServerConfigProtobuf> config(
new QuicServerConfigProtobuf);
- config->set_config(QuicString(serialized->AsStringPiece()));
+ config->set_config(std::string(serialized->AsStringPiece()));
QuicServerConfigProtobuf::PrivateKey* curve25519_key = config->add_key();
curve25519_key->set_tag(kC255);
curve25519_key->set_private_key(curve25519_private_key);
@@ -478,12 +478,12 @@
}
void QuicCryptoServerConfig::SetSourceAddressTokenKeys(
- const std::vector<QuicString>& keys) {
+ const std::vector<std::string>& keys) {
source_address_token_boxer_.SetKeys(keys);
}
void QuicCryptoServerConfig::GetConfigIds(
- std::vector<QuicString>* scids) const {
+ std::vector<std::string>* scids) const {
QuicReaderMutexLock locked(&configs_lock_);
for (auto it = configs_.begin(); it != configs_.end(); ++it) {
scids->push_back(it->first);
@@ -556,7 +556,7 @@
<< "Deleting ProcessClientHelloHelper with a pending callback.";
}
- void Fail(QuicErrorCode error, const QuicString& error_details) {
+ void Fail(QuicErrorCode error, const std::string& error_details) {
(*done_cb_)->Run(error, error_details, nullptr, nullptr, nullptr);
DetachCallback();
}
@@ -564,7 +564,7 @@
void Succeed(std::unique_ptr<CryptoHandshakeMessage> message,
std::unique_ptr<DiversificationNonce> diversification_nonce,
std::unique_ptr<ProofSource::Details> proof_source_details) {
- (*done_cb_)->Run(QUIC_NO_ERROR, QuicString(), std::move(message),
+ (*done_cb_)->Run(QUIC_NO_ERROR, std::string(), std::move(message),
std::move(diversification_nonce),
std::move(proof_source_details));
DetachCallback();
@@ -721,7 +721,7 @@
std::unique_ptr<ProofSource::Details> proof_source_details_;
const KeyExchange::Factory& key_exchange_factory_;
std::unique_ptr<CryptoHandshakeMessage> out_;
- QuicString public_value_;
+ std::string public_value_;
QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result>
validate_chlo_result_;
QuicConnectionId connection_id_;
@@ -764,7 +764,7 @@
validate_chlo_result->client_hello;
const ClientHelloInfo& info = validate_chlo_result->info;
- QuicString error_details;
+ std::string error_details;
QuicErrorCode valid = CryptoUtils::ValidateClientHello(
client_hello, version, supported_versions, &error_details);
if (valid != QUIC_NO_ERROR) {
@@ -818,7 +818,7 @@
return;
}
DCHECK(proof_source_.get());
- QuicString chlo_hash;
+ std::string chlo_hash;
CryptoUtils::HashHandshakeMessage(client_hello, &chlo_hash,
Perspective::IS_SERVER);
@@ -833,7 +833,7 @@
total_framing_overhead, chlo_packet_size, requested_config,
primary_config, std::move(done_cb)));
proof_source_->GetProof(
- server_address, QuicString(info.sni), primary_config->serialized,
+ server_address, std::string(info.sni), primary_config->serialized,
version.transport_version, chlo_hash, std::move(cb));
helper.DetachCallback();
return;
@@ -1014,12 +1014,12 @@
params->sni = QuicHostnameUtils::NormalizeHostname(info.sni);
}
- QuicString hkdf_suffix;
+ std::string hkdf_suffix;
const QuicData& client_hello_serialized = client_hello.GetSerialized();
- hkdf_suffix.reserve(connection_id.length() +
- client_hello_serialized.length() +
- requested_config->serialized.size());
- hkdf_suffix.append(connection_id.data(), connection_id.length());
+ hkdf_suffix.reserve(connection_id.length() +
+ client_hello_serialized.length() +
+ requested_config->serialized.size());
+ hkdf_suffix.append(connection_id.data(), connection_id.length());
hkdf_suffix.append(client_hello_serialized.data(),
client_hello_serialized.length());
hkdf_suffix.append(requested_config->serialized);
@@ -1039,7 +1039,7 @@
const QuicData& client_hello_copy_serialized =
client_hello_copy.GetSerialized();
- QuicString hkdf_input;
+ std::string hkdf_input;
hkdf_input.append(QuicCryptoConfig::kCETVLabel,
strlen(QuicCryptoConfig::kCETVLabel) + 1);
hkdf_input.append(connection_id.data(), connection_id.length());
@@ -1084,11 +1084,11 @@
return;
}
- params->channel_id = QuicString(key);
+ params->channel_id = std::string(key);
}
}
- QuicString hkdf_input;
+ std::string hkdf_input;
size_t label_len = strlen(QuicCryptoConfig::kInitialLabel) + 1;
hkdf_input.reserve(label_len + hkdf_suffix.size());
hkdf_input.append(QuicCryptoConfig::kInitialLabel, label_len);
@@ -1108,25 +1108,25 @@
return;
}
- QuicString forward_secure_public_value;
+ std::string forward_secure_public_value;
std::unique_ptr<KeyExchange> forward_secure_key_exchange =
key_exchange_factory.Create(rand);
forward_secure_public_value =
- QuicString(forward_secure_key_exchange->public_value());
+ std::string(forward_secure_key_exchange->public_value());
if (!forward_secure_key_exchange->CalculateSharedKey(
public_value, ¶ms->forward_secure_premaster_secret)) {
helper.Fail(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER, "Invalid public value");
return;
}
- QuicString forward_secure_hkdf_input;
+ std::string forward_secure_hkdf_input;
label_len = strlen(QuicCryptoConfig::kForwardSecureLabel) + 1;
forward_secure_hkdf_input.reserve(label_len + hkdf_suffix.size());
forward_secure_hkdf_input.append(QuicCryptoConfig::kForwardSecureLabel,
label_len);
forward_secure_hkdf_input.append(hkdf_suffix);
- QuicString shlo_nonce;
+ std::string shlo_nonce;
shlo_nonce = NewServerNonce(rand, info.now);
out->SetStringPiece(kServerNonceTag, shlo_nonce);
@@ -1162,7 +1162,7 @@
configs_lock_.AssertReaderHeld();
if (!requested_scid.empty()) {
- auto it = configs_.find((QuicString(requested_scid)));
+ auto it = configs_.find((std::string(requested_scid)));
if (it != configs_.end()) {
// We'll use the config that the client requested in order to do
// key-agreement.
@@ -1406,7 +1406,7 @@
}
QuicReferenceCountedPointer<ProofSource::Chain> chain =
- proof_source_->GetCertChain(server_address, QuicString(info->sni));
+ proof_source_->GetCertChain(server_address, std::string(info->sni));
if (!chain) {
info->reject_reasons.push_back(SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE);
} else if (!ValidateExpectedLeafCertificate(client_hello, chain->certs)) {
@@ -1467,8 +1467,8 @@
const QuicCryptoNegotiatedParameters& params,
const CachedNetworkParameters* cached_network_params,
std::unique_ptr<BuildServerConfigUpdateMessageResultCallback> cb) const {
- QuicString serialized;
- QuicString source_address_token;
+ std::string serialized;
+ std::string source_address_token;
const CommonCertSets* common_cert_sets;
{
QuicReaderMutexLock locked(&configs_lock_);
@@ -1533,14 +1533,14 @@
QuicTransportVersion version,
QuicCompressedCertsCache* compressed_certs_cache,
const CommonCertSets* common_cert_sets,
- const QuicString& client_common_set_hashes,
- const QuicString& client_cached_cert_hashes,
+ const std::string& client_common_set_hashes,
+ const std::string& client_cached_cert_hashes,
bool sct_supported_by_client,
- const QuicString& sni,
+ const std::string& sni,
bool ok,
const QuicReferenceCountedPointer<ProofSource::Chain>& chain,
- const QuicString& signature,
- const QuicString& leaf_cert_sct,
+ const std::string& signature,
+ const std::string& leaf_cert_sct,
std::unique_ptr<ProofSource::Details> details,
CryptoHandshakeMessage message,
std::unique_ptr<BuildServerConfigUpdateMessageResultCallback> cb) const {
@@ -1549,7 +1549,7 @@
return;
}
- const QuicString compressed =
+ const std::string compressed =
CompressChain(compressed_certs_cache, chain, client_common_set_hashes,
client_cached_cert_hashes, common_cert_sets);
@@ -1589,17 +1589,17 @@
<< "with server-designated connection ID "
<< server_designated_connection_id;
out->set_tag(kSREJ);
- if (!QuicUtils::IsConnectionIdValidForVersion(
- server_designated_connection_id, version)) {
- QUIC_BUG << "Tried to send server designated connection ID "
- << server_designated_connection_id
- << " which is invalid with version "
- << QuicVersionToString(version);
- return;
- }
- out->SetStringPiece(
- kRCID, QuicStringPiece(server_designated_connection_id.data(),
- server_designated_connection_id.length()));
+ if (!QuicUtils::IsConnectionIdValidForVersion(
+ server_designated_connection_id, version)) {
+ QUIC_BUG << "Tried to send server designated connection ID "
+ << server_designated_connection_id
+ << " which is invalid with version "
+ << QuicVersionToString(version);
+ return;
+ }
+ out->SetStringPiece(
+ kRCID, QuicStringPiece(server_designated_connection_id.data(),
+ server_designated_connection_id.length()));
} else {
out->set_tag(kREJ);
}
@@ -1625,17 +1625,17 @@
QuicStringPiece client_common_set_hashes;
if (client_hello.GetStringPiece(kCCS, &client_common_set_hashes)) {
- params->client_common_set_hashes = QuicString(client_common_set_hashes);
+ params->client_common_set_hashes = std::string(client_common_set_hashes);
}
QuicStringPiece client_cached_cert_hashes;
if (client_hello.GetStringPiece(kCCRT, &client_cached_cert_hashes)) {
- params->client_cached_cert_hashes = QuicString(client_cached_cert_hashes);
+ params->client_cached_cert_hashes = std::string(client_cached_cert_hashes);
} else {
params->client_cached_cert_hashes.clear();
}
- const QuicString compressed =
+ const std::string compressed =
CompressChain(compressed_certs_cache, signed_config.chain,
params->client_common_set_hashes,
params->client_cached_cert_hashes, config.common_cert_sets);
@@ -1659,7 +1659,7 @@
"overhead calculation may underflow");
bool should_return_sct =
params->sct_supported_by_client && enable_serving_sct_;
- const QuicString& cert_sct = signed_config.proof.leaf_cert_scts;
+ const std::string& cert_sct = signed_config.proof.leaf_cert_scts;
const size_t sct_size = should_return_sct ? cert_sct.size() : 0;
const size_t total_size =
signed_config.proof.signature.size() + compressed.size() + sct_size;
@@ -1674,8 +1674,7 @@
} else {
// Log SNI and subject name for the leaf cert if its SCT is empty.
// This is for debugging b/28342827.
- const std::vector<quic::QuicString>& certs =
- signed_config.chain->certs;
+ const std::vector<std::string>& certs = signed_config.chain->certs;
QuicStringPiece ca_subject;
if (!certs.empty()) {
QuicCertUtils::ExtractSubjectNameFromDERCert(certs[0], &ca_subject);
@@ -1697,20 +1696,20 @@
}
}
-QuicString QuicCryptoServerConfig::CompressChain(
+std::string QuicCryptoServerConfig::CompressChain(
QuicCompressedCertsCache* compressed_certs_cache,
const QuicReferenceCountedPointer<ProofSource::Chain>& chain,
- const QuicString& client_common_set_hashes,
- const QuicString& client_cached_cert_hashes,
+ const std::string& client_common_set_hashes,
+ const std::string& client_cached_cert_hashes,
const CommonCertSets* common_sets) {
// Check whether the compressed certs is available in the cache.
DCHECK(compressed_certs_cache);
- const QuicString* cached_value = compressed_certs_cache->GetCompressedCert(
+ const std::string* cached_value = compressed_certs_cache->GetCompressedCert(
chain, client_common_set_hashes, client_cached_cert_hashes);
if (cached_value) {
return *cached_value;
}
- QuicString compressed =
+ std::string compressed =
CertCompressor::CompressChain(chain->certs, client_common_set_hashes,
client_cached_cert_hashes, common_sets);
// Insert the newly compressed cert to cache.
@@ -1747,7 +1746,7 @@
QUIC_LOG(WARNING) << "Server config message is missing SCID";
return nullptr;
}
- config->id = QuicString(scid);
+ config->id = std::string(scid);
if (msg->GetTaglist(kAEAD, &config->aead) != QUIC_NO_ERROR) {
QUIC_LOG(WARNING) << "Server config message is missing AEAD";
@@ -1802,7 +1801,7 @@
for (size_t i = 0; i < kexs_tags.size(); i++) {
const QuicTag tag = kexs_tags[i];
- QuicString private_key;
+ std::string private_key;
config->kexs.push_back(tag);
@@ -1867,7 +1866,7 @@
primary_config_changed_cb_ = std::move(cb);
}
-QuicString QuicCryptoServerConfig::NewSourceAddressToken(
+std::string QuicCryptoServerConfig::NewSourceAddressToken(
const Config& config,
const SourceAddressTokens& previous_tokens,
const QuicIpAddress& ip,
@@ -1922,7 +1921,7 @@
const Config& config,
QuicStringPiece token,
SourceAddressTokens* tokens) const {
- QuicString storage;
+ std::string storage;
QuicStringPiece plaintext;
if (!config.source_address_token_boxer->Unbox(token, &storage, &plaintext)) {
return SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE;
@@ -1999,8 +1998,8 @@
static const size_t kServerNoncePlaintextSize =
4 /* timestamp */ + 20 /* random bytes */;
-QuicString QuicCryptoServerConfig::NewServerNonce(QuicRandom* rand,
- QuicWallTime now) const {
+std::string QuicCryptoServerConfig::NewServerNonce(QuicRandom* rand,
+ QuicWallTime now) const {
const uint32_t timestamp = static_cast<uint32_t>(now.ToUNIXSeconds());
uint8_t server_nonce[kServerNoncePlaintextSize];
@@ -2019,7 +2018,7 @@
bool QuicCryptoServerConfig::ValidateExpectedLeafCertificate(
const CryptoHandshakeMessage& client_hello,
- const std::vector<QuicString>& certs) const {
+ const std::vector<std::string>& certs) const {
if (certs.empty()) {
return false;
}
diff --git a/quic/core/crypto/quic_crypto_server_config.h b/quic/core/crypto/quic_crypto_server_config.h
index 9f91c9a..858c95e 100644
--- a/quic/core/crypto/quic_crypto_server_config.h
+++ b/quic/core/crypto/quic_crypto_server_config.h
@@ -76,7 +76,7 @@
PrimaryConfigChangedCallback& operator=(const PrimaryConfigChangedCallback&) =
delete;
virtual ~PrimaryConfigChangedCallback();
- virtual void Run(const QuicString& scid) = 0;
+ virtual void Run(const std::string& scid) = 0;
};
// Callback used to accept the result of the |client_hello| validation step.
@@ -92,7 +92,7 @@
CryptoHandshakeMessage client_hello;
ClientHelloInfo info;
QuicErrorCode error_code;
- QuicString error_details;
+ std::string error_details;
// Populated if the CHLO STK contained a CachedNetworkParameters proto.
CachedNetworkParameters cached_network_params;
@@ -121,7 +121,7 @@
const ProcessClientHelloResultCallback&) = delete;
virtual ~ProcessClientHelloResultCallback();
virtual void Run(QuicErrorCode error,
- const QuicString& error_details,
+ const std::string& error_details,
std::unique_ptr<CryptoHandshakeMessage> message,
std::unique_ptr<DiversificationNonce> diversification_nonce,
std::unique_ptr<ProofSource::Details> details) = 0;
@@ -163,7 +163,7 @@
// Create a new KeyExchange of the specified type using the specified
// private key.
- virtual std::unique_ptr<KeyExchange> Create(QuicString /*server_config_id*/,
+ virtual std::unique_ptr<KeyExchange> Create(std::string /*server_config_id*/,
QuicTag type,
QuicStringPiece private_key) = 0;
};
@@ -192,10 +192,10 @@
QuicTagVector token_binding_params;
// id contains the server config id for the resulting config. If empty, a
// random id is generated.
- QuicString id;
+ std::string id;
// orbit contains the kOrbitSize bytes of the orbit value for the server
// config. If |orbit| is empty then a random orbit is generated.
- QuicString orbit;
+ std::string orbit;
// p256 determines whether a P-256 public key will be included in the
// server config. Note that this breaks deterministic server-config
// generation since P-256 key generation doesn't use the QuicRandom given
@@ -262,10 +262,10 @@
// decrypting a source address token. Note that these keys are used *without*
// passing them through a KDF, in contradistinction to the
// |source_address_token_secret| argument to the constructor.
- void SetSourceAddressTokenKeys(const std::vector<QuicString>& keys);
+ void SetSourceAddressTokenKeys(const std::vector<std::string>& keys);
// Get the server config ids for all known configs.
- void GetConfigIds(std::vector<QuicString>* scids) const;
+ void GetConfigIds(std::vector<std::string>* scids) const;
// Checks |client_hello| for gross errors and determines whether it can be
// shown to be fresh (i.e. not a replay). The result of the validation step
@@ -429,7 +429,7 @@
SSL_CTX* ssl_ctx() const;
void set_pre_shared_key(QuicStringPiece psk) {
- pre_shared_key_ = QuicString(psk);
+ pre_shared_key_ = std::string(psk);
}
bool pad_rej() const { return pad_rej_; }
@@ -455,9 +455,9 @@
// getters/setters here.
// |serialized| contains the bytes of this server config, suitable for
// sending on the wire.
- QuicString serialized;
+ std::string serialized;
// id contains the SCID of this server config.
- QuicString id;
+ std::string id;
// orbit contains the orbit value for this config: an opaque identifier
// used to identify clusters of server frontends.
unsigned char orbit[kOrbitSize];
@@ -636,11 +636,11 @@
// sets known locally and |client_common_set_hashes| contains the hashes of
// the common sets known to the peer. |client_cached_cert_hashes| contains
// 64-bit, FNV-1a hashes of certificates that the peer already possesses.
- static QuicString CompressChain(
+ static std::string CompressChain(
QuicCompressedCertsCache* compressed_certs_cache,
const QuicReferenceCountedPointer<ProofSource::Chain>& chain,
- const QuicString& client_common_set_hashes,
- const QuicString& client_cached_cert_hashes,
+ const std::string& client_common_set_hashes,
+ const std::string& client_cached_cert_hashes,
const CommonCertSets* common_sets);
// ParseConfigProtobuf parses the given config protobuf and returns a
@@ -651,7 +651,7 @@
// NewSourceAddressToken returns a fresh source address token for the given
// IP address. |cached_network_params| is optional, and can be nullptr.
- QuicString NewSourceAddressToken(
+ std::string NewSourceAddressToken(
const Config& config,
const SourceAddressTokens& previous_tokens,
const QuicIpAddress& ip,
@@ -696,7 +696,7 @@
QuicWallTime now) const;
// NewServerNonce generates and encrypts a random nonce.
- QuicString NewServerNonce(QuicRandom* rand, QuicWallTime now) const;
+ std::string NewServerNonce(QuicRandom* rand, QuicWallTime now) const;
// ValidateExpectedLeafCertificate checks the |client_hello| to see if it has
// an XLCT tag, and if so, verifies that its value matches the hash of the
@@ -705,7 +705,7 @@
// XLCT tag is present and valid. It returns false otherwise.
bool ValidateExpectedLeafCertificate(
const CryptoHandshakeMessage& client_hello,
- const std::vector<QuicString>& certs) const;
+ const std::vector<std::string>& certs) const;
// Returns true if the PDMD field from the client hello demands an X509
// certificate.
@@ -742,10 +742,10 @@
const QuicTransportVersion version_;
QuicCompressedCertsCache* compressed_certs_cache_;
const CommonCertSets* common_cert_sets_;
- const QuicString client_common_set_hashes_;
- const QuicString client_cached_cert_hashes_;
+ const std::string client_common_set_hashes_;
+ const std::string client_cached_cert_hashes_;
const bool sct_supported_by_client_;
- const QuicString sni_;
+ const std::string sni_;
CryptoHandshakeMessage message_;
std::unique_ptr<BuildServerConfigUpdateMessageResultCallback> cb_;
};
@@ -757,14 +757,14 @@
QuicTransportVersion version,
QuicCompressedCertsCache* compressed_certs_cache,
const CommonCertSets* common_cert_sets,
- const QuicString& client_common_set_hashes,
- const QuicString& client_cached_cert_hashes,
+ const std::string& client_common_set_hashes,
+ const std::string& client_cached_cert_hashes,
bool sct_supported_by_client,
- const QuicString& sni,
+ const std::string& sni,
bool ok,
const QuicReferenceCountedPointer<ProofSource::Chain>& chain,
- const QuicString& signature,
- const QuicString& leaf_cert_sct,
+ const std::string& signature,
+ const std::string& leaf_cert_sct,
std::unique_ptr<ProofSource::Details> details,
CryptoHandshakeMessage message,
std::unique_ptr<BuildServerConfigUpdateMessageResultCallback> cb) const;
@@ -837,7 +837,7 @@
// If non-empty, the server will operate in the pre-shared key mode by
// incorporating |pre_shared_key_| into the key schedule.
- QuicString pre_shared_key_;
+ std::string pre_shared_key_;
// Whether REJ message should be padded to max packet size.
bool pad_rej_;
@@ -866,7 +866,7 @@
// The server config that is used for this proof (and the rest of the
// request).
QuicReferenceCountedPointer<QuicCryptoServerConfig::Config> config;
- QuicString primary_scid;
+ std::string primary_scid;
protected:
~QuicSignedServerConfig() override;
diff --git a/quic/core/crypto/quic_crypto_server_config_test.cc b/quic/core/crypto/quic_crypto_server_config_test.cc
index 101be1d..6d38bde 100644
--- a/quic/core/crypto/quic_crypto_server_config_test.cc
+++ b/quic/core/crypto/quic_crypto_server_config_test.cc
@@ -58,11 +58,11 @@
TlsServerHandshaker::CreateSslCtx());
QuicCryptoServerConfigPeer peer(&server);
- std::vector<QuicString> certs = {"testcert"};
+ std::vector<std::string> certs = {"testcert"};
QuicReferenceCountedPointer<ProofSource::Chain> chain(
new ProofSource::Chain(certs));
- QuicString compressed = QuicCryptoServerConfigPeer::CompressChain(
+ std::string compressed = QuicCryptoServerConfigPeer::CompressChain(
&compressed_certs_cache, chain, "", "", nullptr);
EXPECT_EQ(compressed_certs_cache.Size(), 1u);
@@ -80,18 +80,18 @@
QuicCryptoServerConfigPeer peer(&server);
// Compress the certs for the first time.
- std::vector<QuicString> certs = {"testcert"};
+ std::vector<std::string> certs = {"testcert"};
QuicReferenceCountedPointer<ProofSource::Chain> chain(
new ProofSource::Chain(certs));
- QuicString common_certs = "";
- QuicString cached_certs = "";
+ std::string common_certs = "";
+ std::string cached_certs = "";
- QuicString compressed = QuicCryptoServerConfigPeer::CompressChain(
+ std::string compressed = QuicCryptoServerConfigPeer::CompressChain(
&compressed_certs_cache, chain, common_certs, cached_certs, nullptr);
EXPECT_EQ(compressed_certs_cache.Size(), 1u);
// Compress the same certs, should use cache if available.
- QuicString compressed2 = QuicCryptoServerConfigPeer::CompressChain(
+ std::string compressed2 = QuicCryptoServerConfigPeer::CompressChain(
&compressed_certs_cache, chain, common_certs, cached_certs, nullptr);
EXPECT_EQ(compressed, compressed2);
EXPECT_EQ(compressed_certs_cache.Size(), 1u);
@@ -110,13 +110,13 @@
TlsServerHandshaker::CreateSslCtx());
QuicCryptoServerConfigPeer peer(&server);
- std::vector<QuicString> certs = {"testcert"};
+ std::vector<std::string> certs = {"testcert"};
QuicReferenceCountedPointer<ProofSource::Chain> chain(
new ProofSource::Chain(certs));
- QuicString common_certs = "";
- QuicString cached_certs = "";
+ std::string common_certs = "";
+ std::string cached_certs = "";
- QuicString compressed = QuicCryptoServerConfigPeer::CompressChain(
+ std::string compressed = QuicCryptoServerConfigPeer::CompressChain(
&compressed_certs_cache, chain, common_certs, cached_certs, nullptr);
EXPECT_EQ(compressed_certs_cache.Size(), 1u);
@@ -124,7 +124,7 @@
QuicReferenceCountedPointer<ProofSource::Chain> chain2(
new ProofSource::Chain(certs));
- QuicString compressed2 = QuicCryptoServerConfigPeer::CompressChain(
+ std::string compressed2 = QuicCryptoServerConfigPeer::CompressChain(
&compressed_certs_cache, chain2, common_certs, cached_certs, nullptr);
EXPECT_EQ(compressed_certs_cache.Size(), 2u);
@@ -134,8 +134,8 @@
crypto_test_utils::MockCommonCertSets(certs[0], set_hash, 1));
QuicStringPiece different_common_certs(
reinterpret_cast<const char*>(&set_hash), sizeof(set_hash));
- QuicString compressed3 = QuicCryptoServerConfigPeer::CompressChain(
- &compressed_certs_cache, chain, QuicString(different_common_certs),
+ std::string compressed3 = QuicCryptoServerConfigPeer::CompressChain(
+ &compressed_certs_cache, chain, std::string(different_common_certs),
cached_certs, common_sets.get());
EXPECT_EQ(compressed_certs_cache.Size(), 3u);
}
@@ -162,20 +162,21 @@
rand_, &clock_, QuicCryptoServerConfig::ConfigOptions()));
}
- QuicString NewSourceAddressToken(QuicString config_id,
- const QuicIpAddress& ip) {
+ std::string NewSourceAddressToken(std::string config_id,
+ const QuicIpAddress& ip) {
return NewSourceAddressToken(config_id, ip, nullptr);
}
- QuicString NewSourceAddressToken(QuicString config_id,
- const QuicIpAddress& ip,
- const SourceAddressTokens& previous_tokens) {
+ std::string NewSourceAddressToken(
+ std::string config_id,
+ const QuicIpAddress& ip,
+ const SourceAddressTokens& previous_tokens) {
return peer_.NewSourceAddressToken(config_id, previous_tokens, ip, rand_,
clock_.WallNow(), nullptr);
}
- QuicString NewSourceAddressToken(
- QuicString config_id,
+ std::string NewSourceAddressToken(
+ std::string config_id,
const QuicIpAddress& ip,
CachedNetworkParameters* cached_network_params) {
SourceAddressTokens previous_tokens;
@@ -183,14 +184,14 @@
clock_.WallNow(), cached_network_params);
}
- HandshakeFailureReason ValidateSourceAddressTokens(QuicString config_id,
+ HandshakeFailureReason ValidateSourceAddressTokens(std::string config_id,
QuicStringPiece srct,
const QuicIpAddress& ip) {
return ValidateSourceAddressTokens(config_id, srct, ip, nullptr);
}
HandshakeFailureReason ValidateSourceAddressTokens(
- QuicString config_id,
+ std::string config_id,
QuicStringPiece srct,
const QuicIpAddress& ip,
CachedNetworkParameters* cached_network_params) {
@@ -198,8 +199,8 @@
config_id, srct, ip, clock_.WallNow(), cached_network_params);
}
- const QuicString kPrimary = "<primary>";
- const QuicString kOverride = "Config with custom source address token key";
+ const std::string kPrimary = "<primary>";
+ const std::string kOverride = "Config with custom source address token key";
QuicIpAddress ip4_;
QuicIpAddress ip4_dual_;
@@ -219,9 +220,9 @@
// to a single IP address and server config.
TEST_F(SourceAddressTokenTest, SourceAddressToken) {
// Primary config generates configs that validate successfully.
- const QuicString token4 = NewSourceAddressToken(kPrimary, ip4_);
- const QuicString token4d = NewSourceAddressToken(kPrimary, ip4_dual_);
- const QuicString token6 = NewSourceAddressToken(kPrimary, ip6_);
+ const std::string token4 = NewSourceAddressToken(kPrimary, ip4_);
+ const std::string token4d = NewSourceAddressToken(kPrimary, ip4_dual_);
+ const std::string token6 = NewSourceAddressToken(kPrimary, ip6_);
EXPECT_EQ(HANDSHAKE_OK, ValidateSourceAddressTokens(kPrimary, token4, ip4_));
ASSERT_EQ(HANDSHAKE_OK,
ValidateSourceAddressTokens(kPrimary, token4, ip4_dual_));
@@ -236,7 +237,7 @@
}
TEST_F(SourceAddressTokenTest, SourceAddressTokenExpiration) {
- const QuicString token = NewSourceAddressToken(kPrimary, ip4_);
+ const std::string token = NewSourceAddressToken(kPrimary, ip4_);
// Validation fails if the token is from the future.
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(-3600 * 2));
@@ -254,7 +255,7 @@
// that this gets written to ValidateSourceAddressToken output argument.
CachedNetworkParameters cached_network_params_input;
cached_network_params_input.set_bandwidth_estimate_bytes_per_second(1234);
- const QuicString token4_with_cached_network_params =
+ const std::string token4_with_cached_network_params =
NewSourceAddressToken(kPrimary, ip4_, &cached_network_params_input);
CachedNetworkParameters cached_network_params_output;
@@ -277,7 +278,7 @@
previous_token.set_timestamp(now.ToUNIXSeconds());
SourceAddressTokens previous_tokens;
(*previous_tokens.add_tokens()) = previous_token;
- const QuicString token4or6 =
+ const std::string token4or6 =
NewSourceAddressToken(kPrimary, ip4_, previous_tokens);
EXPECT_EQ(HANDSHAKE_OK,
@@ -346,7 +347,7 @@
QuicCryptoServerConfig::GenerateConfig(rand_, &clock_, options);
protobuf->set_primary_time(primary_time);
protobuf->set_priority(priority);
- if (QuicString(server_config_id).find("INVALID") == 0) {
+ if (std::string(server_config_id).find("INVALID") == 0) {
protobuf->clear_key();
has_invalid = true;
}
@@ -365,7 +366,7 @@
};
TEST_F(CryptoServerConfigsTest, NoConfigs) {
- test_peer_.CheckConfigs(std::vector<std::pair<QuicString, bool>>());
+ test_peer_.CheckConfigs(std::vector<std::pair<std::string, bool>>());
}
TEST_F(CryptoServerConfigsTest, MakePrimaryFirst) {
diff --git a/quic/core/crypto/quic_decrypter.cc b/quic/core/crypto/quic_decrypter.cc
index d2aa28d..1ab67ba 100644
--- a/quic/core/crypto/quic_decrypter.cc
+++ b/quic/core/crypto/quic_decrypter.cc
@@ -55,14 +55,14 @@
const DiversificationNonce& nonce,
size_t key_size,
size_t nonce_prefix_size,
- QuicString* out_key,
- QuicString* out_nonce_prefix) {
- QuicHKDF hkdf((QuicString(preliminary_key)) + (QuicString(nonce_prefix)),
+ std::string* out_key,
+ std::string* out_nonce_prefix) {
+ QuicHKDF hkdf((std::string(preliminary_key)) + (std::string(nonce_prefix)),
QuicStringPiece(nonce.data(), nonce.size()),
"QUIC key diversification", 0, key_size, 0, nonce_prefix_size,
0);
- *out_key = QuicString(hkdf.server_write_key());
- *out_nonce_prefix = QuicString(hkdf.server_write_iv());
+ *out_key = std::string(hkdf.server_write_key());
+ *out_nonce_prefix = std::string(hkdf.server_write_iv());
}
} // namespace quic
diff --git a/quic/core/crypto/quic_decrypter.h b/quic/core/crypto/quic_decrypter.h
index c7c2ccc..f55b00b 100644
--- a/quic/core/crypto/quic_decrypter.h
+++ b/quic/core/crypto/quic_decrypter.h
@@ -73,8 +73,8 @@
const DiversificationNonce& nonce,
size_t key_size,
size_t nonce_prefix_size,
- QuicString* out_key,
- QuicString* out_nonce_prefix);
+ std::string* out_key,
+ std::string* out_nonce_prefix);
};
} // namespace quic
diff --git a/quic/core/crypto/quic_hkdf_test.cc b/quic/core/crypto/quic_hkdf_test.cc
index f8c53c6..fbf2860 100644
--- a/quic/core/crypto/quic_hkdf_test.cc
+++ b/quic/core/crypto/quic_hkdf_test.cc
@@ -70,10 +70,10 @@
const HKDFInput& test(kHKDFInputs[i]);
SCOPED_TRACE(i);
- const QuicString key = QuicTextUtils::HexDecode(test.key_hex);
- const QuicString salt = QuicTextUtils::HexDecode(test.salt_hex);
- const QuicString info = QuicTextUtils::HexDecode(test.info_hex);
- const QuicString expected = QuicTextUtils::HexDecode(test.output_hex);
+ const std::string key = QuicTextUtils::HexDecode(test.key_hex);
+ const std::string salt = QuicTextUtils::HexDecode(test.salt_hex);
+ const std::string info = QuicTextUtils::HexDecode(test.info_hex);
+ const std::string expected = QuicTextUtils::HexDecode(test.output_hex);
// We set the key_length to the length of the expected output and then take
// the result from the first key, which is the client write key.
diff --git a/quic/core/crypto/transport_parameters_test.cc b/quic/core/crypto/transport_parameters_test.cc
index 8a81841..23b18e5 100644
--- a/quic/core/crypto/transport_parameters_test.cc
+++ b/quic/core/crypto/transport_parameters_test.cc
@@ -412,7 +412,7 @@
orig_params.idle_timeout = 56;
orig_params.google_quic_params = QuicMakeUnique<CryptoHandshakeMessage>();
- const QuicString kTestString = "test string";
+ const std::string kTestString = "test string";
orig_params.google_quic_params->SetStringPiece(42, kTestString);
const uint32_t kTestValue = 12;
orig_params.google_quic_params->SetValue(1337, kTestValue);