]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
upgraded to minitasn 2.10
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 7 Nov 2011 20:25:36 +0000 (21:25 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 7 Nov 2011 20:25:36 +0000 (21:25 +0100)
14 files changed:
lib/minitasn1/coding.c
lib/minitasn1/decoding.c
lib/minitasn1/element.c
lib/minitasn1/element.h
lib/minitasn1/errors.c
lib/minitasn1/gstr.c
lib/minitasn1/gstr.h
lib/minitasn1/int.h
lib/minitasn1/libtasn1.h
lib/minitasn1/parser_aux.c
lib/minitasn1/parser_aux.h
lib/minitasn1/structure.c
lib/minitasn1/structure.h
lib/minitasn1/version.c

index 31b5ebb1762ba827cda12879735e240929602dbb..3cc0ef81292e5366fedf873823defbc80920b28c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2008, 2009, 2010 Free Software
+ * Copyright (C) 2002, 2004, 2006, 2008, 2009, 2010, 2011 Free Software
  * Foundation, Inc.
  *
  * This file is part of LIBTASN1.
@@ -256,15 +256,17 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len)
   char *temp, *n_end, *n_start;
   unsigned char bit7;
   unsigned long val, val1 = 0;
+  int str_len = strlen(str);
 
   max_len = *der_len;
 
-  temp = (char *) _asn1_malloc (strlen (str) + 2);
+  temp = _asn1_malloc (str_len + 2);
   if (temp == NULL)
     return ASN1_MEM_ALLOC_ERROR;
 
-  strcpy (temp, str);
-  strcat (temp, ".");
+  memcpy (temp, str, str_len);
+  temp[str_len] = '.';
+  temp[str_len+1] = 0;
 
   counter = 0;
   n_start = temp;
@@ -857,16 +859,11 @@ _asn1_ordering_set_of (unsigned char *der, int der_len, ASN1_TYPE node)
  * Creates the DER encoding for the NAME structure (inside *POINTER
  * structure).
  *
- * Returns:
- *
- *   %ASN1_SUCCESS: DER encoding OK.
- *
- *   %ASN1_ELEMENT_NOT_FOUND: NAME is not a valid element.
- *
- *   %ASN1_VALUE_NOT_FOUND: There is an element without a value.
- *
- *   %ASN1_MEM_ERROR: @ider vector isn't big enough. Also in this case
- *     LEN will contain the length needed.
+ * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND
+ *   if @name is not a valid element, %ASN1_VALUE_NOT_FOUND if there
+ *   is an element without a value, %ASN1_MEM_ERROR if the @ider
+ *   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,
index 8c8b01fd322cd2b83cd5be4515edf3b1702e3ed9..3849375d07143cc8f35b7ad4931bc3ba8f170f4e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2008, 2009, 2010 Free Software
+ * Copyright (C) 2002, 2004, 2006, 2008, 2009, 2010, 2011 Free Software
  * Foundation, Inc.
  *
  * This file is part of LIBTASN1.
@@ -1367,7 +1367,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
   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;
-  unsigned char class, *temp2;
+  unsigned char class;
   unsigned long tag;
   int indefinite, result;
   const unsigned char *der = ider;
@@ -1921,7 +1921,6 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
                  if (state == FOUND)
                    {
                      _asn1_set_value_octet (p, der + counter, len2 + len3);
-                     temp2 = NULL;
 
                      if (p == nodeFound)
                        state = EXIT;
index 51ade14f3b69fb68d47708646b9150593b1ebf42..a8fdc929e3198b31ba9fc57823915335dd10b298 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2008, 2009, 2010
- * Free Software Foundation, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2008, 2009, 2010,
+ * 2011 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -264,13 +264,9 @@ _asn1_append_sequence_set (ASN1_TYPE node)
  *           result=asn1_write_value(cert,
  *           "tbsCertificate.subject.rdnSequence.?LAST", "NEW", 1);
  *
- * Returns:
- *
- *   %ASN1_SUCCESS: Set value OK.
- *
- *   %ASN1_ELEMENT_NOT_FOUND: NAME is not a valid element.
- *
- *   %ASN1_VALUE_NOT_VALID: VALUE has a wrong format.
+ * Returns: %ASN1_SUCCESS if the value was set,
+ *   %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,
@@ -697,16 +693,12 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
  * ANY: If NAME indicates an any type, VALUE will indicate the DER
  *   encoding of the structure actually used.
  *
- * Returns:
- *
- *   %ASN1_SUCCESS: Set value OK.
- *
- *   %ASN1_ELEMENT_NOT_FOUND: NAME is not a valid element.
- *
- *   %ASN1_VALUE_NOT_FOUND: There isn't any value for the element selected.
- *
- *   %ASN1_MEM_ERROR: The value vector isn't big enough to store the result.
- *   In this case LEN will contain the number of bytes needed.
+ * Returns: %ASN1_SUCCESS if value is returned,
+ *   %ASN1_ELEMENT_NOT_FOUND if @name is not a valid element,
+ *   %ASN1_VALUE_NOT_FOUND if there isn't any value for the element
+ *   selected, and %ASN1_MEM_ERROR if The value vector isn't big enough
+ *   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)
@@ -883,11 +875,8 @@ asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
  * %ASN1_CLASS_UNIVERSAL, %ASN1_CLASS_PRIVATE or
  * %ASN1_CLASS_CONTEXT_SPECIFIC.
  *
- * Returns:
- *
- *   %ASN1_SUCCESS: Set value OK.
- *
- *   %ASN1_ELEMENT_NOT_FOUND: NAME is not a valid element.
+ * 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,
@@ -986,7 +975,5 @@ asn1_read_tag (ASN1_TYPE root, const char *name, int *tagValue,
        }
     }
 
-
   return ASN1_SUCCESS;
-
 }
index 95c382a176c22d3df6bad657a5fc827e3f52cb4a..67a234f50ac2bd8f3bb551217171d9c6a3ff6b7c 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2008, 2009, 2010
- * Free Software Foundation, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2008, 2009, 2010,
+ * 2011 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
index 052c64ff3b169a2b12a9c18574928ddad0330eff..c5508dae85934cc29e279a701664ccaf298a0190 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010 Free Software
+ * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2011 Free Software
  * Foundation, Inc.
  *
  * This file is part of LIBTASN1.
index b3f6af27a16fcac86de86eecd8db76b5b142e002..32ab904cd4145ac08a74274793549a45c81732e3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Free Software
+ * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
  * Foundation, Inc.
  *
  * This file is part of LIBTASN1.
index bffb912332cc03a4bb21d5c99eab7acfc93453c5..33bdec94f40c96d1e42d5130a2ff40f042e56065 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Free Software
+ * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
  * Foundation, Inc.
  *
  * This file is part of LIBTASN1.
index def492759dc0662e06e2292ec7c89e5f32988c05..6b2b5eb6c62bcfc45749f6988cdafe43a9a0ee05 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
- * Software Foundation, Inc.
+ * Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ * Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
index fd3a1393f5180b6948a330f746ba3b2ff730499c..78f7b54de1ad89f71dbd79d4f1077f582b44cb8e 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
- * Software Foundation, Inc.
+ * Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ * Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -45,7 +45,7 @@ extern "C"
 {
 #endif
 
-#define ASN1_VERSION "2.6"
+#define ASN1_VERSION "2.10"
 
   typedef int asn1_retCode;    /* type returned by libtasn1 functions */
 
index a3150a8e22a648ecc5b1a051dc96b8d08433dffb..597fe6d40a4183fb1baf7136f50dd487df969d8e 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010 Free
- * Software Foundation, Inc.
+ * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011
+ * Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
index def52edcf376a4179cf7c3f7ee6431a897f70def..ca9e66c39569909e490a67264facfc616c8a1930 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010 Free
- * Software Foundation, Inc.
+ * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011
+ * Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
index b1c5b30c96b05b15b7294227bda023add2bdd0ca..c3d7896b45d02cf74f1d2eab7a73be1056dfc4ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009, 2010 Free
+ * Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Free
  * Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
@@ -168,16 +168,11 @@ _asn1_create_static_structure (ASN1_TYPE pointer, char *output_file_name,
  * Creates the structures needed to manage the ASN.1 definitions.
  * @array is a vector created by asn1_parser2array().
  *
- * Returns:
- *
- * %ASN1_SUCCESS: Structure created correctly.
- *
- * %ASN1_ELEMENT_NOT_EMPTY: *@definitions not ASN1_TYPE_EMPTY.
- *
- * %ASN1_IDENTIFIER_NOT_FOUND: In the file there is an identifier that
- *   is not defined (see @errorDescription for more information).
- *
- * %ASN1_ARRAY_ERROR: The array pointed by @array is wrong.
+ * Returns: %ASN1_SUCCESS if structure was created correctly,
+ *   %ASN1_ELEMENT_NOT_EMPTY if *@definitions not ASN1_TYPE_EMPTY,
+ *   %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,
@@ -284,11 +279,8 @@ asn1_array2tree (const ASN1_ARRAY_TYPE * array, ASN1_TYPE * definitions,
  * Deletes the structure *@structure.  At the end, *@structure is set
  * to ASN1_TYPE_EMPTY.
  *
- * Returns:
- *
- * %ASN1_SUCCESS: Everything OK.
- *
- * %ASN1_ELEMENT_NOT_FOUND: *@structure was ASN1_TYPE_EMPTY.
+ * Returns: %ASN1_SUCCESS if successful, %ASN1_ELEMENT_NOT_FOUND if
+ *   *@structure was ASN1_TYPE_EMPTY.
  **/
 asn1_retCode
 asn1_delete_structure (ASN1_TYPE * structure)
@@ -351,11 +343,8 @@ asn1_delete_structure (ASN1_TYPE * structure)
  *
  * Deletes the element named *@element_name inside *@structure.
  *
- * Returns:
- *
- * %ASN1_SUCCESS: Everything OK.
- *
- * %ASN1_ELEMENT_NOT_FOUND: The name element was not found.
+ * 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)
@@ -670,11 +659,8 @@ _asn1_expand_identifier (ASN1_TYPE * node, ASN1_TYPE root)
  *
  * rc = asn1_create_element(cert_def, "PKIX1.Certificate", certptr);
  *
- * Returns:
- *
- * %ASN1_SUCCESS: Creation OK.
- *
- * %ASN1_ELEMENT_NOT_FOUND: SOURCE_NAME isn't known
+ * 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,
@@ -1072,13 +1058,8 @@ asn1_print_structure (FILE * out, ASN1_TYPE structure, const char *name,
  * Counts the number of elements of a sub-structure called NAME with
  * names equal to "?1","?2", ...
  *
- * Returns:
- *
- *  %ASN1_SUCCESS: Creation OK.
- *
- *  %ASN1_ELEMENT_NOT_FOUND: NAME isn't known.
- *
- *  %ASN1_GENERIC_ERROR: Pointer num equal to NULL.
+ * 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)
@@ -1171,7 +1152,7 @@ asn1_find_structure_from_oid (ASN1_TYPE definitions, const char *oidValue)
  *
  * Create a deep copy of a ASN1_TYPE variable.
  *
- * Return value: Return %ASN1_SUCCESS on success.
+ * Returns: Return %ASN1_SUCCESS on success.
  **/
 asn1_retCode
 asn1_copy_node (ASN1_TYPE dst, const char *dst_name,
index 3885afc3141ee89c82248e1504d57fbdb4add0e7..98d32ab93bcf4b278b23c8ae8f4daa3c498316fb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009, 2010 Free
+ * Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Free
  * Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
index ad7b43eb36225daa687b7fb6671d627028d694de..c0cf1f2927215ce55fcbea4072157bc637f54945 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010 Free
- * Software Foundation, Inc.
+ * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011
+ * Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *