diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2021-03-10 18:27:03 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2021-03-10 18:27:03 +0000 |
commit | 06d4511f550945476dc17abd95853923792052be (patch) | |
tree | d3485c697017cae21d625c75682302bf3b8c7228 /lib/libssl/ssl_sigalgs.c | |
parent | 1b9ee26d82faa9776b136c078d6fbe082eb6459c (diff) |
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/ssl_sigalgs.c')
-rw-r--r-- | lib/libssl/ssl_sigalgs.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libssl/ssl_sigalgs.c b/lib/libssl/ssl_sigalgs.c index 1b5aad72f7b..68bb6a38896 100644 --- a/lib/libssl/ssl_sigalgs.c +++ b/lib/libssl/ssl_sigalgs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_sigalgs.c,v 1.22 2020/10/11 01:13:04 guenther Exp $ */ +/* $OpenBSD: ssl_sigalgs.c,v 1.23 2021/03/10 18:27:02 jsing Exp $ */ /* * Copyright (c) 2018-2020 Bob Beck <beck@openbsd.org> * @@ -265,7 +265,7 @@ ssl_sigalg_select(SSL *s, EVP_PKEY *pkey) int check_curve = 0; CBS cbs; - if (TLS1_get_version(s) >= TLS1_3_VERSION) { + if (S3I(s)->hs.negotiated_tls_version >= TLS1_3_VERSION) { tls_sigalgs = tls13_sigalgs; tls_sigalgs_len = tls13_sigalgs_len; check_curve = 1; @@ -291,7 +291,7 @@ ssl_sigalg_select(SSL *s, EVP_PKEY *pkey) * RFC 5246 allows a TLS 1.2 client to send no sigalgs, in * which case the server must use the the default. */ - if (TLS1_get_version(s) < TLS1_3_VERSION && + if (S3I(s)->hs.negotiated_tls_version < TLS1_3_VERSION && S3I(s)->hs.sigalgs == NULL) { switch (pkey->type) { case EVP_PKEY_RSA: @@ -323,7 +323,7 @@ ssl_sigalg_select(SSL *s, EVP_PKEY *pkey) continue; /* RSA cannot be used without PSS in TLSv1.3. */ - if (TLS1_get_version(s) >= TLS1_3_VERSION && + if (S3I(s)->hs.negotiated_tls_version >= TLS1_3_VERSION && sigalg->key_type == EVP_PKEY_RSA && (sigalg->flags & SIGALG_FLAG_RSA_PSS) == 0) continue; |