aboutsummaryrefslogtreecommitdiff
path: root/ssl/handshake_server.cc
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2021-05-20 15:57:09 -0400
committerDavid Benjamin <davidben@google.com>2021-06-11 18:36:38 +0000
commit83a49939abb5a15508548ed1d33af8128d70cab5 (patch)
tree92124e67e0431fe53bd31862e73975bc5e4f49eb /ssl/handshake_server.cc
parent24545c541c424b4f9bd8f42edc06d84d6542e764 (diff)
downloadboringssl-83a49939abb5a15508548ed1d33af8128d70cab5.zip
boringssl-83a49939abb5a15508548ed1d33af8128d70cab5.tar.gz
boringssl-83a49939abb5a15508548ed1d33af8128d70cab5.tar.bz2
Add most of an ECH client implementation.
Based on an initial implementation by Dan McArdle at https://boringssl-review.googlesource.com/c/boringssl/+/46784 This CL contains most of a client implementation for draft-ietf-tls-esni-10. The pieces missing so far, which will be done in follow-up CLs are: 1. While the ClientHelloInner is padded, the server Certificate message is not. I'll add that once we resolve the spec discussions on how to do that. (We were originally going to use TLS record-level padding, but that doesn't work well with QUIC.) 2. The client should check the public name is a valid DNS name before copying it into ClientHelloOuter.server_name. 3. The ClientHelloOuter handshake flow is not yet implemented. This CL can detect when the server selects ClientHelloOuter, but for now the handshake immediately fails. A follow-up CL will remove that logic and instead add the APIs and extra checks needed. Otherwise, this should be complete, including padding and compression. The main interesting point design-wise is that we run through ClientHello construction multiple times. We need to construct ClientHelloInner and ClientHelloOuter. Then each of those has slight variants: EncodedClientHelloInner is the compressed form, and ClientHelloOuterAAD just has the ECH extension erased to avoid a circular dependency. I've computed ClientHelloInner and EncodedClientHelloInner concurrently because the compression scheme requires shifting the extensions around to be contiguous. However, I've computed ClientHelloOuterAAD and ClientHelloOuter by running through the logic twice. This probably can be done better, but the next draft revises the construction anyway, so I'm thinking I'll rework it then. (In the next draft, we use a placeholder payload of the same length, so we can construct the ClientHello once and fill in the payload.) Additionally, now that we have a client available in ssl_test, this adds a threading test to confirm that SSL_CTX_set1_ech_keys is properly synchronized. (Confirmed that, if I drop the lock in SSL_CTX_set1_ech_keys, TSan notices.) Change-Id: Icaff68b595035bdcc73c468ff638e67c84239ef4 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48004 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'ssl/handshake_server.cc')
-rw-r--r--ssl/handshake_server.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/ssl/handshake_server.cc b/ssl/handshake_server.cc
index c7d45f3..f6feb87 100644
--- a/ssl/handshake_server.cc
+++ b/ssl/handshake_server.cc
@@ -618,11 +618,11 @@ static enum ssl_hs_wait_t do_read_client_hello(SSL_HANDSHAKE *hs) {
}
if (hs->ech_keys) {
- for (const auto &ech_config : hs->ech_keys->configs) {
+ for (const auto &config : hs->ech_keys->configs) {
hs->ech_hpke_ctx.Reset();
- if (config_id != ech_config->config_id() ||
- !ech_config->SetupContext(hs->ech_hpke_ctx.get(), kdf_id, aead_id,
- enc)) {
+ if (config_id != config->ech_config().config_id ||
+ !config->SetupContext(hs->ech_hpke_ctx.get(), kdf_id, aead_id,
+ enc)) {
// Ignore the error and try another ECHConfig.
ERR_clear_error();
continue;