diff options
| author | jsing <> | 2022-11-10 18:06:37 +0000 |
|---|---|---|
| committer | jsing <> | 2022-11-10 18:06:37 +0000 |
| commit | 89b5796e48ebf1a65b490024b25e1111aaa5d4e3 (patch) | |
| tree | 1c172cf5ae25ab26fa6f64cb114505e1bfcc1267 /src/lib/libssl/tls_buffer.c | |
| parent | 9a85a413c50cb23ce2475f47d9c284f7010bae36 (diff) | |
| download | openbsd-89b5796e48ebf1a65b490024b25e1111aaa5d4e3.tar.gz openbsd-89b5796e48ebf1a65b490024b25e1111aaa5d4e3.tar.bz2 openbsd-89b5796e48ebf1a65b490024b25e1111aaa5d4e3.zip | |
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 'src/lib/libssl/tls_buffer.c')
| -rw-r--r-- | src/lib/libssl/tls_buffer.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/libssl/tls_buffer.c b/src/lib/libssl/tls_buffer.c index f70cfbc1a0..517d66d685 100644 --- a/src/lib/libssl/tls_buffer.c +++ b/src/lib/libssl/tls_buffer.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls_buffer.c,v 1.3 2022/07/22 19:33:53 jsing Exp $ */ | 1 | /* $OpenBSD: tls_buffer.c,v 1.4 2022/11/10 18:06:37 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018, 2019, 2022 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019, 2022 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -155,6 +155,15 @@ tls_buffer_extend(struct tls_buffer *buf, size_t len, | |||
| 155 | } | 155 | } |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | size_t | ||
| 159 | tls_buffer_remaining(struct tls_buffer *buf) | ||
| 160 | { | ||
| 161 | if (buf->offset > buf->len) | ||
| 162 | return 0; | ||
| 163 | |||
| 164 | return buf->len - buf->offset; | ||
| 165 | } | ||
| 166 | |||
| 158 | ssize_t | 167 | ssize_t |
| 159 | tls_buffer_read(struct tls_buffer *buf, uint8_t *rbuf, size_t n) | 168 | tls_buffer_read(struct tls_buffer *buf, uint8_t *rbuf, size_t n) |
| 160 | { | 169 | { |
