int
main (int argc, char *argv[])
{
- int result;
+ int result, verbose = 0;
asn1_node_t definitions = NULL;
asn1_node_t asn1_element = NULL;
char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
const char *treefile = getenv ("ASN1ENCODING");
+ if (argc > 1)
+ verbose = 1;
+
if (!treefile)
treefile = "Test_encoding.asn";
- printf ("\n\n/****************************************/\n");
- printf ("/* Test sequence : coding-decoding */\n");
- printf ("/****************************************/\n\n");
+ if (verbose != 0)
+ {
+ printf ("\n\n/****************************************/\n");
+ printf ("/* Test sequence : coding-decoding */\n");
+ printf ("/****************************************/\n\n");
+ }
/* Check version */
if (asn1_check_version ("0.3.3") == NULL)
asn1_delete_structure (&asn1_element);
- printf ("Success\n");
+ if (verbose) printf ("Success\n");
exit (0);
}
{
int ec = 0;
const char *errstr;
+ int verbose = 0;
+
+ if (argc > 1)
+ verbose = 1;
do
{
errstr = asn1_strerror (ec);
- asn1_perror (ec);
+ if (verbose != 0)
+ asn1_perror (ec);
ec++;
}
while (errstr);
ssize_t size;
const char *treefile = getenv ("ASN1PKIX");
const char *indeffile = getenv ("ASN1INDEF");
+ int verbose = 0;
+
+ if (argc > 1)
+ verbose = 1;
if (!treefile)
treefile = "pkix.asn";
if (!indeffile)
indeffile = "TestIndef.p12";
- printf ("\n\n/****************************************/\n");
- printf ("/* Test sequence : Test_indefinite */\n");
- printf ("/****************************************/\n\n");
- printf ("ASN1TREE: %s\n", treefile);
+ if (verbose)
+ {
+ printf ("\n\n/****************************************/\n");
+ printf ("/* Test sequence : Test_indefinite */\n");
+ printf ("/****************************************/\n\n");
+ printf ("ASN1TREE: %s\n", treefile);
+ }
/* Check version */
if (asn1_check_version ("0.2.11") == NULL)
#include "libtasn1.h"
int
-main (void)
+main (int argc, char** argv)
{
/* Test that values larger than long are rejected. This has worked
fine with all versions of libtasn1. */
+ int verbose = 0;
+
+ if (argc > 1)
+ verbose = 1;
+
{
unsigned char der[] = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";
long l;
l = asn1_get_length_der (der, sizeof der, &len);
if (l == -2L)
- puts ("OK: asn1_get_length_der bignum");
+ {
+ if (verbose) puts ("OK: asn1_get_length_der bignum");
+ }
else
{
printf ("ERROR: asn1_get_length_der bignum (l %ld len %d)\n", l, len);
l = asn1_get_length_der (der, der_len, &len);
if (l == -2L)
- puts ("OK: asn1_get_length_der intnum");
+ {
+ if (verbose) puts ("OK: asn1_get_length_der intnum");
+ }
else
{
printf ("ERROR: asn1_get_length_der intnum (l %ld len %d)\n", l,
l = asn1_get_length_der (der, der_len, &len);
if (l == -4L)
- puts ("OK: asn1_get_length_der overflow-small");
+ {
+ if (verbose) puts ("OK: asn1_get_length_der overflow-small");
+ }
else
{
printf ("ERROR: asn1_get_length_der overflow-small (l %ld len %d)\n", l,
l = asn1_get_length_der (der, der_len, &len);
if (l == -4L)
- puts ("OK: asn1_get_length_der overflow-large1");
+ {
+ if (verbose) puts ("OK: asn1_get_length_der overflow-large1");
+ }
else
{
printf ("ERROR: asn1_get_length_der overflow-large1 (l %ld len %d)\n", l,
l = asn1_get_length_der (der, der_len, &len);
if (l == -2L)
- puts ("OK: asn1_get_length_der overflow-large2");
+ {
+ if (verbose) puts ("OK: asn1_get_length_der overflow-large2");
+ }
else
{
printf ("ERROR: asn1_get_length_der overflow-large2 (l %ld len %d)\n", l,
char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
test_type *test;
int errorCounter = 0, testCounter = 0;
+ int verbose = 0;
+
+ if (argc > 1)
+ verbose = 1;
fileCorrectName = getenv ("ASN1PARSER");
if (!fileCorrectName)
fileCorrectName = "Test_parser.asn";
- printf ("\n\n/****************************************/\n");
- printf ("/* Test sequence : Test_parser */\n");
- printf ("/****************************************/\n\n");
- printf ("ASN1PARSER: %s\n", fileCorrectName);
+ if (verbose != 0)
+ {
+ printf ("\n\n/****************************************/\n");
+ printf ("/* Test sequence : Test_parser */\n");
+ printf ("/****************************************/\n\n");
+ printf ("ASN1PARSER: %s\n", fileCorrectName);
+ }
result = asn1_parser2tree (fileCorrectName, &definitions, errorDescription);
}
- printf ("Total tests : %d\n", testCounter);
- printf ("Total errors: %d\n", errorCounter);
+ if (verbose != 0)
+ {
+ printf ("Total tests : %d\n", testCounter);
+ printf ("Total errors: %d\n", errorCounter);
+ }
if (errorCounter > 0)
return 1;
unsigned char value[1024], der[1024];
int valueLen, tag = 0, class = 0;
int k;
- int start, end;
+ int start, end, verbose = 0;
const char *str_p = NULL;
const char *treefile = getenv ("ASN1TREE");
+
+ if (argc > 1)
+ verbose = 1;
if (!treefile)
treefile = "Test_tree.asn";
- printf ("\n\n/****************************************/\n");
- printf ("/* Test sequence : Test_tree */\n");
- printf ("/****************************************/\n\n");
- printf ("ASN1TREE: %s\n", treefile);
+ if (verbose != 0)
+ {
+ printf ("\n\n/****************************************/\n");
+ printf ("/* Test sequence : Test_tree */\n");
+ printf ("/****************************************/\n\n");
+ printf ("ASN1TREE: %s\n", treefile);
+ }
/* Check version */
if (asn1_check_version ("0.2.11") == NULL)
str_p = asn1_find_structure_from_oid (definitions, test->par1);
break;
case ACT_VISIT:
- asn1_print_structure (out, asn1_element, test->par1, test->par3);
- fprintf (out, "\n");
+ if (verbose)
+ {
+ asn1_print_structure (out, asn1_element, test->par1, test->par3);
+ fprintf (out, "\n");
+ }
result = ASN1_SUCCESS;
break;
case ACT_PRINT_DER:
- printf ("DER encoding len:%i\n", der_len);
- printf ("DER encoding: ");
- for (k = 0; k < der_len; k++)
- printf ("%02x ", der[k]);
- printf ("\n\n");
+ if (verbose)
+ {
+ printf ("DER encoding len:%i\n", der_len);
+ printf ("DER encoding: ");
+ for (k = 0; k < der_len; k++)
+ printf ("%02x ", der[k]);
+ printf ("\n\n");
+ }
result = ASN1_SUCCESS;
break;
case ACT_SET_DER:
}
- printf ("Total tests : %d\n", testCounter);
- printf ("Total errors: %d\n", errorCounter);
-
+ if (verbose != 0)
+ {
+ printf ("Total tests : %d\n", testCounter);
+ printf ("Total errors: %d\n", errorCounter);
+ }
/* Clear the definition structures */
asn1_delete_structure (&definitions);
$ASN1DECODING \
$srcdir/../examples/pkix.asn \
$srcdir/crlf.cer \
- PKIX1Implicit88.Certificate
+ PKIX1Implicit88.Certificate >/dev/null