diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2020-05-09 08:39:45 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2020-05-09 08:39:45 +0000 |
commit | 7033c0cf4734df91620810ae40988b6aeed2e158 (patch) | |
tree | 39c4eb3d5ae95cf8692f3fda24ae55b6ea2bae79 /lib/libssl | |
parent | e4f00949afe5a2bc05be918311ab1bbc3580b2ff (diff) |
Pull the sending of alerts up into tls13_handshake_perform().
This fixes the case where a send function signals that an alert should be
sent, then returns failure. Previously the failure would be propagated
up, without the alert being sent.
Issued noted by tb@
ok tb@
Diffstat (limited to 'lib/libssl')
-rw-r--r-- | lib/libssl/tls13_handshake.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/libssl/tls13_handshake.c b/lib/libssl/tls13_handshake.c index d324a7f4ba1..d739dc99e58 100644 --- a/lib/libssl/tls13_handshake.c +++ b/lib/libssl/tls13_handshake.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_handshake.c,v 1.55 2020/05/02 00:30:55 inoguchi Exp $ */ +/* $OpenBSD: tls13_handshake.c,v 1.56 2020/05/09 08:39:44 jsing Exp $ */ /* * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org> * Copyright (c) 2019 Joel Sing <jsing@openbsd.org> @@ -309,13 +309,16 @@ tls13_handshake_perform(struct tls13_ctx *ctx) if (ctx->alert) return tls13_send_alert(ctx->rl, ctx->alert); - if (action->sender == ctx->mode) { - if ((ret = tls13_handshake_send_action(ctx, action)) <= 0) - return ret; - } else { - if ((ret = tls13_handshake_recv_action(ctx, action)) <= 0) - return ret; - } + if (action->sender == ctx->mode) + ret = tls13_handshake_send_action(ctx, action); + else + ret = tls13_handshake_recv_action(ctx, action); + + if (ctx->alert) + return tls13_send_alert(ctx->rl, ctx->alert); + + if (ret <= 0) + return ret; if (!tls13_handshake_advance_state_machine(ctx)) return TLS13_IO_FAILURE; @@ -340,9 +343,6 @@ tls13_handshake_send_action(struct tls13_ctx *ctx, return TLS13_IO_FAILURE; if (!tls13_handshake_msg_finish(ctx->hs_msg)) return TLS13_IO_FAILURE; - - if (ctx->alert) - return tls13_send_alert(ctx->rl, ctx->alert); } if ((ret = tls13_handshake_msg_send(ctx->hs_msg, ctx->rl)) <= 0) @@ -424,9 +424,6 @@ tls13_handshake_recv_action(struct tls13_ctx *ctx, } } - if (ctx->alert) - ret = tls13_send_alert(ctx->rl, ctx->alert); - tls13_handshake_msg_free(ctx->hs_msg); ctx->hs_msg = NULL; |