| Index: net/quic/crypto/chacha20_poly1305_decrypter_test.cc
|
| diff --git a/net/quic/crypto/chacha20_poly1305_decrypter_test.cc b/net/quic/crypto/chacha20_poly1305_decrypter_test.cc
|
| index 312e2d4da3b3ae7dfb1ce29fae2b4509a9d94022..54ca9ff4c8941bae5bfb447026311b415d7a7a1a 100644
|
| --- a/net/quic/crypto/chacha20_poly1305_decrypter_test.cc
|
| +++ b/net/quic/crypto/chacha20_poly1305_decrypter_test.cc
|
| @@ -75,15 +75,13 @@ QuicData* DecryptWithNonce(ChaCha20Poly1305Decrypter* decrypter,
|
| StringPiece nonce,
|
| StringPiece associated_data,
|
| StringPiece ciphertext) {
|
| - size_t plaintext_size = ciphertext.length();
|
| - scoped_ptr<char[]> plaintext(new char[plaintext_size]);
|
| -
|
| - if (!decrypter->Decrypt(nonce, associated_data, ciphertext,
|
| - reinterpret_cast<unsigned char*>(plaintext.get()),
|
| - &plaintext_size)) {
|
| - return nullptr;
|
| - }
|
| - return new QuicData(plaintext.release(), plaintext_size, true);
|
| + QuicPacketSequenceNumber sequence_number;
|
| + StringPiece nonce_prefix(nonce.data(),
|
| + nonce.size() - sizeof(sequence_number));
|
| + decrypter->SetNoncePrefix(nonce_prefix);
|
| + memcpy(&sequence_number, nonce.data() + nonce_prefix.size(),
|
| + sizeof(sequence_number));
|
| + return decrypter->DecryptPacket(sequence_number, associated_data, ciphertext);
|
| }
|
|
|
| TEST(ChaCha20Poly1305DecrypterTest, Decrypt) {
|
|
|