libtasn1-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU libtasn1 branch, master, updated. libtasn1_2_13-40-g841a245


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_13-40-g841a245
Date: Mon, 01 Oct 2012 20:14:50 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU libtasn1".

http://git.savannah.gnu.org/cgit/libtasn1.git/commit/?id=841a2450a9d4497c84b248f8faec1e3e38cd195b

The branch, master has been updated
       via  841a2450a9d4497c84b248f8faec1e3e38cd195b (commit)
       via  c48c4111d0429a5c3c1ccc19745a7ce6359efe30 (commit)
       via  0f25d868fa70dd4a4f373158a8ce692806161981 (commit)
       via  6b4c44923d89de87d9b908b10eecc19f598f51c3 (commit)
       via  3745b54eee7934478aa0fcb7ceecb4797fd78115 (commit)
       via  97f40453042a02371269f2d7af6f46928276ece8 (commit)
       via  901a49ced275c448e21177b64f6fe85f1d4208b2 (commit)
      from  005827d4b7c32d43cfbd1235ba1dd4d0a4ea7fcc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 841a2450a9d4497c84b248f8faec1e3e38cd195b
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Oct 1 22:13:55 2012 +0200

    documented update

commit c48c4111d0429a5c3c1ccc19745a7ce6359efe30
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Oct 1 22:09:26 2012 +0200

    ASN1_TYPE definition corrected

commit 0f25d868fa70dd4a4f373158a8ce692806161981
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Oct 1 22:07:34 2012 +0200

    updated to new types

commit 6b4c44923d89de87d9b908b10eecc19f598f51c3
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Oct 1 22:03:03 2012 +0200

    node_data_struct -> asn_data_node_st

commit 3745b54eee7934478aa0fcb7ceecb4797fd78115
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Oct 1 22:00:02 2012 +0200

    ASN1_ARRAY_TYPE -> asn_static_node_t

commit 97f40453042a02371269f2d7af6f46928276ece8
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Oct 1 21:55:54 2012 +0200

    Renamed types.
    
    node_asn -> asn_node_st
    ASN1_TYPE -> node_asn_t
    ASN1_TYPE_EMPTY -> NULL

commit 901a49ced275c448e21177b64f6fe85f1d4208b2
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Oct 1 21:48:04 2012 +0200

    asn1_retCode -> int

-----------------------------------------------------------------------

Summary of changes:
 NEWS               |    9 ++++
 doc/libtasn1.texi  |    8 ++--
 lib/ASN1.c         |   18 ++++----
 lib/coding.c       |   34 +++++++-------
 lib/decoding.c     |   86 ++++++++++++++++++------------------
 lib/element.c      |   34 +++++++-------
 lib/element.h      |    6 +-
 lib/errors.c       |    4 +-
 lib/int.h          |   14 +++---
 lib/libtasn1.h     |  121 ++++++++++++++++++++++++++++-----------------------
 lib/parser_aux.c   |   86 ++++++++++++++++++------------------
 lib/parser_aux.h   |   56 ++++++++++++------------
 lib/structure.c    |  118 +++++++++++++++++++++++++-------------------------
 lib/structure.h    |    8 ++--
 src/asn1Coding.c   |    6 +-
 src/asn1Decoding.c |   10 ++--
 src/asn1Parser.c   |    2 +-
 17 files changed, 320 insertions(+), 300 deletions(-)

diff --git a/NEWS b/NEWS
index aa30c23..ad700d8 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,15 @@ GNU Libtasn1 NEWS                                     -*- 
outline -*-
 - Optimizations in internal tree allocation.
 - Optimizations in tree search.
 - libtasn1.h no longer exports internal structures.
+- Types were renamed for consistency:
+  ASN1_DATA_NODE -> asn_data_node_st
+  ASN1_ARRAY_TYPE -> asn_static_node_t
+  ASN1_TYPE -> asn_node_t
+  ASN1_TYPE_EMPTY -> NULL
+  static_struct_asn -> asn_static_node_st
+  node_asn_struct -> asn_node_st
+  node_asn -> asn_node_st
+  (the old types are still available as definitions)
 
 * Noteworthy changes in release 2.13 (2012-05-31) [stable]
 - Updated fix for DER decoding issue to not depend on specific compilers.
diff --git a/doc/libtasn1.texi b/doc/libtasn1.texi
index 3b97215..fc88b25 100644
--- a/doc/libtasn1.texi
+++ b/doc/libtasn1.texi
@@ -229,16 +229,16 @@ The name "?LAST" indicates the last element of a 
@code{SET_OF} or
 
 The header file of this library is @file{libtasn1.h}.
 
address@hidden Main type ASN1_TYPE
address@hidden Main type asn_node_t
 
-The main type used in it is @code{ASN1_TYPE}, and it's used to store
+The main type used in it is @code{asn_node_t}, and it's used to store
 the ASN.1 definitions and structures (instances).
 
-The constant @code{ASN1_TYPE_EMPTY} can be used for the variable
+The constant @code{NULL} can be used for the variable
 initialization.  For example:
 
 @example
- ASN1_TYPE definitions=ASN1_TYPE_EMPTY;
+ asn_node_t definitions=NULL;
 @end example
 
 Some functions require a parameter named errorDescription of char*
diff --git a/lib/ASN1.c b/lib/ASN1.c
index b6a5844..f61df56 100644
--- a/lib/ASN1.c
+++ b/lib/ASN1.c
@@ -109,9 +109,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
@@ -248,7 +248,7 @@ typedef union YYSTYPE
 
   unsigned int constant;
   char str[ASN1_MAX_NAME_SIZE+1];
-  ASN1_TYPE node;
+  asn_node_t node;
 
 
 
@@ -2802,23 +2802,23 @@ _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,
+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/coding.c b/lib/coding.c
index 11f8f48..0a0a1e6 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -44,7 +44,7 @@
 /* Return:                                            */
 /******************************************************/
 static void
-_asn1_error_description_value_not_found (ASN1_TYPE node,
+_asn1_error_description_value_not_found (asn_node_t node,
                                         char *ErrorDescription)
 {
 
@@ -177,7 +177,7 @@ asn1_octet_der (const unsigned char *str, int str_len,
 /*   ASN1_MEM_ERROR when DER isn't big enough         */
 /*   ASN1_SUCCESS otherwise                           */
 /******************************************************/
-static asn1_retCode
+static int
 _asn1_time_der (unsigned char *str, unsigned char *der, int *der_len)
 {
   int len_len;
@@ -249,7 +249,7 @@ _asn1_get_utctime_der(unsigned char *der,int 
*der_len,unsigned char *str)
 /*   ASN1_MEM_ERROR when DER isn't big enough         */
 /*   ASN1_SUCCESS otherwise                           */
 /******************************************************/
-static asn1_retCode
+static int
 _asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len)
 {
   int len_len, counter, k, first, max_len;
@@ -372,11 +372,11 @@ asn1_bit_der (const unsigned char *str, int bit_len,
 /*   ASN1_MEM_ERROR if der vector isn't big enough,   */
 /*   otherwise ASN1_SUCCESS.                          */
 /******************************************************/
-static asn1_retCode
-_asn1_complete_explicit_tag (ASN1_TYPE node, unsigned char *der,
+static int
+_asn1_complete_explicit_tag (asn_node_t node, unsigned char *der,
                             int *counter, int *max_len)
 {
-  ASN1_TYPE p;
+  asn_node_t p;
   int is_tag_implicit, len2, len3;
   unsigned char temp[SIZEOF_UNSIGNED_INT];
 
@@ -445,11 +445,11 @@ _asn1_complete_explicit_tag (ASN1_TYPE node, unsigned 
char *der,
 /*   ASN1_MEM_ERROR if der vector isn't big enough,   */
 /*   otherwise ASN1_SUCCESS.                          */
 /******************************************************/
-static asn1_retCode
-_asn1_insert_tag_der (ASN1_TYPE node, unsigned char *der, int *counter,
+static int
+_asn1_insert_tag_der (asn_node_t node, unsigned char *der, int *counter,
                      int *max_len)
 {
-  ASN1_TYPE p;
+  asn_node_t p;
   int tag_len, is_tag_implicit;
   unsigned char class, class_implicit = 0, temp[SIZEOF_UNSIGNED_INT * 3 + 1];
   unsigned long tag_implicit = 0;
@@ -607,7 +607,7 @@ _asn1_insert_tag_der (ASN1_TYPE node, unsigned char *der, 
int *counter,
 /* Return:                                            */
 /******************************************************/
 static void
-_asn1_ordering_set (unsigned char *der, int der_len, ASN1_TYPE node)
+_asn1_ordering_set (unsigned char *der, int der_len, asn_node_t node)
 {
   struct vet
   {
@@ -618,7 +618,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, 
ASN1_TYPE node)
 
   int counter, len, len2;
   struct vet *first, *last, *p_vet, *p2_vet;
-  ASN1_TYPE p;
+  asn_node_t p;
   unsigned char class, *temp;
   unsigned long tag;
 
@@ -721,7 +721,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, 
ASN1_TYPE node)
 /* Return:                                            */
 /******************************************************/
 static void
-_asn1_ordering_set_of (unsigned char *der, int der_len, ASN1_TYPE node)
+_asn1_ordering_set_of (unsigned char *der, int der_len, asn_node_t node)
 {
   struct vet
   {
@@ -731,7 +731,7 @@ _asn1_ordering_set_of (unsigned char *der, int der_len, 
ASN1_TYPE node)
 
   int counter, len, len2, change;
   struct vet *first, *last, *p_vet, *p2_vet;
-  ASN1_TYPE p;
+  asn_node_t p;
   unsigned char *temp, class;
   unsigned long k, max;
 
@@ -866,14 +866,14 @@ _asn1_ordering_set_of (unsigned char *der, int der_len, 
ASN1_TYPE node)
  *   vector isn't big enough and in this case @len will contain the
  *   length needed.
  **/
-asn1_retCode
-asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len,
+int
+asn1_der_coding (asn_node_t element, const char *name, void *ider, int *len,
                 char *ErrorDescription)
 {
-  ASN1_TYPE node, p, p2;
+  asn_node_t node, p, p2;
   unsigned char temp[SIZEOF_UNSIGNED_LONG_INT * 3 + 1];
   int counter, counter_old, len2, len3, tlen, move, max_len, max_len_old;
-  asn1_retCode err;
+  int err;
   unsigned char *der = ider;
 
   node = asn1_find_node (element, name);
diff --git a/lib/decoding.c b/lib/decoding.c
index 717112b..df86f85 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -32,11 +32,11 @@
 #include "element.h"
 #include <limits.h>
 
-static asn1_retCode
+static int
 _asn1_get_indefinite_length_string (const unsigned char *der, int *len);
 
 static void
-_asn1_error_description_tag_error (ASN1_TYPE node, char *ErrorDescription)
+_asn1_error_description_tag_error (asn_node_t node, char *ErrorDescription)
 {
 
   Estrcpy (ErrorDescription, ":: tag error near element '");
@@ -369,10 +369,10 @@ asn1_get_bit_der (const unsigned char *der, int der_len,
 }
 
 static int
-_asn1_extract_tag_der (ASN1_TYPE node, const unsigned char *der, int der_len,
+_asn1_extract_tag_der (asn_node_t node, const unsigned char *der, int der_len,
                       int *ret_len)
 {
-  ASN1_TYPE p;
+  asn_node_t p;
   int counter, len2, len3, is_tag_implicit;
   unsigned long tag, tag_implicit = 0;
   unsigned char class, class2, class_implicit = 0;
@@ -567,9 +567,9 @@ _asn1_extract_tag_der (ASN1_TYPE node, const unsigned char 
*der, int der_len,
 }
 
 static int
-_asn1_delete_not_used (ASN1_TYPE node)
+_asn1_delete_not_used (asn_node_t node)
 {
-  ASN1_TYPE p, p2;
+  asn_node_t p, p2;
 
   if (node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
@@ -625,8 +625,8 @@ _asn1_delete_not_used (ASN1_TYPE node)
   return ASN1_SUCCESS;
 }
 
-static asn1_retCode
-_asn1_extract_der_octet (ASN1_TYPE node, const unsigned char *der,
+static int
+_asn1_extract_der_octet (asn_node_t node, const unsigned char *der,
                         int der_len)
 {
   int len2, len3;
@@ -670,8 +670,8 @@ _asn1_extract_der_octet (ASN1_TYPE node, const unsigned 
char *der,
   return ASN1_SUCCESS;
 }
 
-static asn1_retCode
-_asn1_get_octet_string (const unsigned char *der, ASN1_TYPE node, int *len)
+static int
+_asn1_get_octet_string (const unsigned char *der, asn_node_t node, int *len)
 {
   int len2, len3, counter, tot_len, indefinite;
 
@@ -750,7 +750,7 @@ _asn1_get_octet_string (const unsigned char *der, ASN1_TYPE 
node, int *len)
 
 }
 
-static asn1_retCode
+static int
 _asn1_get_indefinite_length_string (const unsigned char *der, int *len)
 {
   int len2, len3, counter, indefinite;
@@ -812,18 +812,18 @@ _asn1_get_indefinite_length_string (const unsigned char 
*der, int *len)
  * string. The structure must just be created with function
  * asn1_create_element().  If an error occurs during the decoding
  * procedure, the address@hidden is deleted and set equal to
- * %ASN1_TYPE_EMPTY.
+ * %NULL.
  *
  * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND
- *   if @ELEMENT is %ASN1_TYPE_EMPTY, and %ASN1_TAG_ERROR or
+ *   if @ELEMENT is %NULL, and %ASN1_TAG_ERROR or
  *   %ASN1_DER_ERROR if the der encoding doesn't match the structure
  *   name (address@hidden deleted).
  **/
-asn1_retCode
-asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
+int
+asn1_der_decoding (asn_node_t * element, const void *ider, int len,
                   char *errorDescription)
 {
-  ASN1_TYPE node, p, p2, p3;
+  asn_node_t node, p, p2, p3;
   char temp[128];
   int counter, len2, len3, len4, move, ris, tlen;
   unsigned char class;
@@ -833,7 +833,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
 
   node = *element;
 
-  if (node == ASN1_TYPE_EMPTY)
+  if (node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
   if (node->type & CONST_OPTION)
@@ -1390,18 +1390,18 @@ cleanup:
  * asn1_create_element().  The DER vector must contain the encoding
  * string of the whole @STRUCTURE.  If an error occurs during the
  * decoding procedure, the address@hidden is deleted and set equal to
- * %ASN1_TYPE_EMPTY.
+ * %NULL.
  *
  * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND
- *   if ELEMENT is %ASN1_TYPE_EMPTY or @elementName == NULL, and
+ *   if ELEMENT is %NULL or @elementName == NULL, and
  *   %ASN1_TAG_ERROR or %ASN1_DER_ERROR if the der encoding doesn't
  *   match the structure @structure (*ELEMENT deleted).
  **/
-asn1_retCode
-asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
+int
+asn1_der_decoding_element (asn_node_t * structure, const char *elementName,
                           const void *ider, int len, char *errorDescription)
 {
-  ASN1_TYPE node, p, p2, p3, nodeFound = ASN1_TYPE_EMPTY;
+  asn_node_t node, p, p2, p3, nodeFound = NULL;
   char temp[128], currentName[ASN1_MAX_NAME_SIZE * 10], *dot_p, *char_p;
   int nameLen = ASN1_MAX_NAME_SIZE * 10 - 1, state;
   int counter, len2, len3, len4, move, ris, tlen;
@@ -1412,7 +1412,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
 
   node = *structure;
 
-  if (node == ASN1_TYPE_EMPTY)
+  if (node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
   if (elementName == NULL)
@@ -2207,15 +2207,15 @@ cleanup:
  * certificate.
  *
  * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND
- *   if ELEMENT is %ASN1_TYPE EMPTY or @name_element is not a valid
+ *   if ELEMENT is %asn_node_t EMPTY or @name_element is not a valid
  *   element, %ASN1_TAG_ERROR or %ASN1_DER_ERROR if the der encoding
  *   doesn't match the structure ELEMENT.
  **/
-asn1_retCode
-asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
+int
+asn1_der_decoding_startEnd (asn_node_t element, const void *ider, int len,
                            const char *name_element, int *start, int *end)
 {
-  ASN1_TYPE node, node_to_find, p, p2, p3;
+  asn_node_t node, node_to_find, p, p2, p3;
   int counter, len2, len3, len4, move, ris;
   unsigned char class;
   unsigned long tag;
@@ -2224,7 +2224,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void 
*ider, int len,
 
   node = element;
 
-  if (node == ASN1_TYPE_EMPTY)
+  if (node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
   node_to_find = asn1_find_node (node, name_element);
@@ -2562,17 +2562,17 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const 
void *ider, int len,
  *   problem in OBJECT_ID -> TYPE association, or other error codes
  *   depending on DER decoding.
  **/
-asn1_retCode
-asn1_expand_any_defined_by (ASN1_TYPE definitions, ASN1_TYPE * element)
+int
+asn1_expand_any_defined_by (asn_node_t definitions, asn_node_t * element)
 {
   char definitionsName[ASN1_MAX_NAME_SIZE], name[2 * ASN1_MAX_NAME_SIZE + 1],
     value[ASN1_MAX_NAME_SIZE];
-  asn1_retCode retCode = ASN1_SUCCESS, result;
+  int retCode = ASN1_SUCCESS, result;
   int len, len2, len3;
-  ASN1_TYPE p, p2, p3, aux = ASN1_TYPE_EMPTY;
+  asn_node_t p, p2, p3, aux = NULL;
   char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
 
-  if ((definitions == ASN1_TYPE_EMPTY) || (*element == ASN1_TYPE_EMPTY))
+  if ((definitions == NULL) || (*element == NULL))
     return ASN1_ELEMENT_NOT_FOUND;
 
   strcpy (definitionsName, definitions->name);
@@ -2696,7 +2696,7 @@ asn1_expand_any_defined_by (ASN1_TYPE definitions, 
ASN1_TYPE * element)
                                      if (result == ASN1_SUCCESS)
                                        {
                                          p = aux;
-                                         aux = ASN1_TYPE_EMPTY;
+                                         aux = NULL;
                                          break;
                                        }
                                      else
@@ -2792,22 +2792,22 @@ asn1_expand_any_defined_by (ASN1_TYPE definitions, 
ASN1_TYPE * element)
  *   %ASN1_VALUE_NOT_VALID if it wasn't possible to find the type to
  *   use for expansion, or other errors depending on DER decoding.
  **/
-asn1_retCode
-asn1_expand_octet_string (ASN1_TYPE definitions, ASN1_TYPE * element,
+int
+asn1_expand_octet_string (asn_node_t definitions, asn_node_t * element,
                          const char *octetName, const char *objectName)
 {
   char name[2 * ASN1_MAX_NAME_SIZE + 1], value[ASN1_MAX_NAME_SIZE];
-  asn1_retCode retCode = ASN1_SUCCESS, result;
+  int retCode = ASN1_SUCCESS, result;
   int len, len2, len3;
-  ASN1_TYPE p2, aux = ASN1_TYPE_EMPTY;
-  ASN1_TYPE octetNode = ASN1_TYPE_EMPTY, objectNode = ASN1_TYPE_EMPTY;
+  asn_node_t p2, aux = NULL;
+  asn_node_t octetNode = NULL, objectNode = NULL;
   char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
 
-  if ((definitions == ASN1_TYPE_EMPTY) || (*element == ASN1_TYPE_EMPTY))
+  if ((definitions == NULL) || (*element == NULL))
     return ASN1_ELEMENT_NOT_FOUND;
 
   octetNode = asn1_find_node (*element, octetName);
-  if (octetNode == ASN1_TYPE_EMPTY)
+  if (octetNode == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
   if (type_field (octetNode->type) != TYPE_OCTET_STRING)
     return ASN1_ELEMENT_NOT_FOUND;
@@ -2815,7 +2815,7 @@ asn1_expand_octet_string (ASN1_TYPE definitions, 
ASN1_TYPE * element,
     return ASN1_VALUE_NOT_FOUND;
 
   objectNode = asn1_find_node (*element, objectName);
-  if (objectNode == ASN1_TYPE_EMPTY)
+  if (objectNode == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
   if (type_field (objectNode->type) != TYPE_OBJECT_ID)
@@ -2876,7 +2876,7 @@ asn1_expand_octet_string (ASN1_TYPE definitions, 
ASN1_TYPE * element,
                          result = asn1_delete_structure (&octetNode);
                          if (result == ASN1_SUCCESS)
                            {
-                             aux = ASN1_TYPE_EMPTY;
+                             aux = NULL;
                              break;
                            }
                          else
diff --git a/lib/element.c b/lib/element.c
index 2ee4950..ee10478 100644
--- a/lib/element.c
+++ b/lib/element.c
@@ -34,9 +34,9 @@
 #include "element.h"
 
 void
-_asn1_hierarchical_name (ASN1_TYPE node, char *name, int name_size)
+_asn1_hierarchical_name (asn_node_t node, char *name, int name_size)
 {
-  ASN1_TYPE p;
+  asn_node_t p;
   char tmp_name[64];
 
   p = node;
@@ -74,7 +74,7 @@ _asn1_hierarchical_name (ASN1_TYPE node, char *name, int 
name_size)
 /*   len: number of significant byte of value_out.                */
 /* Return: ASN1_MEM_ERROR or ASN1_SUCCESS                         */
 /******************************************************************/
-asn1_retCode
+int
 _asn1_convert_integer (const unsigned char *value, unsigned char *value_out,
                       int value_out_size, int *len)
 {
@@ -127,9 +127,9 @@ _asn1_convert_integer (const unsigned char *value, unsigned 
char *value_out,
 
 
 int
-_asn1_append_sequence_set (ASN1_TYPE node)
+_asn1_append_sequence_set (asn_node_t node)
 {
-  ASN1_TYPE p, p2;
+  asn_node_t p, p2;
   char temp[10];
   long n;
 
@@ -267,11 +267,11 @@ _asn1_append_sequence_set (ASN1_TYPE node)
  *   %ASN1_ELEMENT_NOT_FOUND if @name is not a valid element, and
  *   %ASN1_VALUE_NOT_VALID if @ivalue has a wrong format.
  **/
-asn1_retCode
-asn1_write_value (ASN1_TYPE node_root, const char *name,
+int
+asn1_write_value (asn_node_t node_root, const char *name,
                  const void *ivalue, int len)
 {
-  ASN1_TYPE node, p, p2;
+  asn_node_t node, p, p2;
   unsigned char *temp, *value_temp = NULL, *default_temp = NULL;
   int len2, k, k2, negative;
   size_t i;
@@ -693,10 +693,10 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
  *   to store the result, and in this case @len will contain the number of
  *   bytes needed.
  **/
-asn1_retCode
-asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
+int
+asn1_read_value (asn_node_t root, const char *name, void *ivalue, int *len)
 {
-  ASN1_TYPE node, p, p2;
+  asn_node_t node, p, p2;
   int len2, len3;
   int value_size = *len;
   unsigned char *value = ivalue;
@@ -871,11 +871,11 @@ asn1_read_value (ASN1_TYPE root, const char *name, void 
*ivalue, int *len)
  * Returns: %ASN1_SUCCESS if successful, %ASN1_ELEMENT_NOT_FOUND if
  *   @name is not a valid element.
  **/
-asn1_retCode
-asn1_read_tag (ASN1_TYPE root, const char *name, int *tagValue,
+int
+asn1_read_tag (asn_node_t root, const char *name, int *tagValue,
               int *classValue)
 {
-  ASN1_TYPE node, p, pTag;
+  asn_node_t node, p, pTag;
 
   node = asn1_find_node (root, name);
   if (node == NULL)
@@ -974,14 +974,14 @@ asn1_read_tag (ASN1_TYPE root, const char *name, int 
*tagValue,
 /**
  * asn1_read_node_value:
  * @node: pointer to a node.
- * @data: a point to a node_data_struct
+ * @data: a point to a asn_data_node_st
  *
- * Returns the value a data node inside a ASN1_TYPE structure.
+ * Returns the value a data node inside a asn_node_t structure.
  * The data returned should be handled as constant values.
  *
  * Returns: %ASN1_SUCCESS if the node exists.
  **/
-asn1_retCode asn1_read_node_value (ASN1_TYPE node, ASN1_DATA_NODE* data)
+int asn1_read_node_value (asn_node_t node, asn_data_node_st* data)
 {
   data->name = node->name;
   data->value = node->value;
diff --git a/lib/element.h b/lib/element.h
index 9cad46e..d48f362 100644
--- a/lib/element.h
+++ b/lib/element.h
@@ -23,12 +23,12 @@
 #define _ELEMENT_H
 
 
-asn1_retCode _asn1_append_sequence_set (ASN1_TYPE node);
+int _asn1_append_sequence_set (asn_node_t node);
 
-asn1_retCode _asn1_convert_integer (const unsigned char *value,
+int _asn1_convert_integer (const unsigned char *value,
                                    unsigned char *value_out,
                                    int value_out_size, int *len);
 
-void _asn1_hierarchical_name (ASN1_TYPE node, char *name, int name_size);
+void _asn1_hierarchical_name (asn_node_t node, char *name, int name_size);
 
 #endif
diff --git a/lib/errors.c b/lib/errors.c
index 8b6e5e4..e01c3ee 100644
--- a/lib/errors.c
+++ b/lib/errors.c
@@ -68,7 +68,7 @@ static const libtasn1_error_entry error_algorithms[] = {
  * Since: 1.6
  **/
 void
-asn1_perror (asn1_retCode error)
+asn1_perror (int error)
 {
   const char *str = asn1_strerror (error);
   fprintf (stderr, "LIBTASN1 ERROR: %s\n", str ? str : "(null)");
@@ -90,7 +90,7 @@ asn1_perror (asn1_retCode error)
  * Since: 1.6
  **/
 const char *
-asn1_strerror (asn1_retCode error)
+asn1_strerror (int error)
 {
   const libtasn1_error_entry *p;
 
diff --git a/lib/int.h b/lib/int.h
index 9e6bc89..6643ffb 100644
--- a/lib/int.h
+++ b/lib/int.h
@@ -43,7 +43,7 @@
 /* This structure is also in libtasn1.h, but then contains less
    fields.  You cannot make any modifications to these first fields
    without breaking ABI.  */
-struct node_asn_struct
+struct asn_node_st
 {
   /* public fields: */
   char name[ASN1_MAX_NAME_SIZE+1];                     /* Node name */
@@ -51,9 +51,9 @@ struct node_asn_struct
   unsigned int type;           /* Node type */
   unsigned char *value;                /* Node value */
   int value_len;
-  ASN1_TYPE down;              /* Pointer to the son node */
-  ASN1_TYPE right;             /* Pointer to the brother node */
-  ASN1_TYPE left;              /* Pointer to the next list element */
+  asn_node_t down;             /* Pointer to the son node */
+  asn_node_t right;            /* Pointer to the brother node */
+  asn_node_t left;             /* Pointer to the next list element */
   /* private fields: */
   unsigned char small_value[ASN1_SMALL_VALUE_SIZE];    /* For small values */
 };
@@ -75,11 +75,11 @@ uint32_t _asn1_bhash( const void *key, size_t length);
 
 /****************************************/
 /* Returns the first 8 bits.            */
-/* Used with the field type of node_asn */
+/* Used with the field type of asn_node_st */
 /****************************************/
 #define type_field(x)     (x&0xFF)
 
-/* List of constants for field type of typedef node_asn  */
+/* List of constants for field type of typedef asn_node_st  */
 #define TYPE_CONSTANT      ASN1_ETYPE_CONSTANT
 #define TYPE_IDENTIFIER    ASN1_ETYPE_IDENTIFIER
 #define TYPE_INTEGER       ASN1_ETYPE_INTEGER
@@ -105,7 +105,7 @@ uint32_t _asn1_bhash( const void *key, size_t length);
 
 
 /***********************************************************************/
-/* List of constants to better specify the type of typedef node_asn.   */
+/* List of constants to better specify the type of typedef asn_node_st.   */
 /***********************************************************************/
 /*  Used with TYPE_TAG  */
 #define CONST_UNIVERSAL   (1<<8)
diff --git a/lib/libtasn1.h b/lib/libtasn1.h
index 6293e7d..f5ecbd7 100644
--- a/lib/libtasn1.h
+++ b/lib/libtasn1.h
@@ -46,8 +46,6 @@ extern "C"
 
 #define ASN1_VERSION "3.0"
 
-  typedef int asn1_retCode;    /* type returned by libtasn1 functions */
-
   /*****************************************/
   /* Errors returned by libtasn1 functions */
   /*****************************************/
@@ -108,26 +106,25 @@ extern "C"
   /* that represent an ASN.1 DEFINITION.                */
   /******************************************************/
 
-  typedef struct node_asn_struct node_asn;
+  typedef struct asn_node_st asn_node_st;
 
-  typedef node_asn *ASN1_TYPE;
+  typedef asn_node_st *asn_node_t;
 
   /* maximum number of characters of a name */
   /* inside a file with ASN1 definitons     */
 #define ASN1_MAX_NAME_SIZE 64
 
-#define ASN1_TYPE_EMPTY  NULL
 
   /*****************************************/
   /* For the on-disk format of ASN.1 trees */
   /*****************************************/
-  struct static_struct_asn
+  struct asn_static_node_st
   {
     const char *name;          /* Node name */
     unsigned int type;         /* Node type */
     const void *value;         /* Node value */
   };
-  typedef struct static_struct_asn ASN1_ARRAY_TYPE;
+  typedef struct asn_static_node_st asn_static_node_t;
 
 /* List of constants for field type of typedef node_asn  */
 #define ASN1_ETYPE_CONSTANT       1
@@ -153,14 +150,14 @@ extern "C"
 #define ASN1_ETYPE_ENUMERATED    21
 #define ASN1_ETYPE_GENERALSTRING 27
 
-  struct node_data_struct
+  struct asn_data_node_st
   {
     const char *name;          /* Node name */
     const void *value;         /* Node value */
     unsigned int value_len;     /* Node value size */
     unsigned int type;         /* Node value type (ASN1_ETYPE_*) */
   };
-  typedef struct node_data_struct ASN1_DATA_NODE;
+  typedef struct asn_data_node_st asn_data_node_st;
 
   /***********************************/
   /*  Fixed constants                */
@@ -176,88 +173,88 @@ extern "C"
   /*  Functions definitions          */
   /***********************************/
 
-  extern ASN1_API asn1_retCode
+  extern ASN1_API int
     asn1_parser2tree (const char *file_name,
-                     ASN1_TYPE * definitions, char *errorDescription);
+                     asn_node_t * definitions, char *errorDescription);
 
-  extern ASN1_API asn1_retCode
+  extern ASN1_API int
     asn1_parser2array (const char *inputFileName,
                       const char *outputFileName,
                       const char *vectorName, char *errorDescription);
 
-  extern ASN1_API asn1_retCode
-    asn1_array2tree (const ASN1_ARRAY_TYPE * array,
-                    ASN1_TYPE * definitions, char *errorDescription);
+  extern ASN1_API int
+    asn1_array2tree (const asn_static_node_t * array,
+                    asn_node_t * definitions, char *errorDescription);
 
   extern ASN1_API void
-    asn1_print_structure (FILE * out, ASN1_TYPE structure,
+    asn1_print_structure (FILE * out, asn_node_t structure,
                          const char *name, int mode);
 
-  extern ASN1_API asn1_retCode
-    asn1_create_element (ASN1_TYPE definitions,
-                        const char *source_name, ASN1_TYPE * element);
+  extern ASN1_API int
+    asn1_create_element (asn_node_t definitions,
+                        const char *source_name, asn_node_t * element);
 
-  extern ASN1_API asn1_retCode asn1_delete_structure (ASN1_TYPE * structure);
+  extern ASN1_API int asn1_delete_structure (asn_node_t * structure);
 
-  extern ASN1_API asn1_retCode
-    asn1_delete_element (ASN1_TYPE structure, const char *element_name);
+  extern ASN1_API int
+    asn1_delete_element (asn_node_t structure, const char *element_name);
 
-  extern ASN1_API asn1_retCode
-    asn1_write_value (ASN1_TYPE node_root, const char *name,
+  extern ASN1_API int
+    asn1_write_value (asn_node_t node_root, const char *name,
                      const void *ivalue, int len);
 
-  extern ASN1_API asn1_retCode
-    asn1_read_value (ASN1_TYPE root, const char *name,
+  extern ASN1_API int
+    asn1_read_value (asn_node_t root, const char *name,
                     void *ivalue, int *len);
 
-  extern ASN1_API asn1_retCode
-    asn1_read_node_value (ASN1_TYPE node, ASN1_DATA_NODE* data);
+  extern ASN1_API int
+    asn1_read_node_value (asn_node_t node, asn_data_node_st* data);
 
-  extern ASN1_API asn1_retCode
-    asn1_number_of_elements (ASN1_TYPE element, const char *name, int *num);
+  extern ASN1_API int
+    asn1_number_of_elements (asn_node_t element, const char *name, int *num);
 
-  extern ASN1_API asn1_retCode
-    asn1_der_coding (ASN1_TYPE element, const char *name,
+  extern ASN1_API int
+    asn1_der_coding (asn_node_t element, const char *name,
                     void *ider, int *len, char *ErrorDescription);
 
-  extern ASN1_API asn1_retCode
-    asn1_der_decoding (ASN1_TYPE * element, const void *ider,
+  extern ASN1_API int
+    asn1_der_decoding (asn_node_t * element, const void *ider,
                       int len, char *errorDescription);
 
-  extern ASN1_API asn1_retCode
-    asn1_der_decoding_element (ASN1_TYPE * structure,
+  extern ASN1_API int
+    asn1_der_decoding_element (asn_node_t * structure,
                               const char *elementName,
                               const void *ider, int len,
                               char *errorDescription);
 
-  extern ASN1_API asn1_retCode
-    asn1_der_decoding_startEnd (ASN1_TYPE element,
+  extern ASN1_API int
+    asn1_der_decoding_startEnd (asn_node_t element,
                                const void *ider, int len,
                                const char *name_element,
                                int *start, int *end);
 
-  extern ASN1_API asn1_retCode
-    asn1_expand_any_defined_by (ASN1_TYPE definitions, ASN1_TYPE * element);
+  extern ASN1_API int
+    asn1_expand_any_defined_by (asn_node_t definitions, asn_node_t * element);
 
-  extern ASN1_API asn1_retCode
-    asn1_expand_octet_string (ASN1_TYPE definitions,
-                             ASN1_TYPE * element,
+  extern ASN1_API int
+    asn1_expand_octet_string (asn_node_t definitions,
+                             asn_node_t * element,
                              const char *octetName, const char *objectName);
 
-  extern ASN1_API asn1_retCode
-    asn1_read_tag (ASN1_TYPE root, const char *name,
+  extern ASN1_API int
+    asn1_read_tag (asn_node_t root, const char *name,
                   int *tagValue, int *classValue);
 
-  extern ASN1_API const char *asn1_find_structure_from_oid (ASN1_TYPE
+  extern ASN1_API const char *asn1_find_structure_from_oid (asn_node_t
                                                            definitions,
                                                            const char
                                                            *oidValue);
 
   extern ASN1_API const char *asn1_check_version (const char *req_version);
 
-  extern ASN1_API const char *asn1_strerror (asn1_retCode error);
+  extern ASN1_API const char *asn1_strerror (int error);
 
-  extern ASN1_API void asn1_perror (asn1_retCode error);
+  extern ASN1_API void asn1_perror (int error);
 
   /* DER utility functions. */
 
@@ -269,7 +266,7 @@ extern "C"
     asn1_octet_der (const unsigned char *str, int str_len,
                    unsigned char *der, int *der_len);
 
-  extern ASN1_API asn1_retCode
+  extern ASN1_API int
     asn1_get_octet_der (const unsigned char *der, int der_len,
                        int *ret_len, unsigned char *str,
                        int str_size, int *str_len);
@@ -277,7 +274,7 @@ extern "C"
   extern ASN1_API void asn1_bit_der (const unsigned char *str, int bit_len,
                                     unsigned char *der, int *der_len);
 
-  extern ASN1_API asn1_retCode
+  extern ASN1_API int
     asn1_get_bit_der (const unsigned char *der, int der_len,
                      int *ret_len, unsigned char *str,
                      int str_size, int *bit_len);
@@ -293,12 +290,26 @@ extern "C"
 
   /* Other utility functions. */
 
-  extern ASN1_API ASN1_TYPE
-    asn1_find_node (ASN1_TYPE pointer, const char *name);
+  extern ASN1_API asn_node_t
+    asn1_find_node (asn_node_t pointer, const char *name);
+
+  extern ASN1_API int
+    asn1_copy_node (asn_node_t dst, const char *dst_name,
+                   asn_node_t src, const char *src_name);
+
+/* Compatibility types */
+  typedef int asn1_retCode;    /* type returned by libtasn1 functions */
+
+#define node_asn_struct asn_node_st
+#define node_asn asn_node_st
+#define ASN1_TYPE asn_node_t
+#define ASN1_TYPE_EMPTY NULL
+
+#define static_struct_asn asn_static_node_st
+#define ASN1_ARRAY_TYPE asn_static_node_t
 
-  extern ASN1_API asn1_retCode
-    asn1_copy_node (ASN1_TYPE dst, const char *dst_name,
-                   ASN1_TYPE src, const char *src_name);
+#define node_data_struct asn_data_node_st
+#define ASN1_DATA_NODE asn_data_node_st
 
 #ifdef __cplusplus
 }
diff --git a/lib/parser_aux.c b/lib/parser_aux.c
index ff701bc..b52ad89 100644
--- a/lib/parser_aux.c
+++ b/lib/parser_aux.c
@@ -34,7 +34,7 @@ char _asn1_identifierMissing[ASN1_MAX_NAME_SIZE + 1]; /* 
identifier name not fou
 /***********************************************/
 typedef struct list_struct
 {
-  ASN1_TYPE node;
+  asn_node_t node;
   struct list_struct *next;
 } list_type;
 
@@ -51,13 +51,13 @@ list_type *firstElement = NULL;
 /*         and CONST_ constants).                     */
 /* Return: pointer to the new element.                */
 /******************************************************/
-ASN1_TYPE
+asn_node_t
 _asn1_add_static_node (unsigned int type)
 {
   list_type *listElement;
-  ASN1_TYPE punt;
+  asn_node_t punt;
 
-  punt = calloc (1, sizeof (struct node_asn_struct));
+  punt = calloc (1, sizeof (struct asn_node_st));
   if (punt == NULL)
     return NULL;
 
@@ -89,10 +89,10 @@ _asn1_add_static_node (unsigned int type)
  *
  * Returns: the search result, or %NULL if not found.
  **/
-ASN1_TYPE
-asn1_find_node (ASN1_TYPE pointer, const char *name)
+asn_node_t
+asn1_find_node (asn_node_t pointer, const char *name)
 {
-  ASN1_TYPE p;
+  asn_node_t p;
   char *n_end, n[ASN1_MAX_NAME_SIZE + 1];
   const char *n_start;
   unsigned int nsize;
@@ -207,8 +207,8 @@ asn1_find_node (ASN1_TYPE pointer, const char *name)
 /*   len: character number of value.                              */
 /* Return: pointer to the NODE_ASN element.                       */
 /******************************************************************/
-ASN1_TYPE
-_asn1_set_value (ASN1_TYPE node, const void *value, unsigned int len)
+asn_node_t
+_asn1_set_value (asn_node_t node, const void *value, unsigned int len)
 {
   if (node == NULL)
     return node;
@@ -250,8 +250,8 @@ _asn1_set_value (ASN1_TYPE node, const void *value, 
unsigned int len)
 /*   len: character number of value.                              */
 /* Return: pointer to the NODE_ASN element.                       */
 /******************************************************************/
-ASN1_TYPE
-_asn1_set_value_octet (ASN1_TYPE node, const void *value, unsigned int len)
+asn_node_t
+_asn1_set_value_octet (asn_node_t node, const void *value, unsigned int len)
 {
   int len2;
   void *temp;
@@ -271,8 +271,8 @@ _asn1_set_value_octet (ASN1_TYPE node, const void *value, 
unsigned int len)
 /* the same as _asn1_set_value except that it sets an already malloc'ed
  * value.
  */
-ASN1_TYPE
-_asn1_set_value_m (ASN1_TYPE node, void *value, unsigned int len)
+asn_node_t
+_asn1_set_value_m (asn_node_t node, void *value, unsigned int len)
 {
   if (node == NULL)
     return node;
@@ -304,8 +304,8 @@ _asn1_set_value_m (ASN1_TYPE node, void *value, unsigned 
int len)
 /*   len: character number of value.                              */
 /* Return: pointer to the NODE_ASN element.                       */
 /******************************************************************/
-ASN1_TYPE
-_asn1_append_value (ASN1_TYPE node, const void *value, unsigned int len)
+asn_node_t
+_asn1_append_value (asn_node_t node, const void *value, unsigned int len)
 {
   if (node == NULL)
     return node;
@@ -354,8 +354,8 @@ _asn1_append_value (ASN1_TYPE node, const void *value, 
unsigned int len)
 /*         to set.                                                */
 /* Return: pointer to the NODE_ASN element.                       */
 /******************************************************************/
-ASN1_TYPE
-_asn1_set_name (ASN1_TYPE node, const char *name)
+asn_node_t
+_asn1_set_name (asn_node_t node, const char *name)
 {
 unsigned int nsize;
 
@@ -383,8 +383,8 @@ unsigned int nsize;
 /*   src: a source element pointer.                               */
 /* Return: pointer to the NODE_ASN element.                       */
 /******************************************************************/
-ASN1_TYPE
-_asn1_cpy_name (ASN1_TYPE dst, ASN1_TYPE src)
+asn_node_t
+_asn1_cpy_name (asn_node_t dst, asn_node_t src)
 {
 unsigned int nsize;
 
@@ -413,8 +413,8 @@ unsigned int nsize;
 /*          by NODE.                                              */
 /* Return: pointer to *NODE.                                      */
 /******************************************************************/
-ASN1_TYPE
-_asn1_set_right (ASN1_TYPE node, ASN1_TYPE right)
+asn_node_t
+_asn1_set_right (asn_node_t node, asn_node_t right)
 {
   if (node == NULL)
     return node;
@@ -432,10 +432,10 @@ _asn1_set_right (ASN1_TYPE node, ASN1_TYPE right)
 /*   node: starting element pointer.                              */
 /* Return: pointer to the last element along the right chain.     */
 /******************************************************************/
-ASN1_TYPE
-_asn1_get_last_right (ASN1_TYPE node)
+asn_node_t
+_asn1_get_last_right (asn_node_t node)
 {
-  ASN1_TYPE p;
+  asn_node_t p;
 
   if (node == NULL)
     return NULL;
@@ -453,7 +453,7 @@ _asn1_get_last_right (ASN1_TYPE node)
 /*   node: NODE_ASN element pointer.                              */
 /******************************************************************/
 void
-_asn1_remove_node (ASN1_TYPE node)
+_asn1_remove_node (asn_node_t node)
 {
   if (node == NULL)
     return;
@@ -470,10 +470,10 @@ _asn1_remove_node (ASN1_TYPE node)
 /*   node: NODE_ASN element pointer.                              */
 /* Return: Null if not found.                                     */
 /******************************************************************/
-ASN1_TYPE
-_asn1_find_up (ASN1_TYPE node)
+asn_node_t
+_asn1_find_up (asn_node_t node)
 {
-  ASN1_TYPE p;
+  asn_node_t p;
 
   if (node == NULL)
     return NULL;
@@ -568,10 +568,10 @@ _asn1_ltostr (long v, char *str)
 /*   ASN1_ELEMENT_NOT_FOUND if NODE is NULL,                       */
 /*   otherwise ASN1_SUCCESS                                             */
 /******************************************************************/
-asn1_retCode
-_asn1_change_integer_value (ASN1_TYPE node)
+int
+_asn1_change_integer_value (asn_node_t node)
 {
-  ASN1_TYPE p;
+  asn_node_t p;
   unsigned char val[SIZEOF_UNSIGNED_LONG_INT];
   unsigned char val2[SIZEOF_UNSIGNED_LONG_INT + 1];
   int len;
@@ -635,10 +635,10 @@ _asn1_change_integer_value (ASN1_TYPE node)
 /*   ASN1_ELEMENT_NOT_FOUND if NODE is NULL,                       */
 /*   otherwise ASN1_SUCCESS                                             */
 /******************************************************************/
-asn1_retCode
-_asn1_expand_object_id (ASN1_TYPE node)
+int
+_asn1_expand_object_id (asn_node_t node)
 {
-  ASN1_TYPE p, p2, p3, p4, p5;
+  asn_node_t p, p2, p3, p4, p5;
   char name_root[ASN1_MAX_NAME_SIZE], name2[2 * ASN1_MAX_NAME_SIZE + 1];
   int move, tlen;
 
@@ -818,10 +818,10 @@ _asn1_expand_object_id (ASN1_TYPE node)
 /*   ASN1_ELEMENT_NOT_FOUND if NODE is NULL,                       */
 /*   otherwise ASN1_SUCCESS                                             */
 /******************************************************************/
-asn1_retCode
-_asn1_type_set_config (ASN1_TYPE node)
+int
+_asn1_type_set_config (asn_node_t node)
 {
-  ASN1_TYPE p, p2;
+  asn_node_t p, p2;
   int move;
 
   if (node == NULL)
@@ -891,10 +891,10 @@ _asn1_type_set_config (ASN1_TYPE node)
 /*   ASN1_IDENTIFIER_NOT_FOUND   if an identifier is not defined, */
 /*   otherwise ASN1_SUCCESS                                       */
 /******************************************************************/
-asn1_retCode
-_asn1_check_identifier (ASN1_TYPE node)
+int
+_asn1_check_identifier (asn_node_t node)
 {
-  ASN1_TYPE p, p2;
+  asn_node_t p, p2;
   char name2[ASN1_MAX_NAME_SIZE * 2 + 2];
 
   if (node == NULL)
@@ -998,10 +998,10 @@ _asn1_check_identifier (ASN1_TYPE node)
 /*     a DEFINITIONS element,                                     */
 /*   otherwise ASN1_SUCCESS                                       */
 /******************************************************************/
-asn1_retCode
-_asn1_set_default_tag (ASN1_TYPE node)
+int
+_asn1_set_default_tag (asn_node_t node)
 {
-  ASN1_TYPE p;
+  asn_node_t p;
 
   if ((node == NULL) || (type_field (node->type) != TYPE_DEFINITIONS))
     return ASN1_ELEMENT_NOT_FOUND;
diff --git a/lib/parser_aux.h b/lib/parser_aux.h
index f3aeb54..a224e78 100644
--- a/lib/parser_aux.h
+++ b/lib/parser_aux.h
@@ -27,28 +27,28 @@
 /***************************************/
 /*  Functions used by ASN.1 parser     */
 /***************************************/
-ASN1_TYPE _asn1_add_static_node (unsigned int type);
+asn_node_t _asn1_add_static_node (unsigned int type);
 
-ASN1_TYPE
-_asn1_set_value (ASN1_TYPE node, const void *value, unsigned int len);
+asn_node_t
+_asn1_set_value (asn_node_t node, const void *value, unsigned int len);
 
-ASN1_TYPE _asn1_set_value_m (ASN1_TYPE node, void *value, unsigned int len);
+asn_node_t _asn1_set_value_m (asn_node_t node, void *value, unsigned int len);
 
-ASN1_TYPE
-_asn1_set_value_octet (ASN1_TYPE node, const void *value, unsigned int len);
+asn_node_t
+_asn1_set_value_octet (asn_node_t node, const void *value, unsigned int len);
 
-ASN1_TYPE
-_asn1_append_value (ASN1_TYPE node, const void *value, unsigned int len);
+asn_node_t
+_asn1_append_value (asn_node_t node, const void *value, unsigned int len);
 
-ASN1_TYPE _asn1_set_name (ASN1_TYPE node, const char *name);
+asn_node_t _asn1_set_name (asn_node_t node, const char *name);
 
-ASN1_TYPE _asn1_cpy_name (ASN1_TYPE dst, ASN1_TYPE src);
+asn_node_t _asn1_cpy_name (asn_node_t dst, asn_node_t src);
 
-ASN1_TYPE _asn1_set_right (ASN1_TYPE node, ASN1_TYPE right);
+asn_node_t _asn1_set_right (asn_node_t node, asn_node_t right);
 
-ASN1_TYPE _asn1_get_last_right (ASN1_TYPE node);
+asn_node_t _asn1_get_last_right (asn_node_t node);
 
-void _asn1_remove_node (ASN1_TYPE node);
+void _asn1_remove_node (asn_node_t node);
 
 void _asn1_delete_list (void);
 
@@ -56,17 +56,17 @@ void _asn1_delete_list_and_nodes (void);
 
 char *_asn1_ltostr (long v, char *str);
 
-ASN1_TYPE _asn1_find_up (ASN1_TYPE node);
+asn_node_t _asn1_find_up (asn_node_t node);
 
-asn1_retCode _asn1_change_integer_value (ASN1_TYPE node);
+int _asn1_change_integer_value (asn_node_t node);
 
-asn1_retCode _asn1_expand_object_id (ASN1_TYPE node);
+int _asn1_expand_object_id (asn_node_t node);
 
-asn1_retCode _asn1_type_set_config (ASN1_TYPE node);
+int _asn1_type_set_config (asn_node_t node);
 
-asn1_retCode _asn1_check_identifier (ASN1_TYPE node);
+int _asn1_check_identifier (asn_node_t node);
 
-asn1_retCode _asn1_set_default_tag (ASN1_TYPE node);
+int _asn1_set_default_tag (asn_node_t node);
 
 /******************************************************************/
 /* Function : _asn1_get_right                                     */
@@ -76,8 +76,8 @@ asn1_retCode _asn1_set_default_tag (ASN1_TYPE node);
 /*   node: NODE_ASN element pointer.                              */
 /* Return: field RIGHT of NODE.                                   */
 /******************************************************************/
-inline static ASN1_TYPE
-_asn1_get_right (ASN1_TYPE node)
+inline static asn_node_t
+_asn1_get_right (asn_node_t node)
 {
   if (node == NULL)
     return NULL;
@@ -93,8 +93,8 @@ _asn1_get_right (ASN1_TYPE node)
 /*          by NODE.                                              */
 /* Return: pointer to *NODE.                                      */
 /******************************************************************/
-inline static ASN1_TYPE
-_asn1_set_down (ASN1_TYPE node, ASN1_TYPE down)
+inline static asn_node_t
+_asn1_set_down (asn_node_t node, asn_node_t down)
 {
   if (node == NULL)
     return node;
@@ -112,8 +112,8 @@ _asn1_set_down (ASN1_TYPE node, ASN1_TYPE down)
 /*   node: NODE_ASN element pointer.                              */
 /* Return: field DOWN of NODE.                                    */
 /******************************************************************/
-inline static ASN1_TYPE
-_asn1_get_down (ASN1_TYPE node)
+inline static asn_node_t
+_asn1_get_down (asn_node_t node)
 {
   if (node == NULL)
     return NULL;
@@ -128,7 +128,7 @@ _asn1_get_down (ASN1_TYPE node)
 /* Return: a null terminated string.                              */
 /******************************************************************/
 inline static char *
-_asn1_get_name (ASN1_TYPE node)
+_asn1_get_name (asn_node_t node)
 {
   if (node == NULL)
     return NULL;
@@ -146,8 +146,8 @@ _asn1_get_name (ASN1_TYPE node)
 /*          value of field TYPE.                                  */
 /* Return: NODE pointer.                                          */
 /******************************************************************/
-inline static ASN1_TYPE
-_asn1_mod_type (ASN1_TYPE node, unsigned int value)
+inline static asn_node_t
+_asn1_mod_type (asn_node_t node, unsigned int value)
 {
   if (node == NULL)
     return node;
diff --git a/lib/structure.c b/lib/structure.c
index 7d622ce..4ce9f6a 100644
--- a/lib/structure.c
+++ b/lib/structure.c
@@ -44,12 +44,12 @@ extern char _asn1_identifierMissing[];
 /*         and CONST_ constants).                     */
 /* Return: pointer to the new element.                */
 /******************************************************/
-ASN1_TYPE
+asn_node_t
 _asn1_add_single_node (unsigned int type)
 {
-  ASN1_TYPE punt;
+  asn_node_t punt;
 
-  punt = calloc (1, sizeof (struct node_asn_struct));
+  punt = calloc (1, sizeof (struct asn_node_st));
   if (punt == NULL)
     return NULL;
 
@@ -67,8 +67,8 @@ _asn1_add_single_node (unsigned int type)
 /*   node: NODE_ASN element pointer.                              */
 /* Return: NULL if not found.                                     */
 /******************************************************************/
-ASN1_TYPE
-_asn1_find_left (ASN1_TYPE node)
+asn_node_t
+_asn1_find_left (asn_node_t node)
 {
   if ((node == NULL) || (node->left == NULL) || (node->left->down == node))
     return NULL;
@@ -77,12 +77,12 @@ _asn1_find_left (ASN1_TYPE node)
 }
 
 
-asn1_retCode
-_asn1_create_static_structure (ASN1_TYPE pointer, char *output_file_name,
+int
+_asn1_create_static_structure (asn_node_t pointer, char *output_file_name,
                               char *vector_name)
 {
   FILE *file;
-  ASN1_TYPE p;
+  asn_node_t p;
   unsigned long t;
 
   file = fopen (output_file_name, "w");
@@ -96,7 +96,7 @@ _asn1_create_static_structure (ASN1_TYPE pointer, char 
*output_file_name,
 
   fprintf (file, "#include <libtasn1.h>\n\n");
 
-  fprintf (file, "const ASN1_ARRAY_TYPE %s[] = {\n", vector_name);
+  fprintf (file, "const asn_static_node_t %s[] = {\n", vector_name);
 
   p = pointer;
 
@@ -168,22 +168,22 @@ _asn1_create_static_structure (ASN1_TYPE pointer, char 
*output_file_name,
  * @array is a vector created by asn1_parser2array().
  *
  * Returns: %ASN1_SUCCESS if structure was created correctly,
- *   %ASN1_ELEMENT_NOT_EMPTY if address@hidden not ASN1_TYPE_EMPTY,
+ *   %ASN1_ELEMENT_NOT_EMPTY if address@hidden not NULL,
  *   %ASN1_IDENTIFIER_NOT_FOUND if in the file there is an identifier
  *   that is not defined (see @errorDescription for more information),
  *   %ASN1_ARRAY_ERROR if the array pointed by @array is wrong.
  **/
-asn1_retCode
-asn1_array2tree (const ASN1_ARRAY_TYPE * array, ASN1_TYPE * definitions,
+int
+asn1_array2tree (const asn_static_node_t * array, asn_node_t * definitions,
                 char *errorDescription)
 {
-  ASN1_TYPE p, p_last = NULL;
+  asn_node_t p, p_last = NULL;
   unsigned long k;
   int move;
-  asn1_retCode result;
+  int result;
 
 
-  if (*definitions != ASN1_TYPE_EMPTY)
+  if (*definitions != NULL)
     return ASN1_ELEMENT_NOT_EMPTY;
 
   move = UP;
@@ -263,7 +263,7 @@ asn1_array2tree (const ASN1_ARRAY_TYPE * array, ASN1_TYPE * 
definitions,
   if (result != ASN1_SUCCESS)
     {
       _asn1_delete_list_and_nodes ();
-      *definitions = ASN1_TYPE_EMPTY;
+      *definitions = NULL;
     }
   else
     _asn1_delete_list ();
@@ -276,17 +276,17 @@ asn1_array2tree (const ASN1_ARRAY_TYPE * array, ASN1_TYPE 
* definitions,
  * @structure: pointer to the structure that you want to delete.
  *
  * Deletes the structure address@hidden  At the end, address@hidden is set
- * to ASN1_TYPE_EMPTY.
+ * to NULL.
  *
  * Returns: %ASN1_SUCCESS if successful, %ASN1_ELEMENT_NOT_FOUND if
- *   address@hidden was ASN1_TYPE_EMPTY.
+ *   address@hidden was NULL.
  **/
-asn1_retCode
-asn1_delete_structure (ASN1_TYPE * structure)
+int
+asn1_delete_structure (asn_node_t * structure)
 {
-  ASN1_TYPE p, p2, p3;
+  asn_node_t p, p2, p3;
 
-  if (*structure == ASN1_TYPE_EMPTY)
+  if (*structure == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
   p = *structure;
@@ -328,7 +328,7 @@ asn1_delete_structure (ASN1_TYPE * structure)
        }
     }
 
-  *structure = ASN1_TYPE_EMPTY;
+  *structure = NULL;
   return ASN1_SUCCESS;
 }
 
@@ -345,14 +345,14 @@ asn1_delete_structure (ASN1_TYPE * structure)
  * Returns: %ASN1_SUCCESS if successful, %ASN1_ELEMENT_NOT_FOUND if
  *   the @element_name was not found.
  **/
-asn1_retCode
-asn1_delete_element (ASN1_TYPE structure, const char *element_name)
+int
+asn1_delete_element (asn_node_t structure, const char *element_name)
 {
-  ASN1_TYPE p2, p3, source_node;
+  asn_node_t p2, p3, source_node;
 
   source_node = asn1_find_node (structure, element_name);
 
-  if (source_node == ASN1_TYPE_EMPTY)
+  if (source_node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
   p2 = source_node->right;
@@ -371,10 +371,10 @@ asn1_delete_element (ASN1_TYPE structure, const char 
*element_name)
   return asn1_delete_structure (&source_node);
 }
 
-ASN1_TYPE
-_asn1_copy_structure3 (ASN1_TYPE source_node)
+asn_node_t
+_asn1_copy_structure3 (asn_node_t source_node)
 {
-  ASN1_TYPE dest_node, p_s, p_d, p_d_prev;
+  asn_node_t dest_node, p_s, p_d, p_d_prev;
   int move;
 
   if (source_node == NULL)
@@ -429,10 +429,10 @@ _asn1_copy_structure3 (ASN1_TYPE source_node)
 }
 
 
-static ASN1_TYPE
-_asn1_copy_structure2 (ASN1_TYPE root, const char *source_name)
+static asn_node_t
+_asn1_copy_structure2 (asn_node_t root, const char *source_name)
 {
-  ASN1_TYPE source_node;
+  asn_node_t source_node;
 
   source_node = asn1_find_node (root, source_name);
 
@@ -441,10 +441,10 @@ _asn1_copy_structure2 (ASN1_TYPE root, const char 
*source_name)
 }
 
 
-static asn1_retCode
-_asn1_type_choice_config (ASN1_TYPE node)
+static int
+_asn1_type_choice_config (asn_node_t node)
 {
-  ASN1_TYPE p, p2, p3, p4;
+  asn_node_t p, p2, p3, p4;
   int move, tlen;
 
   if (node == NULL)
@@ -526,10 +526,10 @@ _asn1_type_choice_config (ASN1_TYPE node)
 }
 
 
-static asn1_retCode
-_asn1_expand_identifier (ASN1_TYPE * node, ASN1_TYPE root)
+static int
+_asn1_expand_identifier (asn_node_t * node, asn_node_t root)
 {
-  ASN1_TYPE p, p2, p3;
+  asn_node_t p, p2, p3;
   char name2[ASN1_MAX_NAME_SIZE + 2];
   int move;
 
@@ -648,11 +648,11 @@ _asn1_expand_identifier (ASN1_TYPE * node, ASN1_TYPE root)
  * Returns: %ASN1_SUCCESS if creation OK, %ASN1_ELEMENT_NOT_FOUND if
  *   @source_name is not known.
  **/
-asn1_retCode
-asn1_create_element (ASN1_TYPE definitions, const char *source_name,
-                    ASN1_TYPE * element)
+int
+asn1_create_element (asn_node_t definitions, const char *source_name,
+                    asn_node_t * element)
 {
-  ASN1_TYPE dest_node;
+  asn_node_t dest_node;
   int res;
 
   dest_node = _asn1_copy_structure2 (definitions, source_name);
@@ -684,10 +684,10 @@ asn1_create_element (ASN1_TYPE definitions, const char 
*source_name,
  * from the @name element inside the structure @structure.
  **/
 void
-asn1_print_structure (FILE * out, ASN1_TYPE structure, const char *name,
+asn1_print_structure (FILE * out, asn_node_t structure, const char *name,
                      int mode)
 {
-  ASN1_TYPE p, root;
+  asn_node_t p, root;
   int k, indent = 0, len, len2, len3;
 
   if (out == NULL)
@@ -1047,10 +1047,10 @@ asn1_print_structure (FILE * out, ASN1_TYPE structure, 
const char *name,
  * Returns: %ASN1_SUCCESS if successful, %ASN1_ELEMENT_NOT_FOUND if
  *   @name is not known, %ASN1_GENERIC_ERROR if pointer @num is %NULL.
  **/
-asn1_retCode
-asn1_number_of_elements (ASN1_TYPE element, const char *name, int *num)
+int
+asn1_number_of_elements (asn_node_t element, const char *name, int *num)
 {
-  ASN1_TYPE node, p;
+  asn_node_t node, p;
 
   if (num == NULL)
     return ASN1_GENERIC_ERROR;
@@ -1086,15 +1086,15 @@ asn1_number_of_elements (ASN1_TYPE element, const char 
*name, int *num)
  *   the OID.
  **/
 const char *
-asn1_find_structure_from_oid (ASN1_TYPE definitions, const char *oidValue)
+asn1_find_structure_from_oid (asn_node_t definitions, const char *oidValue)
 {
   char definitionsName[ASN1_MAX_NAME_SIZE], name[2 * ASN1_MAX_NAME_SIZE + 1];
   char value[ASN1_MAX_NAME_SIZE];
-  ASN1_TYPE p;
+  asn_node_t p;
   int len;
-  asn1_retCode result;
+  int result;
 
-  if ((definitions == ASN1_TYPE_EMPTY) || (oidValue == NULL))
+  if ((definitions == NULL) || (oidValue == NULL))
     return NULL;               /* ASN1_ELEMENT_NOT_FOUND; */
 
 
@@ -1131,24 +1131,24 @@ asn1_find_structure_from_oid (ASN1_TYPE definitions, 
const char *oidValue)
 
 /**
  * asn1_copy_node:
- * @dst: Destination ASN1_TYPE node.
+ * @dst: Destination asn_node_t node.
  * @dst_name: Field name in destination node.
- * @src: Source ASN1_TYPE node.
+ * @src: Source asn_node_t node.
  * @src_name: Field name in source node.
  *
- * Create a deep copy of a ASN1_TYPE variable.
+ * Create a deep copy of a asn_node_t variable.
  *
  * Returns: Return %ASN1_SUCCESS on success.
  **/
-asn1_retCode
-asn1_copy_node (ASN1_TYPE dst, const char *dst_name,
-               ASN1_TYPE src, const char *src_name)
+int
+asn1_copy_node (asn_node_t dst, const char *dst_name,
+               asn_node_t src, const char *src_name)
 {
 /* FIXME: rewrite using copy_structure().
  * It seems quite hard to do.
  */
   int result;
-  ASN1_TYPE dst_node;
+  asn_node_t dst_node;
   void *data = NULL;
   int size = 0;
 
diff --git a/lib/structure.h b/lib/structure.h
index cf4205b..db7e3be 100644
--- a/lib/structure.h
+++ b/lib/structure.h
@@ -28,14 +28,14 @@
 #ifndef _STRUCTURE_H
 #define _STRUCTURE_H
 
-asn1_retCode _asn1_create_static_structure (ASN1_TYPE pointer,
+int _asn1_create_static_structure (asn_node_t pointer,
                                            char *output_file_name,
                                            char *vector_name);
 
-ASN1_TYPE _asn1_copy_structure3 (ASN1_TYPE source_node);
+asn_node_t _asn1_copy_structure3 (asn_node_t source_node);
 
-ASN1_TYPE _asn1_add_single_node (unsigned int type);
+asn_node_t _asn1_add_single_node (unsigned int type);
 
-ASN1_TYPE _asn1_find_left (ASN1_TYPE node);
+asn_node_t _asn1_find_left (asn_node_t node);
 
 #endif
diff --git a/src/asn1Coding.c b/src/asn1Coding.c
index 9ddb0a4..b9a7ca3 100644
--- a/src/asn1Coding.c
+++ b/src/asn1Coding.c
@@ -133,8 +133,8 @@ main (int argc, char *argv[])
   char *inputFileAsnName = NULL;
   char *inputFileAssignmentName = NULL;
   int checkSyntaxOnly = 0;
-  ASN1_TYPE definitions = ASN1_TYPE_EMPTY;
-  ASN1_TYPE structure = ASN1_TYPE_EMPTY;
+  asn_node_t definitions = NULL;
+  asn_node_t structure = NULL;
   char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
   int asn1_result = ASN1_SUCCESS;
   FILE *outputFile;
@@ -248,7 +248,7 @@ main (int argc, char *argv[])
   while (readAssignment (inputFile, varName, value) == ASSIGNMENT_SUCCESS)
     {
       printf ("var=%s, value=%s\n", varName, value);
-      if (structure == ASN1_TYPE_EMPTY)
+      if (structure == NULL)
        {
          asn1_result = asn1_create_element (definitions, value, &structure);
        }
diff --git a/src/asn1Decoding.c b/src/asn1Decoding.c
index c46e43b..f942734 100644
--- a/src/asn1Decoding.c
+++ b/src/asn1Decoding.c
@@ -33,7 +33,7 @@
 #include <read-file.h>
 #include "benchmark.h"
 
-static int decode(ASN1_TYPE definitions, const char* typeName, void* der, int 
der_len, int benchmark);
+static int decode(asn_node_t definitions, const char* typeName, void* der, int 
der_len, int benchmark);
 
 /* This feature is available in gcc versions 2.5 and later.  */
 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
@@ -76,7 +76,7 @@ main (int argc, char *argv[])
   char *inputFileAsnName = NULL;
   char *inputFileDerName = NULL;
   char *typeName = NULL;
-  ASN1_TYPE definitions = ASN1_TYPE_EMPTY;
+  asn_node_t definitions = NULL;
   char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
   int asn1_result = ASN1_SUCCESS;
   unsigned char *der;
@@ -224,11 +224,11 @@ main (int argc, char *argv[])
   exit (0);
 }
 
-static int simple_decode(ASN1_TYPE definitions, const char* typeName, void* 
der, int der_len, int benchmark)
+static int simple_decode(asn_node_t definitions, const char* typeName, void* 
der, int der_len, int benchmark)
 {
   
 int asn1_result;
-ASN1_TYPE structure = ASN1_TYPE_EMPTY;
+asn_node_t structure = NULL;
 char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
 
   asn1_result = asn1_create_element (definitions, typeName, &structure);
@@ -263,7 +263,7 @@ char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
   return ASN1_SUCCESS;
 }
 
-static int decode(ASN1_TYPE definitions, const char* typeName, void* der, int 
der_len, int benchmark)
+static int decode(asn_node_t definitions, const char* typeName, void* der, int 
der_len, int benchmark)
 {
 struct benchmark_st st;
 
diff --git a/src/asn1Parser.c b/src/asn1Parser.c
index e14da83..4bd4d68 100644
--- a/src/asn1Parser.c
+++ b/src/asn1Parser.c
@@ -80,7 +80,7 @@ main (int argc, char *argv[])
   char *inputFileName = NULL;
   char *vectorName = NULL;
   int checkSyntaxOnly = 0;
-  ASN1_TYPE pointer = ASN1_TYPE_EMPTY;
+  asn_node_t pointer = NULL;
   char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
   int parse_result = ASN1_SUCCESS;
 


hooks/post-receive
-- 
GNU libtasn1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]