summaryrefslogtreecommitdiff
path: root/lib/libssl/tls13_record_layer.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2020-01-23 02:49:39 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2020-01-23 02:49:39 +0000
commit124bf5ad66a603c2f3117a74d408a294655b6c3a (patch)
tree0fdb27108685a1e19afe824d4ef8cb1fb45a2f0e /lib/libssl/tls13_record_layer.c
parent597784e200b40a43013bb225361d3f3a2a0b93b6 (diff)
Add a TLS13_IO_ALERT return value so that we can explicitly signal when
we sent or received a fatal alert. Pull the fatal_alert check up into tls13_legacy_error(). Also, if sending an alert resulted in EOF, do not propagate this back since we do not want to signal EOF to the caller (rather we want to indicate failure). ok beck@ tb@
Diffstat (limited to 'lib/libssl/tls13_record_layer.c')
-rw-r--r--lib/libssl/tls13_record_layer.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libssl/tls13_record_layer.c b/lib/libssl/tls13_record_layer.c
index 4de73409994..f6dbbf1550b 100644
--- a/lib/libssl/tls13_record_layer.c
+++ b/lib/libssl/tls13_record_layer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_record_layer.c,v 1.22 2020/01/22 06:23:00 jsing Exp $ */
+/* $OpenBSD: tls13_record_layer.c,v 1.23 2020/01/23 02:49:38 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
*
@@ -278,7 +278,7 @@ tls13_record_layer_process_alert(struct tls13_record_layer *rl)
} else if (alert_level == SSL3_AL_FATAL) {
rl->read_closed = 1;
rl->write_closed = 1;
- ret = TLS13_IO_FAILURE; /* XXX - ALERT? */
+ ret = TLS13_IO_ALERT;
} else
return tls13_send_alert(rl, SSL_AD_ILLEGAL_PARAMETER);
@@ -293,8 +293,11 @@ tls13_record_layer_send_alert(struct tls13_record_layer *rl)
/* This has to fit into a single record, per RFC 8446 section 5.1. */
if ((ret = tls13_record_layer_write_record(rl, SSL3_RT_ALERT,
- rl->alert_data, rl->alert_len)) != rl->alert_len)
+ rl->alert_data, rl->alert_len)) != rl->alert_len) {
+ if (ret == TLS13_IO_EOF)
+ ret = TLS13_IO_ALERT;
return ret;
+ }
freezero(rl->alert_data, rl->alert_len);
rl->alert_data = NULL;
@@ -309,7 +312,7 @@ tls13_record_layer_send_alert(struct tls13_record_layer *rl)
} else {
rl->read_closed = 1;
rl->write_closed = 1;
- ret = TLS13_IO_SUCCESS; /* XXX - ALERT? */
+ ret = TLS13_IO_ALERT;
}
return ret;