summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-06-09 10:11:59 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-06-09 10:11:59 +0200
commitec726e0058149f890023aadaeeaa6c77edfa32b3 (patch)
tree865704630d5533126de0f6fdd5fc55b218c7b571 /tests
parent2318607f3dad6e7a7009385917dafe6d02654189 (diff)
downloadlibtasn1-ec726e0058149f890023aadaeeaa6c77edfa32b3.tar.gz
libtasn1-ec726e0058149f890023aadaeeaa6c77edfa32b3.tar.bz2
libtasn1-ec726e0058149f890023aadaeeaa6c77edfa32b3.zip
Added test for asn1_der_decoding_startEnd() after an asn1_dup_node().
Diffstat (limited to 'tests')
-rw-r--r--tests/copynode.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/copynode.c b/tests/copynode.c
index a24f1ce..29a8a51 100644
--- a/tests/copynode.c
+++ b/tests/copynode.c
@@ -46,6 +46,7 @@ main (int argc, char *argv[])
asn1_node asn1_element = NULL, cpy_node = NULL;
char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
FILE *out, *fd;
+ int start, end;
ssize_t size;
int size2;
const char *treefile = getenv ("ASN1PKIX");
@@ -176,6 +177,32 @@ main (int argc, char *argv[])
exit(1);
}
+ result = asn1_der_decoding_startEnd (asn1_element, buffer, size, "tbsCertList.issuer", &start, &end);
+ if (result != ASN1_SUCCESS)
+ {
+ asn1_perror (result);
+ printf ("Cannot find start End\n");
+ exit (1);
+ }
+ if (start != 24 && end != 291)
+ {
+ printf("Error in start and end values for issuer. Have: %d..%d\n", start, end);
+ exit(1);
+ }
+
+ result = asn1_der_decoding_startEnd (asn1_element, buffer, size, "signature", &start, &end);
+ if (result != ASN1_SUCCESS)
+ {
+ asn1_perror (result);
+ printf ("Cannot find start End\n");
+ exit (1);
+ }
+ if (start != 372 && end != 503)
+ {
+ printf("Error in start and end values for signature. Have: %d..%d\n", start, end);
+ exit(1);
+ }
+
/* Clear the definition structures */
asn1_delete_structure (&asn1_element);
asn1_delete_structure (&cpy_node);