diff options
author | doug <> | 2015-06-19 00:23:36 +0000 |
---|---|---|
committer | doug <> | 2015-06-19 00:23:36 +0000 |
commit | efbf61787a43b6d1b3a3509ed4e6cf7eb2ee6231 (patch) | |
tree | 0c2bf824ab545d4f85a730e504864d99df649f58 /src/lib/libssl/bs_cbs.c | |
parent | 815c9ed0143713859a67f4501a0f3698f19d25a3 (diff) | |
download | openbsd-efbf61787a43b6d1b3a3509ed4e6cf7eb2ee6231.tar.gz openbsd-efbf61787a43b6d1b3a3509ed4e6cf7eb2ee6231.tar.bz2 openbsd-efbf61787a43b6d1b3a3509ed4e6cf7eb2ee6231.zip |
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@
Diffstat (limited to 'src/lib/libssl/bs_cbs.c')
-rw-r--r-- | src/lib/libssl/bs_cbs.c | 8 |
1 files changed, 7 insertions, 1 deletions
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 @@ | |||
1 | /* $OpenBSD: bs_cbs.c,v 1.13 2015/06/17 07:25:56 doug Exp $ */ | 1 | /* $OpenBSD: bs_cbs.c,v 1.14 2015/06/19 00:23:36 doug Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014, Google Inc. | 3 | * Copyright (c) 2014, Google Inc. |
4 | * | 4 | * |
@@ -32,6 +32,12 @@ CBS_init(CBS *cbs, const uint8_t *data, size_t len) | |||
32 | cbs->len = len; | 32 | cbs->len = len; |
33 | } | 33 | } |
34 | 34 | ||
35 | void | ||
36 | CBS_dup(const CBS *cbs, CBS *out) | ||
37 | { | ||
38 | CBS_init(out, CBS_data(cbs), CBS_len(cbs)); | ||
39 | } | ||
40 | |||
35 | static int | 41 | static int |
36 | cbs_get(CBS *cbs, const uint8_t **p, size_t n) | 42 | cbs_get(CBS *cbs, const uint8_t **p, size_t n) |
37 | { | 43 | { |