mirror of https://github.com/ctz/rustls
client: tweak ClientHelloPayload construction
Previously we separately iterated the `input.hello.sent_extensions` to track our sent extensions before constructing a `ClientHelloPayload` that contained them. The `ClientHelloPayload` was constructed in-line for the `HandshakeMessagePayload` towards the end of `emit_client_hello_for_retry`. To support ECH we will want to do some additional work with the `ClientHelloPayload`, and so this commit does some minor rearranging to facilitate this.
This commit is contained in:
parent
1d09958864
commit
5a03d5b4c9
|
@ -313,12 +313,6 @@ fn emit_client_hello_for_retry(
|
|||
}
|
||||
});
|
||||
|
||||
// Note what extensions we sent.
|
||||
input.hello.sent_extensions = exts
|
||||
.iter()
|
||||
.map(ClientExtension::ext_type)
|
||||
.collect();
|
||||
|
||||
let mut cipher_suites: Vec<_> = config
|
||||
.provider
|
||||
.cipher_suites
|
||||
|
@ -331,16 +325,25 @@ fn emit_client_hello_for_retry(
|
|||
// We don't do renegotiation at all, in fact.
|
||||
cipher_suites.push(CipherSuite::TLS_EMPTY_RENEGOTIATION_INFO_SCSV);
|
||||
|
||||
let chp_payload = ClientHelloPayload {
|
||||
client_version: ProtocolVersion::TLSv1_2,
|
||||
random: input.random,
|
||||
session_id: input.session_id,
|
||||
cipher_suites,
|
||||
compression_methods: vec![Compression::Null],
|
||||
extensions: exts,
|
||||
};
|
||||
|
||||
// Note what extensions we sent.
|
||||
input.hello.sent_extensions = chp_payload
|
||||
.extensions
|
||||
.iter()
|
||||
.map(ClientExtension::ext_type)
|
||||
.collect();
|
||||
|
||||
let mut chp = HandshakeMessagePayload {
|
||||
typ: HandshakeType::ClientHello,
|
||||
payload: HandshakePayload::ClientHello(ClientHelloPayload {
|
||||
client_version: ProtocolVersion::TLSv1_2,
|
||||
random: input.random,
|
||||
session_id: input.session_id,
|
||||
cipher_suites,
|
||||
compression_methods: vec![Compression::Null],
|
||||
extensions: exts,
|
||||
}),
|
||||
payload: HandshakePayload::ClientHello(chp_payload),
|
||||
};
|
||||
|
||||
let early_key_schedule = if let Some(resuming) = tls13_session {
|
||||
|
|
Loading…
Reference in New Issue