diff options
author | jsing <> | 2022-07-22 19:33:53 +0000 |
---|---|---|
committer | jsing <> | 2022-07-22 19:33:53 +0000 |
commit | 6612d759045c7571f6be2ff1366a704ba82eb216 (patch) | |
tree | 621585d83424bc407b8aa48aef0a859751335e14 /src/lib/libssl/tls_internal.h | |
parent | eb96f22ae583afb63244c20ef4b563fcdd868d57 (diff) | |
download | openbsd-6612d759045c7571f6be2ff1366a704ba82eb216.tar.gz openbsd-6612d759045c7571f6be2ff1366a704ba82eb216.tar.bz2 openbsd-6612d759045c7571f6be2ff1366a704ba82eb216.zip |
Add read and write support to tls_buffer.
tls_buffer was original created for a specific use case, namely reading in
length prefixed messages. This adds read and write support, along with a
capacity limit, allowing it to be used in additional use cases.
ok beck@ tb@
Diffstat (limited to 'src/lib/libssl/tls_internal.h')
-rw-r--r-- | src/lib/libssl/tls_internal.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/libssl/tls_internal.h b/src/lib/libssl/tls_internal.h index ac2d14da48..88dae9e67e 100644 --- a/src/lib/libssl/tls_internal.h +++ b/src/lib/libssl/tls_internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_internal.h,v 1.7 2022/07/20 06:32:24 jsing Exp $ */ | 1 | /* $OpenBSD: tls_internal.h,v 1.8 2022/07/22 19:33:53 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2018, 2019, 2021 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019, 2021 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -47,10 +47,15 @@ typedef ssize_t (*tls_flush_cb)(void *_cb_arg); | |||
47 | struct tls_buffer; | 47 | struct tls_buffer; |
48 | 48 | ||
49 | struct tls_buffer *tls_buffer_new(size_t init_size); | 49 | struct tls_buffer *tls_buffer_new(size_t init_size); |
50 | void tls_buffer_clear(struct tls_buffer *buf); | ||
50 | void tls_buffer_free(struct tls_buffer *buf); | 51 | void tls_buffer_free(struct tls_buffer *buf); |
52 | void tls_buffer_set_capacity_limit(struct tls_buffer *buf, size_t limit); | ||
51 | ssize_t tls_buffer_extend(struct tls_buffer *buf, size_t len, | 53 | ssize_t tls_buffer_extend(struct tls_buffer *buf, size_t len, |
52 | tls_read_cb read_cb, void *cb_arg); | 54 | tls_read_cb read_cb, void *cb_arg); |
53 | void tls_buffer_cbs(struct tls_buffer *buf, CBS *cbs); | 55 | ssize_t tls_buffer_read(struct tls_buffer *buf, uint8_t *rbuf, size_t n); |
56 | ssize_t tls_buffer_write(struct tls_buffer *buf, const uint8_t *wbuf, size_t n); | ||
57 | int tls_buffer_append(struct tls_buffer *buf, const uint8_t *wbuf, size_t n); | ||
58 | int tls_buffer_data(struct tls_buffer *buf, CBS *cbs); | ||
54 | int tls_buffer_finish(struct tls_buffer *buf, uint8_t **out, size_t *out_len); | 59 | int tls_buffer_finish(struct tls_buffer *buf, uint8_t **out, size_t *out_len); |
55 | 60 | ||
56 | /* | 61 | /* |