diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | doc/libtasn1.texi | 6 | ||||
-rw-r--r-- | lib/ASN1.c | 6 | ||||
-rw-r--r-- | lib/coding.c | 22 | ||||
-rw-r--r-- | lib/decoding.c | 38 | ||||
-rw-r--r-- | lib/element.c | 24 | ||||
-rw-r--r-- | lib/element.h | 4 | ||||
-rw-r--r-- | lib/int.h | 6 | ||||
-rw-r--r-- | lib/libtasn1.h | 52 | ||||
-rw-r--r-- | lib/parser_aux.c | 74 | ||||
-rw-r--r-- | lib/parser_aux.h | 56 | ||||
-rw-r--r-- | lib/structure.c | 74 | ||||
-rw-r--r-- | lib/structure.h | 8 | ||||
-rw-r--r-- | src/asn1Coding.c | 4 | ||||
-rw-r--r-- | src/asn1Decoding.c | 10 | ||||
-rw-r--r-- | src/asn1Parser.c | 2 | ||||
-rw-r--r-- | tests/Test_encoding.c | 4 | ||||
-rw-r--r-- | tests/Test_indefinite.c | 4 | ||||
-rw-r--r-- | tests/Test_parser.c | 2 | ||||
-rw-r--r-- | tests/Test_tree.c | 4 |
20 files changed, 202 insertions, 202 deletions
@@ -8,8 +8,8 @@ GNU Libtasn1 NEWS -*- outline -*- - libtasn1.h no longer exports internal structures. - Types were renamed for consistency: ASN1_DATA_NODE -> asn1_data_node_st - ASN1_ARRAY_TYPE -> asn1_static_node_t - ASN1_TYPE -> asn1_node_t + ASN1_ARRAY_TYPE -> asn1_static_node + ASN1_TYPE -> asn1_node ASN1_TYPE_EMPTY -> NULL static_struct_asn -> asn1_static_node_st node_asn_struct -> asn1_node_st diff --git a/doc/libtasn1.texi b/doc/libtasn1.texi index 3268914..13238aa 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}. -@cindex Main type asn1_node_t +@cindex Main type asn1_node -The main type used in it is @code{asn1_node_t}, and it's used to store +The main type used in it is @code{asn1_node}, and it's used to store the ASN.1 definitions and structures (instances). The constant @code{NULL} can be used for the variable initialization. For example: @example - asn1_node_t definitions=NULL; + asn1_node definitions=NULL; @end example Some functions require a parameter named errorDescription of char* @@ -111,7 +111,7 @@ static FILE *file_asn1; /* Pointer to file to parse */ static int result_parse; /* result of the parser algorithm */ -static asn1_node_t p_tree; /* pointer to the root of the +static asn1_node 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_node_t node; + asn1_node node; @@ -2822,7 +2822,7 @@ _asn1_create_errorDescription(int error,char *errorDescription) * characters. **/ int -asn1_parser2tree(const char *file_name, asn1_node_t *definitions, +asn1_parser2tree(const char *file_name, asn1_node *definitions, char *errorDescription) { diff --git a/lib/coding.c b/lib/coding.c index 3cbcd8a..581ef96 100644 --- a/lib/coding.c +++ b/lib/coding.c @@ -44,7 +44,7 @@ /* Return: */ /******************************************************/ static void -_asn1_error_description_value_not_found (asn1_node_t node, +_asn1_error_description_value_not_found (asn1_node node, char *ErrorDescription) { @@ -373,10 +373,10 @@ asn1_bit_der (const unsigned char *str, int bit_len, /* otherwise ASN1_SUCCESS. */ /******************************************************/ static int -_asn1_complete_explicit_tag (asn1_node_t node, unsigned char *der, +_asn1_complete_explicit_tag (asn1_node node, unsigned char *der, int *counter, int *max_len) { - asn1_node_t p; + asn1_node p; int is_tag_implicit, len2, len3; unsigned char temp[SIZEOF_UNSIGNED_INT]; @@ -446,10 +446,10 @@ _asn1_complete_explicit_tag (asn1_node_t node, unsigned char *der, /* otherwise ASN1_SUCCESS. */ /******************************************************/ static int -_asn1_insert_tag_der (asn1_node_t node, unsigned char *der, int *counter, +_asn1_insert_tag_der (asn1_node node, unsigned char *der, int *counter, int *max_len) { - asn1_node_t p; + asn1_node 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_node_t node, unsigned char *der, int *counter, /* Return: */ /******************************************************/ static void -_asn1_ordering_set (unsigned char *der, int der_len, asn1_node_t node) +_asn1_ordering_set (unsigned char *der, int der_len, asn1_node node) { struct vet { @@ -618,7 +618,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, asn1_node_t node) int counter, len, len2; struct vet *first, *last, *p_vet, *p2_vet; - asn1_node_t p; + asn1_node p; unsigned char class, *temp; unsigned long tag; @@ -721,7 +721,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, asn1_node_t node) /* Return: */ /******************************************************/ static void -_asn1_ordering_set_of (unsigned char *der, int der_len, asn1_node_t node) +_asn1_ordering_set_of (unsigned char *der, int der_len, asn1_node node) { struct vet { @@ -731,7 +731,7 @@ _asn1_ordering_set_of (unsigned char *der, int der_len, asn1_node_t node) int counter, len, len2, change; struct vet *first, *last, *p_vet, *p2_vet; - asn1_node_t p; + asn1_node p; unsigned char *temp, class; unsigned long k, max; @@ -867,10 +867,10 @@ _asn1_ordering_set_of (unsigned char *der, int der_len, asn1_node_t node) * length needed. **/ int -asn1_der_coding (asn1_node_t element, const char *name, void *ider, int *len, +asn1_der_coding (asn1_node element, const char *name, void *ider, int *len, char *ErrorDescription) { - asn1_node_t node, p, p2; + asn1_node 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; int err; diff --git a/lib/decoding.c b/lib/decoding.c index 4373a1d..79766a1 100644 --- a/lib/decoding.c +++ b/lib/decoding.c @@ -36,7 +36,7 @@ static int _asn1_get_indefinite_length_string (const unsigned char *der, int *len); static void -_asn1_error_description_tag_error (asn1_node_t node, char *ErrorDescription) +_asn1_error_description_tag_error (asn1_node 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_node_t node, const unsigned char *der, int der_len, +_asn1_extract_tag_der (asn1_node node, const unsigned char *der, int der_len, int *ret_len) { - asn1_node_t p; + asn1_node 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_node_t node, const unsigned char *der, int der_len, } static int -_asn1_delete_not_used (asn1_node_t node) +_asn1_delete_not_used (asn1_node node) { - asn1_node_t p, p2; + asn1_node p, p2; if (node == NULL) return ASN1_ELEMENT_NOT_FOUND; @@ -626,7 +626,7 @@ _asn1_delete_not_used (asn1_node_t node) } static int -_asn1_extract_der_octet (asn1_node_t node, const unsigned char *der, +_asn1_extract_der_octet (asn1_node node, const unsigned char *der, int der_len) { int len2, len3; @@ -671,7 +671,7 @@ _asn1_extract_der_octet (asn1_node_t node, const unsigned char *der, } static int -_asn1_get_octet_string (const unsigned char *der, asn1_node_t node, int *len) +_asn1_get_octet_string (const unsigned char *der, asn1_node node, int *len) { int len2, len3, counter, tot_len, indefinite; @@ -820,10 +820,10 @@ _asn1_get_indefinite_length_string (const unsigned char *der, int *len) * name (*@ELEMENT deleted). **/ int -asn1_der_decoding (asn1_node_t * element, const void *ider, int len, +asn1_der_decoding (asn1_node * element, const void *ider, int len, char *errorDescription) { - asn1_node_t node, p, p2, p3; + asn1_node node, p, p2, p3; char temp[128]; int counter, len2, len3, len4, move, ris, tlen; unsigned char class; @@ -1401,10 +1401,10 @@ cleanup: * match the structure @structure (*ELEMENT deleted). **/ int -asn1_der_decoding_element (asn1_node_t * structure, const char *elementName, +asn1_der_decoding_element (asn1_node * structure, const char *elementName, const void *ider, int len, char *errorDescription) { - asn1_node_t node, p, p2, p3, nodeFound = NULL; + asn1_node 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; @@ -2210,15 +2210,15 @@ cleanup: * certificate. * * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND - * if ELEMENT is %asn1_node_t EMPTY or @name_element is not a valid + * if ELEMENT is %asn1_node 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. **/ int -asn1_der_decoding_startEnd (asn1_node_t element, const void *ider, int len, +asn1_der_decoding_startEnd (asn1_node element, const void *ider, int len, const char *name_element, int *start, int *end) { - asn1_node_t node, node_to_find, p, p2, p3; + asn1_node node, node_to_find, p, p2, p3; int counter, len2, len3, len4, move, ris; unsigned char class; unsigned long tag; @@ -2566,13 +2566,13 @@ asn1_der_decoding_startEnd (asn1_node_t element, const void *ider, int len, * depending on DER decoding. **/ int -asn1_expand_any_defined_by (asn1_node_t definitions, asn1_node_t * element) +asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element) { char definitionsName[ASN1_MAX_NAME_SIZE], name[2 * ASN1_MAX_NAME_SIZE + 1], value[ASN1_MAX_NAME_SIZE]; int retCode = ASN1_SUCCESS, result; int len, len2, len3; - asn1_node_t p, p2, p3, aux = NULL; + asn1_node p, p2, p3, aux = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; if ((definitions == NULL) || (*element == NULL)) @@ -2796,14 +2796,14 @@ asn1_expand_any_defined_by (asn1_node_t definitions, asn1_node_t * element) * use for expansion, or other errors depending on DER decoding. **/ int -asn1_expand_octet_string (asn1_node_t definitions, asn1_node_t * element, +asn1_expand_octet_string (asn1_node definitions, asn1_node * element, const char *octetName, const char *objectName) { char name[2 * ASN1_MAX_NAME_SIZE + 1], value[ASN1_MAX_NAME_SIZE]; int retCode = ASN1_SUCCESS, result; int len, len2, len3; - asn1_node_t p2, aux = NULL; - asn1_node_t octetNode = NULL, objectNode = NULL; + asn1_node p2, aux = NULL; + asn1_node octetNode = NULL, objectNode = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; if ((definitions == NULL) || (*element == NULL)) diff --git a/lib/element.c b/lib/element.c index 6105620..4c871a1 100644 --- a/lib/element.c +++ b/lib/element.c @@ -34,9 +34,9 @@ #include "element.h" void -_asn1_hierarchical_name (asn1_node_t node, char *name, int name_size) +_asn1_hierarchical_name (asn1_node node, char *name, int name_size) { - asn1_node_t p; + asn1_node p; char tmp_name[64]; p = node; @@ -127,9 +127,9 @@ _asn1_convert_integer (const unsigned char *value, unsigned char *value_out, int -_asn1_append_sequence_set (asn1_node_t node) +_asn1_append_sequence_set (asn1_node node) { - asn1_node_t p, p2; + asn1_node p, p2; char temp[10]; long n; @@ -268,10 +268,10 @@ _asn1_append_sequence_set (asn1_node_t node) * %ASN1_VALUE_NOT_VALID if @ivalue has a wrong format. **/ int -asn1_write_value (asn1_node_t node_root, const char *name, +asn1_write_value (asn1_node node_root, const char *name, const void *ivalue, int len) { - asn1_node_t node, p, p2; + asn1_node node, p, p2; unsigned char *temp, *value_temp = NULL, *default_temp = NULL; int len2, k, k2, negative; size_t i; @@ -694,9 +694,9 @@ asn1_write_value (asn1_node_t node_root, const char *name, * bytes needed. **/ int -asn1_read_value (asn1_node_t root, const char *name, void *ivalue, int *len) +asn1_read_value (asn1_node root, const char *name, void *ivalue, int *len) { - asn1_node_t node, p, p2; + asn1_node node, p, p2; int len2, len3; int value_size = *len; unsigned char *value = ivalue; @@ -872,10 +872,10 @@ asn1_read_value (asn1_node_t root, const char *name, void *ivalue, int *len) * @name is not a valid element. **/ int -asn1_read_tag (asn1_node_t root, const char *name, int *tagValue, +asn1_read_tag (asn1_node root, const char *name, int *tagValue, int *classValue) { - asn1_node_t node, p, pTag; + asn1_node node, p, pTag; node = asn1_find_node (root, name); if (node == NULL) @@ -976,12 +976,12 @@ asn1_read_tag (asn1_node_t root, const char *name, int *tagValue, * @node: pointer to a node. * @data: a point to a asn1_data_node_st * - * Returns the value a data node inside a asn1_node_t structure. + * Returns the value a data node inside a asn1_node structure. * The data returned should be handled as constant values. * * Returns: %ASN1_SUCCESS if the node exists. **/ -int asn1_read_node_value (asn1_node_t node, asn1_data_node_st* data) +int asn1_read_node_value (asn1_node node, asn1_data_node_st* data) { data->name = node->name; data->value = node->value; diff --git a/lib/element.h b/lib/element.h index ee07837..3bd38bb 100644 --- a/lib/element.h +++ b/lib/element.h @@ -23,12 +23,12 @@ #define _ELEMENT_H -int _asn1_append_sequence_set (asn1_node_t node); +int _asn1_append_sequence_set (asn1_node node); int _asn1_convert_integer (const unsigned char *value, unsigned char *value_out, int value_out_size, int *len); -void _asn1_hierarchical_name (asn1_node_t node, char *name, int name_size); +void _asn1_hierarchical_name (asn1_node node, char *name, int name_size); #endif @@ -51,9 +51,9 @@ struct asn1_node_st unsigned int type; /* Node type */ unsigned char *value; /* Node value */ int value_len; - asn1_node_t down; /* Pointer to the son node */ - asn1_node_t right; /* Pointer to the brother node */ - asn1_node_t left; /* Pointer to the next list element */ + asn1_node down; /* Pointer to the son node */ + asn1_node right; /* Pointer to the brother node */ + asn1_node left; /* Pointer to the next list element */ /* private fields: */ unsigned char small_value[ASN1_SMALL_VALUE_SIZE]; /* For small values */ }; diff --git a/lib/libtasn1.h b/lib/libtasn1.h index a75b554..5be46d0 100644 --- a/lib/libtasn1.h +++ b/lib/libtasn1.h @@ -108,7 +108,7 @@ extern "C" typedef struct asn1_node_st asn1_node_st; - typedef asn1_node_st *asn1_node_t; + typedef asn1_node_st *asn1_node; /* maximum number of characters of a name */ /* inside a file with ASN1 definitons */ @@ -175,7 +175,7 @@ extern "C" extern ASN1_API int asn1_parser2tree (const char *file_name, - asn1_node_t * definitions, char *errorDescription); + asn1_node * definitions, char *errorDescription); extern ASN1_API int asn1_parser2array (const char *inputFileName, @@ -184,68 +184,68 @@ extern "C" extern ASN1_API int asn1_array2tree (const asn1_static_node_t * array, - asn1_node_t * definitions, char *errorDescription); + asn1_node * definitions, char *errorDescription); extern ASN1_API void - asn1_print_structure (FILE * out, asn1_node_t structure, + asn1_print_structure (FILE * out, asn1_node structure, const char *name, int mode); extern ASN1_API int - asn1_create_element (asn1_node_t definitions, - const char *source_name, asn1_node_t * element); + asn1_create_element (asn1_node definitions, + const char *source_name, asn1_node * element); - extern ASN1_API int asn1_delete_structure (asn1_node_t * structure); + extern ASN1_API int asn1_delete_structure (asn1_node * structure); extern ASN1_API int - asn1_delete_element (asn1_node_t structure, const char *element_name); + asn1_delete_element (asn1_node structure, const char *element_name); extern ASN1_API int - asn1_write_value (asn1_node_t node_root, const char *name, + asn1_write_value (asn1_node node_root, const char *name, const void *ivalue, int len); extern ASN1_API int - asn1_read_value (asn1_node_t root, const char *name, + asn1_read_value (asn1_node root, const char *name, void *ivalue, int *len); extern ASN1_API int - asn1_read_node_value (asn1_node_t node, asn1_data_node_st* data); + asn1_read_node_value (asn1_node node, asn1_data_node_st* data); extern ASN1_API int - asn1_number_of_elements (asn1_node_t element, const char *name, int *num); + asn1_number_of_elements (asn1_node element, const char *name, int *num); extern ASN1_API int - asn1_der_coding (asn1_node_t element, const char *name, + asn1_der_coding (asn1_node element, const char *name, void *ider, int *len, char *ErrorDescription); extern ASN1_API int - asn1_der_decoding (asn1_node_t * element, const void *ider, + asn1_der_decoding (asn1_node * element, const void *ider, int len, char *errorDescription); extern ASN1_API int - asn1_der_decoding_element (asn1_node_t * structure, + asn1_der_decoding_element (asn1_node * structure, const char *elementName, const void *ider, int len, char *errorDescription); extern ASN1_API int - asn1_der_decoding_startEnd (asn1_node_t element, + asn1_der_decoding_startEnd (asn1_node element, const void *ider, int len, const char *name_element, int *start, int *end); extern ASN1_API int - asn1_expand_any_defined_by (asn1_node_t definitions, asn1_node_t * element); + asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element); extern ASN1_API int - asn1_expand_octet_string (asn1_node_t definitions, - asn1_node_t * element, + asn1_expand_octet_string (asn1_node definitions, + asn1_node * element, const char *octetName, const char *objectName); extern ASN1_API int - asn1_read_tag (asn1_node_t root, const char *name, + asn1_read_tag (asn1_node root, const char *name, int *tagValue, int *classValue); - extern ASN1_API const char *asn1_find_structure_from_oid (asn1_node_t + extern ASN1_API const char *asn1_find_structure_from_oid (asn1_node definitions, const char *oidValue); @@ -290,12 +290,12 @@ extern "C" /* Other utility functions. */ - extern ASN1_API asn1_node_t - asn1_find_node (asn1_node_t pointer, const char *name); + extern ASN1_API asn1_node + asn1_find_node (asn1_node pointer, const char *name); extern ASN1_API int - asn1_copy_node (asn1_node_t dst, const char *dst_name, - asn1_node_t src, const char *src_name); + asn1_copy_node (asn1_node dst, const char *dst_name, + asn1_node src, const char *src_name); /* Compatibility types */ @@ -303,7 +303,7 @@ typedef int asn1_retCode; /* type returned by libtasn1 functions */ #define node_asn_struct asn1_node_st #define node_asn asn1_node_st -#define ASN1_TYPE asn1_node_t +#define ASN1_TYPE asn1_node #define ASN1_TYPE_EMPTY NULL #define static_struct_asn asn1_static_node_st diff --git a/lib/parser_aux.c b/lib/parser_aux.c index 9e792fd..96ecac6 100644 --- a/lib/parser_aux.c +++ b/lib/parser_aux.c @@ -35,7 +35,7 @@ char _asn1_identifierMissing[ASN1_MAX_NAME_SIZE + 1]; /* identifier name not fou /***********************************************/ typedef struct list_struct { - asn1_node_t node; + asn1_node node; struct list_struct *next; } list_type; @@ -52,11 +52,11 @@ list_type *firstElement = NULL; /* and CONST_ constants). */ /* Return: pointer to the new element. */ /******************************************************/ -asn1_node_t +asn1_node _asn1_add_static_node (unsigned int type) { list_type *listElement; - asn1_node_t punt; + asn1_node punt; punt = calloc (1, sizeof (struct asn1_node_st)); if (punt == NULL) @@ -90,10 +90,10 @@ _asn1_add_static_node (unsigned int type) * * Returns: the search result, or %NULL if not found. **/ -asn1_node_t -asn1_find_node (asn1_node_t pointer, const char *name) +asn1_node +asn1_find_node (asn1_node pointer, const char *name) { - asn1_node_t p; + asn1_node p; char *n_end, n[ASN1_MAX_NAME_SIZE + 1]; const char *n_start; unsigned int nsize; @@ -208,8 +208,8 @@ asn1_find_node (asn1_node_t pointer, const char *name) /* len: character number of value. */ /* Return: pointer to the NODE_ASN element. */ /******************************************************************/ -asn1_node_t -_asn1_set_value (asn1_node_t node, const void *value, unsigned int len) +asn1_node +_asn1_set_value (asn1_node node, const void *value, unsigned int len) { if (node == NULL) return node; @@ -251,8 +251,8 @@ _asn1_set_value (asn1_node_t node, const void *value, unsigned int len) /* len: character number of value. */ /* Return: pointer to the NODE_ASN element. */ /******************************************************************/ -asn1_node_t -_asn1_set_value_octet (asn1_node_t node, const void *value, unsigned int len) +asn1_node +_asn1_set_value_octet (asn1_node node, const void *value, unsigned int len) { int len2; void *temp; @@ -272,8 +272,8 @@ _asn1_set_value_octet (asn1_node_t node, const void *value, unsigned int len) /* the same as _asn1_set_value except that it sets an already malloc'ed * value. */ -asn1_node_t -_asn1_set_value_m (asn1_node_t node, void *value, unsigned int len) +asn1_node +_asn1_set_value_m (asn1_node node, void *value, unsigned int len) { if (node == NULL) return node; @@ -305,8 +305,8 @@ _asn1_set_value_m (asn1_node_t node, void *value, unsigned int len) /* len: character number of value. */ /* Return: pointer to the NODE_ASN element. */ /******************************************************************/ -asn1_node_t -_asn1_append_value (asn1_node_t node, const void *value, unsigned int len) +asn1_node +_asn1_append_value (asn1_node node, const void *value, unsigned int len) { if (node == NULL) return node; @@ -355,8 +355,8 @@ _asn1_append_value (asn1_node_t node, const void *value, unsigned int len) /* to set. */ /* Return: pointer to the NODE_ASN element. */ /******************************************************************/ -asn1_node_t -_asn1_set_name (asn1_node_t node, const char *name) +asn1_node +_asn1_set_name (asn1_node node, const char *name) { unsigned int nsize; @@ -384,8 +384,8 @@ unsigned int nsize; /* src: a source element pointer. */ /* Return: pointer to the NODE_ASN element. */ /******************************************************************/ -asn1_node_t -_asn1_cpy_name (asn1_node_t dst, asn1_node_t src) +asn1_node +_asn1_cpy_name (asn1_node dst, asn1_node src) { if (dst == NULL) return dst; @@ -412,8 +412,8 @@ _asn1_cpy_name (asn1_node_t dst, asn1_node_t src) /* by NODE. */ /* Return: pointer to *NODE. */ /******************************************************************/ -asn1_node_t -_asn1_set_right (asn1_node_t node, asn1_node_t right) +asn1_node +_asn1_set_right (asn1_node node, asn1_node right) { if (node == NULL) return node; @@ -431,10 +431,10 @@ _asn1_set_right (asn1_node_t node, asn1_node_t right) /* node: starting element pointer. */ /* Return: pointer to the last element along the right chain. */ /******************************************************************/ -asn1_node_t -_asn1_get_last_right (asn1_node_t node) +asn1_node +_asn1_get_last_right (asn1_node node) { - asn1_node_t p; + asn1_node p; if (node == NULL) return NULL; @@ -452,7 +452,7 @@ _asn1_get_last_right (asn1_node_t node) /* node: NODE_ASN element pointer. */ /******************************************************************/ void -_asn1_remove_node (asn1_node_t node) +_asn1_remove_node (asn1_node node) { if (node == NULL) return; @@ -469,10 +469,10 @@ _asn1_remove_node (asn1_node_t node) /* node: NODE_ASN element pointer. */ /* Return: Null if not found. */ /******************************************************************/ -asn1_node_t -_asn1_find_up (asn1_node_t node) +asn1_node +_asn1_find_up (asn1_node node) { - asn1_node_t p; + asn1_node p; if (node == NULL) return NULL; @@ -568,9 +568,9 @@ _asn1_ltostr (long v, char *str) /* otherwise ASN1_SUCCESS */ /******************************************************************/ int -_asn1_change_integer_value (asn1_node_t node) +_asn1_change_integer_value (asn1_node node) { - asn1_node_t p; + asn1_node p; unsigned char val[SIZEOF_UNSIGNED_LONG_INT]; unsigned char val2[SIZEOF_UNSIGNED_LONG_INT + 1]; int len; @@ -635,9 +635,9 @@ _asn1_change_integer_value (asn1_node_t node) /* otherwise ASN1_SUCCESS */ /******************************************************************/ int -_asn1_expand_object_id (asn1_node_t node) +_asn1_expand_object_id (asn1_node node) { - asn1_node_t p, p2, p3, p4, p5; + asn1_node p, p2, p3, p4, p5; char name_root[ASN1_MAX_NAME_SIZE], name2[2 * ASN1_MAX_NAME_SIZE + 1]; int move, tlen; @@ -818,9 +818,9 @@ _asn1_expand_object_id (asn1_node_t node) /* otherwise ASN1_SUCCESS */ /******************************************************************/ int -_asn1_type_set_config (asn1_node_t node) +_asn1_type_set_config (asn1_node node) { - asn1_node_t p, p2; + asn1_node p, p2; int move; if (node == NULL) @@ -891,9 +891,9 @@ _asn1_type_set_config (asn1_node_t node) /* otherwise ASN1_SUCCESS */ /******************************************************************/ int -_asn1_check_identifier (asn1_node_t node) +_asn1_check_identifier (asn1_node node) { - asn1_node_t p, p2; + asn1_node p, p2; char name2[ASN1_MAX_NAME_SIZE * 2 + 2]; if (node == NULL) @@ -998,9 +998,9 @@ _asn1_check_identifier (asn1_node_t node) /* otherwise ASN1_SUCCESS */ /******************************************************************/ int -_asn1_set_default_tag (asn1_node_t node) +_asn1_set_default_tag (asn1_node node) { - asn1_node_t p; + asn1_node 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 8838866..df369c7 100644 --- a/lib/parser_aux.h +++ b/lib/parser_aux.h @@ -27,28 +27,28 @@ /***************************************/ /* Functions used by ASN.1 parser */ /***************************************/ -asn1_node_t _asn1_add_static_node (unsigned int type); +asn1_node _asn1_add_static_node (unsigned int type); -asn1_node_t -_asn1_set_value (asn1_node_t node, const void *value, unsigned int len); +asn1_node +_asn1_set_value (asn1_node node, const void *value, unsigned int len); -asn1_node_t _asn1_set_value_m (asn1_node_t node, void *value, unsigned int len); +asn1_node _asn1_set_value_m (asn1_node node, void *value, unsigned int len); -asn1_node_t -_asn1_set_value_octet (asn1_node_t node, const void *value, unsigned int len); +asn1_node +_asn1_set_value_octet (asn1_node node, const void *value, unsigned int len); -asn1_node_t -_asn1_append_value (asn1_node_t node, const void *value, unsigned int len); +asn1_node +_asn1_append_value (asn1_node node, const void *value, unsigned int len); -asn1_node_t _asn1_set_name (asn1_node_t node, const char *name); +asn1_node _asn1_set_name (asn1_node node, const char *name); -asn1_node_t _asn1_cpy_name (asn1_node_t dst, asn1_node_t src); +asn1_node _asn1_cpy_name (asn1_node dst, asn1_node src); -asn1_node_t _asn1_set_right (asn1_node_t node, asn1_node_t right); +asn1_node _asn1_set_right (asn1_node node, asn1_node right); -asn1_node_t _asn1_get_last_right (asn1_node_t node); +asn1_node _asn1_get_last_right (asn1_node node); -void _asn1_remove_node (asn1_node_t node); +void _asn1_remove_node (asn1_node 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_node_t _asn1_find_up (asn1_node_t node); +asn1_node _asn1_find_up (asn1_node node); -int _asn1_change_integer_value (asn1_node_t node); +int _asn1_change_integer_value (asn1_node node); -int _asn1_expand_object_id (asn1_node_t node); +int _asn1_expand_object_id (asn1_node node); -int _asn1_type_set_config (asn1_node_t node); +int _asn1_type_set_config (asn1_node node); -int _asn1_check_identifier (asn1_node_t node); +int _asn1_check_identifier (asn1_node node); -int _asn1_set_default_tag (asn1_node_t node); +int _asn1_set_default_tag (asn1_node node); /******************************************************************/ /* Function : _asn1_get_right */ @@ -76,8 +76,8 @@ int _asn1_set_default_tag (asn1_node_t node); /* node: NODE_ASN element pointer. */ /* Return: field RIGHT of NODE. */ /******************************************************************/ -inline static asn1_node_t -_asn1_get_right (asn1_node_t node) +inline static asn1_node +_asn1_get_right (asn1_node node) { if (node == NULL) return NULL; @@ -93,8 +93,8 @@ _asn1_get_right (asn1_node_t node) /* by NODE. */ /* Return: pointer to *NODE. */ /******************************************************************/ -inline static asn1_node_t -_asn1_set_down (asn1_node_t node, asn1_node_t down) +inline static asn1_node +_asn1_set_down (asn1_node node, asn1_node down) { if (node == NULL) return node; @@ -112,8 +112,8 @@ _asn1_set_down (asn1_node_t node, asn1_node_t down) /* node: NODE_ASN element pointer. */ /* Return: field DOWN of NODE. */ /******************************************************************/ -inline static asn1_node_t -_asn1_get_down (asn1_node_t node) +inline static asn1_node +_asn1_get_down (asn1_node node) { if (node == NULL) return NULL; @@ -128,7 +128,7 @@ _asn1_get_down (asn1_node_t node) /* Return: a null terminated string. */ /******************************************************************/ inline static char * -_asn1_get_name (asn1_node_t node) +_asn1_get_name (asn1_node node) { if (node == NULL) return NULL; @@ -146,8 +146,8 @@ _asn1_get_name (asn1_node_t node) /* value of field TYPE. */ /* Return: NODE pointer. */ /******************************************************************/ -inline static asn1_node_t -_asn1_mod_type (asn1_node_t node, unsigned int value) +inline static asn1_node +_asn1_mod_type (asn1_node node, unsigned int value) { if (node == NULL) return node; diff --git a/lib/structure.c b/lib/structure.c index 3eb562f..4613d06 100644 --- a/lib/structure.c +++ b/lib/structure.c @@ -44,10 +44,10 @@ extern char _asn1_identifierMissing[]; /* and CONST_ constants). */ /* Return: pointer to the new element. */ /******************************************************/ -asn1_node_t +asn1_node _asn1_add_single_node (unsigned int type) { - asn1_node_t punt; + asn1_node punt; punt = calloc (1, sizeof (struct asn1_node_st)); if (punt == NULL) @@ -67,8 +67,8 @@ _asn1_add_single_node (unsigned int type) /* node: NODE_ASN element pointer. */ /* Return: NULL if not found. */ /******************************************************************/ -asn1_node_t -_asn1_find_left (asn1_node_t node) +asn1_node +_asn1_find_left (asn1_node node) { if ((node == NULL) || (node->left == NULL) || (node->left->down == node)) return NULL; @@ -78,11 +78,11 @@ _asn1_find_left (asn1_node_t node) int -_asn1_create_static_structure (asn1_node_t pointer, char *output_file_name, +_asn1_create_static_structure (asn1_node pointer, char *output_file_name, char *vector_name) { FILE *file; - asn1_node_t p; + asn1_node p; unsigned long t; file = fopen (output_file_name, "w"); @@ -174,10 +174,10 @@ _asn1_create_static_structure (asn1_node_t pointer, char *output_file_name, * %ASN1_ARRAY_ERROR if the array pointed by @array is wrong. **/ int -asn1_array2tree (const asn1_static_node_t * array, asn1_node_t * definitions, +asn1_array2tree (const asn1_static_node_t * array, asn1_node * definitions, char *errorDescription) { - asn1_node_t p, p_last = NULL; + asn1_node p, p_last = NULL; unsigned long k; int move; int result; @@ -282,9 +282,9 @@ asn1_array2tree (const asn1_static_node_t * array, asn1_node_t * definitions, * *@structure was NULL. **/ int -asn1_delete_structure (asn1_node_t * structure) +asn1_delete_structure (asn1_node * structure) { - asn1_node_t p, p2, p3; + asn1_node p, p2, p3; if (*structure == NULL) return ASN1_ELEMENT_NOT_FOUND; @@ -346,9 +346,9 @@ asn1_delete_structure (asn1_node_t * structure) * the @element_name was not found. **/ int -asn1_delete_element (asn1_node_t structure, const char *element_name) +asn1_delete_element (asn1_node structure, const char *element_name) { - asn1_node_t p2, p3, source_node; + asn1_node p2, p3, source_node; source_node = asn1_find_node (structure, element_name); @@ -371,10 +371,10 @@ asn1_delete_element (asn1_node_t structure, const char *element_name) return asn1_delete_structure (&source_node); } -asn1_node_t -_asn1_copy_structure3 (asn1_node_t source_node) +asn1_node +_asn1_copy_structure3 (asn1_node source_node) { - asn1_node_t dest_node, p_s, p_d, p_d_prev; + asn1_node dest_node, p_s, p_d, p_d_prev; int move; if (source_node == NULL) @@ -429,10 +429,10 @@ _asn1_copy_structure3 (asn1_node_t source_node) } -static asn1_node_t -_asn1_copy_structure2 (asn1_node_t root, const char *source_name) +static asn1_node +_asn1_copy_structure2 (asn1_node root, const char *source_name) { - asn1_node_t source_node; + asn1_node source_node; source_node = asn1_find_node (root, source_name); @@ -442,9 +442,9 @@ _asn1_copy_structure2 (asn1_node_t root, const char *source_name) static int -_asn1_type_choice_config (asn1_node_t node) +_asn1_type_choice_config (asn1_node node) { - asn1_node_t p, p2, p3, p4; + asn1_node p, p2, p3, p4; int move, tlen; if (node == NULL) @@ -527,9 +527,9 @@ _asn1_type_choice_config (asn1_node_t node) static int -_asn1_expand_identifier (asn1_node_t * node, asn1_node_t root) +_asn1_expand_identifier (asn1_node * node, asn1_node root) { - asn1_node_t p, p2, p3; + asn1_node p, p2, p3; char name2[ASN1_MAX_NAME_SIZE + 2]; int move; @@ -649,10 +649,10 @@ _asn1_expand_identifier (asn1_node_t * node, asn1_node_t root) * @source_name is not known. **/ int -asn1_create_element (asn1_node_t definitions, const char *source_name, - asn1_node_t * element) +asn1_create_element (asn1_node definitions, const char *source_name, + asn1_node * element) { - asn1_node_t dest_node; + asn1_node dest_node; int res; dest_node = _asn1_copy_structure2 (definitions, source_name); @@ -684,10 +684,10 @@ asn1_create_element (asn1_node_t definitions, const char *source_name, * from the @name element inside the structure @structure. **/ void -asn1_print_structure (FILE * out, asn1_node_t structure, const char *name, +asn1_print_structure (FILE * out, asn1_node structure, const char *name, int mode) { - asn1_node_t p, root; + asn1_node p, root; int k, indent = 0, len, len2, len3; if (out == NULL) @@ -1048,9 +1048,9 @@ asn1_print_structure (FILE * out, asn1_node_t structure, const char *name, * @name is not known, %ASN1_GENERIC_ERROR if pointer @num is %NULL. **/ int -asn1_number_of_elements (asn1_node_t element, const char *name, int *num) +asn1_number_of_elements (asn1_node element, const char *name, int *num) { - asn1_node_t node, p; + asn1_node node, p; if (num == NULL) return ASN1_GENERIC_ERROR; @@ -1086,11 +1086,11 @@ asn1_number_of_elements (asn1_node_t element, const char *name, int *num) * the OID. **/ const char * -asn1_find_structure_from_oid (asn1_node_t definitions, const char *oidValue) +asn1_find_structure_from_oid (asn1_node definitions, const char *oidValue) { char definitionsName[ASN1_MAX_NAME_SIZE], name[2 * ASN1_MAX_NAME_SIZE + 1]; char value[ASN1_MAX_NAME_SIZE]; - asn1_node_t p; + asn1_node p; int len; int result; @@ -1131,24 +1131,24 @@ asn1_find_structure_from_oid (asn1_node_t definitions, const char *oidValue) /** * asn1_copy_node: - * @dst: Destination asn1_node_t node. + * @dst: Destination asn1_node node. * @dst_name: Field name in destination node. - * @src: Source asn1_node_t node. + * @src: Source asn1_node node. * @src_name: Field name in source node. * - * Create a deep copy of a asn1_node_t variable. + * Create a deep copy of a asn1_node variable. * * Returns: Return %ASN1_SUCCESS on success. **/ int -asn1_copy_node (asn1_node_t dst, const char *dst_name, - asn1_node_t src, const char *src_name) +asn1_copy_node (asn1_node dst, const char *dst_name, + asn1_node src, const char *src_name) { /* FIXME: rewrite using copy_structure(). * It seems quite hard to do. */ int result; - asn1_node_t dst_node; + asn1_node dst_node; void *data = NULL; int size = 0; diff --git a/lib/structure.h b/lib/structure.h index 1e177c0..986e13a 100644 --- a/lib/structure.h +++ b/lib/structure.h @@ -28,14 +28,14 @@ #ifndef _STRUCTURE_H #define _STRUCTURE_H -int _asn1_create_static_structure (asn1_node_t pointer, +int _asn1_create_static_structure (asn1_node pointer, char *output_file_name, char *vector_name); -asn1_node_t _asn1_copy_structure3 (asn1_node_t source_node); +asn1_node _asn1_copy_structure3 (asn1_node source_node); -asn1_node_t _asn1_add_single_node (unsigned int type); +asn1_node _asn1_add_single_node (unsigned int type); -asn1_node_t _asn1_find_left (asn1_node_t node); +asn1_node _asn1_find_left (asn1_node node); #endif diff --git a/src/asn1Coding.c b/src/asn1Coding.c index b11dbcb..00057be 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_node_t definitions = NULL; - asn1_node_t structure = NULL; + asn1_node definitions = NULL; + asn1_node structure = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; int asn1_result = ASN1_SUCCESS; FILE *outputFile; diff --git a/src/asn1Decoding.c b/src/asn1Decoding.c index e2e32a7..ee09e18 100644 --- a/src/asn1Decoding.c +++ b/src/asn1Decoding.c @@ -33,7 +33,7 @@ #include <read-file.h> #include "benchmark.h" -static int decode(asn1_node_t definitions, const char* typeName, void* der, int der_len, int benchmark); +static int decode(asn1_node 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_node_t definitions = NULL; + asn1_node 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_node_t definitions, const char* typeName, void* der, int der_len, int benchmark) +static int simple_decode(asn1_node definitions, const char* typeName, void* der, int der_len, int benchmark) { int asn1_result; -asn1_node_t structure = NULL; +asn1_node 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_node_t definitions, const char* typeName, void* der, int der_len, int benchmark) +static int decode(asn1_node 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 054af7c..430ac7f 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_node_t pointer = NULL; + asn1_node pointer = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; int parse_result = ASN1_SUCCESS; diff --git a/tests/Test_encoding.c b/tests/Test_encoding.c index 6b3e7bb..d6c7d57 100644 --- a/tests/Test_encoding.c +++ b/tests/Test_encoding.c @@ -37,8 +37,8 @@ int main (int argc, char *argv[]) { int result, verbose = 0; - asn1_node_t definitions = NULL; - asn1_node_t asn1_element = NULL; + asn1_node definitions = NULL; + asn1_node asn1_element = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; const char *treefile = getenv ("ASN1ENCODING"); diff --git a/tests/Test_indefinite.c b/tests/Test_indefinite.c index e951b46..f06db4d 100644 --- a/tests/Test_indefinite.c +++ b/tests/Test_indefinite.c @@ -41,8 +41,8 @@ main (int argc, char *argv[]) { int result; char buffer[10 * 1024]; - asn1_node_t definitions = NULL; - asn1_node_t asn1_element = NULL; + asn1_node definitions = NULL; + asn1_node 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 6b9ef70..4adb0bf 100644 --- a/tests/Test_parser.c +++ b/tests/Test_parser.c @@ -148,7 +148,7 @@ int main (int argc, char *argv[]) { int result; - asn1_node_t definitions = NULL; + asn1_node definitions = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; test_type *test; int errorCounter = 0, testCounter = 0; diff --git a/tests/Test_tree.c b/tests/Test_tree.c index 70b6df4..abfaa5e 100644 --- a/tests/Test_tree.c +++ b/tests/Test_tree.c @@ -433,8 +433,8 @@ int main (int argc, char *argv[]) { int result; - asn1_node_t definitions = NULL; - asn1_node_t asn1_element = NULL; + asn1_node definitions = NULL; + asn1_node asn1_element = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; FILE *out; test_type *test; |