summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_sigalgs.c
diff options
context:
space:
mode:
authorjsing <>2021-03-10 18:27:02 +0000
committerjsing <>2021-03-10 18:27:02 +0000
commitbec282ffa4cbd669be0dc9e8fab07c4c21ebcb66 (patch)
treed994b83bcf4c074517ad35a21855741c2995e67b /src/lib/libssl/ssl_sigalgs.c
parent9108b7f38107e9f7ce1aaa33e615a7935b057ad0 (diff)
downloadopenbsd-bec282ffa4cbd669be0dc9e8fab07c4c21ebcb66.tar.gz
openbsd-bec282ffa4cbd669be0dc9e8fab07c4c21ebcb66.tar.bz2
openbsd-bec282ffa4cbd669be0dc9e8fab07c4c21ebcb66.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 'src/lib/libssl/ssl_sigalgs.c')
-rw-r--r--src/lib/libssl/ssl_sigalgs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libssl/ssl_sigalgs.c b/src/lib/libssl/ssl_sigalgs.c
index 1b5aad72f7..68bb6a3889 100644
--- a/src/lib/libssl/ssl_sigalgs.c
+++ b/src/lib/libssl/ssl_sigalgs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_sigalgs.c,v 1.22 2020/10/11 01:13:04 guenther Exp $ */ 1/* $OpenBSD: ssl_sigalgs.c,v 1.23 2021/03/10 18:27:02 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018-2020 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018-2020 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -265,7 +265,7 @@ ssl_sigalg_select(SSL *s, EVP_PKEY *pkey)
265 int check_curve = 0; 265 int check_curve = 0;
266 CBS cbs; 266 CBS cbs;
267 267
268 if (TLS1_get_version(s) >= TLS1_3_VERSION) { 268 if (S3I(s)->hs.negotiated_tls_version >= TLS1_3_VERSION) {
269 tls_sigalgs = tls13_sigalgs; 269 tls_sigalgs = tls13_sigalgs;
270 tls_sigalgs_len = tls13_sigalgs_len; 270 tls_sigalgs_len = tls13_sigalgs_len;
271 check_curve = 1; 271 check_curve = 1;
@@ -291,7 +291,7 @@ ssl_sigalg_select(SSL *s, EVP_PKEY *pkey)
291 * RFC 5246 allows a TLS 1.2 client to send no sigalgs, in 291 * RFC 5246 allows a TLS 1.2 client to send no sigalgs, in
292 * which case the server must use the the default. 292 * which case the server must use the the default.
293 */ 293 */
294 if (TLS1_get_version(s) < TLS1_3_VERSION && 294 if (S3I(s)->hs.negotiated_tls_version < TLS1_3_VERSION &&
295 S3I(s)->hs.sigalgs == NULL) { 295 S3I(s)->hs.sigalgs == NULL) {
296 switch (pkey->type) { 296 switch (pkey->type) {
297 case EVP_PKEY_RSA: 297 case EVP_PKEY_RSA:
@@ -323,7 +323,7 @@ ssl_sigalg_select(SSL *s, EVP_PKEY *pkey)
323 continue; 323 continue;
324 324
325 /* RSA cannot be used without PSS in TLSv1.3. */ 325 /* RSA cannot be used without PSS in TLSv1.3. */
326 if (TLS1_get_version(s) >= TLS1_3_VERSION && 326 if (S3I(s)->hs.negotiated_tls_version >= TLS1_3_VERSION &&
327 sigalg->key_type == EVP_PKEY_RSA && 327 sigalg->key_type == EVP_PKEY_RSA &&
328 (sigalg->flags & SIGALG_FLAG_RSA_PSS) == 0) 328 (sigalg->flags & SIGALG_FLAG_RSA_PSS) == 0)
329 continue; 329 continue;