From e54cc10f1680a965c058dcb9c32c3cd1750ae13d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 29 Sep 2004 12:40:30 +0000 Subject: r2749: add asn1_read_implicit_Integer() metze (This used to be commit a62fbcb30f63245d9dfb48c83a5f449965bb1ca7) --- source4/libcli/util/asn1.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'source4/libcli/util/asn1.c') diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c index 4ff335399a..138ae930e3 100644 --- a/source4/libcli/util/asn1.c +++ b/source4/libcli/util/asn1.c @@ -591,17 +591,27 @@ BOOL asn1_read_ContextSimple(ASN1_DATA *data, uint8_t num, DATA_BLOB *blob) return !data->has_error; } -/* read an interger */ -BOOL asn1_read_Integer(ASN1_DATA *data, int *i) +/* read an interger without tag*/ +BOOL asn1_read_implicit_Integer(ASN1_DATA *data, int *i) { uint8_t b; *i = 0; - - if (!asn1_start_tag(data, ASN1_INTEGER)) return False; + while (asn1_tag_remaining(data)>0) { - asn1_read_uint8(data, &b); + if (!asn1_read_uint8(data, &b)) return False; *i = (*i << 8) + b; } + return !data->has_error; + +} + +/* read an interger */ +BOOL asn1_read_Integer(ASN1_DATA *data, int *i) +{ + *i = 0; + + if (!asn1_start_tag(data, ASN1_INTEGER)) return False; + if (!asn1_read_implicit_Integer(data, i)) return False; return asn1_end_tag(data); } -- cgit