summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2020-05-10 14:07:01 +0000
committerjsing <>2020-05-10 14:07:01 +0000
commit460f8be5c360d203bab35f98b05092261d9701b0 (patch)
tree34f42dfbb5b736bec73cd24e71c4ae0431f0017f /src
parent591e19f9efe5d236b5f96c0eedefde55e6503ab3 (diff)
downloadopenbsd-460f8be5c360d203bab35f98b05092261d9701b0.tar.gz
openbsd-460f8be5c360d203bab35f98b05092261d9701b0.tar.bz2
openbsd-460f8be5c360d203bab35f98b05092261d9701b0.zip
Only reset TLS extension state when parsing client hello or server hello.
With TLSv1.3 we end up parsing extensions from more than just these two messages. This can result in variables (like the selected alpn) being freed when things still need them. ok tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/ssl_tlsext.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c
index bc122686c9..65e53f93be 100644
--- a/src/lib/libssl/ssl_tlsext.c
+++ b/src/lib/libssl/ssl_tlsext.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_tlsext.c,v 1.65 2020/05/09 15:05:50 beck Exp $ */ 1/* $OpenBSD: ssl_tlsext.c,v 1.66 2020/05/10 14:07:01 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> 4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
@@ -2061,8 +2061,9 @@ tlsext_server_build(SSL *s, CBB *cbb, uint16_t msg_type)
2061int 2061int
2062tlsext_server_parse(SSL *s, CBS *cbs, int *alert, uint16_t msg_type) 2062tlsext_server_parse(SSL *s, CBS *cbs, int *alert, uint16_t msg_type)
2063{ 2063{
2064 /* XXX - this possibly should be done by the caller... */ 2064 /* XXX - this should be done by the caller... */
2065 tlsext_server_reset_state(s); 2065 if (msg_type == SSL_TLSEXT_MSG_CH)
2066 tlsext_server_reset_state(s);
2066 2067
2067 return tlsext_parse(s, cbs, alert, 1, msg_type); 2068 return tlsext_parse(s, cbs, alert, 1, msg_type);
2068} 2069}
@@ -2084,8 +2085,9 @@ tlsext_client_build(SSL *s, CBB *cbb, uint16_t msg_type)
2084int 2085int
2085tlsext_client_parse(SSL *s, CBS *cbs, int *alert, uint16_t msg_type) 2086tlsext_client_parse(SSL *s, CBS *cbs, int *alert, uint16_t msg_type)
2086{ 2087{
2087 /* XXX - this possibly should be done by the caller... */ 2088 /* XXX - this should be done by the caller... */
2088 tlsext_client_reset_state(s); 2089 if (msg_type == SSL_TLSEXT_MSG_SH)
2090 tlsext_client_reset_state(s);
2089 2091
2090 return tlsext_parse(s, cbs, alert, 0, msg_type); 2092 return tlsext_parse(s, cbs, alert, 0, msg_type);
2091} 2093}