summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls_content.h
diff options
context:
space:
mode:
authorjsing <>2021-09-04 16:26:12 +0000
committerjsing <>2021-09-04 16:26:12 +0000
commitcae6ba899a9344e719ed96e6afdb8958b891efb0 (patch)
tree44332845387994e621a09d6d1451fd9e6a3c865d /src/lib/libssl/tls_content.h
parent5f9c147b857183086592529152aa63fc86fa2e56 (diff)
downloadopenbsd-cae6ba899a9344e719ed96e6afdb8958b891efb0.tar.gz
openbsd-cae6ba899a9344e719ed96e6afdb8958b891efb0.tar.bz2
openbsd-cae6ba899a9344e719ed96e6afdb8958b891efb0.zip
Factor out the TLSv1.3 code that handles content from TLS records.
Currently, the plaintext content from opened TLS records is handled via the rbuf code in the TLSv1.3 record layer. Factor this out and provide a separate struct tls_content, which knows how to track and manipulate the content. This makes the TLSv1.3 code cleaner, however it will also soon also be used to untangle parts of the legacy record layer. ok beck@ tb@
Diffstat (limited to 'src/lib/libssl/tls_content.h')
-rw-r--r--src/lib/libssl/tls_content.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/lib/libssl/tls_content.h b/src/lib/libssl/tls_content.h
new file mode 100644
index 0000000000..173af2a740
--- /dev/null
+++ b/src/lib/libssl/tls_content.h
@@ -0,0 +1,48 @@
1/* $OpenBSD: tls_content.h,v 1.1 2021/09/04 16:26:12 jsing Exp $ */
2/*
3 * Copyright (c) 2020 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_CONTENT_H
19#define HEADER_TLS_CONTENT_H
20
21#include "bytestring.h"
22
23__BEGIN_HIDDEN_DECLS
24
25struct tls_content;
26
27struct tls_content *tls_content_new(void);
28void tls_content_clear(struct tls_content *content);
29void tls_content_free(struct tls_content *content);
30
31CBS *tls_content_cbs(struct tls_content *content);
32int tls_content_equal(struct tls_content *content, const uint8_t *buf, size_t n);
33size_t tls_content_remaining(struct tls_content *content);
34uint8_t tls_content_type(struct tls_content *content);
35uint16_t tls_content_epoch(struct tls_content *content);
36
37int tls_content_dup_data(struct tls_content *content, uint8_t type,
38 const uint8_t *data, size_t data_len);
39void tls_content_set_data(struct tls_content *content, uint8_t type,
40 const uint8_t *data, size_t data_len);
41void tls_content_set_epoch(struct tls_content *content, uint16_t epoch);
42
43ssize_t tls_content_peek(struct tls_content *content, uint8_t *buf, size_t n);
44ssize_t tls_content_read(struct tls_content *content, uint8_t *buf, size_t n);
45
46__END_HIDDEN_DECLS
47
48#endif