Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Unified Diff: net/quic/crypto/aes_128_gcm_12_decrypter_test.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/crypto/aead_base_decrypter.h ('k') | net/quic/crypto/chacha20_poly1305_decrypter_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/aes_128_gcm_12_decrypter_test.cc
diff --git a/net/quic/crypto/aes_128_gcm_12_decrypter_test.cc b/net/quic/crypto/aes_128_gcm_12_decrypter_test.cc
index 037bf7ec3358bfb838faec16b056695e58dc0c3f..377d2b5d52ef6bbdbfe479bdca814c0a1945e05b 100644
--- a/net/quic/crypto/aes_128_gcm_12_decrypter_test.cc
+++ b/net/quic/crypto/aes_128_gcm_12_decrypter_test.cc
@@ -257,15 +257,13 @@ QuicData* DecryptWithNonce(Aes128Gcm12Decrypter* 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(Aes128Gcm12DecrypterTest, Decrypt) {
« no previous file with comments | « net/quic/crypto/aead_base_decrypter.h ('k') | net/quic/crypto/chacha20_poly1305_decrypter_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698