diff options
author | beck <> | 2020-01-21 03:40:05 +0000 |
---|---|---|
committer | beck <> | 2020-01-21 03:40:05 +0000 |
commit | 46c0c6a7b768b3aa9319915bd3af13633e7745e2 (patch) | |
tree | 137affc52a2dd50575dbc6c92f552e962fb9c96b /src/lib/libssl/tls13_handshake.c | |
parent | 5acce3f58ab8ea3f51a29f1fd7044fcf134f5b06 (diff) | |
download | openbsd-46c0c6a7b768b3aa9319915bd3af13633e7745e2.tar.gz openbsd-46c0c6a7b768b3aa9319915bd3af13633e7745e2.tar.bz2 openbsd-46c0c6a7b768b3aa9319915bd3af13633e7745e2.zip |
Add alert processing in tls client code, by adding alert to the
tls13 context, and emiting the alert at the upper layers when
the lower level code fails
ok jsing@, tb@
Diffstat (limited to 'src/lib/libssl/tls13_handshake.c')
-rw-r--r-- | src/lib/libssl/tls13_handshake.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/libssl/tls13_handshake.c b/src/lib/libssl/tls13_handshake.c index c86187caec..48a01d3ca4 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.37 2020/01/20 22:04:17 beck Exp $ */ | 1 | /* $OpenBSD: tls13_handshake.c,v 1.38 2020/01/21 03:40:05 beck 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> |
@@ -291,7 +291,8 @@ tls13_handshake_perform(struct tls13_ctx *ctx) | |||
291 | ctx->handshake_completed = 1; | 291 | ctx->handshake_completed = 1; |
292 | tls13_record_layer_handshake_completed(ctx->rl); | 292 | tls13_record_layer_handshake_completed(ctx->rl); |
293 | return TLS13_IO_SUCCESS; | 293 | return TLS13_IO_SUCCESS; |
294 | } | 294 | } else if (ctx->alert) |
295 | return tls13_send_alert(ctx->rl, ctx->alert); | ||
295 | 296 | ||
296 | if (action->sender == ctx->mode) { | 297 | if (action->sender == ctx->mode) { |
297 | if ((ret = tls13_handshake_send_action(ctx, action)) <= 0) | 298 | if ((ret = tls13_handshake_send_action(ctx, action)) <= 0) |
@@ -329,6 +330,8 @@ tls13_handshake_send_action(struct tls13_ctx *ctx, | |||
329 | /* XXX - provide CBB. */ | 330 | /* XXX - provide CBB. */ |
330 | if (!action->send(ctx)) | 331 | if (!action->send(ctx)) |
331 | return TLS13_IO_FAILURE; | 332 | return TLS13_IO_FAILURE; |
333 | else if (ctx->alert) | ||
334 | return tls13_send_alert(ctx->rl, ctx->alert); | ||
332 | } | 335 | } |
333 | 336 | ||
334 | if ((ret = tls13_handshake_msg_send(ctx->hs_msg, ctx->rl)) <= 0) | 337 | if ((ret = tls13_handshake_msg_send(ctx->hs_msg, ctx->rl)) <= 0) |
@@ -389,6 +392,8 @@ tls13_handshake_recv_action(struct tls13_ctx *ctx, | |||
389 | ret = TLS13_IO_FAILURE; | 392 | ret = TLS13_IO_FAILURE; |
390 | if (action->recv(ctx)) | 393 | if (action->recv(ctx)) |
391 | ret = TLS13_IO_SUCCESS; | 394 | ret = TLS13_IO_SUCCESS; |
395 | else if (ctx->alert) | ||
396 | ret = tls13_send_alert(ctx->rl, ctx->alert); | ||
392 | 397 | ||
393 | tls13_handshake_msg_free(ctx->hs_msg); | 398 | tls13_handshake_msg_free(ctx->hs_msg); |
394 | ctx->hs_msg = NULL; | 399 | ctx->hs_msg = NULL; |