summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/tls13_handshake.c6
-rw-r--r--src/lib/libssl/tls13_internal.h4
-rw-r--r--src/lib/libssl/tls13_lib.c28
3 files changed, 22 insertions, 16 deletions
diff --git a/src/lib/libssl/tls13_handshake.c b/src/lib/libssl/tls13_handshake.c
index 31bd796b93..c850e716e7 100644
--- a/src/lib/libssl/tls13_handshake.c
+++ b/src/lib/libssl/tls13_handshake.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_handshake.c,v 1.49 2020/01/29 13:44:42 tb Exp $ */ 1/* $OpenBSD: tls13_handshake.c,v 1.50 2020/02/05 06:12:43 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org>
4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
@@ -355,7 +355,7 @@ tls13_handshake_send_action(struct tls13_ctx *ctx,
355 } 355 }
356 356
357 if (ctx->handshake_message_sent_cb != NULL) 357 if (ctx->handshake_message_sent_cb != NULL)
358 ctx->handshake_message_sent_cb(ctx, &cbs); 358 ctx->handshake_message_sent_cb(ctx);
359 359
360 tls13_handshake_msg_free(ctx->hs_msg); 360 tls13_handshake_msg_free(ctx->hs_msg);
361 ctx->hs_msg = NULL; 361 ctx->hs_msg = NULL;
@@ -394,7 +394,7 @@ tls13_handshake_recv_action(struct tls13_ctx *ctx,
394 return TLS13_IO_FAILURE; 394 return TLS13_IO_FAILURE;
395 395
396 if (ctx->handshake_message_recv_cb != NULL) 396 if (ctx->handshake_message_recv_cb != NULL)
397 ctx->handshake_message_recv_cb(ctx, &cbs); 397 ctx->handshake_message_recv_cb(ctx);
398 398
399 /* 399 /*
400 * In TLSv1.3 there is no way to know if you're going to receive a 400 * In TLSv1.3 there is no way to know if you're going to receive a
diff --git a/src/lib/libssl/tls13_internal.h b/src/lib/libssl/tls13_internal.h
index 00035ea36e..2c325fe914 100644
--- a/src/lib/libssl/tls13_internal.h
+++ b/src/lib/libssl/tls13_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_internal.h,v 1.58 2020/01/30 17:09:23 jsing Exp $ */ 1/* $OpenBSD: tls13_internal.h,v 1.59 2020/02/05 06:12:43 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
@@ -50,7 +50,7 @@ typedef void (*tls13_phh_sent_cb)(void *_cb_arg);
50typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg); 50typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg);
51typedef ssize_t (*tls13_write_cb)(const void *_buf, size_t _buflen, 51typedef ssize_t (*tls13_write_cb)(const void *_buf, size_t _buflen,
52 void *_cb_arg); 52 void *_cb_arg);
53typedef void (*tls13_handshake_message_cb)(void *_cb_arg, CBS *_cbs); 53typedef void (*tls13_handshake_message_cb)(void *_cb_arg);
54 54
55/* 55/*
56 * Buffers. 56 * Buffers.
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