From efbf61787a43b6d1b3a3509ed4e6cf7eb2ee6231 Mon Sep 17 00:00:00 2001 From: doug <> Date: Fri, 19 Jun 2015 00:23:36 +0000 Subject: Add CBS_dup() to initialize a new CBS with the same values. This is useful for when you need to check the data ahead and then continue on from the same spot. input + ok jsing@ miod@ --- src/lib/libssl/bs_cbs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/lib/libssl/bs_cbs.c') diff --git a/src/lib/libssl/bs_cbs.c b/src/lib/libssl/bs_cbs.c index 45c253cc4b..8173177249 100644 --- a/src/lib/libssl/bs_cbs.c +++ b/src/lib/libssl/bs_cbs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bs_cbs.c,v 1.13 2015/06/17 07:25:56 doug Exp $ */ +/* $OpenBSD: bs_cbs.c,v 1.14 2015/06/19 00:23:36 doug Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -32,6 +32,12 @@ CBS_init(CBS *cbs, const uint8_t *data, size_t len) cbs->len = len; } +void +CBS_dup(const CBS *cbs, CBS *out) +{ + CBS_init(out, CBS_data(cbs), CBS_len(cbs)); +} + static int cbs_get(CBS *cbs, const uint8_t **p, size_t n) { -- cgit v1.2.3-55-g6feb