summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ASN1.c3
-rw-r--r--lib/ASN1.y21
-rw-r--r--lib/libtasn1.h3
-rw-r--r--tests/Test_encoding.c6
-rw-r--r--tests/Test_errors.c2
-rw-r--r--tests/Test_indefinite.c6
-rw-r--r--tests/Test_parser.c4
-rw-r--r--tests/Test_simple.c2
-rw-r--r--tests/Test_tree.c6
-rw-r--r--tests/Test_tree_asn1_tab.c326
10 files changed, 194 insertions, 185 deletions
diff --git a/lib/ASN1.c b/lib/ASN1.c
index f61df56..8a73052 100644
--- a/lib/ASN1.c
+++ b/lib/ASN1.c
@@ -2811,7 +2811,8 @@ _asn1_create_errorDescription(int error,char *errorDescription)
**/
int
asn1_parser2tree(const char *file_name, asn_node_t *definitions,
- char *errorDescription){
+ char *errorDescription)
+{
p_tree=NULL;
diff --git a/lib/ASN1.y b/lib/ASN1.y
index 66173ea..68515cf 100644
--- a/lib/ASN1.y
+++ b/lib/ASN1.y
@@ -32,9 +32,9 @@
#include <structure.h>
static FILE *file_asn1; /* Pointer to file to parse */
-static asn1_retCode result_parse; /* result of the parser
+static int result_parse; /* result of the parser
algorithm */
-static ASN1_TYPE p_tree; /* pointer to the root of the
+static asn_node_t p_tree; /* pointer to the root of the
structure created by the
parser*/
static unsigned long lineNumber; /* line number describing the
@@ -57,7 +57,7 @@ static int _asn1_yylex(void);
%union {
unsigned int constant;
char str[ASN1_MAX_NAME_SIZE+1];
- ASN1_TYPE node;
+ asn_node_t node;
}
@@ -568,23 +568,24 @@ _asn1_create_errorDescription(int error,char *errorDescription)
*
* Returns: %ASN1_SUCCESS if the file has a correct syntax and every
* identifier is known, %ASN1_ELEMENT_NOT_EMPTY if @definitions not
- * %ASN1_TYPE_EMPTY, %ASN1_FILE_NOT_FOUND if an error occured while
+ * %NULL, %ASN1_FILE_NOT_FOUND if an error occured while
* opening @file_name, %ASN1_SYNTAX_ERROR if the syntax is not
* correct, %ASN1_IDENTIFIER_NOT_FOUND if in the file there is an
* identifier that is not defined, %ASN1_NAME_TOO_LONG if in the
* file there is an identifier whith more than %ASN1_MAX_NAME_SIZE
* characters.
**/
-asn1_retCode
-asn1_parser2tree(const char *file_name, ASN1_TYPE *definitions,
- char *errorDescription){
+int
+asn1_parser2tree(const char *file_name, asn_node_t *definitions,
+ char *errorDescription)
+{
- p_tree=ASN1_TYPE_EMPTY;
+ p_tree=NULL;
- if(*definitions != ASN1_TYPE_EMPTY)
+ if(*definitions != NULL)
return ASN1_ELEMENT_NOT_EMPTY;
- *definitions=ASN1_TYPE_EMPTY;
+ *definitions=NULL;
fileName = file_name;
diff --git a/lib/libtasn1.h b/lib/libtasn1.h
index f5ecbd7..8ad6b13 100644
--- a/lib/libtasn1.h
+++ b/lib/libtasn1.h
@@ -298,7 +298,8 @@ extern "C"
asn_node_t src, const char *src_name);
/* Compatibility types */
- typedef int asn1_retCode; /* type returned by libtasn1 functions */
+
+typedef int asn1_retCode; /* type returned by libtasn1 functions */
#define node_asn_struct asn_node_st
#define node_asn asn_node_st
diff --git a/tests/Test_encoding.c b/tests/Test_encoding.c
index 5dbd4c9..1c0323d 100644
--- a/tests/Test_encoding.c
+++ b/tests/Test_encoding.c
@@ -36,9 +36,9 @@ int data_size = sizeof (data);
int
main (int argc, char *argv[])
{
- asn1_retCode result;
- ASN1_TYPE definitions = ASN1_TYPE_EMPTY;
- ASN1_TYPE asn1_element = ASN1_TYPE_EMPTY;
+ int result;
+ asn_node_t definitions = NULL;
+ asn_node_t asn1_element = NULL;
char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
const char *treefile = getenv ("ASN1ENCODING");
diff --git a/tests/Test_errors.c b/tests/Test_errors.c
index 2c85100..8480b22 100644
--- a/tests/Test_errors.c
+++ b/tests/Test_errors.c
@@ -23,7 +23,7 @@
int
main (int argc, char *argv[])
{
- asn1_retCode ec = 0;
+ int ec = 0;
const char *errstr;
do
diff --git a/tests/Test_indefinite.c b/tests/Test_indefinite.c
index f77e69a..108f3db 100644
--- a/tests/Test_indefinite.c
+++ b/tests/Test_indefinite.c
@@ -39,10 +39,10 @@
int
main (int argc, char *argv[])
{
- asn1_retCode result;
+ int result;
char buffer[10 * 1024];
- ASN1_TYPE definitions = ASN1_TYPE_EMPTY;
- ASN1_TYPE asn1_element = ASN1_TYPE_EMPTY;
+ asn_node_t definitions = NULL;
+ asn_node_t asn1_element = NULL;
char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
FILE *out, *fd;
ssize_t size;
diff --git a/tests/Test_parser.c b/tests/Test_parser.c
index fd56210..2d5dd48 100644
--- a/tests/Test_parser.c
+++ b/tests/Test_parser.c
@@ -147,8 +147,8 @@ createFile (int lineNumber, const char *line)
int
main (int argc, char *argv[])
{
- asn1_retCode result;
- ASN1_TYPE definitions = ASN1_TYPE_EMPTY;
+ int result;
+ asn_node_t definitions = NULL;
char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
test_type *test;
int errorCounter = 0, testCounter = 0;
diff --git a/tests/Test_simple.c b/tests/Test_simple.c
index 7527184..b6bb53d 100644
--- a/tests/Test_simple.c
+++ b/tests/Test_simple.c
@@ -79,7 +79,7 @@ static const struct tv tv[] = {
int
main (int argc, char *argv[])
{
- asn1_retCode result;
+ int result;
unsigned char der[100];
unsigned char str[100];
int der_len = sizeof (der);
diff --git a/tests/Test_tree.c b/tests/Test_tree.c
index c68cbc2..295859b 100644
--- a/tests/Test_tree.c
+++ b/tests/Test_tree.c
@@ -432,9 +432,9 @@ test_type test_array[] = {
int
main (int argc, char *argv[])
{
- asn1_retCode result;
- ASN1_TYPE definitions = ASN1_TYPE_EMPTY;
- ASN1_TYPE asn1_element = ASN1_TYPE_EMPTY;
+ int result;
+ asn_node_t definitions = NULL;
+ asn_node_t asn1_element = NULL;
char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
FILE *out;
test_type *test;
diff --git a/tests/Test_tree_asn1_tab.c b/tests/Test_tree_asn1_tab.c
index d736a19..caf8cfc 100644
--- a/tests/Test_tree_asn1_tab.c
+++ b/tests/Test_tree_asn1_tab.c
@@ -1,163 +1,169 @@
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
-#include "libtasn1.h"
+#include <libtasn1.h>
-const ASN1_ARRAY_TYPE Test_tree_asn1_tab[]={
- {"TEST_TREE",536875024,0},
- {0,1610612748,0},
- {"iso",1073741825,"1"},
- {"identified-organization",1073741825,"3"},
- {"dod",1073741825,"6"},
- {"internet",1073741825,"1"},
- {"security",1073741825,"5"},
- {"mechanisms",1073741825,"5"},
- {"pkix",1073741825,"7"},
- {"id-mod",1073741825,"0"},
- {"id-pkix1-implicit-88",1,"2"},
- {"KrbError",1610620933,0},
- {0,1073746952,"30"},
- {"pvno",536879107,0},
- {0,4104,"0"},
- {"CertTemplate",1610612741,0},
- {"version",1610637315,0},
- {0,4104,"0"},
- {"issuer",1610637314,"Name"},
- {0,4104,"3"},
- {"validity",536895491,0},
- {0,4104,"4"},
- {"Name",1610612754,0},
- {"rdnSequence",2,"RDNSequence"},
- {"RDNSequence",1073741826,"RelativeDistinguishedName"},
- {"RelativeDistinguishedName",1612709903,0},
- {"MAX",1074266122,"1"},
- {0,2,"AttributeTypeAndValue"},
- {"AttributeTypeAndValue",1610612741,0},
- {"type",1073741826,"AttributeType"},
- {"value",2,"AttributeValue"},
- {"AttributeType",1073741836,0},
- {"AttributeValue",1073741837,0},
- {"sequenceEmpty",1610612741,0},
- {"int1",1073741827,0},
- {"seq1",1610620930,"Sequence_octetTest1"},
- {0,4104,"1"},
- {"set1",536879119,0},
- {0,1073743880,"2"},
- {0,3,0},
- {"IndefiniteLengthTest",1610612741,0},
- {"seq1",1610620930,"Sequence_octetTest1"},
- {0,4104,"1"},
- {"set1",1610612751,0},
- {0,12,0},
- {"int1",3,0},
- {"OidTest",1610612741,0},
- {"oid3",1610653708,0},
- {0,1073741833,"id-Test"},
- {0,4104,"3"},
- {"oid",1610653708,0},
- {0,1073741833,"id-anyTest2"},
- {0,4104,"1"},
- {"oid2",536911884,0},
- {0,1073741833,"id-anyTest"},
- {0,4104,"2"},
- {"OidAndTimeTest",1610612741,0},
- {"set",1610612751,0},
- {0,3,0},
- {"oid",1073741836,0},
- {"time2",1082130449,0},
- {"bol",1073741828,0},
- {"oct",1073741831,0},
- {"bit",1073758214,0},
- {"bol2",1610645508,0},
- {0,65545,0},
- {"enum",1610907669,0},
- {0,1073741833,"v1"},
- {"v1",1073741825,"1"},
- {"v2",1,"2"},
- {"any",1610637325,0},
- {0,4104,"1"},
- {"gen",1073758235,0},
- {"time1",16777233,0},
- {"SequenceTestTag",1610612741,0},
- {"int1",1610620931,0},
- {0,2056,"2"},
- {"int2",1610620931,0},
- {0,4104,"3"},
- {"str1",1610620930,"PrintableString"},
- {0,4104,"1"},
- {"str2",1073741826,"UniversalString"},
- {"str3",536879106,"UniversalString"},
- {0,2056,"2"},
- {"Sequence1",1610612741,0},
- {"int1",1610915843,0},
- {0,1073741833,"v2"},
- {0,1073745928,"0"},
- {"v1",1073741825,"0"},
- {"v2",1073741825,"1"},
- {"v3",1,"2"},
- {"int2",1073741827,0},
- {"seq",1610612751,0},
- {0,3,0},
- {"id",1073741836,0},
- {"oct",1073741831,0},
- {"any1",541081613,0},
- {"id",1,0},
- {"DHParameter",1610612741,0},
- {"prime",1073741827,0},
- {"base",1073741827,0},
- {"privateValueLength",16387,0},
- {"id-octetTest1",1879048204,0},
- {0,1073741825,"1"},
- {0,1073741825,"2"},
- {0,1073741825,"3"},
- {0,1,"4"},
- {"Sequence_octetTest1",1610612741,0},
- {"int",16387,0},
- {"AnyTest2",1610612754,0},
- {"str",1073741831,0},
- {"int",3,0},
- {"id-ic",1879048204,0},
- {0,1073741825,"2"},
- {0,1,"5"},
- {"id-anyTest",1879048204,0},
- {0,1073741825,"id-ic"},
- {0,1073741825,"29"},
- {0,1,"1"},
- {"id-anyTest2",1879048204,0},
- {0,1073741825,"id-ic"},
- {0,1073741825,"29"},
- {0,1,"2"},
- {"anyTest2",1073741827,0},
- {"VisibleString",1610620935,0},
- {0,4360,"26"},
- {"NumericString",1610620935,0},
- {0,4360,"18"},
- {"IA5String",1610620935,0},
- {0,4360,"22"},
- {"TeletexString",1610620935,0},
- {0,4360,"20"},
- {"PrintableString",1610620935,0},
- {0,4360,"19"},
- {"UniversalString",1610620935,0},
- {0,4360,"28"},
- {"BMPString",1610620935,0},
- {0,4360,"30"},
- {"UTF8String",1610620935,0},
- {0,4360,"12"},
- {"Test3",1610612741,0},
- {"a",1073741827,0},
- {"b",536879106,"GeneralString2"},
- {0,2056,"1"},
- {"GeneralString2",1610620955,0},
- {0,2056,"2"},
- {"X520LocalityName",1610612754,0},
- {"teletexString",1073741826,"TeletexString"},
- {"printableString",1073741826,"PrintableString"},
- {"universalString",1073741826,"UniversalString"},
- {"utf8String",1073741826,"UTF8String"},
- {"bmpString",2,"BMPString"},
- {"id-Test",805306380,0},
- {0,1073741825,"1"},
- {0,1073741825,"2"},
- {0,1073741825,"29"},
- {0,1,"2"},
- {0,0,0}
+const asn_static_node_t Test_tree_asn1_tab[] = {
+ { "TEST_TREE", 536875024, NULL },
+ { NULL, 1610612748, NULL },
+ { "iso", 1073741825, "1"},
+ { "identified-organization", 1073741825, "3"},
+ { "dod", 1073741825, "6"},
+ { "internet", 1073741825, "1"},
+ { "security", 1073741825, "5"},
+ { "mechanisms", 1073741825, "5"},
+ { "pkix", 1073741825, "7"},
+ { "id-mod", 1073741825, "0"},
+ { "id-pkix1-implicit-88", 1, "2"},
+ { "KrbError", 1610620933, NULL },
+ { NULL, 1073746952, "30"},
+ { "pvno", 536879107, NULL },
+ { NULL, 4104, "0"},
+ { "Checksum", 1610612741, NULL },
+ { "checksum", 536879111, NULL },
+ { NULL, 4104, "1"},
+ { "CertTemplate", 1610612741, NULL },
+ { "version", 1610637315, NULL },
+ { NULL, 4104, "0"},
+ { "issuer", 1610637314, "Name"},
+ { NULL, 4104, "3"},
+ { "validity", 536895491, NULL },
+ { NULL, 4104, "4"},
+ { "Name", 1610612754, NULL },
+ { "rdnSequence", 2, "RDNSequence"},
+ { "RDNSequence", 1073741826, "RelativeDistinguishedName"},
+ { "RelativeDistinguishedName", 1612709903, NULL },
+ { "MAX", 1074266122, "1"},
+ { NULL, 2, "AttributeTypeAndValue"},
+ { "AttributeTypeAndValue", 1610612741, NULL },
+ { "type", 1073741826, "AttributeType"},
+ { "value", 2, "AttributeValue"},
+ { "AttributeType", 1073741836, NULL },
+ { "AttributeValue", 1073741837, NULL },
+ { "sequenceEmpty", 1610612741, NULL },
+ { "int1", 1073741827, NULL },
+ { "seq1", 1610620930, "Sequence_octetTest1"},
+ { NULL, 4104, "1"},
+ { "set1", 536879119, NULL },
+ { NULL, 1073743880, "2"},
+ { NULL, 3, NULL },
+ { "IndefiniteLengthTest", 1610612741, NULL },
+ { "seq1", 1610620930, "Sequence_octetTest1"},
+ { NULL, 4104, "1"},
+ { "set1", 1610612751, NULL },
+ { NULL, 12, NULL },
+ { "int1", 3, NULL },
+ { "OidTest", 1610612741, NULL },
+ { "oid3", 1610653708, NULL },
+ { NULL, 1073741833, "id-Test"},
+ { NULL, 4104, "3"},
+ { "oid", 1610653708, NULL },
+ { NULL, 1073741833, "id-anyTest2"},
+ { NULL, 4104, "1"},
+ { "oid2", 536911884, NULL },
+ { NULL, 1073741833, "id-anyTest"},
+ { NULL, 4104, "2"},
+ { "OidAndTimeTest", 1610612741, NULL },
+ { "set", 1610612751, NULL },
+ { NULL, 3, NULL },
+ { "oid", 1073741836, NULL },
+ { "time2", 1082130449, NULL },
+ { "bol", 1073741828, NULL },
+ { "oct", 1073741831, NULL },
+ { "bit", 1073758214, NULL },
+ { "bol2", 1610645508, NULL },
+ { NULL, 65545, NULL },
+ { "enum", 1610907669, NULL },
+ { NULL, 1073741833, "v1"},
+ { "v1", 1073741825, "1"},
+ { "v2", 1, "2"},
+ { "any", 1610637325, NULL },
+ { NULL, 4104, "1"},
+ { "gen", 1073758235, NULL },
+ { "time1", 16777233, NULL },
+ { "SequenceTestTag", 1610612741, NULL },
+ { "int1", 1610620931, NULL },
+ { NULL, 2056, "2"},
+ { "int2", 1610620931, NULL },
+ { NULL, 4104, "3"},
+ { "str1", 1610620930, "PrintableString"},
+ { NULL, 4104, "1"},
+ { "str2", 1073741826, "UniversalString"},
+ { "str3", 536879106, "UniversalString"},
+ { NULL, 2056, "2"},
+ { "Sequence1", 1610612741, NULL },
+ { "int1", 1610915843, NULL },
+ { NULL, 1073741833, "v2"},
+ { NULL, 1073745928, "0"},
+ { "v1", 1073741825, "0"},
+ { "v2", 1073741825, "1"},
+ { "v3", 1, "2"},
+ { "int2", 1073741827, NULL },
+ { "seq", 1610612751, NULL },
+ { NULL, 3, NULL },
+ { "id", 1073741836, NULL },
+ { "oct", 1073741831, NULL },
+ { "any1", 541081613, NULL },
+ { "id", 1, NULL },
+ { "DHParameter", 1610612741, NULL },
+ { "prime", 1073741827, NULL },
+ { "base", 1073741827, NULL },
+ { "privateValueLength", 16387, NULL },
+ { "id-octetTest1", 1879048204, NULL },
+ { NULL, 1073741825, "1"},
+ { NULL, 1073741825, "2"},
+ { NULL, 1073741825, "3"},
+ { NULL, 1, "4"},
+ { "Sequence_octetTest1", 1610612741, NULL },
+ { "int", 16387, NULL },
+ { "AnyTest2", 1610612754, NULL },
+ { "str", 1073741831, NULL },
+ { "int", 3, NULL },
+ { "id-ic", 1879048204, NULL },
+ { NULL, 1073741825, "2"},
+ { NULL, 1, "5"},
+ { "id-anyTest", 1879048204, NULL },
+ { NULL, 1073741825, "id-ic"},
+ { NULL, 1073741825, "29"},
+ { NULL, 1, "1"},
+ { "id-anyTest2", 1879048204, NULL },
+ { NULL, 1073741825, "id-ic"},
+ { NULL, 1073741825, "29"},
+ { NULL, 1, "2"},
+ { "anyTest2", 1073741827, NULL },
+ { "VisibleString", 1610620935, NULL },
+ { NULL, 4360, "26"},
+ { "NumericString", 1610620935, NULL },
+ { NULL, 4360, "18"},
+ { "IA5String", 1610620935, NULL },
+ { NULL, 4360, "22"},
+ { "TeletexString", 1610620935, NULL },
+ { NULL, 4360, "20"},
+ { "PrintableString", 1610620935, NULL },
+ { NULL, 4360, "19"},
+ { "UniversalString", 1610620935, NULL },
+ { NULL, 4360, "28"},
+ { "BMPString", 1610620935, NULL },
+ { NULL, 4360, "30"},
+ { "UTF8String", 1610620935, NULL },
+ { NULL, 4360, "12"},
+ { "Test3", 1610612741, NULL },
+ { "a", 1073741827, NULL },
+ { "b", 536879106, "GeneralString2"},
+ { NULL, 2056, "1"},
+ { "GeneralString2", 1610620955, NULL },
+ { NULL, 2056, "2"},
+ { "X520LocalityName", 1610612754, NULL },
+ { "teletexString", 1073741826, "TeletexString"},
+ { "printableString", 1073741826, "PrintableString"},
+ { "universalString", 1073741826, "UniversalString"},
+ { "utf8String", 1073741826, "UTF8String"},
+ { "bmpString", 2, "BMPString"},
+ { "id-Test", 805306380, NULL },
+ { NULL, 1073741825, "1"},
+ { NULL, 1073741825, "2"},
+ { NULL, 1073741825, "29"},
+ { NULL, 1, "2"},
+ { NULL, 0, NULL }
};