diff options
author | jsing <> | 2021-03-10 18:27:02 +0000 |
---|---|---|
committer | jsing <> | 2021-03-10 18:27:02 +0000 |
commit | bec282ffa4cbd669be0dc9e8fab07c4c21ebcb66 (patch) | |
tree | d994b83bcf4c074517ad35a21855741c2995e67b /src/lib/libssl/ssl_pkt.c | |
parent | 9108b7f38107e9f7ce1aaa33e615a7935b057ad0 (diff) | |
download | openbsd-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_pkt.c')
-rw-r--r-- | src/lib/libssl/ssl_pkt.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libssl/ssl_pkt.c b/src/lib/libssl/ssl_pkt.c index 894064c817..5b1af504fb 100644 --- a/src/lib/libssl/ssl_pkt.c +++ b/src/lib/libssl/ssl_pkt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_pkt.c,v 1.36 2021/02/20 14:14:16 tb Exp $ */ | 1 | /* $OpenBSD: ssl_pkt.c,v 1.37 2021/03/10 18:27:02 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -561,8 +561,9 @@ do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len) | |||
561 | * bytes and record version number > TLS 1.0. | 561 | * bytes and record version number > TLS 1.0. |
562 | */ | 562 | */ |
563 | version = s->version; | 563 | version = s->version; |
564 | if (S3I(s)->hs.state == SSL3_ST_CW_CLNT_HELLO_B && !s->internal->renegotiate && | 564 | if (S3I(s)->hs.state == SSL3_ST_CW_CLNT_HELLO_B && |
565 | TLS1_get_version(s) > TLS1_VERSION) | 565 | !s->internal->renegotiate && |
566 | S3I(s)->hs.our_max_tls_version > TLS1_VERSION) | ||
566 | version = TLS1_VERSION; | 567 | version = TLS1_VERSION; |
567 | 568 | ||
568 | /* | 569 | /* |