store received TransportParamters in TlsClientHandshaker so that it could later be stored into the session cache. gfe-relnote: no behavior change. not protected. PiperOrigin-RevId: 305787035 Change-Id: If4163f18dd18e1b5b5f019f9487e1b68b1d884af
diff --git a/quic/core/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc index b0a7d36..6740fbd 100644 --- a/quic/core/tls_client_handshaker.cc +++ b/quic/core/tls_client_handshaker.cc
@@ -163,7 +163,7 @@ bool TlsClientHandshaker::ProcessTransportParameters( std::string* error_details) { - TransportParameters params; + received_transport_params_ = std::make_unique<TransportParameters>(); const uint8_t* param_bytes; size_t param_bytes_len; SSL_get_peer_quic_transport_params(ssl(), ¶m_bytes, ¶m_bytes_len); @@ -174,7 +174,8 @@ std::string parse_error_details; if (!ParseTransportParameters( session()->connection()->version(), Perspective::IS_SERVER, - param_bytes, param_bytes_len, ¶ms, &parse_error_details)) { + param_bytes, param_bytes_len, received_transport_params_.get(), + &parse_error_details)) { DCHECK(!parse_error_details.empty()); *error_details = "Unable to parse server's transport parameters: " + parse_error_details; @@ -183,24 +184,27 @@ // When interoperating with non-Google implementations that do not send // the version extension, set it to what we expect. - if (params.version == 0) { - params.version = CreateQuicVersionLabel(session()->connection()->version()); + if (received_transport_params_->version == 0) { + received_transport_params_->version = + CreateQuicVersionLabel(session()->connection()->version()); } - if (params.supported_versions.empty()) { - params.supported_versions.push_back(params.version); + if (received_transport_params_->supported_versions.empty()) { + received_transport_params_->supported_versions.push_back( + received_transport_params_->version); } - if (params.version != + if (received_transport_params_->version != CreateQuicVersionLabel(session()->connection()->version())) { *error_details = "Version mismatch detected"; return false; } if (CryptoUtils::ValidateServerHelloVersions( - params.supported_versions, + received_transport_params_->supported_versions, session()->connection()->server_supported_versions(), error_details) != QUIC_NO_ERROR || session()->config()->ProcessTransportParameters( - params, SERVER, error_details) != QUIC_NO_ERROR) { + *received_transport_params_, SERVER, error_details) != + QUIC_NO_ERROR) { DCHECK(!error_details->empty()); return false; }
diff --git a/quic/core/tls_client_handshaker.h b/quic/core/tls_client_handshaker.h index d9ee760..5dab631 100644 --- a/quic/core/tls_client_handshaker.h +++ b/quic/core/tls_client_handshaker.h
@@ -5,11 +5,13 @@ #ifndef QUICHE_QUIC_CORE_TLS_CLIENT_HANDSHAKER_H_ #define QUICHE_QUIC_CORE_TLS_CLIENT_HANDSHAKER_H_ +#include <memory> #include <string> #include "third_party/boringssl/src/include/openssl/ssl.h" #include "net/third_party/quiche/src/quic/core/crypto/proof_verifier.h" #include "net/third_party/quiche/src/quic/core/crypto/tls_client_connection.h" +#include "net/third_party/quiche/src/quic/core/crypto/transport_parameters.h" #include "net/third_party/quiche/src/quic/core/quic_crypto_client_stream.h" #include "net/third_party/quiche/src/quic/core/quic_crypto_stream.h" #include "net/third_party/quiche/src/quic/core/tls_handshaker.h" @@ -156,6 +158,8 @@ bool allow_empty_alpn_for_tests_ = false; TlsClientConnection tls_connection_; + + std::unique_ptr<TransportParameters> received_transport_params_ = nullptr; }; } // namespace quic