diff options
author | jsing <> | 2019-02-21 17:09:51 +0000 |
---|---|---|
committer | jsing <> | 2019-02-21 17:09:51 +0000 |
commit | c2747c010f47d9ef1447b26470fa7fb033c543c3 (patch) | |
tree | 37e9b40407a361bdc95cfaf9c0cabf83399eafa4 /src | |
parent | e76fac4c623c3bc630ce30d524b5f6a9fa699538 (diff) | |
download | openbsd-c2747c010f47d9ef1447b26470fa7fb033c543c3.tar.gz openbsd-c2747c010f47d9ef1447b26470fa7fb033c543c3.tar.bz2 openbsd-c2747c010f47d9ef1447b26470fa7fb033c543c3.zip |
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@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/tls13_internal.h | 4 | ||||
-rw-r--r-- | src/lib/libssl/tls13_record_layer.c | 16 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/lib/libssl/tls13_internal.h b/src/lib/libssl/tls13_internal.h index 71abb6c443..43b65d6162 100644 --- a/src/lib/libssl/tls13_internal.h +++ b/src/lib/libssl/tls13_internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_internal.h,v 1.19 2019/02/14 17:55:32 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_internal.h,v 1.20 2019/02/21 17:09:51 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> |
4 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> |
@@ -36,7 +36,7 @@ __BEGIN_HIDDEN_DECLS | |||
36 | #define TLS13_IO_WANT_POLLIN -2 | 36 | #define TLS13_IO_WANT_POLLIN -2 |
37 | #define TLS13_IO_WANT_POLLOUT -3 | 37 | #define TLS13_IO_WANT_POLLOUT -3 |
38 | 38 | ||
39 | typedef int (*tls13_alert_cb)(uint8_t _alert_level, uint8_t _alert_desc, | 39 | typedef void (*tls13_alert_cb)(uint8_t _alert_level, uint8_t _alert_desc, |
40 | void *_cb_arg); | 40 | void *_cb_arg); |
41 | typedef int (*tls13_post_handshake_cb)(void *_cb_arg); | 41 | typedef int (*tls13_post_handshake_cb)(void *_cb_arg); |
42 | typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg); | 42 | typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg); |
diff --git a/src/lib/libssl/tls13_record_layer.c b/src/lib/libssl/tls13_record_layer.c index d1b53244c5..8f6eb94df4 100644 --- a/src/lib/libssl/tls13_record_layer.c +++ b/src/lib/libssl/tls13_record_layer.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_record_layer.c,v 1.3 2019/02/21 17:02:02 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_record_layer.c,v 1.4 2019/02/21 17:09:51 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -188,21 +188,23 @@ tls13_record_layer_process_alert(struct tls13_record_layer *rl) | |||
188 | * read channel closure (close_notify) or termination (all others). | 188 | * read channel closure (close_notify) or termination (all others). |
189 | */ | 189 | */ |
190 | if (rl->rbuf == NULL) | 190 | if (rl->rbuf == NULL) |
191 | return -1; | 191 | return TLS13_IO_FAILURE; |
192 | if (rl->rbuf_content_type != SSL3_RT_ALERT) | 192 | if (rl->rbuf_content_type != SSL3_RT_ALERT) |
193 | return -1; | 193 | return TLS13_IO_FAILURE; |
194 | 194 | ||
195 | if (!CBS_get_u8(&rl->rbuf_cbs, &alert_level)) | 195 | if (!CBS_get_u8(&rl->rbuf_cbs, &alert_level)) |
196 | return -1; /* XXX - decode error alert. */ | 196 | return TLS13_IO_FAILURE; /* XXX - decode error alert. */ |
197 | if (!CBS_get_u8(&rl->rbuf_cbs, &alert_desc)) | 197 | if (!CBS_get_u8(&rl->rbuf_cbs, &alert_desc)) |
198 | return -1; /* XXX - decode error alert. */ | 198 | return TLS13_IO_FAILURE; /* XXX - decode error alert. */ |
199 | 199 | ||
200 | if (CBS_len(&rl->rbuf_cbs) != 0) | 200 | if (CBS_len(&rl->rbuf_cbs) != 0) |
201 | return -1; | 201 | return TLS13_IO_FAILURE; |
202 | 202 | ||
203 | tls13_record_layer_rbuf_free(rl); | 203 | tls13_record_layer_rbuf_free(rl); |
204 | 204 | ||
205 | return rl->alert_cb(alert_level, alert_desc, rl->cb_arg); | 205 | rl->alert_cb(alert_level, alert_desc, rl->cb_arg); |
206 | |||
207 | return TLS13_IO_SUCCESS; | ||
206 | } | 208 | } |
207 | 209 | ||
208 | int | 210 | int |