diff options
-rw-r--r-- | doc/asn1.tex | 14 | ||||
-rw-r--r-- | lib/element.c | 4 | ||||
-rw-r--r-- | lib/structure.c | 6 | ||||
-rw-r--r-- | src/asn1Coding_test.asg | 6 | ||||
-rw-r--r-- | tests/Test_parser.c | 4 | ||||
-rw-r--r-- | tests/Test_tree.asn | 7 | ||||
-rw-r--r-- | tests/Test_tree.c | 14 |
7 files changed, 39 insertions, 16 deletions
diff --git a/doc/asn1.tex b/doc/asn1.tex index 8e6839d..937d453 100644 --- a/doc/asn1.tex +++ b/doc/asn1.tex @@ -19,7 +19,7 @@ This is part of the GnuTLS project\\ \begin{center} \par -Copyright \copyright\ 2001, 2002 Fabio Fiorina\\ +Copyright \copyright\ 2001, 2002, 2003 Fabio Fiorina\\ \setlength{\parskip}{4mm} \par Permission is granted to copy, distribute and/or modify this @@ -39,7 +39,7 @@ chapter entitled "GNU Free Documentation License". \chapter{ASN.1 structures handling} \section{Introduction} - This document describes the first version of library 'libasn1' developed + This document describes the version 0.2.0 of library 'libtasn1' developed for ASN1 (Abstract Syntax Notation One) structures management. The main features of this library are: \begin{itemize} @@ -85,6 +85,7 @@ Here is the list of types that the parser can manage: \item OCTET STRING \item UTCTime \item GeneralizedTime +\item GeneralString \item SEQUENCE \item SEQUENCE OF \item SET @@ -133,10 +134,10 @@ Elements of structured types that don't have a name, receive the name "?1","?2", The name "?LAST" indicates the last element of a SET\_OF or SEQUENCE\_OF. \section{Library Notes} -The header file of this library is libasn1.h . +The header file of this library is libtasn1.h . The main type used in it is ASN1\_TYPE, and it's used to store the ASN1 definitions and structures (instances). -The constant ASN1\_TYPE\_EMPTY must be used for the variable initialization. +The constant ASN1\_TYPE\_EMPTY can be used for the variable initialization. \par Example: ASN1\_TYPE definitions=ASN1\_TYPE\_EMPTY; \par @@ -234,3 +235,8 @@ Options: + + + + + diff --git a/lib/element.c b/lib/element.c index 37a3272..9a4b6fb 100644 --- a/lib/element.c +++ b/lib/element.c @@ -232,14 +232,14 @@ _asn1_append_sequence_set(node_asn *node) * \item SET OF\: the same as SEQUENCE OF. * Using "pkix.asn": * - * result=asn1_write_value(cert,"certificate1.tbsCertificate.subject.rdnSequence.?LAST","NEW",1); + * result=asn1_write_value(cert,"tbsCertificate.subject.rdnSequence.?LAST","NEW",1); *\end{itemize} * * If an element is OPTIONAL and you want to delete it, you must use the value=NULL and len=0. * * Using "pkix.asn"\: * - * result=asn1_write_value(cert,"certificate1.tbsCertificate.issuerUniqueID",NULL,0); + * result=asn1_write_value(cert,"tbsCertificate.issuerUniqueID",NULL,0); * **/ asn1_retCode diff --git a/lib/structure.c b/lib/structure.c index e187ef0..5a6e612 100644 --- a/lib/structure.c +++ b/lib/structure.c @@ -533,7 +533,7 @@ _asn1_expand_identifier(node_asn **node,node_asn *root) * ASN1_ELEMENT_NOT_FOUND\: SOURCE_NAME isn't known * * Example: using "pkix.asn" - * result=asn1_create_structure(cert_def,"PKIX1.Certificate",&cert,"certificate1"); + * result=asn1_create_structure(cert_def,"PKIX1.Certificate",&cert); **/ asn1_retCode asn1_create_element(ASN1_TYPE definitions,const char *source_name, @@ -542,10 +542,6 @@ asn1_create_element(ASN1_TYPE definitions,const char *source_name, node_asn *dest_node; int res; - if(*element!=ASN1_TYPE_EMPTY){ - asn1_delete_structure(element); - } - dest_node=_asn1_copy_structure2(definitions,source_name); if(dest_node==NULL) return ASN1_ELEMENT_NOT_FOUND; diff --git a/src/asn1Coding_test.asg b/src/asn1Coding_test.asg index 6f594e0..b0f9495 100644 --- a/src/asn1Coding_test.asg +++ b/src/asn1Coding_test.asg @@ -1,6 +1,6 @@ -Sequence Test.Sequence1 +TEST Test.Sequence1 -Sequence.int1 10 -Sequence.int2 -10 +int1 10 +int2 -10 diff --git a/tests/Test_parser.c b/tests/Test_parser.c index 31755c6..87c1ee2 100644 --- a/tests/Test_parser.c +++ b/tests/Test_parser.c @@ -89,10 +89,10 @@ test_type test_array[]={ {0} }; -char +int readLine(FILE *file,char *line) { - char c; + int c; while(((c=fgetc(file))!=EOF) && (c!='\n')){ *line=c; diff --git a/tests/Test_tree.asn b/tests/Test_tree.asn index 657090c..4e3db3f 100644 --- a/tests/Test_tree.asn +++ b/tests/Test_tree.asn @@ -17,6 +17,13 @@ Sequence1 ::= SEQUENCE{ oct OCTET STRING } +DHParameter ::= SEQUENCE { + prime INTEGER, + base INTEGER, + privateValueLength INTEGER OPTIONAL +} + + id-octetTest1 OBJECT IDENTIFIER ::= {1 2 3 4} Sequence_octetTest1 ::= SEQUENCE{ diff --git a/tests/Test_tree.c b/tests/Test_tree.c index bfd58c8..cd01222 100644 --- a/tests/Test_tree.c +++ b/tests/Test_tree.c @@ -64,6 +64,20 @@ test_type test_array[]={ {ACT_DELETE,"","",0,ASN1_ELEMENT_NOT_FOUND}, /* Test: Integer */ + {ACT_CREATE,"TEST_TREE.DHParameter",0,0,ASN1_SUCCESS}, + {ACT_WRITE,"prime","1",0,ASN1_SUCCESS}, + {ACT_WRITE,"base","2",0,ASN1_SUCCESS}, + {ACT_WRITE,"privateValueLength",NULL,0,ASN1_SUCCESS}, + {ACT_VISIT,"","",ASN1_PRINT_ALL,ASN1_SUCCESS}, + {ACT_ENCODING,"",0,0,ASN1_SUCCESS}, + {ACT_PRINT_DER,0,0,0,ASN1_SUCCESS}, + {ACT_DELETE,"","",0,ASN1_SUCCESS}, + {ACT_CREATE,"TEST_TREE.DHParameter",0,0,ASN1_SUCCESS}, + {ACT_DECODING,0,0,0,ASN1_SUCCESS}, + {ACT_VISIT,"","",ASN1_PRINT_ALL,ASN1_SUCCESS}, + {ACT_DELETE,"","",0,ASN1_SUCCESS}, + + /* Test: Integer */ {ACT_CREATE,"TEST_TREE.AnyTest2",0,0,ASN1_SUCCESS}, {ACT_WRITE,"","int",0,ASN1_SUCCESS}, {ACT_WRITE,"int","0",0,ASN1_SUCCESS}, |