diff options
| author | doug <> | 2015-06-19 00:23:36 +0000 |
|---|---|---|
| committer | doug <> | 2015-06-19 00:23:36 +0000 |
| commit | 512915f28ea9c781f7fb047c687e3863fa3168b7 (patch) | |
| tree | 0c2bf824ab545d4f85a730e504864d99df649f58 /src/lib/libssl/bs_cbs.c | |
| parent | d475c1337d104a1f41d2c0db1ab61eb9f8f214ed (diff) | |
| download | openbsd-512915f28ea9c781f7fb047c687e3863fa3168b7.tar.gz openbsd-512915f28ea9c781f7fb047c687e3863fa3168b7.tar.bz2 openbsd-512915f28ea9c781f7fb047c687e3863fa3168b7.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 | { |
