diff options
author | beck <> | 2019-11-17 00:10:47 +0000 |
---|---|---|
committer | beck <> | 2019-11-17 00:10:47 +0000 |
commit | 6dc247f99372dd30c77652836201381b14efe0af (patch) | |
tree | 1006a2f2bd27da639a05e5d1c3e88bf65b9ba05e /src/lib | |
parent | 13bcf61e228400d01e501e57d279641478062b64 (diff) | |
download | openbsd-6dc247f99372dd30c77652836201381b14efe0af.tar.gz openbsd-6dc247f99372dd30c77652836201381b14efe0af.tar.bz2 openbsd-6dc247f99372dd30c77652836201381b14efe0af.zip |
Separate the callbacks for recieved and completed post handshake messages
from the record layer
ok jsing@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libssl/tls13_internal.h | 8 | ||||
-rw-r--r-- | src/lib/libssl/tls13_lib.c | 4 | ||||
-rw-r--r-- | src/lib/libssl/tls13_record_layer.c | 20 |
3 files changed, 22 insertions, 10 deletions
diff --git a/src/lib/libssl/tls13_internal.h b/src/lib/libssl/tls13_internal.h index 1d7a7eb699..7288ca3448 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.28 2019/04/05 20:23:38 tb Exp $ */ | 1 | /* $OpenBSD: tls13_internal.h,v 1.29 2019/11/17 00:10:47 beck 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> |
@@ -38,7 +38,8 @@ __BEGIN_HIDDEN_DECLS | |||
38 | #define TLS13_IO_USE_LEGACY -4 | 38 | #define TLS13_IO_USE_LEGACY -4 |
39 | 39 | ||
40 | typedef void (*tls13_alert_cb)(uint8_t _alert_desc, void *_cb_arg); | 40 | typedef void (*tls13_alert_cb)(uint8_t _alert_desc, void *_cb_arg); |
41 | typedef int (*tls13_post_handshake_cb)(void *_cb_arg); | 41 | typedef int (*tls13_post_handshake_recv_cb)(void *_cb_arg, CBS *cbs); |
42 | typedef int (*tls13_post_handshake_sent_cb)(void *_cb_arg); | ||
42 | typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg); | 43 | typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg); |
43 | typedef ssize_t (*tls13_write_cb)(const void *_buf, size_t _buflen, | 44 | typedef ssize_t (*tls13_write_cb)(const void *_buf, size_t _buflen, |
44 | void *_cb_arg); | 45 | void *_cb_arg); |
@@ -107,7 +108,8 @@ struct tls13_record_layer; | |||
107 | 108 | ||
108 | struct tls13_record_layer *tls13_record_layer_new(tls13_read_cb wire_read, | 109 | struct tls13_record_layer *tls13_record_layer_new(tls13_read_cb wire_read, |
109 | tls13_write_cb wire_write, tls13_alert_cb alert_cb, | 110 | tls13_write_cb wire_write, tls13_alert_cb alert_cb, |
110 | tls13_post_handshake_cb post_handshake_cb, void *cb_arg); | 111 | tls13_post_handshake_recv_cb post_handshake_recv_cb, |
112 | tls13_post_handshake_sent_cb post_handshake_sent_cb, void *cb_arg); | ||
111 | void tls13_record_layer_free(struct tls13_record_layer *rl); | 113 | void tls13_record_layer_free(struct tls13_record_layer *rl); |
112 | void tls13_record_layer_set_aead(struct tls13_record_layer *rl, | 114 | void tls13_record_layer_set_aead(struct tls13_record_layer *rl, |
113 | const EVP_AEAD *aead); | 115 | const EVP_AEAD *aead); |
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c index 81325cd86f..61ca3d4682 100644 --- a/src/lib/libssl/tls13_lib.c +++ b/src/lib/libssl/tls13_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_lib.c,v 1.11 2019/03/17 15:13:23 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_lib.c,v 1.12 2019/11/17 00:10:47 beck 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 | * |
@@ -101,7 +101,7 @@ tls13_ctx_new(int mode) | |||
101 | ctx->mode = mode; | 101 | ctx->mode = mode; |
102 | 102 | ||
103 | if ((ctx->rl = tls13_record_layer_new(tls13_legacy_wire_read_cb, | 103 | if ((ctx->rl = tls13_record_layer_new(tls13_legacy_wire_read_cb, |
104 | tls13_legacy_wire_write_cb, tls13_alert_received_cb, NULL, | 104 | tls13_legacy_wire_write_cb, tls13_alert_received_cb, NULL, NULL, |
105 | ctx)) == NULL) | 105 | ctx)) == NULL) |
106 | goto err; | 106 | goto err; |
107 | 107 | ||
diff --git a/src/lib/libssl/tls13_record_layer.c b/src/lib/libssl/tls13_record_layer.c index 66e201fcbc..ff26b09d46 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.9 2019/03/17 15:13:23 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_record_layer.c,v 1.10 2019/11/17 00:10:47 beck 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 | * |
@@ -58,7 +58,8 @@ struct tls13_record_layer { | |||
58 | 58 | ||
59 | /* Record callbacks. */ | 59 | /* Record callbacks. */ |
60 | tls13_alert_cb alert_cb; | 60 | tls13_alert_cb alert_cb; |
61 | tls13_post_handshake_cb post_handshake_cb; | 61 | tls13_post_handshake_recv_cb post_handshake_recv_cb; |
62 | tls13_post_handshake_sent_cb post_handshake_sent_cb; | ||
62 | 63 | ||
63 | /* Wire read/write callbacks. */ | 64 | /* Wire read/write callbacks. */ |
64 | tls13_read_cb wire_read; | 65 | tls13_read_cb wire_read; |
@@ -92,7 +93,9 @@ tls13_record_layer_wrec_free(struct tls13_record_layer *rl) | |||
92 | 93 | ||
93 | struct tls13_record_layer * | 94 | struct tls13_record_layer * |
94 | tls13_record_layer_new(tls13_read_cb wire_read, tls13_write_cb wire_write, | 95 | tls13_record_layer_new(tls13_read_cb wire_read, tls13_write_cb wire_write, |
95 | tls13_alert_cb alert_cb, tls13_post_handshake_cb post_handshake_cb, | 96 | tls13_alert_cb alert_cb, |
97 | tls13_post_handshake_recv_cb post_handshake_recv_cb, | ||
98 | tls13_post_handshake_sent_cb post_handshake_sent_cb, | ||
96 | void *cb_arg) | 99 | void *cb_arg) |
97 | { | 100 | { |
98 | struct tls13_record_layer *rl; | 101 | struct tls13_record_layer *rl; |
@@ -103,7 +106,8 @@ tls13_record_layer_new(tls13_read_cb wire_read, tls13_write_cb wire_write, | |||
103 | rl->wire_read = wire_read; | 106 | rl->wire_read = wire_read; |
104 | rl->wire_write = wire_write; | 107 | rl->wire_write = wire_write; |
105 | rl->alert_cb = alert_cb; | 108 | rl->alert_cb = alert_cb; |
106 | rl->post_handshake_cb = post_handshake_cb; | 109 | rl->post_handshake_recv_cb = post_handshake_recv_cb; |
110 | rl->post_handshake_sent_cb = post_handshake_sent_cb; | ||
107 | rl->cb_arg = cb_arg; | 111 | rl->cb_arg = cb_arg; |
108 | 112 | ||
109 | return rl; | 113 | return rl; |
@@ -691,8 +695,14 @@ tls13_record_layer_read(struct tls13_record_layer *rl, uint8_t content_type, | |||
691 | */ | 695 | */ |
692 | if (rl->rbuf_content_type == SSL3_RT_HANDSHAKE) { | 696 | if (rl->rbuf_content_type == SSL3_RT_HANDSHAKE) { |
693 | if (rl->handshake_completed) { | 697 | if (rl->handshake_completed) { |
694 | /* XXX - call callback, drop for now... */ | 698 | if (rl->post_handshake_recv_cb != NULL) |
699 | rl->post_handshake_recv_cb( | ||
700 | rl->cb_arg, &rl->rbuf_cbs); | ||
695 | tls13_record_layer_rbuf_free(rl); | 701 | tls13_record_layer_rbuf_free(rl); |
702 | /* | ||
703 | * XXX if handshake or alert queued | ||
704 | * return POLLOUT | ||
705 | */ | ||
696 | return TLS13_IO_WANT_POLLIN; | 706 | return TLS13_IO_WANT_POLLIN; |
697 | } | 707 | } |
698 | } | 708 | } |