diff options
author | 2015-06-17 07:00:22 +0000 | |
---|---|---|
committer | 2015-06-17 07:00:22 +0000 | |
commit | 34e475baa11c5a5ca99b53ac5e554351151ab3b7 (patch) | |
tree | 03dfa0c4b3ef6c62c5684a064eb3342b101f4821 /lib/libssl/bs_cbs.c | |
parent | Cleanup SSL_OP_* compat flags in ssl.h. (diff) | |
download | wireguard-openbsd-34e475baa11c5a5ca99b53ac5e554351151ab3b7.tar.xz wireguard-openbsd-34e475baa11c5a5ca99b53ac5e554351151ab3b7.zip |
Add a new function CBS_offset() to report the current offset in the data.
"why not" miod@, sure jsing@
Diffstat (limited to 'lib/libssl/bs_cbs.c')
-rw-r--r-- | lib/libssl/bs_cbs.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libssl/bs_cbs.c b/lib/libssl/bs_cbs.c index 1b513c9a0e2..1368fe0fd7f 100644 --- a/lib/libssl/bs_cbs.c +++ b/lib/libssl/bs_cbs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bs_cbs.c,v 1.10 2015/06/16 06:11:39 doug Exp $ */ +/* $OpenBSD: bs_cbs.c,v 1.11 2015/06/17 07:00:22 doug Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -28,6 +28,7 @@ void CBS_init(CBS *cbs, const uint8_t *data, size_t len) { cbs->data = data; + cbs->initial_len = len; cbs->len = len; } @@ -43,6 +44,12 @@ cbs_get(CBS *cbs, const uint8_t **p, size_t n) return 1; } +size_t +CBS_offset(const CBS *cbs) +{ + return cbs->initial_len - cbs->len; +} + int CBS_skip(CBS *cbs, size_t len) { |