diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2022-11-10 18:06:38 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2022-11-10 18:06:38 +0000 |
commit | 3bbac420a7474e56637be2e557939d53e077228c (patch) | |
tree | 709ed1499e82539eeaf0ad632532d21746e7e274 /lib/libssl/tls_buffer.c | |
parent | a4dea857f338aee7d38fd2f09c8aa2e8665c9448 (diff) |
Use tls_buffer for alert and handshake fragments in the legacy stack.
This avoids a bunch of pointer munging and a handrolled memmove.
ok tb@
Diffstat (limited to 'lib/libssl/tls_buffer.c')
-rw-r--r-- | lib/libssl/tls_buffer.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libssl/tls_buffer.c b/lib/libssl/tls_buffer.c index f70cfbc1a0d..517d66d685b 100644 --- a/lib/libssl/tls_buffer.c +++ b/lib/libssl/tls_buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls_buffer.c,v 1.3 2022/07/22 19:33:53 jsing Exp $ */ +/* $OpenBSD: tls_buffer.c,v 1.4 2022/11/10 18:06:37 jsing Exp $ */ /* * Copyright (c) 2018, 2019, 2022 Joel Sing <jsing@openbsd.org> * @@ -155,6 +155,15 @@ tls_buffer_extend(struct tls_buffer *buf, size_t len, } } +size_t +tls_buffer_remaining(struct tls_buffer *buf) +{ + if (buf->offset > buf->len) + return 0; + + return buf->len - buf->offset; +} + ssize_t tls_buffer_read(struct tls_buffer *buf, uint8_t *rbuf, size_t n) { |