summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls13_lib.c
diff options
context:
space:
mode:
authortb <>2020-02-05 06:12:43 +0000
committertb <>2020-02-05 06:12:43 +0000
commit2ea9bc2f2eed516702797aac6d428221092613a3 (patch)
tree2294088e149a61d156b174d66775d37a987dcc32 /src/lib/libssl/tls13_lib.c
parentf785987ce739e20256eb67b362a15f289d5120b3 (diff)
downloadopenbsd-2ea9bc2f2eed516702797aac6d428221092613a3.tar.gz
openbsd-2ea9bc2f2eed516702797aac6d428221092613a3.tar.bz2
openbsd-2ea9bc2f2eed516702797aac6d428221092613a3.zip
Rework tls13_legacy_handshake_message_{recv,sent}_cb() to use
their own CBS as a preparation for upcoming HRR diffs. ok jsing
Diffstat (limited to 'src/lib/libssl/tls13_lib.c')
-rw-r--r--src/lib/libssl/tls13_lib.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c
index 3a90c0d6df..92743ef4b3 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.32 2020/01/29 17:03:58 jsing Exp $ */ 1/* $OpenBSD: tls13_lib.c,v 1.33 2020/02/05 06:12:43 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>
@@ -106,27 +106,33 @@ tls13_alert_received_cb(uint8_t alert_desc, void *arg)
106} 106}
107 107
108static void 108static void
109tls13_legacy_handshake_message_recv_cb(void *arg, CBS *cbs) 109tls13_legacy_handshake_message_recv_cb(void *arg)
110{ 110{
111 struct tls13_ctx *ctx = arg; 111 struct tls13_ctx *ctx = arg;
112 SSL *s = ctx->ssl; 112 SSL *s = ctx->ssl;
113 CBS cbs;
113 114
114 if (s->internal->msg_callback != NULL) 115 if (s->internal->msg_callback == NULL)
115 s->internal->msg_callback(0, TLS1_3_VERSION, SSL3_RT_HANDSHAKE, 116 return;
116 CBS_data(cbs), CBS_len(cbs), s, 117
117 s->internal->msg_callback_arg); 118 tls13_handshake_msg_data(ctx->hs_msg, &cbs);
119 s->internal->msg_callback(0, TLS1_3_VERSION, SSL3_RT_HANDSHAKE,
120 CBS_data(&cbs), CBS_len(&cbs), s, s->internal->msg_callback_arg);
118} 121}
119 122
120static void 123static void
121tls13_legacy_handshake_message_sent_cb(void *arg, CBS *cbs) 124tls13_legacy_handshake_message_sent_cb(void *arg)
122{ 125{
123 struct tls13_ctx *ctx = arg; 126 struct tls13_ctx *ctx = arg;
124 SSL *s = ctx->ssl; 127 SSL *s = ctx->ssl;
128 CBS cbs;
129
130 if (s->internal->msg_callback == NULL)
131 return;
125 132
126 if (s->internal->msg_callback != NULL) 133 tls13_handshake_msg_data(ctx->hs_msg, &cbs);
127 s->internal->msg_callback(1, TLS1_3_VERSION, SSL3_RT_HANDSHAKE, 134 s->internal->msg_callback(1, TLS1_3_VERSION, SSL3_RT_HANDSHAKE,
128 CBS_data(cbs), CBS_len(cbs), s, 135 CBS_data(&cbs), CBS_len(&cbs), s, s->internal->msg_callback_arg);
129 s->internal->msg_callback_arg);
130} 136}
131 137
132static int 138static int