diff options
author | jsing <> | 2020-01-26 07:24:47 +0000 |
---|---|---|
committer | jsing <> | 2020-01-26 07:24:47 +0000 |
commit | 1b26de44d271b3f7f83a642504512a3bcf349f8b (patch) | |
tree | 1b56e41640150c0da0d7ea761ea18a7cc78ae488 /src | |
parent | 2c5f414c66d94839172e610df260529eecc306db (diff) | |
download | openbsd-1b26de44d271b3f7f83a642504512a3bcf349f8b.tar.gz openbsd-1b26de44d271b3f7f83a642504512a3bcf349f8b.tar.bz2 openbsd-1b26de44d271b3f7f83a642504512a3bcf349f8b.zip |
When an SSL method is set, bump the max version back to that of the
incoming method if it is a client.
This addresses the case where TLS_method() is used to initialise a SSL_CTX,
then a TLS_client_method() is then set, resulting in TLSv1.2 being used
instead of TLSv1.3. This is observable in smtpd.
ok beck@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/ssl_lib.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index a6bdfaa4a1..a5a79d76bc 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_lib.c,v 1.210 2020/01/23 10:40:59 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.211 2020/01/26 07:24:47 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 | * |
@@ -2240,6 +2240,15 @@ SSL_set_ssl_method(SSL *s, const SSL_METHOD *meth) | |||
2240 | ret = s->method->internal->ssl_new(s); | 2240 | ret = s->method->internal->ssl_new(s); |
2241 | } | 2241 | } |
2242 | 2242 | ||
2243 | /* | ||
2244 | * XXX - reset the client max version to that of the incoming | ||
2245 | * method, otherwise a caller that uses a TLS_method() and then | ||
2246 | * sets with TLS_client_method() cannot do TLSv1.3. | ||
2247 | */ | ||
2248 | if (meth->internal->max_version == TLS1_3_VERSION && | ||
2249 | meth->internal->ssl_connect != NULL) | ||
2250 | s->internal->max_version = meth->internal->max_version; | ||
2251 | |||
2243 | if (conn == 1) | 2252 | if (conn == 1) |
2244 | s->internal->handshake_func = meth->internal->ssl_connect; | 2253 | s->internal->handshake_func = meth->internal->ssl_connect; |
2245 | else if (conn == 0) | 2254 | else if (conn == 0) |