summaryrefslogtreecommitdiffstats
path: root/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2020-09-14 18:34:12 +0000
committerjsing <jsing@openbsd.org>2020-09-14 18:34:12 +0000
commit79bec84b0ca05d11f9b6be02d860b225d90442ae (patch)
treea73b9b0c2b8d3d2d9621693d26b43da274f892f7 /lib/libssl/ssl_lib.c
parentFix handling of user names containing '@' symbols. (diff)
downloadwireguard-openbsd-79bec84b0ca05d11f9b6be02d860b225d90442ae.tar.xz
wireguard-openbsd-79bec84b0ca05d11f9b6be02d860b225d90442ae.zip
Move state initialisation from SSL_clear() to ssl3_clear().
If we use the default method (now TLSv1.3) and end up talking to a TLSv1.2 server that gives us a session ticket, then try to resume that session, we end up trying to talk TLS without doing a handshake. This is caused by the state (S3I(s)->hs.state) getting cleared, which results in SSL_do_handshake() and others thinking they do not need to do anything (as SSL_in_init() and SSL_in_before() are not true). The reason this occurs is due to SSL_set_ssl_method() calling ssl_free() and ssl_new() when switching methods. The end result is that the S3I(s) has been freed and reallocated, losing the state in the process. Since the state is part of the S3I(s) structure, move its initialisation into ssl3_clear() - this ensures it gets correctly reinitialised across a SSL_set_ssl_method() call. Issue noticed by sthen@ with nginx and unifi. ok beck@ tb@
Diffstat (limited to 'lib/libssl/ssl_lib.c')
-rw-r--r--lib/libssl/ssl_lib.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c
index a194e5639a7..82c544c6204 100644
--- a/lib/libssl/ssl_lib.c
+++ b/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_lib.c,v 1.226 2020/09/13 16:49:05 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.227 2020/09/14 18:34:12 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -216,8 +216,6 @@ SSL_clear(SSL *s)
} else
s->method->internal->ssl_clear(s);
- S3I(s)->hs.state = SSL_ST_BEFORE|((s->server) ? SSL_ST_ACCEPT : SSL_ST_CONNECT);
-
return (1);
}