summaryrefslogtreecommitdiffstats
path: root/lib/libssl/tls13_handshake.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2020-01-23 02:24:38 +0000
committerjsing <jsing@openbsd.org>2020-01-23 02:24:38 +0000
commitdc02d6ed3bbe05ac89ecd902fe7339e6233fa3cc (patch)
treebd4fa4e8e196ae09d189870ecd6894782f05e302 /lib/libssl/tls13_handshake.c
parentciss(4): tsleep(9) -> tsleep_nsec(9) (diff)
downloadwireguard-openbsd-dc02d6ed3bbe05ac89ecd902fe7339e6233fa3cc.tar.xz
wireguard-openbsd-dc02d6ed3bbe05ac89ecd902fe7339e6233fa3cc.zip
Pass a CBB to TLSv1.3 send handlers.
This avoids the need for each send handler to call tls13_handshake_msg_start() and tls13_handshake_msg_finish(). ok beck@ tb@
Diffstat (limited to 'lib/libssl/tls13_handshake.c')
-rw-r--r--lib/libssl/tls13_handshake.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/libssl/tls13_handshake.c b/lib/libssl/tls13_handshake.c
index d4d998248d9..1157d6ecac2 100644
--- a/lib/libssl/tls13_handshake.c
+++ b/lib/libssl/tls13_handshake.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_handshake.c,v 1.40 2020/01/22 13:10:51 jsing Exp $ */
+/* $OpenBSD: tls13_handshake.c,v 1.41 2020/01/23 02:24:38 jsing Exp $ */
/*
* Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org>
* Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
@@ -30,7 +30,7 @@ struct tls13_handshake_action {
uint8_t handshake_complete;
uint8_t preserve_transcript_hash;
- int (*send)(struct tls13_ctx *ctx);
+ int (*send)(struct tls13_ctx *ctx, CBB *cbb);
int (*sent)(struct tls13_ctx *ctx);
int (*recv)(struct tls13_ctx *ctx, CBS *cbs);
};
@@ -321,17 +321,22 @@ tls13_handshake_send_action(struct tls13_ctx *ctx,
struct tls13_handshake_action *action)
{
ssize_t ret;
+ CBB cbb;
CBS cbs;
/* If we have no handshake message, we need to build one. */
if (ctx->hs_msg == NULL) {
if ((ctx->hs_msg = tls13_handshake_msg_new()) == NULL)
return TLS13_IO_FAILURE;
-
- /* XXX - provide CBB. */
- if (!action->send(ctx))
+ if (!tls13_handshake_msg_start(ctx->hs_msg, &cbb,
+ action->handshake_type))
+ return TLS13_IO_FAILURE;
+ if (!action->send(ctx, &cbb))
return TLS13_IO_FAILURE;
- else if (ctx->alert)
+ if (!tls13_handshake_msg_finish(ctx->hs_msg))
+ return TLS13_IO_FAILURE;
+
+ if (ctx->alert)
return tls13_send_alert(ctx->rl, ctx->alert);
}