diff options
| author | jsing <> | 2021-10-23 13:12:14 +0000 |
|---|---|---|
| committer | jsing <> | 2021-10-23 13:12:14 +0000 |
| commit | 3262c76ed1f7d7ad4c2133bc12fc909491a69e83 (patch) | |
| tree | bfbb08766325a11dd03fa658249cdacb09f2c3c0 /src/lib/libssl/tls_internal.h | |
| parent | 81a8498ebdd96ffafcc4f8113ec6f203b3065eac (diff) | |
| download | openbsd-3262c76ed1f7d7ad4c2133bc12fc909491a69e83.tar.gz openbsd-3262c76ed1f7d7ad4c2133bc12fc909491a69e83.tar.bz2 openbsd-3262c76ed1f7d7ad4c2133bc12fc909491a69e83.zip | |
Rename tls13_buffer to tls_buffer.
This code will soon be used in the DTLSv1.2 and TLSv1.2 stack. Also
introduce tls_internal.h and move/rename the read/write/flush callbacks.
ok beck@ tb@
Diffstat (limited to 'src/lib/libssl/tls_internal.h')
| -rw-r--r-- | src/lib/libssl/tls_internal.h | 56 |
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 | */ | ||
| 36 | typedef ssize_t (*tls_read_cb)(void *_buf, size_t _buflen, void *_cb_arg); | ||
| 37 | typedef ssize_t (*tls_write_cb)(const void *_buf, size_t _buflen, | ||
| 38 | void *_cb_arg); | ||
| 39 | typedef ssize_t (*tls_flush_cb)(void *_cb_arg); | ||
| 40 | |||
| 41 | /* | ||
| 42 | * Buffers. | ||
| 43 | */ | ||
| 44 | struct tls_buffer; | ||
| 45 | |||
| 46 | struct tls_buffer *tls_buffer_new(size_t init_size); | ||
| 47 | int tls_buffer_set_data(struct tls_buffer *buf, CBS *data); | ||
| 48 | void tls_buffer_free(struct tls_buffer *buf); | ||
| 49 | ssize_t tls_buffer_extend(struct tls_buffer *buf, size_t len, | ||
| 50 | tls_read_cb read_cb, void *cb_arg); | ||
| 51 | void tls_buffer_cbs(struct tls_buffer *buf, CBS *cbs); | ||
| 52 | int tls_buffer_finish(struct tls_buffer *buf, uint8_t **out, size_t *out_len); | ||
| 53 | |||
| 54 | __END_HIDDEN_DECLS | ||
| 55 | |||
| 56 | #endif | ||
