Skip to content

Commit 1fa3a32

Browse files
committed
bogo: implement most client-side ECH tests
Getting bogo test coverage working for ECH requires taking a (temporary) dev-dep. on the provider-example crate so we can use the Rust Crypto HPKE provider. This in turn means that we now have two Rustls versions in tree, the src crate and the older version being used by the provider example by way of hickory-dns. This will fall away when proper HPKE support is implemented with one/both built-in crypto providers but in the meantime requires some small adjustments in CI and the runme script. In general the scope of a proper HPKE impl will be much less invasive than implementing ECH so we can use this hack for now and revisit shortly. The bogo shim also requires some updates to support new command line flags. Additionally in order to be able to assert some details in errors (e.g. that an ECH required err contained expected retry configs) we have to pipe the `Options` struct deeper into the client/server processing logic. To support ECH bogo testing w/ aws-lc-rs as the provider requires taking a patch on an unreleased aws-lc-rs fix that increases a `MAX_HKDF_INFO_LEN` constant beyond 80 bytes. In practice when computing ECH confirmation the info fed through the HKDF interface can be larger than 80 bytes and without this change the operation fails with an output length error. Beyond these changes, it's worth discussing the ignored tests. They're either not applicable, or need upstream bogo fixes: "TLS-ECH-Server*": We ignore all the TLS-ECH-Server tests. We haven't implemented server side ECH yet "TLS-ECH-Client-ExpectECHOuterExtensions" "TLS-ECH-Client-CompressSupportedVersions": These rely on extension compression between inner/outer hellos. NYI. "TLS-ECH-Client-SelectECHConfig" "TLS-ECH-Client-NoSupportedConfigs" These are meant to test unsupported configs are handled correctly: we happen to support the HPKE ciphersuites that make them "unsupported". There's a fix for this upstream we can take later. "TLS-ECH-Client-SkipInvalidPublicName*": Our name validation allows underscores in names. We also don't fallback to GREASE when there are no valid ECH configs. "TLS-ECH-Client-NoSupportedConfigs-GREASE": We don't fallback to GREASE for no ECH configs. "TLS-ECH-Client-Reject-ResumeInnerSession-TLS13": This test expects an unexpected extension error in the resumption connection, but this only happens if the outer hello didn't include GREASE PSK. BoringSSL's impl doesn't. Ours does. As a result we produce `:ECH_REJECTED:` instead of :UNEXPECTED_EXTENSION:` and have to ignore this test. "TLS-ECH-Client-TLS12-RejectRetryConfigs" "TLS-ECH-Client-Reject-NoClientCertificate-TLS12" "TLS-ECH-Client-Reject-TLS12" "TLS-ECH-Client-Reject-ResumeInnerSession-TLS12" "TLS-ECH-GREASE-Client-TLS12-RejectRetryConfigs" "TLS-ECH-Client-Reject-EarlyDataRejected-TLS12" "TLS-ECH-Client-Reject-NoClientCertificate-TLS12-Async" We never offer/support TLS 1.2 when using ECH. There's no fallback to plaintext or GREASE for a server that won't support TLS 1.3
1 parent 9de0b3d commit 1fa3a32

File tree

8 files changed

+192
-36
lines changed

8 files changed

+192
-36
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ jobs:
232232
uses: dtolnay/rust-toolchain@nightly
233233

234234
- name: Smoke-test benchmark program (ring)
235-
run: cargo run -p rustls --profile=bench --locked --example bench
235+
run: cargo run -p rustls@0.23.5 --profile=bench --locked --example bench
236236

237237
- name: Smoke-test benchmark program (aws-lc-rs)
238-
run: cargo run -p rustls --profile=bench --locked --example bench --no-default-features --features aws_lc_rs,tls12,std
238+
run: cargo run -p rustls@0.23.5 --profile=bench --locked --example bench --no-default-features --features aws_lc_rs,tls12,std
239239

240240
- name: Smoke-test benchmark program (fips)
241-
run: cargo run -p rustls --profile=bench --locked --example bench --no-default-features --features fips,tls12,std
241+
run: cargo run -p rustls@0.23.5 --profile=bench --locked --example bench --no-default-features --features fips,tls12,std
242242

243243
- name: Run micro-benchmarks
244244
run: cargo bench --locked --all-features
@@ -258,7 +258,7 @@ jobs:
258258
uses: dtolnay/rust-toolchain@nightly
259259

260260
- name: cargo doc (rustls; all features)
261-
run: cargo doc --locked --all-features --no-deps --document-private-items --package rustls
261+
run: cargo doc --locked --all-features --no-deps --document-private-items --package rustls@0.23.5
262262
env:
263263
RUSTDOCFLAGS: -Dwarnings
264264

@@ -403,7 +403,7 @@ jobs:
403403
components: clippy
404404
# because examples enable rustls' features, `--workspace --no-default-features` is not
405405
# the same as `--package rustls --no-default-features` so run it separately
406-
- run: cargo clippy --locked --package rustls --no-default-features --all-targets -- --deny warnings
406+
- run: cargo clippy --locked --package rustls@0.23.5 --no-default-features --all-targets -- --deny warnings
407407
- run: cargo clippy --locked --workspace --all-features --all-targets -- --deny warnings
408408
# not part of the workspace
409409
- run: cargo clippy --locked --manifest-path=fuzz/Cargo.toml --all-features --all-targets -- --deny warnings
@@ -420,7 +420,7 @@ jobs:
420420
uses: dtolnay/rust-toolchain@nightly
421421
with:
422422
components: clippy
423-
- run: cargo clippy --locked --package rustls --no-default-features --all-targets
423+
- run: cargo clippy --locked --package rustls@0.23.5 --no-default-features --all-targets
424424
- run: cargo clippy --locked --workspace --all-features --all-targets
425425
- run: cargo clippy --locked --manifest-path=fuzz/Cargo.toml --all-features --all-targets
426426

Cargo.lock

Lines changed: 5 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ lto = "yes"
3131
# TODO(XXX): Remove this once 0.25 is released - we want the ECH fixes from
3232
# https://github.com/hickory-dns/hickory-dns/pull/2183
3333
hickory-resolver = { git = "https://github.com/hickory-dns/hickory-dns", rev = "6334a01430088ead8642cafaee592ec7bf49831f" }
34+
35+
# TODO(XXX): Remove this once upstream HKDF info size limit increased.
36+
aws-lc-rs = { git = "https://github.com/cpu/aws-lc-rs", rev = "58f8fe83a42fb65a7efb65f4fe84234211318221" }

bogo/config.json.in

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,21 @@
3131
"ServerOCSPCallback*": "",
3232
"CertCompression*": "not implemented",
3333
"DuplicateCertCompressionExt*": "",
34-
"TLS-ECH-*": "",
34+
"TLS-ECH-Server*": "ECH server support NYI",
35+
"TLS-ECH-Client-ExpectECHOuterExtensions": "ECH extension compression NYI",
36+
"TLS-ECH-Client-CompressSupportedVersions": "ECH extension compression NYI",
37+
"TLS-ECH-Client-SelectECHConfig": "TODO(XXX): re-enable after upstream bogo fix",
38+
"TLS-ECH-Client-NoSupportedConfigs": "TODO(XXX): re-enable after upstream bogo fix",
39+
"TLS-ECH-Client-SkipInvalidPublicName*": "we allow underscore names, don't fallback on no ECH configs",
40+
"TLS-ECH-Client-NoSupportedConfigs-GREASE": "we don't fallback to GREASE for no ECH configs",
41+
"TLS-ECH-Client-TLS12-RejectRetryConfigs": "we disable TLS1.2 w/ ECH",
42+
"TLS-ECH-Client-Reject-NoClientCertificate-TLS12": "we disable TLS1.2 w/ ECH",
43+
"TLS-ECH-Client-Reject-TLS12": "we disable TLS1.2 w/ ECH",
44+
"TLS-ECH-Client-Reject-ResumeInnerSession-TLS12": "we disable TLS1.2 w/ ECH",
45+
"TLS-ECH-GREASE-Client-TLS12-RejectRetryConfigs": "we disable TLS1.2 w/ ECH",
46+
"TLS-ECH-Client-Reject-EarlyDataRejected-TLS12": "we disable TLS1.2 w/ ECH",
47+
"TLS-ECH-Client-Reject-NoClientCertificate-TLS12-Async": "we disable TLS1.2 w/ ECH",
48+
"TLS-ECH-Client-Reject-ResumeInnerSession-TLS13": "assumes no outter GREASE PSK, we send GREASE PSK",
3549
"ALPS-*": "",
3650
"*Kyber*": "",
3751
"ExtraClientEncryptedExtension-*": "we don't implement ALPS",

bogo/runme

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ set -xe
77

88
case ${BOGO_SHIM_PROVIDER:-aws-lc-rs} in
99
ring)
10-
cargo build -p rustls --example bogo_shim --no-default-features --features ring,tls12,logging,std
10+
cargo build -p rustls@0.23.5 --example bogo_shim --no-default-features --features ring,tls12,logging,std
1111
cpp -P -DRING config.json.in -oconfig.json
1212
;;
1313
aws-lc-rs)
14-
cargo build -p rustls --example bogo_shim --no-default-features --features aws_lc_rs,tls12,logging,std
14+
cargo build -p rustls@0.23.5 --example bogo_shim --no-default-features --features aws_lc_rs,tls12,logging,std
1515
cpp -P -DAWS_LC_RS config.json.in -oconfig.json
1616
;;
1717
existing)

fuzz/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rustls/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ rcgen = { version = "0.13", default-features = false, features = ["aws_lc_rs", "
4848
rustls-pemfile = "2"
4949
time = { version = "0.3.6", default-features = false }
5050
webpki-roots = "0.26"
51+
# TODO(@cpu): Remove once HPKE provider backed by aws-lc-rs and/or ring is available.
52+
rustls-provider-example = { path = "../provider-example" }
5153

5254
[target.'cfg(not(target_env = "msvc"))'.dev-dependencies]
5355
tikv-jemallocator = "0.5"

0 commit comments

Comments
 (0)