summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/tls_internal.h')
-rw-r--r--src/lib/libssl/tls_internal.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/lib/libssl/tls_internal.h b/src/lib/libssl/tls_internal.h
new file mode 100644
index 0000000000..10af32efdd
--- /dev/null
+++ b/src/lib/libssl/tls_internal.h
@@ -0,0 +1,56 @@
1/* $OpenBSD: tls_internal.h,v 1.1 2021/10/23 13:12:14 jsing Exp $ */
2/*
3 * Copyright (c) 2018, 2019, 2021 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef HEADER_TLS_INTERNAL_H
19#define HEADER_TLS_INTERNAL_H
20
21#include "bytestring.h"
22
23__BEGIN_HIDDEN_DECLS
24
25#define TLS_IO_SUCCESS 1
26#define TLS_IO_EOF 0
27#define TLS_IO_FAILURE -1
28#define TLS_IO_ALERT -2
29#define TLS_IO_WANT_POLLIN -3
30#define TLS_IO_WANT_POLLOUT -4
31#define TLS_IO_WANT_RETRY -5 /* Retry the previous call immediately. */
32
33/*
34 * Callbacks.
35 */
36typedef ssize_t (*tls_read_cb)(void *_buf, size_t _buflen, void *_cb_arg);
37typedef ssize_t (*tls_write_cb)(const void *_buf, size_t _buflen,
38 void *_cb_arg);
39typedef ssize_t (*tls_flush_cb)(void *_cb_arg);
40
41/*
42 * Buffers.
43 */
44struct tls_buffer;
45
46struct tls_buffer *tls_buffer_new(size_t init_size);
47int tls_buffer_set_data(struct tls_buffer *buf, CBS *data);
48void tls_buffer_free(struct tls_buffer *buf);
49ssize_t tls_buffer_extend(struct tls_buffer *buf, size_t len,
50 tls_read_cb read_cb, void *cb_arg);
51void tls_buffer_cbs(struct tls_buffer *buf, CBS *cbs);
52int tls_buffer_finish(struct tls_buffer *buf, uint8_t **out, size_t *out_len);
53
54__END_HIDDEN_DECLS
55
56#endif