diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-03-14 15:02:15 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-03-14 15:02:15 +0100 |
commit | 05b093a2ef966fd02a2e93248194778b1caa2d55 (patch) | |
tree | 1c7f86f3ef28a9741f9eb93b371d1ada53d0cffc | |
parent | 27251752116bd04dcf5369ae93b03769847ce879 (diff) | |
download | libtasn1-05b093a2ef966fd02a2e93248194778b1caa2d55.tar.gz libtasn1-05b093a2ef966fd02a2e93248194778b1caa2d55.tar.bz2 libtasn1-05b093a2ef966fd02a2e93248194778b1caa2d55.zip |
Handle recursive CHOICEs.
-rw-r--r-- | lib/decoding.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/decoding.c b/lib/decoding.c index 26e5041..82f1c24 100644 --- a/lib/decoding.c +++ b/lib/decoding.c @@ -538,6 +538,9 @@ _asn1_extract_tag_der (asn1_node node, const unsigned char *der, int der_len, case ASN1_ETYPE_ANY: counter -= len2; break; + case ASN1_ETYPE_CHOICE: + counter -= len2; + break; default: return ASN1_DER_ERROR; break; @@ -566,6 +569,8 @@ int ris; break; p = p->right; } + + *ret_len = 0; return ris; } else @@ -973,7 +978,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int len, goto cleanup; } } - else + else if (type_field (p->type) != ASN1_ETYPE_CHOICE) p = p->down; } @@ -987,7 +992,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int len, if (ris == ASN1_SUCCESS) ris = - _asn1_extract_tag_der (p, der + counter, len - counter, &len2); + extract_tag_der_recursive (p, der + counter, len - counter, &len2); if (ris != ASN1_SUCCESS) { if (p->type & CONST_OPTION) @@ -1563,7 +1568,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName, goto cleanup; } } - else + else if (type_field (p->type) != ASN1_ETYPE_CHOICE) p = p->down; } |