summaryrefslogtreecommitdiffstats
path: root/lib/libssl/tls13_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2020-05-11 17:28:33 +0000
committerjsing <jsing@openbsd.org>2020-05-11 17:28:33 +0000
commita234fc1e1b9dc096f75a1e33b28224fce8f146c7 (patch)
tree618c7ff6aa9a2791b324b54e5fcad4fa0c183012 /lib/libssl/tls13_lib.c
parentUse ssl_get_new_session() in the TLSv1.3 server. (diff)
downloadwireguard-openbsd-a234fc1e1b9dc096f75a1e33b28224fce8f146c7.tar.xz
wireguard-openbsd-a234fc1e1b9dc096f75a1e33b28224fce8f146c7.zip
Move the record layer callbacks into a struct.
This makes the code more readable, requires less code churn when adding a new callback and is likely to avoid bugs due to function argument ordering. ok beck@ inoguchi@ tb@
Diffstat (limited to 'lib/libssl/tls13_lib.c')
-rw-r--r--lib/libssl/tls13_lib.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/libssl/tls13_lib.c b/lib/libssl/tls13_lib.c
index d3e4050c1e0..f096fe633ec 100644
--- a/lib/libssl/tls13_lib.c
+++ b/lib/libssl/tls13_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_lib.c,v 1.41 2020/05/10 16:56:11 jsing Exp $ */
+/* $OpenBSD: tls13_lib.c,v 1.42 2020/05/11 17:28:33 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2019 Bob Beck <beck@openbsd.org>
@@ -332,6 +332,14 @@ tls13_phh_received_cb(void *cb_arg, CBS *cbs)
return ret;
}
+static const struct tls13_record_layer_callbacks rl_callbacks = {
+ .wire_read = tls13_legacy_wire_read_cb,
+ .wire_write = tls13_legacy_wire_write_cb,
+ .alert_recv = tls13_alert_received_cb,
+ .phh_recv = tls13_phh_received_cb,
+ .phh_sent = tls13_phh_done_cb,
+};
+
struct tls13_ctx *
tls13_ctx_new(int mode)
{
@@ -342,9 +350,7 @@ tls13_ctx_new(int mode)
ctx->mode = mode;
- if ((ctx->rl = tls13_record_layer_new(tls13_legacy_wire_read_cb,
- tls13_legacy_wire_write_cb, tls13_alert_received_cb,
- tls13_phh_received_cb, tls13_phh_done_cb, ctx)) == NULL)
+ if ((ctx->rl = tls13_record_layer_new(&rl_callbacks, ctx)) == NULL)
goto err;
ctx->handshake_message_sent_cb = tls13_legacy_handshake_message_sent_cb;