Set crypto_negotiated_params for IETF QUIC client in 0-RTT
PiperOrigin-RevId: 330579701
Change-Id: I8a588a456bfd126c250dc0d9d0e03033c6f4f8c7
diff --git a/quic/core/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc
index dfaab51..46bf285 100644
--- a/quic/core/tls_client_handshaker.cc
+++ b/quic/core/tls_client_handshaker.cc
@@ -456,6 +456,14 @@
}
void TlsClientHandshaker::FinishHandshake() {
+ // Fill crypto_negotiated_params_:
+ const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl());
+ if (cipher) {
+ crypto_negotiated_params_->cipher_suite = SSL_CIPHER_get_value(cipher);
+ }
+ crypto_negotiated_params_->key_exchange_group = SSL_get_curve_id(ssl());
+ crypto_negotiated_params_->peer_signature_algorithm =
+ SSL_get_peer_signature_algorithm(ssl());
if (SSL_in_early_data(ssl())) {
// SSL_do_handshake returns after sending the ClientHello if the session is
// 0-RTT-capable, which means that FinishHandshake will get called twice -
@@ -470,14 +478,6 @@
}
QUIC_LOG(INFO) << "Client: handshake finished";
state_ = STATE_HANDSHAKE_COMPLETE;
- // Fill crypto_negotiated_params_:
- const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl());
- if (cipher) {
- crypto_negotiated_params_->cipher_suite = SSL_CIPHER_get_value(cipher);
- }
- crypto_negotiated_params_->key_exchange_group = SSL_get_curve_id(ssl());
- crypto_negotiated_params_->peer_signature_algorithm =
- SSL_get_peer_signature_algorithm(ssl());
std::string error_details;
if (!ProcessTransportParameters(&error_details)) {
diff --git a/quic/core/tls_client_handshaker_test.cc b/quic/core/tls_client_handshaker_test.cc
index e2988d9..a0a6ea7 100644
--- a/quic/core/tls_client_handshaker_test.cc
+++ b/quic/core/tls_client_handshaker_test.cc
@@ -399,6 +399,9 @@
// messages from the server.
stream()->CryptoConnect();
EXPECT_TRUE(stream()->encryption_established());
+ EXPECT_NE(stream()->crypto_negotiated_params().cipher_suite, 0);
+ EXPECT_NE(stream()->crypto_negotiated_params().key_exchange_group, 0);
+ EXPECT_NE(stream()->crypto_negotiated_params().peer_signature_algorithm, 0);
// Finish the handshake with the server.
QuicConfig config;
crypto_test_utils::HandshakeWithFakeServer(