summaryrefslogtreecommitdiffstats
path: root/lib/libssl/tls13_buffer.c
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2019-11-20 16:21:20 +0000
committerbeck <beck@openbsd.org>2019-11-20 16:21:20 +0000
commit7d42f7619b7ab62ae6563e52a49087db702d641f (patch)
tree3de7103990321bd11e16ba7e62faf1bb22735055 /lib/libssl/tls13_buffer.c
parentCorrectly match another 9560-based device. (diff)
downloadwireguard-openbsd-7d42f7619b7ab62ae6563e52a49087db702d641f.tar.xz
wireguard-openbsd-7d42f7619b7ab62ae6563e52a49087db702d641f.zip
Add accessors to change the buffer in a handshake message.
Needed for doing TLS 1.3 Post Handshake Handshake messages. ok jsing@
Diffstat (limited to 'lib/libssl/tls13_buffer.c')
-rw-r--r--lib/libssl/tls13_buffer.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libssl/tls13_buffer.c b/lib/libssl/tls13_buffer.c
index 1b490c8b46d..8990327bb62 100644
--- a/lib/libssl/tls13_buffer.c
+++ b/lib/libssl/tls13_buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_buffer.c,v 1.1 2019/01/17 06:32:12 jsing Exp $ */
+/* $OpenBSD: tls13_buffer.c,v 1.2 2019/11/20 16:21:20 beck Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
*
@@ -75,6 +75,15 @@ tls13_buffer_resize(struct tls13_buffer *buf, size_t capacity)
return 1;
}
+int
+tls13_buffer_set_data(struct tls13_buffer *buf, CBS *data)
+{
+ if (!tls13_buffer_resize(buf, CBS_len(data)))
+ return 0;
+ memcpy(buf->data, CBS_data(data), CBS_len(data));
+ return 1;
+}
+
ssize_t
tls13_buffer_extend(struct tls13_buffer *buf, size_t len,
tls13_read_cb read_cb, void *cb_arg)