@@ -344,10 +344,16 @@ bool TlsServerHandshaker::DisableResumption() {
344344}
345345
346346bool TlsServerHandshaker::IsZeroRtt () const {
347+ if (cached_ssl_info_.has_value ()) {
348+ return cached_ssl_info_->is_zero_rtt ;
349+ }
347350 return SSL_early_data_accepted (ssl ());
348351}
349352
350353bool TlsServerHandshaker::IsResumption () const {
354+ if (cached_ssl_info_.has_value ()) {
355+ return cached_ssl_info_->is_resumption ;
356+ }
351357 return SSL_session_reused (ssl ());
352358}
353359
@@ -448,6 +454,9 @@ void TlsServerHandshaker::OnConnectionClosed(
448454}
449455
450456ssl_early_data_reason_t TlsServerHandshaker::EarlyDataReason () const {
457+ if (cached_ssl_info_.has_value ()) {
458+ return cached_ssl_info_->early_data_reason ;
459+ }
451460 return TlsHandshaker::EarlyDataReason ();
452461}
453462
@@ -656,7 +665,7 @@ void TlsServerHandshaker::SetWriteSecret(
656665 if (level == ENCRYPTION_FORWARD_SECURE) {
657666 encryption_established_ = true ;
658667 // Fill crypto_negotiated_params_:
659- const SSL_CIPHER* ssl_cipher = SSL_get_current_cipher ( ssl () );
668+ const SSL_CIPHER* ssl_cipher = GetCipher ( );
660669 if (ssl_cipher) {
661670 crypto_negotiated_params_->cipher_suite =
662671 SSL_CIPHER_get_protocol_id (ssl_cipher);
@@ -1230,7 +1239,7 @@ bool TlsServerHandshaker::WillNotCallComputeSignature() const {
12301239}
12311240
12321241std::optional<uint16_t > TlsServerHandshaker::GetCiphersuite () const {
1233- const SSL_CIPHER* cipher = SSL_get_pending_cipher ( ssl () );
1242+ const SSL_CIPHER* cipher = GetCipher ( );
12341243 if (cipher == nullptr ) {
12351244 return std::nullopt ;
12361245 }
@@ -1343,6 +1352,20 @@ TlsServerHandshaker::SetApplicationSettings(absl::string_view alpn) {
13431352
13441353SSL* TlsServerHandshaker::GetSsl () const { return ssl (); }
13451354
1355+ void TlsServerHandshaker::ResetSsl () {
1356+ if (cached_ssl_info_.has_value ()) {
1357+ QUIC_BUG (quic_bug_ssl_is_reset_again);
1358+ return ;
1359+ }
1360+ cached_ssl_info_.emplace (CachedSSLInfo{
1361+ .is_resumption = IsResumption (),
1362+ .is_zero_rtt = IsZeroRtt (),
1363+ .early_data_reason = EarlyDataReason (),
1364+ .cipher = GetCipher (),
1365+ });
1366+ tls_connection_.ResetSsl ();
1367+ }
1368+
13461369bool TlsServerHandshaker::IsCryptoFrameExpectedForEncryptionLevel (
13471370 EncryptionLevel level) const {
13481371 return level != ENCRYPTION_ZERO_RTT;
0 commit comments