diff options
author | tb <> | 2020-07-30 16:23:17 +0000 |
---|---|---|
committer | tb <> | 2020-07-30 16:23:17 +0000 |
commit | c83de9bf1a5deaa83030eac8eb7a2ce4749d120d (patch) | |
tree | ea30368cd2d92bed397d7b50b859b333c5b0ccc6 /src/lib/libssl/tls13_lib.c | |
parent | aac53677fa701dbcea49076f866c4ffbc99edfad (diff) | |
download | openbsd-c83de9bf1a5deaa83030eac8eb7a2ce4749d120d.tar.gz openbsd-c83de9bf1a5deaa83030eac8eb7a2ce4749d120d.tar.bz2 openbsd-c83de9bf1a5deaa83030eac8eb7a2ce4749d120d.zip |
Add minimal info callback support for TLSv1.3
As abieber@ found the hard way, some python frameworks (twisted, synapse)
thought it a great idea to use the info callback mechanism (designed to
get state information about SSL objects) to modify state information such
as setting and verifying the SNI. The switch of TLS_method() to default
to TLSv1.3 broke these contraptions. Further bits of the info callback
mechanism will likely metastasize throughout the TLSv1.3 stack if we
need them, so we only do what's really necessary now.
Lots of debugging, crucial hint and testing by abieber
input & ok jsing
Diffstat (limited to 'src/lib/libssl/tls13_lib.c')
-rw-r--r-- | src/lib/libssl/tls13_lib.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c index 8fef39a12f..1f19bef997 100644 --- a/src/lib/libssl/tls13_lib.c +++ b/src/lib/libssl/tls13_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_lib.c,v 1.52 2020/07/03 04:12:51 tb Exp $ */ | 1 | /* $OpenBSD: tls13_lib.c,v 1.53 2020/07/30 16:23:17 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2019 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2019 Bob Beck <beck@openbsd.org> |
@@ -180,6 +180,19 @@ tls13_legacy_handshake_message_sent_cb(void *arg) | |||
180 | CBS_data(&cbs), CBS_len(&cbs), s, s->internal->msg_callback_arg); | 180 | CBS_data(&cbs), CBS_len(&cbs), s, s->internal->msg_callback_arg); |
181 | } | 181 | } |
182 | 182 | ||
183 | static void | ||
184 | tls13_legacy_info_cb(void *arg, int state, int ret) | ||
185 | { | ||
186 | struct tls13_ctx *ctx = arg; | ||
187 | SSL *s = ctx->ssl; | ||
188 | void (*cb)(const SSL *, int, int); | ||
189 | |||
190 | if ((cb = s->internal->info_callback) == NULL) | ||
191 | cb = s->ctx->internal->info_callback; | ||
192 | if (cb != NULL) | ||
193 | cb(s, state, ret); | ||
194 | } | ||
195 | |||
183 | static int | 196 | static int |
184 | tls13_legacy_ocsp_status_recv_cb(void *arg) | 197 | tls13_legacy_ocsp_status_recv_cb(void *arg) |
185 | { | 198 | { |
@@ -388,6 +401,7 @@ tls13_ctx_new(int mode) | |||
388 | 401 | ||
389 | ctx->handshake_message_sent_cb = tls13_legacy_handshake_message_sent_cb; | 402 | ctx->handshake_message_sent_cb = tls13_legacy_handshake_message_sent_cb; |
390 | ctx->handshake_message_recv_cb = tls13_legacy_handshake_message_recv_cb; | 403 | ctx->handshake_message_recv_cb = tls13_legacy_handshake_message_recv_cb; |
404 | ctx->info_cb = tls13_legacy_info_cb; | ||
391 | ctx->ocsp_status_recv_cb = tls13_legacy_ocsp_status_recv_cb; | 405 | ctx->ocsp_status_recv_cb = tls13_legacy_ocsp_status_recv_cb; |
392 | 406 | ||
393 | ctx->middlebox_compat = 1; | 407 | ctx->middlebox_compat = 1; |