summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2019-02-21 17:09:52 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2019-02-21 17:09:52 +0000
commit568c7be08f9d07fafe3c25d341700350f2510d0c (patch)
tree6699f7aac498539c3a33a72a7df7cb393f8a7868
parentce32335f17b5840b43846178eea3ed5cfb9b78d3 (diff)
Change the alert callback return type from int to void.
There is nothing for the handler to really signal, since it cannot change the fact that we received an alert. While here use TLS13_IO_FAILURE instead of hardcoding -1. ok tb@
-rw-r--r--lib/libssl/tls13_internal.h4
-rw-r--r--lib/libssl/tls13_record_layer.c16
2 files changed, 11 insertions, 9 deletions
diff --git a/lib/libssl/tls13_internal.h b/lib/libssl/tls13_internal.h
index 71abb6c4434..43b65d6162c 100644
--- a/lib/libssl/tls13_internal.h
+++ b/lib/libssl/tls13_internal.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_internal.h,v 1.19 2019/02/14 17:55:32 jsing Exp $ */
+/* $OpenBSD: tls13_internal.h,v 1.20 2019/02/21 17:09:51 jsing Exp $ */
/*
* Copyright (c) 2018 Bob Beck <beck@openbsd.org>
* Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
@@ -36,7 +36,7 @@ __BEGIN_HIDDEN_DECLS
#define TLS13_IO_WANT_POLLIN -2
#define TLS13_IO_WANT_POLLOUT -3
-typedef int (*tls13_alert_cb)(uint8_t _alert_level, uint8_t _alert_desc,
+typedef void (*tls13_alert_cb)(uint8_t _alert_level, uint8_t _alert_desc,
void *_cb_arg);
typedef int (*tls13_post_handshake_cb)(void *_cb_arg);
typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg);
diff --git a/lib/libssl/tls13_record_layer.c b/lib/libssl/tls13_record_layer.c
index d1b53244c56..8f6eb94df4d 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.3 2019/02/21 17:02:02 jsing Exp $ */
+/* $OpenBSD: tls13_record_layer.c,v 1.4 2019/02/21 17:09:51 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
*
@@ -188,21 +188,23 @@ tls13_record_layer_process_alert(struct tls13_record_layer *rl)
* read channel closure (close_notify) or termination (all others).
*/
if (rl->rbuf == NULL)
- return -1;
+ return TLS13_IO_FAILURE;
if (rl->rbuf_content_type != SSL3_RT_ALERT)
- return -1;
+ return TLS13_IO_FAILURE;
if (!CBS_get_u8(&rl->rbuf_cbs, &alert_level))
- return -1; /* XXX - decode error alert. */
+ return TLS13_IO_FAILURE; /* XXX - decode error alert. */
if (!CBS_get_u8(&rl->rbuf_cbs, &alert_desc))
- return -1; /* XXX - decode error alert. */
+ return TLS13_IO_FAILURE; /* XXX - decode error alert. */
if (CBS_len(&rl->rbuf_cbs) != 0)
- return -1;
+ return TLS13_IO_FAILURE;
tls13_record_layer_rbuf_free(rl);
- return rl->alert_cb(alert_level, alert_desc, rl->cb_arg);
+ rl->alert_cb(alert_level, alert_desc, rl->cb_arg);
+
+ return TLS13_IO_SUCCESS;
}
int