From 22cb9bdfd3c3a6a036db08c9c10d7c2530167fc3 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 19 Jun 2009 18:20:20 +0200 Subject: Move asn1_load_nocopy() to lib/util/asn1.c --- lib/util/asn1.c | 10 ++++++++++ lib/util/asn1.h | 1 + 2 files changed, 11 insertions(+) (limited to 'lib') diff --git a/lib/util/asn1.c b/lib/util/asn1.c index 08c4060fd1..184aeec909 100644 --- a/lib/util/asn1.c +++ b/lib/util/asn1.c @@ -779,6 +779,16 @@ bool asn1_blob(const struct asn1_data *asn1, DATA_BLOB *blob) return true; } +/* + Fill in an asn1 struct without making a copy +*/ +void asn1_load_nocopy(struct asn1_data *data, uint8_t *buf, size_t len) +{ + ZERO_STRUCTP(data); + data->data = buf; + data->length = len; +} + /* check if a ASN.1 blob is a full tag */ diff --git a/lib/util/asn1.h b/lib/util/asn1.h index b46494b2ea..b147cccdee 100644 --- a/lib/util/asn1.h +++ b/lib/util/asn1.h @@ -94,6 +94,7 @@ bool asn1_read_enumerated(struct asn1_data *data, int *v); bool asn1_check_enumerated(struct asn1_data *data, int v); bool asn1_write_enumerated(struct asn1_data *data, uint8_t v); bool asn1_blob(const struct asn1_data *asn1, DATA_BLOB *blob); +void asn1_load_nocopy(struct asn1_data *data, uint8_t *buf, size_t len); NTSTATUS asn1_full_tag(DATA_BLOB blob, uint8_t tag, size_t *packet_size); #endif /* _ASN_1_H */ -- cgit