summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-05-30 14:07:02 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-05-30 15:21:22 +0200
commitd14caccbe1f54c42437b41e5a1863339f5987fc6 (patch)
tree80e1740c6be6019107d42a6e3cc14861268da6db
parentdfc8f76ef9a9f9da0fead5777605af4003eb8018 (diff)
downloadlibtasn1-d14caccbe1f54c42437b41e5a1863339f5987fc6.tar.gz
Added check for decoding_startEnd().
-rw-r--r--tests/Test_encdec.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/Test_encdec.c b/tests/Test_encdec.c
index 363f2ff..9b49e72 100644
--- a/tests/Test_encdec.c
+++ b/tests/Test_encdec.c
@@ -47,6 +47,7 @@ main (int argc, char *argv[])
char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
FILE *out, *fd;
ssize_t size;
+ int start, end;
int size2;
const char *treefile = getenv ("ASN1PKIX");
const char *derfile = getenv ("ASN1CRLDER");
@@ -116,6 +117,45 @@ main (int argc, char *argv[])
exit (1);
}
+ result = asn1_der_decoding_startEnd (asn1_element, buffer, size, "tbsCertList", &start, &end);
+ if (result != ASN1_SUCCESS)
+ {
+ asn1_perror (result);
+ printf ("Cannot find start End\n");
+ exit (1);
+ }
+ if (start != 4 && end != 358)
+ {
+ printf("Error in start and end values. 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);
+ }
+
+ result = asn1_der_decoding_startEnd (asn1_element, buffer, size, "tbsCertList.revokedCertificates.?1.userCertificate", &start, &end);
+ if (result != ASN1_SUCCESS)
+ {
+ asn1_perror (result);
+ printf ("Cannot find start End\n");
+ exit (1);
+ }
+ if (start != 326 && end != 343)
+ {
+ printf("Error in start and end values for userCertificate. Have: %d..%d\n", start, end);
+ exit(1);
+ }
+
size2 = sizeof(buffer2);
result = asn1_der_coding (asn1_element, "", buffer2, &size2, NULL);
if (result != ASN1_SUCCESS)