shishi-commit
[Top][All Lists]
Advanced

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

[SCM] GNU shishi branch, master, updated. shishi-0-0-43-13-g2adccd7


From: Simon Josefsson
Subject: [SCM] GNU shishi branch, master, updated. shishi-0-0-43-13-g2adccd7
Date: Thu, 22 Apr 2010 08:04:33 +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 shishi".

http://git.savannah.gnu.org/cgit/shishi.git/commit/?id=2adccd735184e591f5274de49cff7f40f67eff84

The branch, master has been updated
       via  2adccd735184e591f5274de49cff7f40f67eff84 (commit)
      from  db7c3c8750e78c811b3b25a525fa35d3470bb33f (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 2adccd735184e591f5274de49cff7f40f67eff84
Author: Simon Josefsson <address@hidden>
Date:   Thu Apr 22 10:04:27 2010 +0200

    minitasn1: Internal copy upgraded to GNU Libtasn1 v2.6.

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

Summary of changes:
 NEWS              |    2 +
 asn1/Makefile.am  |    2 +-
 asn1/coding.c     |    2 +-
 asn1/decoding.c   |  150 +++++++++++++---------------------
 asn1/element.h    |   21 +++++
 asn1/gstr.h       |   22 +++++
 asn1/libtasn1.h   |  234 +++++++++++++++++++++++++----------------------------
 asn1/parser_aux.c |   97 +---------------------
 asn1/parser_aux.h |   21 +++++
 asn1/structure.h  |   21 +++++
 asn1/version.c    |   52 ++++++++++++
 11 files changed, 312 insertions(+), 312 deletions(-)
 create mode 100644 asn1/version.c

diff --git a/NEWS b/NEWS
index cef3af1..ba6ebd0 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ See the end for copying conditions.
 Reported by Johan van Selst <address@hidden> in
 <http://lists.gnu.org/archive/html/help-shishi/2010-04/msg00000.html>.
 
+** minitasn1: Internal copy upgraded to GNU Libtasn1 v2.6.
+
 ** Doc fixes.
 
 ** API and ABI modifications:
diff --git a/asn1/Makefile.am b/asn1/Makefile.am
index f976570..4298105 100644
--- a/asn1/Makefile.am
+++ b/asn1/Makefile.am
@@ -25,4 +25,4 @@ EXTRA_DIST = README
 noinst_LTLIBRARIES = libminitasn1.la
 libminitasn1_la_SOURCES = libtasn1.h gstr.h errors.h int.h             \
        parser_aux.h structure.h element.h decoding.c gstr.c errors.c   \
-       parser_aux.c structure.c element.c coding.c
+       parser_aux.c structure.c element.c coding.c version.c
diff --git a/asn1/coding.c b/asn1/coding.c
index 9a28b12..31b5ebb 100644
--- a/asn1/coding.c
+++ b/asn1/coding.c
@@ -384,7 +384,7 @@ _asn1_complete_explicit_tag (ASN1_TYPE node, unsigned char 
*der,
       p = node->down;
       /* When there are nested tags we must complete them reverse to
          the order they were created. This is because completing a tag
-         modifies all data within it, including the incomplete tags 
+         modifies all data within it, including the incomplete tags
          which store buffer positions -- address@hidden 2002-09-06
        */
       while (p->right)
diff --git a/asn1/decoding.c b/asn1/decoding.c
index 6875baf..8c8b01f 100644
--- a/asn1/decoding.c
+++ b/asn1/decoding.c
@@ -54,7 +54,7 @@ _asn1_error_description_tag_error (ASN1_TYPE node, char 
*ErrorDescription)
  *
  * Extract a length field from DER data.
  *
- * Return value: Return the decoded length value, or -1 on indefinite
+ * Returns: Return the decoded length value, or -1 on indefinite
  *   length, or -2 when the value was too big.
  **/
 signed long
@@ -101,7 +101,6 @@ asn1_get_length_der (const unsigned char *der, int der_len, 
int *len)
     }
 }
 
-
 /**
  * asn1_get_tag_der:
  * @der: DER data to decode.
@@ -112,7 +111,7 @@ asn1_get_length_der (const unsigned char *der, int der_len, 
int *len)
  *
  * Decode the class and TAG from DER code.
  *
- * Return value: Returns %ASN1_SUCCESS on success, or an error.
+ * Returns: Returns %ASN1_SUCCESS on success, or an error.
  **/
 int
 asn1_get_tag_der (const unsigned char *der, int der_len,
@@ -169,8 +168,8 @@ asn1_get_tag_der (const unsigned char *der, int der_len,
  * asn1_get_length_der() is that this function will return a length
  * even if the value has indefinite encoding.
  *
- * Return value: Return the decoded length value, or negative value
- *   when the value was too big.
+ * Returns: Return the decoded length value, or negative value when
+ *   the value was too big.
  *
  * Since: 2.0
  **/
@@ -203,7 +202,7 @@ asn1_get_length_ber (const unsigned char *ber, int ber_len, 
int *len)
  *
  * Extract an OCTET SEQUENCE from DER data.
  *
- * Return value: Returns %ASN1_SUCCESS on success, or an error.
+ * Returns: Returns %ASN1_SUCCESS on success, or an error.
  **/
 int
 asn1_get_octet_der (const unsigned char *der, int der_len,
@@ -232,8 +231,6 @@ asn1_get_octet_der (const unsigned char *der, int der_len,
   return ASN1_SUCCESS;
 }
 
-
-
 /* Returns ASN1_SUCCESS on success or an error code on error.
  */
 static int
@@ -254,8 +251,6 @@ _asn1_get_time_der (const unsigned char *der, int der_len, 
int *ret_len,
   return ASN1_SUCCESS;
 }
 
-
-
 static int
 _asn1_get_objectid_der (const unsigned char *der, int der_len, int *ret_len,
                        char *str, int str_size)
@@ -288,18 +283,18 @@ _asn1_get_objectid_der (const unsigned char *der, int 
der_len, int *ret_len,
   leading = 1;
   for (k = 1; k < len; k++)
     {
-      
-
       /* X.690 mandates that the leading byte must never be 0x80
        */
-      if (leading != 0 && der[len_len + k] == 0x80) return ASN1_DER_ERROR;
+      if (leading != 0 && der[len_len + k] == 0x80)
+       return ASN1_DER_ERROR;
       leading = 0;
 
       /* check for wrap around */
       val = val << 7;
       val |= der[len_len + k] & 0x7F;
 
-      if (val < prev_val) return ASN1_DER_ERROR;
+      if (val < prev_val)
+       return ASN1_DER_ERROR;
 
       prev_val = val;
 
@@ -313,7 +308,7 @@ _asn1_get_objectid_der (const unsigned char *der, int 
der_len, int *ret_len,
        }
     }
   *ret_len = len + len_len;
-  
+
   return ASN1_SUCCESS;
 }
 
@@ -328,7 +323,7 @@ _asn1_get_objectid_der (const unsigned char *der, int 
der_len, int *ret_len,
  *
  * Extract a BIT SEQUENCE from DER data.
  *
- * Return value: Return %ASN1_SUCCESS on success, or an error.
+ * Returns: Return %ASN1_SUCCESS on success, or an error.
  **/
 int
 asn1_get_bit_der (const unsigned char *der, int der_len,
@@ -356,9 +351,6 @@ asn1_get_bit_der (const unsigned char *der, int der_len,
   return ASN1_SUCCESS;
 }
 
-
-
-
 static int
 _asn1_extract_tag_der (ASN1_TYPE node, const unsigned char *der, int der_len,
                       int *ret_len)
@@ -557,7 +549,6 @@ _asn1_extract_tag_der (ASN1_TYPE node, const unsigned char 
*der, int der_len,
   return ASN1_SUCCESS;
 }
 
-
 static int
 _asn1_delete_not_used (ASN1_TYPE node)
 {
@@ -662,7 +653,6 @@ _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)
 {
@@ -796,7 +786,6 @@ _asn1_get_indefinite_length_string (const unsigned char 
*der, int *len)
 
 }
 
-
 /**
  * asn1_der_decoding:
  * @element: pointer to an ASN1 structure.
@@ -805,20 +794,16 @@ _asn1_get_indefinite_length_string (const unsigned char 
*der, int *len)
  * @errorDescription: null-terminated string contains details when an
  *   error occurred.
  *
- * Fill the structure *ELEMENT with values of a DER encoding
+ * Fill the structure address@hidden with values of a DER encoding
  * string. The structure must just be created with function
- * 'asn1_create_element'.  If an error occurs during the decoding
- * procedure, the *ELEMENT is deleted and set equal to
+ * asn1_create_element().  If an error occurs during the decoding
+ * procedure, the address@hidden is deleted and set equal to
  * %ASN1_TYPE_EMPTY.
  *
- * Returns:
- *
- *   %ASN1_SUCCESS: DER encoding OK.
- *
- *   %ASN1_ELEMENT_NOT_FOUND: ELEMENT is ASN1_TYPE_EMPTY.
- *
- *   %ASN1_TAG_ERROR,ASN1_DER_ERROR: The der encoding doesn't match
- *     the structure NAME. *ELEMENT deleted.
+ * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND
+ *   if @ELEMENT is %ASN1_TYPE_EMPTY, 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,
@@ -1053,8 +1038,9 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
              move = RIGHT;
              break;
            case TYPE_OBJECT_ID:
-             result = _asn1_get_objectid_der (der + counter, len - counter, 
&len2,
-                                     temp, sizeof (temp));
+             result =
+               _asn1_get_objectid_der (der + counter, len - counter, &len2,
+                                       temp, sizeof (temp));
              if (result != ASN1_SUCCESS)
                {
                  asn1_delete_structure (element);
@@ -1347,7 +1333,6 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
   return ASN1_SUCCESS;
 }
 
-
 #define FOUND        1
 #define SAME_BRANCH  2
 #define OTHER_BRANCH 3
@@ -1362,22 +1347,17 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
  * @errorDescription: null-terminated string contains details when an
  *   error occurred.
  *
- * Fill the element named ELEMENTNAME with values of a DER encoding
+ * Fill the element named @ELEMENTNAME with values of a DER encoding
  * string.  The structure must just be created with function
- * 'asn1_create_element'.  The DER vector must contain the encoding
- * string of the whole STRUCTURE.  If an error occurs during the
- * decoding procedure, the *STRUCTURE is deleted and set equal to
+ * 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.
  *
- * Returns:
- *
- *   %ASN1_SUCCESS: DER encoding OK.
- *
- *   %ASN1_ELEMENT_NOT_FOUND: ELEMENT is ASN1_TYPE_EMPTY or
- *     elementName == NULL.
- *
- *   %ASN1_TAG_ERROR,ASN1_DER_ERROR: The der encoding doesn't match
- *   the structure STRUCTURE. *ELEMENT deleted.
+ * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND
+ *   if ELEMENT is %ASN1_TYPE_EMPTY 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,
@@ -1668,12 +1648,13 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
            case TYPE_OBJECT_ID:
              if (state == FOUND)
                {
-                 result = _asn1_get_objectid_der (der + counter, len - 
counter, &len2,
-                                         temp, sizeof (temp));
-                  if (result != ASN1_SUCCESS)
-                  {
-                   return result;
-                  }
+                 result =
+                   _asn1_get_objectid_der (der + counter, len - counter,
+                                           &len2, temp, sizeof (temp));
+                 if (result != ASN1_SUCCESS)
+                   {
+                     return result;
+                   }
 
                  tlen = strlen (temp);
 
@@ -2123,8 +2104,6 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
   return ASN1_SUCCESS;
 }
 
-
-
 /**
  * asn1_der_decoding_startEnd:
  * @element: pointer to an ASN1 element
@@ -2138,21 +2117,17 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
  *
  * Find the start and end point of an element in a DER encoding
  * string. I mean that if you have a der encoding and you have already
- * used the function "asn1_der_decoding" to fill a structure, it may
+ * used the function asn1_der_decoding() to fill a structure, it may
  * happen that you want to find the piece of string concerning an
  * element of the structure.
  *
- * Example: the sequence "tbsCertificate" inside an X509 certificate.
- *
- * Returns:
- *
- *   %ASN1_SUCCESS: DER encoding OK.
- *
- *   %ASN1_ELEMENT_NOT_FOUND: ELEMENT is ASN1_TYPE EMPTY or
- *   NAME_ELEMENT is not a valid element.
+ * One example is the sequence "tbsCertificate" inside an X509
+ * certificate.
  *
- *   %ASN1_TAG_ERROR,ASN1_DER_ERROR: the der encoding doesn't match
- *   the structure ELEMENT.
+ * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND
+ *   if ELEMENT is %ASN1_TYPE 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,
@@ -2475,7 +2450,6 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void 
*ider, int len,
   return ASN1_ELEMENT_NOT_FOUND;
 }
 
-
 /**
  * asn1_expand_any_defined_by:
  * @definitions: ASN1 definitions
@@ -2487,14 +2461,10 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const 
void *ider, int len,
  * expand the element ANY is the first one following the definition of
  * the actual value of the OBJECT IDENTIFIER.
  *
- * Returns:
- *
- *   %ASN1_SUCCESS: Substitution OK.
- *
- *   %ASN1_ERROR_TYPE_ANY: Some "ANY DEFINED BY" element couldn't be
- *   expanded due to a problem in OBJECT_ID -> TYPE association.
- *
- *   other errors: Result of der decoding process.
+ * Returns: %ASN1_SUCCESS if Substitution OK, %ASN1_ERROR_TYPE_ANY if
+ *   some "ANY DEFINED BY" element couldn't be expanded due to a
+ *   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)
@@ -2595,7 +2565,7 @@ asn1_expand_any_defined_by (ASN1_TYPE definitions, 
ASN1_TYPE * element)
                      if ((result == ASN1_SUCCESS)
                          && (!strcmp (p3->value, value)))
                        {
-                         p2 = p2->right;       /* pointer to the structure to 
+                         p2 = p2->right;       /* pointer to the structure to
                                                   use for expansion */
                          while ((p2) && (p2->type & CONST_ASSIGN))
                            p2 = p2->right;
@@ -2708,8 +2678,6 @@ asn1_expand_any_defined_by (ASN1_TYPE definitions, 
ASN1_TYPE * element)
   return retCode;
 }
 
-
-
 /**
  * asn1_expand_octet_string:
  * @definitions: ASN1 definitions
@@ -2719,20 +2687,14 @@ asn1_expand_any_defined_by (ASN1_TYPE definitions, 
ASN1_TYPE * element)
  *    the type for expansion.
  *
  * Expands an "OCTET STRING" element of a structure created from a DER
- * decoding process (asn1_der_decoding function). The type used for
- * expansion is the first one following the definition of the actual
- * value of the OBJECT IDENTIFIER indicated by OBJECTNAME.
- *
- * Returns:
- *
- *   %ASN1_SUCCESS: Substitution OK.
- *
- *   %ASN1_ELEMENT_NOT_FOUND: @objectName or @octetName are not correct.
- *
- *   %ASN1_VALUE_NOT_VALID: Wasn't possible to find the type to use
- *       for expansion.
+ * decoding process (the asn1_der_decoding() function).  The type used
+ * for expansion is the first one following the definition of the
+ * actual value of the OBJECT IDENTIFIER indicated by OBJECTNAME.
  *
- *   other errors: result of der decoding process.
+ * Returns: %ASN1_SUCCESS if substitution OK, %ASN1_ELEMENT_NOT_FOUND
+ *   if @objectName or @octetName are not correct,
+ *   %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,
@@ -2785,7 +2747,7 @@ asn1_expand_octet_string (ASN1_TYPE definitions, 
ASN1_TYPE * element,
              && (!strcmp (objectNode->value, value)))
            {
 
-             p2 = p2->right;   /* pointer to the structure to 
+             p2 = p2->right;   /* pointer to the structure to
                                   use for expansion */
              while ((p2) && (p2->type & CONST_ASSIGN))
                p2 = p2->right;
diff --git a/asn1/element.h b/asn1/element.h
index b5d9eb9..95c382a 100644
--- a/asn1/element.h
+++ b/asn1/element.h
@@ -1,3 +1,24 @@
+/*
+ * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2008, 2009, 2010
+ * Free Software Foundation, Inc.
+ *
+ * This file is part of LIBTASN1.
+ *
+ * The LIBTASN1 library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ */
 
 #ifndef _ELEMENT_H
 #define _ELEMENT_H
diff --git a/asn1/gstr.h b/asn1/gstr.h
index 5452fa4..bffb912 100644
--- a/asn1/gstr.h
+++ b/asn1/gstr.h
@@ -1,3 +1,25 @@
+/*
+ * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Free Software
+ * Foundation, Inc.
+ *
+ * This file is part of LIBTASN1.
+ *
+ * The LIBTASN1 library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ */
+
 void _asn1_str_cpy (char *dest, size_t dest_tot_size, const char *src);
 void _asn1_str_cat (char *dest, size_t dest_tot_size, const char *src);
 
diff --git a/asn1/libtasn1.h b/asn1/libtasn1.h
index fea5cea..fd3a139 100644
--- a/asn1/libtasn1.h
+++ b/asn1/libtasn1.h
@@ -45,7 +45,7 @@ extern "C"
 {
 #endif
 
-#define ASN1_VERSION "2.5"
+#define ASN1_VERSION "2.6"
 
   typedef int asn1_retCode;    /* type returned by libtasn1 functions */
 
@@ -159,138 +159,126 @@ extern "C"
   /*  Functions definitions          */
   /***********************************/
 
-  ASN1_API asn1_retCode
-  asn1_parser2tree (const char *file_name,
-                   ASN1_TYPE * definitions,
-                   char *errorDescription);
-
-  ASN1_API asn1_retCode
-  asn1_parser2array (const char *inputFileName,
-                    const char *outputFileName,
-                    const char *vectorName,
-                    char *errorDescription);
-
-  ASN1_API asn1_retCode
-  asn1_array2tree (const ASN1_ARRAY_TYPE * array,
-                  ASN1_TYPE * definitions,
-                  char *errorDescription);
-
-  ASN1_API void
-  asn1_print_structure (FILE * out, ASN1_TYPE structure,
-                       const char *name, int mode);
-
-  ASN1_API asn1_retCode
-  asn1_create_element (ASN1_TYPE definitions,
-                      const char *source_name,
-                      ASN1_TYPE * element);
-
-  ASN1_API asn1_retCode
-  asn1_delete_structure (ASN1_TYPE * structure);
-
-  ASN1_API asn1_retCode
-  asn1_delete_element (ASN1_TYPE structure,
-                      const char *element_name);
-
-  ASN1_API asn1_retCode
-  asn1_write_value (ASN1_TYPE node_root, const char *name,
-                   const void *ivalue, int len);
-
-  ASN1_API asn1_retCode
-  asn1_read_value (ASN1_TYPE root, const char *name,
-                  void *ivalue, int *len);
-
-  ASN1_API asn1_retCode
-  asn1_number_of_elements (ASN1_TYPE element, const char *name, int *num);
-
-  ASN1_API asn1_retCode
-  asn1_der_coding (ASN1_TYPE element, const char *name,
-                  void *ider, int *len,
-                  char *ErrorDescription);
-
-  ASN1_API asn1_retCode
-  asn1_der_decoding (ASN1_TYPE * element, const void *ider,
-                    int len, char *errorDescription);
-
-  ASN1_API asn1_retCode
-  asn1_der_decoding_element (ASN1_TYPE * structure,
-                            const char *elementName,
-                            const void *ider, int len,
-                            char *errorDescription);
-
-  ASN1_API asn1_retCode
-  asn1_der_decoding_startEnd (ASN1_TYPE element,
-                             const void *ider, int len,
-                             const char *name_element,
-                             int *start, int *end);
-
-  ASN1_API asn1_retCode
-  asn1_expand_any_defined_by (ASN1_TYPE definitions,
-                             ASN1_TYPE * element);
-
-  ASN1_API asn1_retCode
-  asn1_expand_octet_string (ASN1_TYPE definitions,
-                           ASN1_TYPE * element,
-                           const char *octetName,
-                           const char *objectName);
-
-  ASN1_API asn1_retCode
-  asn1_read_tag (ASN1_TYPE root, const char *name,
-                int *tagValue, int *classValue);
-
-  ASN1_API const char *
-  asn1_find_structure_from_oid (ASN1_TYPE definitions,
-                               const char *oidValue);
-
-  ASN1_API const char *
-  asn1_check_version (const char *req_version);
-
-  ASN1_API const char *
-  asn1_strerror (asn1_retCode error);
-
-  ASN1_API void
-  asn1_perror (asn1_retCode error);
+  extern ASN1_API asn1_retCode
+    asn1_parser2tree (const char *file_name,
+                     ASN1_TYPE * definitions, char *errorDescription);
+
+  extern ASN1_API asn1_retCode
+    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 void
+    asn1_print_structure (FILE * out, ASN1_TYPE 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 asn1_retCode asn1_delete_structure (ASN1_TYPE * structure);
+
+  extern ASN1_API asn1_retCode
+    asn1_delete_element (ASN1_TYPE structure, const char *element_name);
+
+  extern ASN1_API asn1_retCode
+    asn1_write_value (ASN1_TYPE node_root, const char *name,
+                     const void *ivalue, int len);
+
+  extern ASN1_API asn1_retCode
+    asn1_read_value (ASN1_TYPE root, const char *name,
+                    void *ivalue, int *len);
+
+  extern ASN1_API asn1_retCode
+    asn1_number_of_elements (ASN1_TYPE element, const char *name, int *num);
+
+  extern ASN1_API asn1_retCode
+    asn1_der_coding (ASN1_TYPE element, const char *name,
+                    void *ider, int *len, char *ErrorDescription);
+
+  extern ASN1_API asn1_retCode
+    asn1_der_decoding (ASN1_TYPE * element, const void *ider,
+                      int len, char *errorDescription);
+
+  extern ASN1_API asn1_retCode
+    asn1_der_decoding_element (ASN1_TYPE * structure,
+                              const char *elementName,
+                              const void *ider, int len,
+                              char *errorDescription);
+
+  extern ASN1_API asn1_retCode
+    asn1_der_decoding_startEnd (ASN1_TYPE 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 asn1_retCode
+    asn1_expand_octet_string (ASN1_TYPE definitions,
+                             ASN1_TYPE * element,
+                             const char *octetName, const char *objectName);
+
+  extern ASN1_API asn1_retCode
+    asn1_read_tag (ASN1_TYPE root, const char *name,
+                  int *tagValue, int *classValue);
+
+  extern ASN1_API const char *asn1_find_structure_from_oid (ASN1_TYPE
+                                                           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 void asn1_perror (asn1_retCode error);
 
   /* DER utility functions. */
 
-  ASN1_API int
-  asn1_get_tag_der (const unsigned char *der, int der_len,
-                   unsigned char *cls, int *len,
-                   unsigned long *tag);
+  extern ASN1_API int
+    asn1_get_tag_der (const unsigned char *der, int der_len,
+                     unsigned char *cls, int *len, unsigned long *tag);
 
-  ASN1_API void
-  asn1_octet_der (const unsigned char *str, int str_len,
-                 unsigned char *der, int *der_len);
+  extern ASN1_API void
+    asn1_octet_der (const unsigned char *str, int str_len,
+                   unsigned char *der, int *der_len);
 
-  ASN1_API asn1_retCode
-  asn1_get_octet_der (const unsigned char *der, int der_len,
-                     int *ret_len, unsigned char *str,
-                     int str_size, int *str_len);
+  extern ASN1_API asn1_retCode
+    asn1_get_octet_der (const unsigned char *der, int der_len,
+                       int *ret_len, unsigned char *str,
+                       int str_size, int *str_len);
 
-  ASN1_API void asn1_bit_der (const unsigned char *str, int bit_len,
-                             unsigned char *der, int *der_len);
+  extern ASN1_API void asn1_bit_der (const unsigned char *str, int bit_len,
+                                    unsigned char *der, int *der_len);
 
-  ASN1_API asn1_retCode
-  asn1_get_bit_der (const unsigned char *der, int der_len,
-                   int *ret_len, unsigned char *str,
-                   int str_size, int *bit_len);
+  extern ASN1_API asn1_retCode
+    asn1_get_bit_der (const unsigned char *der, int der_len,
+                     int *ret_len, unsigned char *str,
+                     int str_size, int *bit_len);
 
-  ASN1_API signed long
-  asn1_get_length_der (const unsigned char *der, int der_len, int *len);
+  extern ASN1_API signed long
+    asn1_get_length_der (const unsigned char *der, int der_len, int *len);
 
-  ASN1_API signed long
-  asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len);
+  extern ASN1_API signed long
+    asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len);
 
-  ASN1_API void
-  asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len);
+  extern ASN1_API void
+    asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len);
 
   /* Other utility functions. */
 
-  ASN1_API ASN1_TYPE
-  asn1_find_node (ASN1_TYPE pointer, const char *name);
+  extern ASN1_API ASN1_TYPE
+    asn1_find_node (ASN1_TYPE pointer, const char *name);
 
-  ASN1_API asn1_retCode
-  asn1_copy_node (ASN1_TYPE dst, const char *dst_name,
-                 ASN1_TYPE src, const char *src_name);
+  extern ASN1_API asn1_retCode
+    asn1_copy_node (ASN1_TYPE dst, const char *dst_name,
+                   ASN1_TYPE src, const char *src_name);
 
   /* Deprecated stuff. */
 
@@ -314,14 +302,12 @@ extern "C"
 #endif
 
   /* Use asn1_strerror instead. */
-  ASN1_API const char *
-  libtasn1_strerror (asn1_retCode error)
+  extern ASN1_API const char *libtasn1_strerror (asn1_retCode error)
     __attribute__ ((deprecated));
 
   /* Use asn1_perror instead. */
-  ASN1_API void
-  libtasn1_perror (asn1_retCode error)
-    __attribute__ ((deprecated));
+  extern ASN1_API void
+    libtasn1_perror (asn1_retCode error) __attribute__ ((deprecated));
 
 #endif
 
diff --git a/asn1/parser_aux.c b/asn1/parser_aux.c
index b740a1e..a3150a8 100644
--- a/asn1/parser_aux.c
+++ b/asn1/parser_aux.c
@@ -83,12 +83,12 @@ _asn1_add_node (unsigned int type)
  * @pointer: NODE_ASN element pointer.
  * @name: null terminated string with the element's name to find.
  *
- * Searches for an element called NAME starting from POINTER.  The
+ * Searches for an element called @name starting from @pointer.  The
  * name is composed by differents identifiers separated by dots.  When
- * *POINTER has a name, the first identifier must be the name of
- * *POINTER, otherwise it must be the name of one child of *POINTER.
+ * address@hidden has a name, the first identifier must be the name of
+ * address@hidden, otherwise it must be the name of one child of address@hidden
  *
- * Return value: the searching result. NULL if not found.
+ * Returns: the search result, or %NULL if not found.
  **/
 ASN1_TYPE
 asn1_find_node (ASN1_TYPE pointer, const char *name)
@@ -160,7 +160,7 @@ asn1_find_node (ASN1_TYPE pointer, const char *name)
 
       p = p->down;
 
-      /* The identifier "?LAST" indicates the last element 
+      /* The identifier "?LAST" indicates the last element
          in the right chain. */
       if (!strcmp (n, "?LAST"))
        {
@@ -1095,90 +1095,3 @@ _asn1_set_default_tag (ASN1_TYPE node)
 
   return ASN1_SUCCESS;
 }
-
-
-
-static const char *
-parse_version_number (const char *s, int *number)
-{
-  int val = 0;
-
-  if (*s == '0' && isdigit (s[1]))
-    return NULL;               /* leading zeros are not allowed */
-  for (; isdigit (*s); s++)
-    {
-      val *= 10;
-      val += *s - '0';
-    }
-  *number = val;
-  return val < 0 ? NULL : s;
-}
-
-/* The parse version functions were copied from libgcrypt.
- */
-static const char *
-parse_version_string (const char *s, int *major, int *minor, int *micro)
-{
-  s = parse_version_number (s, major);
-  if (!s || *s != '.')
-    return NULL;
-  s++;
-  s = parse_version_number (s, minor);
-  if (!s)
-    return NULL;
-  if (*s != '.')
-    {
-      *micro = 0;
-      return s;
-    }
-  s++;
-  s = parse_version_number (s, micro);
-  if (!s)
-    return NULL;
-  return s;                    /* patchlevel */
-}
-
-/**
- * asn1_check_version:
- * @req_version: Required version number, or NULL.
- *
- * Check that the version of the library is at minimum the
- * requested one and return the version string; return %NULL if the
- * condition is not satisfied.  If a %NULL is passed to this function,
- * no check is done, but the version string is simply returned.
- *
- * See %ASN1_VERSION for a suitable @req_version string.
- *
- * Return value: Version string of run-time library, or %NULL if the
- *   run-time library does not meet the required version number.
- */
-const char *
-asn1_check_version (const char *req_version)
-{
-  const char *ver = ASN1_VERSION;
-  int my_major, my_minor, my_micro;
-  int rq_major, rq_minor, rq_micro;
-  const char *my_plvl, *rq_plvl;
-
-  if (!req_version)
-    return ver;
-
-  my_plvl = parse_version_string (ver, &my_major, &my_minor, &my_micro);
-  if (!my_plvl)
-    return NULL;               /* very strange our own version is bogus */
-  rq_plvl = parse_version_string (req_version, &rq_major, &rq_minor,
-                                 &rq_micro);
-  if (!rq_plvl)
-    return NULL;               /* req version string is invalid */
-
-  if (my_major > rq_major
-      || (my_major == rq_major && my_minor > rq_minor)
-      || (my_major == rq_major && my_minor == rq_minor
-         && my_micro > rq_micro)
-      || (my_major == rq_major && my_minor == rq_minor
-         && my_micro == rq_micro && strcmp (my_plvl, rq_plvl) >= 0))
-    {
-      return ver;
-    }
-  return NULL;
-}
diff --git a/asn1/parser_aux.h b/asn1/parser_aux.h
index 564f64e..def52ed 100644
--- a/asn1/parser_aux.h
+++ b/asn1/parser_aux.h
@@ -1,3 +1,24 @@
+/*
+ * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010 Free
+ * Software Foundation, Inc.
+ *
+ * This file is part of LIBTASN1.
+ *
+ * The LIBTASN1 library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ */
 
 #ifndef _PARSER_AUX_H
 #define _PARSER_AUX_H
diff --git a/asn1/structure.h b/asn1/structure.h
index 7257986..3885afc 100644
--- a/asn1/structure.h
+++ b/asn1/structure.h
@@ -1,3 +1,24 @@
+/*
+ * Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009, 2010 Free
+ * Software Foundation, Inc.
+ *
+ * This file is part of LIBTASN1.
+ *
+ * The LIBTASN1 library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ */
 
 /*************************************************/
 /* File: structure.h                             */
diff --git a/asn1/version.c b/asn1/version.c
new file mode 100644
index 0000000..ad7b43e
--- /dev/null
+++ b/asn1/version.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010 Free
+ * Software Foundation, Inc.
+ *
+ * This file is part of LIBTASN1.
+ *
+ * The LIBTASN1 library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>            /* for strverscmp */
+
+#include "libtasn1.h"
+
+/**
+ * asn1_check_version:
+ * @req_version: Required version number, or %NULL.
+ *
+ * Check that the version of the library is at minimum the
+ * requested one and return the version string; return %NULL if the
+ * condition is not satisfied.  If a %NULL is passed to this function,
+ * no check is done, but the version string is simply returned.
+ *
+ * See %ASN1_VERSION for a suitable @req_version string.
+ *
+ * Returns: Version string of run-time library, or %NULL if the
+ *   run-time library does not meet the required version number.
+ */
+const char *
+asn1_check_version (const char *req_version)
+{
+  if (!req_version || strverscmp (req_version, ASN1_VERSION) <= 0)
+    return ASN1_VERSION;
+
+  return NULL;
+}


hooks/post-receive
-- 
GNU shishi




reply via email to

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