summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls13_handshake.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/tls13_handshake.c')
-rw-r--r--src/lib/libssl/tls13_handshake.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/lib/libssl/tls13_handshake.c b/src/lib/libssl/tls13_handshake.c
index d4d998248d..1157d6ecac 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.40 2020/01/22 13:10:51 jsing Exp $ */ 1/* $OpenBSD: tls13_handshake.c,v 1.41 2020/01/23 02:24:38 jsing 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>
@@ -30,7 +30,7 @@ struct tls13_handshake_action {
30 uint8_t handshake_complete; 30 uint8_t handshake_complete;
31 uint8_t preserve_transcript_hash; 31 uint8_t preserve_transcript_hash;
32 32
33 int (*send)(struct tls13_ctx *ctx); 33 int (*send)(struct tls13_ctx *ctx, CBB *cbb);
34 int (*sent)(struct tls13_ctx *ctx); 34 int (*sent)(struct tls13_ctx *ctx);
35 int (*recv)(struct tls13_ctx *ctx, CBS *cbs); 35 int (*recv)(struct tls13_ctx *ctx, CBS *cbs);
36}; 36};
@@ -321,17 +321,22 @@ tls13_handshake_send_action(struct tls13_ctx *ctx,
321 struct tls13_handshake_action *action) 321 struct tls13_handshake_action *action)
322{ 322{
323 ssize_t ret; 323 ssize_t ret;
324 CBB cbb;
324 CBS cbs; 325 CBS cbs;
325 326
326 /* If we have no handshake message, we need to build one. */ 327 /* If we have no handshake message, we need to build one. */
327 if (ctx->hs_msg == NULL) { 328 if (ctx->hs_msg == NULL) {
328 if ((ctx->hs_msg = tls13_handshake_msg_new()) == NULL) 329 if ((ctx->hs_msg = tls13_handshake_msg_new()) == NULL)
329 return TLS13_IO_FAILURE; 330 return TLS13_IO_FAILURE;
330 331 if (!tls13_handshake_msg_start(ctx->hs_msg, &cbb,
331 /* XXX - provide CBB. */ 332 action->handshake_type))
332 if (!action->send(ctx)) 333 return TLS13_IO_FAILURE;
334 if (!action->send(ctx, &cbb))
333 return TLS13_IO_FAILURE; 335 return TLS13_IO_FAILURE;
334 else if (ctx->alert) 336 if (!tls13_handshake_msg_finish(ctx->hs_msg))
337 return TLS13_IO_FAILURE;
338
339 if (ctx->alert)
335 return tls13_send_alert(ctx->rl, ctx->alert); 340 return tls13_send_alert(ctx->rl, ctx->alert);
336 } 341 }
337 342