summaryrefslogtreecommitdiffstats
path: root/lib/libssl/bs_cbs.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libssl/bs_cbs.c')
-rw-r--r--lib/libssl/bs_cbs.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/libssl/bs_cbs.c b/lib/libssl/bs_cbs.c
index 1368fe0fd7f..b36ba489f3a 100644
--- a/lib/libssl/bs_cbs.c
+++ b/lib/libssl/bs_cbs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bs_cbs.c,v 1.11 2015/06/17 07:00:22 doug Exp $ */
+/* $OpenBSD: bs_cbs.c,v 1.12 2015/06/17 07:06:22 doug Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
@@ -96,6 +96,20 @@ CBS_strdup(const CBS *cbs, char **out_ptr)
}
int
+CBS_write_bytes(const CBS *cbs, uint8_t *dst, size_t dst_len, size_t *copied)
+{
+ if (dst_len < cbs->len)
+ return 0;
+
+ memmove(dst, cbs->data, cbs->len);
+
+ if (copied != NULL)
+ *copied = cbs->len;
+
+ return 1;
+}
+
+int
CBS_contains_zero_byte(const CBS *cbs)
{
return memchr(cbs->data, 0, cbs->len) != NULL;