From ec726e0058149f890023aadaeeaa6c77edfa32b3 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Mon, 9 Jun 2014 10:11:59 +0200 Subject: Added test for asn1_der_decoding_startEnd() after an asn1_dup_node(). --- tests/copynode.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests') 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); -- cgit v1.2.3