| Index: components/rappor/byte_vector_utils.cc
|
| diff --git a/components/rappor/byte_vector_utils.cc b/components/rappor/byte_vector_utils.cc
|
| index e9e58b6614cbf3f21139cec1f6d59cc499f01452..03d4786cc8240fc3f7a9bdf45cf4c90c6eed79f5 100644
|
| --- a/components/rappor/byte_vector_utils.cc
|
| +++ b/components/rappor/byte_vector_utils.cc
|
| @@ -22,8 +22,11 @@ base::StringPiece ByteVectorAsStringPiece(const ByteVector& lhs) {
|
| }
|
|
|
| // Concatenates parameters together as a string.
|
| -std::string Concat(const ByteVector& value, char c, const std::string& data) {
|
| - return std::string(value.begin(), value.end()) + c + data;
|
| +std::string Concat(const ByteVector& value, char c, base::StringPiece data) {
|
| + std::string result(value.begin(), value.end());
|
| + result += c;
|
| + data.AppendToString(&result);
|
| + return result;
|
| }
|
|
|
| // Performs the operation: K = HMAC(K, data)
|
| @@ -54,7 +57,7 @@ bool HMAC_Rehash(const crypto::HMAC& hmac, ByteVector* value) {
|
| // The input "Key" is passed by initializing |hmac1| with it.
|
| // The output "Key" is returned by initializing |out_hmac| with it.
|
| // Returns false on an error.
|
| -bool HMAC_DRBG_Update(const std::string& provided_data,
|
| +bool HMAC_DRBG_Update(base::StringPiece provided_data,
|
| const crypto::HMAC& hmac1,
|
| ByteVector* value,
|
| crypto::HMAC* out_hmac) {
|
| @@ -164,7 +167,7 @@ ByteVector ByteVectorGenerator::GetWeightedRandomByteVector(
|
| HmacByteVectorGenerator::HmacByteVectorGenerator(
|
| size_t byte_count,
|
| const std::string& entropy_input,
|
| - const std::string& personalization_string)
|
| + base::StringPiece personalization_string)
|
| : ByteVectorGenerator(byte_count),
|
| hmac_(crypto::HMAC::SHA256),
|
| value_(hmac_.DigestLength(), 0x01),
|
| @@ -175,7 +178,8 @@ HmacByteVectorGenerator::HmacByteVectorGenerator(
|
| // Note: We are using the 8.6.7 interpretation, where the entropy_input and
|
| // nonce are acquired at the same time from the same source.
|
| DCHECK_EQ(kEntropyInputSize, entropy_input.size());
|
| - std::string seed_material(entropy_input + personalization_string);
|
| + std::string seed_material(entropy_input);
|
| + personalization_string.AppendToString(&seed_material);
|
| // 2. Key = 0x00 00...00
|
| crypto::HMAC hmac1(crypto::HMAC::SHA256);
|
| if (!hmac1.Init(std::string(hmac_.DigestLength(), 0x00)))
|
|
|