diff options
author | Harald Welte <laforge@gnumonks.org> | 2016-01-01 16:42:52 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-01-01 16:47:13 +0100 |
commit | 962da50e082b6ad262c533ab185eee0e9a770e60 (patch) | |
tree | 5d5e0ffa2ef8e8ce6ec1fc90f4122e85c7683b16 | |
parent | 1cdb81dd98a8366aac495b8ebc6758e138e55808 (diff) |
asn1helpers: Add new OCTET_STRING_noalloc
This assings the buffer + size of an OCTET_STRING without allocating a new
buffer and copying the data.
-rw-r--r-- | src/asn1helpers.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/asn1helpers.h b/src/asn1helpers.h index 0d121bb..007f207 100644 --- a/src/asn1helpers.h +++ b/src/asn1helpers.h @@ -18,3 +18,9 @@ uint8_t asn1str_to_u8(const OCTET_STRING_t *in); uint32_t asn1bitstr_to_u32(const BIT_STRING_t *in); uint32_t asn1bitstr_to_u28(const BIT_STRING_t *in); uint32_t asn1bitstr_to_u24(const BIT_STRING_t *in); + +static inline void OCTET_STRING_noalloc(OCTET_STRING_t *s, const uint8_t *str, int size) +{ + s->buf = str; + s->size = size; +} |