summaryrefslogtreecommitdiff
path: root/lib/libssl/tls_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libssl/tls_buffer.c')
-rw-r--r--lib/libssl/tls_buffer.c11
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)
{