From 1a6ec4dba6f1322011c578d9ef1a3d4898ddfacd Mon Sep 17 00:00:00 2001 From: doug <> Date: Wed, 17 Jun 2015 07:06:22 +0000 Subject: Add CBS_write_bytes() to copy the remaining CBS bytes to the caller. This is a common operation when dealing with CBS. ok miod@ jsing@ --- src/lib/libssl/bytestring.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/lib/libssl/bytestring.h') diff --git a/src/lib/libssl/bytestring.h b/src/lib/libssl/bytestring.h index 80ca00d77a..2eb18e207d 100644 --- a/src/lib/libssl/bytestring.h +++ b/src/lib/libssl/bytestring.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bytestring.h,v 1.10 2015/06/17 07:00:22 doug Exp $ */ +/* $OpenBSD: bytestring.h,v 1.11 2015/06/17 07:06:22 doug Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -91,6 +91,14 @@ int CBS_stow(const CBS *cbs, uint8_t **out_ptr, size_t *out_len); */ int CBS_strdup(const CBS *cbs, char **out_ptr); +/* + * CBS_write_bytes writes all of the remaining data from |cbs| into |dst| + * if it is at most |dst_len| bytes. If |copied| is not NULL, it will be set + * to the amount copied. It returns one on success and zero otherwise. + */ +int CBS_write_bytes(const CBS *cbs, uint8_t *dst, size_t dst_len, + size_t *copied); + /* * CBS_contains_zero_byte returns one if the current contents of |cbs| contains * a NUL byte and zero otherwise. -- cgit v1.2.3-55-g6feb