| Index: net/quic/crypto/chacha20_poly1305_encrypter_test.cc
|
| diff --git a/net/quic/crypto/chacha20_poly1305_encrypter_test.cc b/net/quic/crypto/chacha20_poly1305_encrypter_test.cc
|
| index 0273b27933c3f2620cc673e83c6ddd4e14430eb2..37e96a105d0e4b2a53f7af51c0f3f87acd74a11c 100644
|
| --- a/net/quic/crypto/chacha20_poly1305_encrypter_test.cc
|
| +++ b/net/quic/crypto/chacha20_poly1305_encrypter_test.cc
|
| @@ -24,15 +24,13 @@ struct TestVector {
|
| };
|
|
|
| const TestVector test_vectors[] = {
|
| - { "4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
|
| - "0a1007",
|
| - "86d09974840bded2a5ca",
|
| - "cd7cf67be39c794a",
|
| - "87e229d4500845a079c0",
|
| - "e3e446f7ede9a19b62a4677dabf4e3d24b876bb28475" // "3896e1d6" truncated.
|
| - },
|
| - { NULL }
|
| -};
|
| + {
|
| + "4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
|
| + "0a1007",
|
| + "86d09974840bded2a5ca", "cd7cf67be39c794a", "87e229d4500845a079c0",
|
| + "e3e446f7ede9a19b62a4677dabf4e3d24b876bb28475" // "3896e1d6" truncated.
|
| + },
|
| + {NULL}};
|
|
|
| } // namespace
|
|
|
| @@ -48,7 +46,9 @@ QuicData* EncryptWithNonce(ChaCha20Poly1305Encrypter* encrypter,
|
| size_t ciphertext_size = encrypter->GetCiphertextSize(plaintext.length());
|
| scoped_ptr<char[]> ciphertext(new char[ciphertext_size]);
|
|
|
| - if (!encrypter->Encrypt(nonce, associated_data, plaintext,
|
| + if (!encrypter->Encrypt(nonce,
|
| + associated_data,
|
| + plaintext,
|
| reinterpret_cast<unsigned char*>(ciphertext.get()))) {
|
| return NULL;
|
| }
|
| @@ -78,14 +78,18 @@ TEST(ChaCha20Poly1305EncrypterTest, Encrypt) {
|
| ChaCha20Poly1305Encrypter encrypter;
|
| ASSERT_TRUE(encrypter.SetKey(key));
|
| scoped_ptr<QuicData> encrypted(EncryptWithNonce(
|
| - &encrypter, iv,
|
| + &encrypter,
|
| + iv,
|
| // This deliberately tests that the encrypter can handle an AAD that
|
| // is set to NULL, as opposed to a zero-length, non-NULL pointer.
|
| - StringPiece(aad.length() ? aad.data() : NULL, aad.length()), pt));
|
| + StringPiece(aad.length() ? aad.data() : NULL, aad.length()),
|
| + pt));
|
| ASSERT_TRUE(encrypted.get());
|
|
|
| - test::CompareCharArraysWithHexError("ciphertext", encrypted->data(),
|
| - encrypted->length(), ct.data(),
|
| + test::CompareCharArraysWithHexError("ciphertext",
|
| + encrypted->data(),
|
| + encrypted->length(),
|
| + ct.data(),
|
| ct.length());
|
| }
|
| }
|
|
|