summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2014-08-27 20:19:50 -0400
committerAdam Langley <agl@google.com>2014-08-28 00:45:30 +0000
commit9b04d657be7daa60864ee0ea81bc493ba07b8ca8 (patch)
tree180d470a8d4ca26c49316ffc167be014dc40c22b /include
parent041b58a6684d2f032f66fa45b0e35f50f9a0fa40 (diff)
downloadsrc-9b04d657be7daa60864ee0ea81bc493ba07b8ca8.tar.gz
Export CBS_get_any_asn1_element.
Useful for parsing things when you don't know what tag to expect (e.g. a CHOICE). Also allow its operands to be NULL, so that it can be used to skip arbitrary elements. Delete CBS_ASN1_ANY which wasn't doing anything. Change-Id: I56413e68b4f2e13860ea3e55373d5830713d7e5c Reviewed-on: https://boringssl-review.googlesource.com/1661 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/openssl/bytestring.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/openssl/bytestring.h b/include/openssl/bytestring.h
index a7507d8..6e18499 100644
--- a/include/openssl/bytestring.h
+++ b/include/openssl/bytestring.h
@@ -128,8 +128,6 @@ OPENSSL_EXPORT int CBS_get_u24_length_prefixed(CBS *cbs, CBS *out);
#define CBS_ASN1_CONSTRUCTED 0x20
#define CBS_ASN1_CONTEXT_SPECIFIC 0x80
-#define CBS_ASN1_ANY 0x10000
-
/* CBS_get_asn1 sets |*out| to the contents of DER-encoded, ASN.1 element (not
* including tag and length bytes) and advances |cbs| over it. The ASN.1
* element must match |tag_value|. It returns one on success and zero
@@ -142,6 +140,18 @@ OPENSSL_EXPORT int CBS_get_asn1(CBS *cbs, CBS *out, unsigned tag_value);
* ASN.1 header bytes too. */
OPENSSL_EXPORT int CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned tag_value);
+/* CBS_get_any_asn1_element sets |*out| to contain the next ASN.1 element from
+ * |*cbs| (including header bytes) and advances |*cbs|. It sets |*out_tag| to
+ * the tag number and |*out_header_len| to the length of the ASN.1 header. If
+ * the element has indefinite length then |*out| will only contain the
+ * header. Each of |out|, |out_tag|, and |out_header_len| may be NULL to ignore
+ * the value.
+ *
+ * Tag numbers greater than 31 are not supported. */
+OPENSSL_EXPORT int CBS_get_any_asn1_element(CBS *cbs, CBS *out,
+ unsigned *out_tag,
+ size_t *out_header_len);
+
/* CBS_get_asn1_uint64 gets an ASN.1 INTEGER from |cbs| using |CBS_get_asn1|
* and sets |*out| to its value. It returns one on success and zero on error,
* where error includes the integer being negative, or too large to represent