summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-06-09 11:30:06 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-06-09 11:30:08 +0200
commit220c35dfae010a503b3993044376f96d57e062a1 (patch)
treee6d8a87f55aede3b39da69ee4d736efb15e0f374
parentf908a06812970930ca6c0e8545e9d4c8e2d0c690 (diff)
downloadlibtasn1-220c35dfae010a503b3993044376f96d57e062a1.tar.gz
libtasn1-220c35dfae010a503b3993044376f96d57e062a1.tar.bz2
libtasn1-220c35dfae010a503b3993044376f96d57e062a1.zip
When encoding DER note the positions of the DER start and end.
That will allow using asn1_der_decoding_startEnd() without performing decoding.
-rw-r--r--lib/coding.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/coding.c b/lib/coding.c
index dc79fcc..2dd80ba 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -1035,6 +1035,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
counter = 0;
move = DOWN;
p = node;
+
while (1)
{
@@ -1042,6 +1043,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
max_len_old = max_len;
if (move != UP)
{
+ p->start = counter;
err = _asn1_insert_tag_der (p, der, &counter, &max_len);
if (err != ASN1_SUCCESS && err != ASN1_MEM_ERROR)
goto error;
@@ -1297,6 +1299,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
if ((move != DOWN) && (counter != counter_old))
{
+ p->end = counter - 1;
err = _asn1_complete_explicit_tag (p, der, &counter, &max_len);
if (err != ASN1_SUCCESS && err != ASN1_MEM_ERROR)
goto error;