diff options
author | 2021-03-10 18:27:01 +0000 | |
---|---|---|
committer | 2021-03-10 18:27:01 +0000 | |
commit | c5e6469d48821e65e529c0cc22a8e2488f1c75fe (patch) | |
tree | d9d607ff358c016d608848d92624de428bd26f32 /lib/libssl/tls13_server.c | |
parent | do not request client certificate unless required (diff) | |
download | wireguard-openbsd-c5e6469d48821e65e529c0cc22a8e2488f1c75fe.tar.xz wireguard-openbsd-c5e6469d48821e65e529c0cc22a8e2488f1c75fe.zip |
Improve internal version handling.
Add handshake fields for our minimum TLS version, our maximum TLS version
and the TLS version negotiated during the handshake. Initialise our min/max
versions at the start of the handshake and leave these unchanged. The
negotiated TLS version is set in the client once we receive the ServerHello
and in the server at the point we select the highest shared version.
Provide an ssl_effective_version() function that returns the negotiated TLS
version if known, otherwise our maximum TLS version - this is effectively
what is stored in s->version currently.
Convert most of the internal code to use one of these three version fields,
which greatly simplifies code (especially in the TLS extension handling
code).
ok tb@
Diffstat (limited to 'lib/libssl/tls13_server.c')
-rw-r--r-- | lib/libssl/tls13_server.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libssl/tls13_server.c b/lib/libssl/tls13_server.c index 715066fb591..29c63bcd06b 100644 --- a/lib/libssl/tls13_server.c +++ b/lib/libssl/tls13_server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_server.c,v 1.70 2021/02/25 17:06:05 jsing Exp $ */ +/* $OpenBSD: tls13_server.c,v 1.71 2021/03/10 18:27:02 jsing Exp $ */ /* * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> * Copyright (c) 2020 Bob Beck <beck@openbsd.org> @@ -29,12 +29,12 @@ tls13_server_init(struct tls13_ctx *ctx) { SSL *s = ctx->ssl; - if (!ssl_supported_tls_version_range(s, &ctx->hs->min_version, - &ctx->hs->max_version)) { + if (!ssl_supported_tls_version_range(s, &S3I(s)->hs.our_min_tls_version, + &S3I(s)->hs.our_max_tls_version)) { SSLerror(s, SSL_R_NO_PROTOCOLS_AVAILABLE); return 0; } - s->version = ctx->hs->max_version; + s->version = S3I(s)->hs.our_max_tls_version; tls13_record_layer_set_retry_after_phh(ctx->rl, (s->internal->mode & SSL_MODE_AUTO_RETRY) != 0); @@ -163,6 +163,7 @@ tls13_client_hello_process(struct tls13_ctx *ctx, CBS *cbs) goto err; return tls13_use_legacy_server(ctx); } + S3I(s)->hs.negotiated_tls_version = TLS1_3_VERSION; /* Add decoded values to the current ClientHello hash */ if (!tls13_clienthello_hash_init(ctx)) { |