Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encrypted client hello configuration messages and serialization #1568

Merged
merged 2 commits into from Nov 8, 2023

Conversation

cpu
Copy link
Member

@cpu cpu commented Nov 3, 2023

This branch breaks out representation of Encrypted Client Hello (ECH) configuration from overall support for the feature. This code is relatively isolated and so can be added without much impact to the rest of the codebase. It does not provide any actual ECH support but is a necessary prerequisite.

The code is almost entirely derived from earlier WIP branches adding ECH support (notably, #663), but updated for the current Rustls codebase, and spot checked against the latest ECH draft at the time of writing (draft-17). HPKE references are also updated to use the published RFC (RFC 9180).

Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Merging #1568 (f876502) into main (e7a380f) will decrease coverage by 0.04%.
The diff coverage is 86.56%.

@@            Coverage Diff             @@
##             main    #1568      +/-   ##
==========================================
- Coverage   96.41%   96.37%   -0.04%     
==========================================
  Files          75       75              
  Lines       15507    15574      +67     
==========================================
+ Hits        14951    15010      +59     
- Misses        556      564       +8     
Files Coverage Δ
rustls/src/msgs/base.rs 93.26% <100.00%> (+0.26%) ⬆️
rustls/src/msgs/handshake.rs 97.95% <94.73%> (-0.15%) ⬇️
rustls/src/msgs/enums.rs 92.30% <0.00%> (-7.70%) ⬇️

... and 1 file with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

rustls/tests/ech.rs Outdated Show resolved Hide resolved
rustls/src/msgs/handshake.rs Outdated Show resolved Hide resolved
rustls/src/msgs/handshake.rs Outdated Show resolved Hide resolved
rustls/src/msgs/handshake.rs Outdated Show resolved Hide resolved
rustls/src/msgs/handshake.rs Outdated Show resolved Hide resolved
rustls/src/msgs/handshake.rs Show resolved Hide resolved
rustls/tests/ech.rs Outdated Show resolved Hide resolved
rustls/tests/ech.rs Outdated Show resolved Hide resolved
This commit breaks out representation of Encrypted Client Hello (ECH)
configuration from overall support for the feature. This code is
relatively isolated and so can be added without much impact to the rest
of the codebase. It does _not_ provide any actual ECH support.

The code is almost entirely derived from earlier WIP branches adding ECH
support, updated for the current Rustls codebase, and spot checked
against the current most ECH draft at the time of writing (draft-17).
HPKE references are also updated to use the published RFC (RFC 9180).

Notable updates from the WIP version:
* adapting to the `Codec` return type change.
* adapting to the enum builder changes.
* adapting to the server name changes.
* adapting to `TlsListElement` trait.
* adapting HPKE registry refs to use the RFC instead of an earlier
  draft.
* adding `Hpke` prefix to enums to clarify their purpose.
* adapting base64 usage to avoid deprecated fns.
* reworking unit tests for de-duplication, adding another encoded test
  case, adding more asserts for decoded content.
* fixing `clippy::use_self` finding.
* Changing `default` fn on `HpkeSymmetricCipherSuite` to be an impl of
  `Default`.
* Updating trust-dns-resolver code to use latest hickory-resolver.
* Pulling out ECH config fetch + deserialize from ECH example program to
  a connect-tests unit test.
This commit adds a new `connect-tests/tests/ech.rs` module that performs
a DNS over HTTPS lookup for HTTPS type records, finding `EchConfig`s and
testing we can deserialize the raw form into the Rustls representation
without error.

Presently it tests against:
* `crypto.cloudflare.com`
* `defo.ie`
* `tls-ech.dev`

Since these are network based tests they need to live in `connect-tests`
to avoid flakyness during normal CI runs.

In previous WIP branches this was done as part of an overall end-to-end
example of using ECH, but we can test this in isolation ahead of having
full ECH support.
@cpu cpu added this pull request to the merge queue Nov 8, 2023
Merged via the queue into rustls:main with commit de9bf1d Nov 8, 2023
22 of 23 checks passed
@cpu cpu deleted the cpu-ech-config branch November 8, 2023 13:46
@imsys
Copy link

imsys commented Nov 13, 2023

Just tagging for better tracking.

@cpu cpu mentioned this pull request Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants