diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-08 18:37:44 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-08 18:37:44 +0000 |
commit | ed3fc15d1ce8fd21b2e97644d8a102e0e1215199 (patch) | |
tree | 15d807a22b47ae1c3460e4e33aa7fb4d9a19baf4 /net/quic/quic_crypto_stream.cc | |
parent | 7f201e739dfcd6f7ba16bce97a60dab84547d864 (diff) | |
download | chromium_src-ed3fc15d1ce8fd21b2e97644d8a102e0e1215199.zip chromium_src-ed3fc15d1ce8fd21b2e97644d8a102e0e1215199.tar.gz chromium_src-ed3fc15d1ce8fd21b2e97644d8a102e0e1215199.tar.bz2 |
Land Recent QUIC Changes
Remove the kAESH tag (AES CBC mode with HMAC) because we won't support it.
Merge internal change: 43418211
Get client to the point where it can do key agreement.
This small change completes allows the client to perform an anonymous DH
handshake. After this, plumbing the pre-master secret into the KDF and enabling
the encrypter/decrypter should Just Work.
More crypto handshake work.
This change brings back the non-crypto parts of the negotiation, outside of
crypto/.
Merge internal change: 43400046
More work on crypto handshake.
This change:
* Removes the rest of the non-crypto related parameters from crypto/.
* Enables actual key-negotiation on the server.
Next step is to enable the non-crypto parameters to be negotiated again.
Merge internal change: 43175686
Inform the congestion manager if a sent packet has data in it, or only acks. The TCP manager does not could ack-only packets against the congestion window.
Merge internal change: 43304285
R=rtenneti@chromium.org
BUG=
Review URL: https://chromiumcodereview.appspot.com/12559005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187000 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic/quic_crypto_stream.cc')
-rw-r--r-- | net/quic/quic_crypto_stream.cc | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/net/quic/quic_crypto_stream.cc b/net/quic/quic_crypto_stream.cc index b10f75c..712c8fd 100644 --- a/net/quic/quic_crypto_stream.cc +++ b/net/quic/quic_crypto_stream.cc @@ -54,4 +54,95 @@ void QuicCryptoStream::SendHandshakeMessage( WriteData(string(data->data(), data->length()), false); } +QuicNegotiatedParameters::QuicNegotiatedParameters() + : idle_connection_state_lifetime(QuicTime::Delta::Zero()), + keepalive_timeout(QuicTime::Delta::Zero()) { +} + +QuicConfig::QuicConfig() + : idle_connection_state_lifetime(QuicTime::Delta::Zero()), + keepalive_timeout(QuicTime::Delta::Zero()) { +} + +QuicConfig::~QuicConfig() { +} + +void QuicConfig::SetDefaults() { + idle_connection_state_lifetime = QuicTime::Delta::FromSeconds(300); + keepalive_timeout = QuicTime::Delta::Zero(); + congestion_control.push_back(kQBIC); +} + +void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { + out->SetValue( + kICSL, static_cast<uint32>(idle_connection_state_lifetime.ToSeconds())); + out->SetValue(kKATO, static_cast<uint32>(keepalive_timeout.ToSeconds())); + out->SetVector(kCGST, congestion_control); +} + +QuicErrorCode QuicConfig::ProcessPeerHandshake( + const CryptoHandshakeMessage& msg, + CryptoUtils::Priority priority, + QuicNegotiatedParameters* out_params, + string* error_details) const { + const CryptoTag* their_congestion_controls; + size_t num_their_congestion_controls; + QuicErrorCode error; + + error = msg.GetTaglist(kCGST, &their_congestion_controls, + &num_their_congestion_controls); + if (error != QUIC_NO_ERROR) { + if (error_details) { + *error_details = "Missing CGST"; + } + return error; + } + + if (!CryptoUtils::FindMutualTag(congestion_control, + their_congestion_controls, + num_their_congestion_controls, + priority, + &out_params->congestion_control, + NULL)) { + if (error_details) { + *error_details = "Unsuported CGST"; + } + return QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP; + } + + uint32 idle; + error = msg.GetUint32(kICSL, &idle); + if (error != QUIC_NO_ERROR) { + if (error_details) { + *error_details = "Missing ICSL"; + } + return error; + } + + out_params->idle_connection_state_lifetime = QuicTime::Delta::FromSeconds( + std::min(static_cast<uint32>(idle_connection_state_lifetime.ToSeconds()), + idle)); + + uint32 keepalive; + error = msg.GetUint32(kKATO, &keepalive); + switch (error) { + case QUIC_NO_ERROR: + out_params->keepalive_timeout = QuicTime::Delta::FromSeconds( + std::min(static_cast<uint32>(keepalive_timeout.ToSeconds()), + keepalive)); + break; + case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND: + // KATO is optional. + out_params->keepalive_timeout = QuicTime::Delta::Zero(); + break; + default: + if (error_details) { + *error_details = "Bad KATO"; + } + return error; + } + + return QUIC_NO_ERROR; +} + } // namespace net |