Make CryptoUtils::HashHandshakeMessage return by value
Also, during the handshake, don't hash the CHLO unless the hash is going to be used.
gfe-relnote: No-op refactoring, no functional change, not flag-protected.
PiperOrigin-RevId: 238635063
Change-Id: I76f033c33f436a1e95db5aae9494dbfdf7139ed5
diff --git a/quic/core/crypto/quic_crypto_server_config.cc b/quic/core/crypto/quic_crypto_server_config.cc
index ccb7691..aa45e33 100644
--- a/quic/core/crypto/quic_crypto_server_config.cc
+++ b/quic/core/crypto/quic_crypto_server_config.cc
@@ -790,10 +790,6 @@
helper.Fail(QUIC_UNSUPPORTED_PROOF_DEMAND, "Missing or invalid PDMD");
return;
}
- DCHECK(proof_source_.get());
- std::string chlo_hash;
- CryptoUtils::HashHandshakeMessage(client_hello, &chlo_hash,
- Perspective::IS_SERVER);
// No need to get a new proof if one was already generated.
if (!signed_config->chain) {
@@ -803,6 +799,10 @@
server_designated_connection_id, clock, rand, compressed_certs_cache,
params, signed_config, total_framing_overhead, chlo_packet_size,
requested_config, primary_config, std::move(done_cb));
+ const std::string chlo_hash =
+ CryptoUtils::HashHandshakeMessage(client_hello, Perspective::IS_SERVER);
+
+ DCHECK(proof_source_.get());
proof_source_->GetProof(
server_address, std::string(info.sni), primary_config->serialized,
version.transport_version, chlo_hash, std::move(cb));