diff options
| author | jsing <> | 2020-01-26 07:24:47 +0000 |
|---|---|---|
| committer | jsing <> | 2020-01-26 07:24:47 +0000 |
| commit | 0f9da56897d767257c99e2ce672b39333033fffb (patch) | |
| tree | 1b56e41640150c0da0d7ea761ea18a7cc78ae488 /src/lib/libssl/ssl_lib.c | |
| parent | 73568496f853bd4748ed4bc0410b24cdefaa9e53 (diff) | |
| download | openbsd-0f9da56897d767257c99e2ce672b39333033fffb.tar.gz openbsd-0f9da56897d767257c99e2ce672b39333033fffb.tar.bz2 openbsd-0f9da56897d767257c99e2ce672b39333033fffb.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/lib/libssl/ssl_lib.c')
| -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) |
