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

Side by Side Diff: net/quic/quic_connection.cc

Issue 1904213002: QUIC: support diversified keys with version 33. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hkdf
Patch Set: Rebase Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 ++stats_.packets_dropped; 617 ++stats_.packets_dropped;
618 return false; 618 return false;
619 } 619 }
620 620
621 return true; 621 return true;
622 } 622 }
623 623
624 void QuicConnection::OnDecryptedPacket(EncryptionLevel level) { 624 void QuicConnection::OnDecryptedPacket(EncryptionLevel level) {
625 last_decrypted_packet_level_ = level; 625 last_decrypted_packet_level_ = level;
626 last_packet_decrypted_ = true; 626 last_packet_decrypted_ = true;
627
627 // If this packet was foward-secure encrypted and the forward-secure encrypter 628 // If this packet was foward-secure encrypted and the forward-secure encrypter
628 // is not being used, start using it. 629 // is not being used, start using it.
629 if (encryption_level_ != ENCRYPTION_FORWARD_SECURE && 630 if (encryption_level_ != ENCRYPTION_FORWARD_SECURE &&
630 has_forward_secure_encrypter_ && level == ENCRYPTION_FORWARD_SECURE) { 631 has_forward_secure_encrypter_ && level == ENCRYPTION_FORWARD_SECURE) {
631 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); 632 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
632 } 633 }
633 } 634 }
634 635
635 bool QuicConnection::OnPacketHeader(const QuicPacketHeader& header) { 636 bool QuicConnection::OnPacketHeader(const QuicPacketHeader& header) {
636 if (debug_visitor_ != nullptr) { 637 if (debug_visitor_ != nullptr) {
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 packet_number_of_last_sent_packet_ + 1836 packet_number_of_last_sent_packet_ +
1836 // 3 times the current congestion window (in slow start) should cover 1837 // 3 times the current congestion window (in slow start) should cover
1837 // about two full round trips worth of packets, which should be 1838 // about two full round trips worth of packets, which should be
1838 // sufficient. 1839 // sufficient.
1839 3 * 1840 3 *
1840 sent_packet_manager_.EstimateMaxPacketsInFlight( 1841 sent_packet_manager_.EstimateMaxPacketsInFlight(
1841 max_packet_length()); 1842 max_packet_length());
1842 } 1843 }
1843 } 1844 }
1844 1845
1846 void QuicConnection::SetDiversificationNonce(const DiversificationNonce nonce) {
1847 DCHECK_EQ(Perspective::IS_SERVER, perspective_);
1848 packet_generator_.SetDiversificationNonce(nonce);
1849 }
1850
1845 void QuicConnection::SetDefaultEncryptionLevel(EncryptionLevel level) { 1851 void QuicConnection::SetDefaultEncryptionLevel(EncryptionLevel level) {
1846 encryption_level_ = level; 1852 encryption_level_ = level;
1847 packet_generator_.set_encryption_level(level); 1853 packet_generator_.set_encryption_level(level);
1848 } 1854 }
1849 1855
1850 void QuicConnection::SetDecrypter(EncryptionLevel level, 1856 void QuicConnection::SetDecrypter(EncryptionLevel level,
1851 QuicDecrypter* decrypter) { 1857 QuicDecrypter* decrypter) {
1852 framer_.SetDecrypter(level, decrypter); 1858 framer_.SetDecrypter(level, decrypter);
1853 } 1859 }
1854 1860
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 } 2362 }
2357 2363
2358 StringPiece QuicConnection::GetCurrentPacket() { 2364 StringPiece QuicConnection::GetCurrentPacket() {
2359 if (current_packet_data_ == nullptr) { 2365 if (current_packet_data_ == nullptr) {
2360 return StringPiece(); 2366 return StringPiece();
2361 } 2367 }
2362 return StringPiece(current_packet_data_, last_size_); 2368 return StringPiece(current_packet_data_, last_size_);
2363 } 2369 }
2364 2370
2365 } // namespace net 2371 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698