diff options
author | tb <> | 2021-06-08 17:41:52 +0000 |
---|---|---|
committer | tb <> | 2021-06-08 17:41:52 +0000 |
commit | 720abb9265f274966faea878c7359724d7a08ba6 (patch) | |
tree | 91efbc532fa039079abad86d2636838a62cd2b5d /src/lib | |
parent | 1b81c9d193b05da688d088eb4d92b1add0d56c02 (diff) | |
download | openbsd-720abb9265f274966faea878c7359724d7a08ba6.tar.gz openbsd-720abb9265f274966faea878c7359724d7a08ba6.tar.bz2 openbsd-720abb9265f274966faea878c7359724d7a08ba6.zip |
TLSv1.3 server: avoid sending alerts in legacy records
As soon as we know that we're dealing with a TLSv1.3 client, set
the legacy version in the record layer to 0x0303 so that we send
alerts with the correct record version. Previously we would send
early alerts with a record version of 0x0300.
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libssl/tls13_server.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libssl/tls13_server.c b/src/lib/libssl/tls13_server.c index 40454f8163..19ad0af487 100644 --- a/src/lib/libssl/tls13_server.c +++ b/src/lib/libssl/tls13_server.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_server.c,v 1.76 2021/05/16 14:10:43 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_server.c,v 1.77 2021/06/08 17:41:52 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> |
@@ -165,6 +165,9 @@ tls13_client_hello_process(struct tls13_ctx *ctx, CBS *cbs) | |||
165 | } | 165 | } |
166 | ctx->hs->negotiated_tls_version = TLS1_3_VERSION; | 166 | ctx->hs->negotiated_tls_version = TLS1_3_VERSION; |
167 | 167 | ||
168 | /* Ensure we send subsequent alerts with the correct record version. */ | ||
169 | tls13_record_layer_set_legacy_version(ctx->rl, TLS1_2_VERSION); | ||
170 | |||
168 | /* Add decoded values to the current ClientHello hash */ | 171 | /* Add decoded values to the current ClientHello hash */ |
169 | if (!tls13_clienthello_hash_init(ctx)) { | 172 | if (!tls13_clienthello_hash_init(ctx)) { |
170 | ctx->alert = TLS13_ALERT_INTERNAL_ERROR; | 173 | ctx->alert = TLS13_ALERT_INTERNAL_ERROR; |
@@ -282,8 +285,6 @@ tls13_client_hello_recv(struct tls13_ctx *ctx, CBS *cbs) | |||
282 | if (s->method->internal->version < TLS1_3_VERSION) | 285 | if (s->method->internal->version < TLS1_3_VERSION) |
283 | return 1; | 286 | return 1; |
284 | 287 | ||
285 | tls13_record_layer_set_legacy_version(ctx->rl, TLS1_2_VERSION); | ||
286 | |||
287 | /* | 288 | /* |
288 | * If a matching key share was provided, we do not need to send a | 289 | * If a matching key share was provided, we do not need to send a |
289 | * HelloRetryRequest. | 290 | * HelloRetryRequest. |