Skip to content

Commit d882860

Browse files
committed
Return more specific type from outer_hello_ext()
1 parent 34cdce3 commit d882860

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

rustls/src/client/ech.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -396,15 +396,13 @@ impl EchState {
396396
false => self.enc.0.clone(),
397397
};
398398

399-
fn outer_hello_ext(ctx: &EchState, enc: Vec<u8>, payload: Vec<u8>) -> ClientExtension {
400-
ClientExtension::EncryptedClientHello(EncryptedClientHello::Outer(
401-
EncryptedClientHelloOuter {
402-
cipher_suite: ctx.cipher_suite,
403-
config_id: ctx.config_id,
404-
enc: PayloadU16::new(enc),
405-
payload: PayloadU16::new(payload),
406-
},
407-
))
399+
fn outer_hello_ext(ctx: &EchState, enc: Vec<u8>, payload: Vec<u8>) -> EncryptedClientHello {
400+
EncryptedClientHello::Outer(EncryptedClientHelloOuter {
401+
cipher_suite: ctx.cipher_suite,
402+
config_id: ctx.config_id,
403+
enc: PayloadU16::new(enc),
404+
payload: PayloadU16::new(payload),
405+
})
408406
}
409407

410408
// The outer handshake is not permitted to resume a session. If we're resuming in the
@@ -418,7 +416,11 @@ impl EchState {
418416
// To compute the encoded AAD we add a placeholder extension with an empty payload.
419417
outer_hello
420418
.extensions
421-
.push(outer_hello_ext(self, enc.clone(), vec![0; payload_len]));
419+
.push(ClientExtension::EncryptedClientHello(outer_hello_ext(
420+
self,
421+
enc.clone(),
422+
vec![0; payload_len],
423+
)));
422424

423425
// Next we compute the proper extension payload.
424426
let payload = self
@@ -429,7 +431,9 @@ impl EchState {
429431
outer_hello.extensions.pop();
430432
outer_hello
431433
.extensions
432-
.push(outer_hello_ext(self, enc, payload));
434+
.push(ClientExtension::EncryptedClientHello(outer_hello_ext(
435+
self, enc, payload,
436+
)));
433437

434438
Ok(outer_hello)
435439
}

0 commit comments

Comments
 (0)