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

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

Issue 20227003: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Land Recent QUIC changes Created 7 years, 5 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/aes_128_gcm_12_encrypter.h ('k') | net/quic/crypto/aes_128_gcm_12_encrypter_openssl.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_encrypter_nss.cc
diff --git a/net/quic/crypto/aes_128_gcm_12_encrypter_nss.cc b/net/quic/crypto/aes_128_gcm_12_encrypter_nss.cc
index 4729ef81bffce311a52a57c0308165e7170f2509..1cd3540c8844b4b66d897af4bd5932ee144ed1ed 100644
--- a/net/quic/crypto/aes_128_gcm_12_encrypter_nss.cc
+++ b/net/quic/crypto/aes_128_gcm_12_encrypter_nss.cc
@@ -250,7 +250,7 @@ SECStatus My_Encrypt(PK11SymKey* key,
} // namespace
-Aes128Gcm12Encrypter::Aes128Gcm12Encrypter() {
+Aes128Gcm12Encrypter::Aes128Gcm12Encrypter() : last_seq_num_(0) {
ignore_result(g_gcm_support_checker.Get());
}
@@ -350,6 +350,12 @@ QuicData* Aes128Gcm12Encrypter::EncryptPacket(
size_t ciphertext_size = GetCiphertextSize(plaintext.length());
scoped_ptr<char[]> ciphertext(new char[ciphertext_size]);
+ if (last_seq_num_ != 0 && sequence_number <= last_seq_num_) {
+ DLOG(FATAL) << "Sequence numbers regressed";
+ return NULL;
+ }
+ last_seq_num_ = sequence_number;
+
uint8 nonce[kNoncePrefixSize + sizeof(sequence_number)];
COMPILE_ASSERT(sizeof(nonce) == kAESNonceSize, bad_sequence_number_size);
memcpy(nonce, nonce_prefix_, kNoncePrefixSize);
« no previous file with comments | « net/quic/crypto/aes_128_gcm_12_encrypter.h ('k') | net/quic/crypto/aes_128_gcm_12_encrypter_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698