summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls13_internal.h
diff options
context:
space:
mode:
authorjsing <>2019-01-17 06:32:12 +0000
committerjsing <>2019-01-17 06:32:12 +0000
commit338694cf0d2ff38a00bab7103081ffa3db2cbeca (patch)
treeaaa2cc958ec6b223edb11b9ce2f0c7cfe55040f0 /src/lib/libssl/tls13_internal.h
parentcc9200b6a36a087c17fb0668d7adccb6a6261dd5 (diff)
downloadopenbsd-338694cf0d2ff38a00bab7103081ffa3db2cbeca.tar.gz
openbsd-338694cf0d2ff38a00bab7103081ffa3db2cbeca.tar.bz2
openbsd-338694cf0d2ff38a00bab7103081ffa3db2cbeca.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 '')
-rw-r--r--src/lib/libssl/tls13_internal.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lib/libssl/tls13_internal.h b/src/lib/libssl/tls13_internal.h
index 83f9988140..872aced77c 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.5 2018/11/09 23:56:20 jsing Exp $ */ 1/* $OpenBSD: tls13_internal.h,v 1.6 2019/01/17 06:32:12 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>
@@ -21,8 +21,27 @@
21 21
22#include <openssl/evp.h> 22#include <openssl/evp.h>
23 23
24#include "bytestring.h"
25
24__BEGIN_HIDDEN_DECLS 26__BEGIN_HIDDEN_DECLS
25 27
28#define TLS13_IO_EOF 0
29#define TLS13_IO_FAILURE -1
30#define TLS13_IO_WANT_POLLIN -2
31#define TLS13_IO_WANT_POLLOUT -3
32
33typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg);
34typedef ssize_t (*tls13_write_cb)(const void *_buf, size_t _buflen, void *_cb_arg);
35
36struct tls13_buffer;
37
38struct tls13_buffer *tls13_buffer_new(size_t init_size);
39void tls13_buffer_free(struct tls13_buffer *buf);
40ssize_t tls13_buffer_extend(struct tls13_buffer *buf, size_t len,
41 tls13_read_cb read_cb, void *cb_arg);
42void tls13_buffer_cbs(struct tls13_buffer *buf, CBS *cbs);
43int tls13_buffer_finish(struct tls13_buffer *buf, uint8_t **out, size_t *out_len);
44
26struct tls13_secret { 45struct tls13_secret {
27 uint8_t *data; 46 uint8_t *data;
28 size_t len; 47 size_t len;