summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-09-29 12:40:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:30 -0500
commite54cc10f1680a965c058dcb9c32c3cd1750ae13d (patch)
treed1eba03018f066d01764b8fdc4b1914811491d1d
parent525dc6f089837456b0fff1d44d50aed4a7ef52ec (diff)
downloadsamba-e54cc10f1680a965c058dcb9c32c3cd1750ae13d.tar.gz
samba-e54cc10f1680a965c058dcb9c32c3cd1750ae13d.tar.bz2
samba-e54cc10f1680a965c058dcb9c32c3cd1750ae13d.zip
r2749: add asn1_read_implicit_Integer()
metze (This used to be commit a62fbcb30f63245d9dfb48c83a5f449965bb1ca7)
-rw-r--r--source4/libcli/util/asn1.c20
1 files changed, 15 insertions, 5 deletions
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);
}