diff options
author | 2019-01-17 06:32:12 +0000 | |
---|---|---|
committer | 2019-01-17 06:32:12 +0000 | |
commit | a80e02e19ec4481da9c394e20c725672e6a41eba (patch) | |
tree | 67c773f1a8b0b1359b18c357cd533aed04ca9a26 /lib/libssl/tls13_internal.h | |
parent | Test handling of escaped backslashes because the code related to (diff) | |
download | wireguard-openbsd-a80e02e19ec4481da9c394e20c725672e6a41eba.tar.xz wireguard-openbsd-a80e02e19ec4481da9c394e20c725672e6a41eba.zip |
Provide an extensible buffer implementation that uses a read callback.
The read callback returns a TLS13_IO_* value on EOF, failure, want pollin
or want pollout, or a positive value indicating the number of bytes read.
This will be used by upcoming TLSv1.3 handshake message and record
processing code, both of which need the ability to read a fixed size
header, before extending the buffer to the number of bytes specified in the
header.
ok beck@ tb@
Diffstat (limited to 'lib/libssl/tls13_internal.h')
-rw-r--r-- | lib/libssl/tls13_internal.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/libssl/tls13_internal.h b/lib/libssl/tls13_internal.h index 83f99881406..872aced77cc 100644 --- a/lib/libssl/tls13_internal.h +++ b/lib/libssl/tls13_internal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_internal.h,v 1.5 2018/11/09 23:56:20 jsing Exp $ */ +/* $OpenBSD: tls13_internal.h,v 1.6 2019/01/17 06:32:12 jsing Exp $ */ /* * Copyright (c) 2018 Bob Beck <beck@openbsd.org> * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> @@ -21,8 +21,27 @@ #include <openssl/evp.h> +#include "bytestring.h" + __BEGIN_HIDDEN_DECLS +#define TLS13_IO_EOF 0 +#define TLS13_IO_FAILURE -1 +#define TLS13_IO_WANT_POLLIN -2 +#define TLS13_IO_WANT_POLLOUT -3 + +typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg); +typedef ssize_t (*tls13_write_cb)(const void *_buf, size_t _buflen, void *_cb_arg); + +struct tls13_buffer; + +struct tls13_buffer *tls13_buffer_new(size_t init_size); +void tls13_buffer_free(struct tls13_buffer *buf); +ssize_t tls13_buffer_extend(struct tls13_buffer *buf, size_t len, + tls13_read_cb read_cb, void *cb_arg); +void tls13_buffer_cbs(struct tls13_buffer *buf, CBS *cbs); +int tls13_buffer_finish(struct tls13_buffer *buf, uint8_t **out, size_t *out_len); + struct tls13_secret { uint8_t *data; size_t len; |