gnutls-commit
[Top][All Lists]
Advanced

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

[SCM] GNU gnutls branch, gnutls_2_12_x, updated. gnutls_2_12_17-5-ga113a


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, gnutls_2_12_x, updated. gnutls_2_12_17-5-ga113a91
Date: Fri, 16 Mar 2012 07:02:47 +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 gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=a113a913975a06e9760a02d3b39b80c615e40fe7

The branch, gnutls_2_12_x has been updated
       via  a113a913975a06e9760a02d3b39b80c615e40fe7 (commit)
       via  1244304c248d7bf67d48b53eb556077addecab2b (commit)
      from  187c71472335456920af0f0a10d32e6cb470b7f8 (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 a113a913975a06e9760a02d3b39b80c615e40fe7
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Fri Mar 16 08:07:36 2012 +0100

    more files to ignore

commit 1244304c248d7bf67d48b53eb556077addecab2b
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Fri Mar 16 08:03:31 2012 +0100

    Upgraded to libtasn1 version 2.12.

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

Summary of changes:
 .gitignore                 |    1 +
 NEWS                       |    2 +
 lib/minitasn1/coding.c     |   43 +++---
 lib/minitasn1/decoding.c   |  368 ++++++++++++++++++++++++++------------------
 lib/minitasn1/element.c    |   55 ++++----
 lib/minitasn1/element.h    |    5 +-
 lib/minitasn1/errors.c     |    3 +-
 lib/minitasn1/gstr.c       |    3 +-
 lib/minitasn1/gstr.h       |    3 +-
 lib/minitasn1/int.h        |    9 +-
 lib/minitasn1/libtasn1.h   |    5 +-
 lib/minitasn1/parser_aux.c |   24 ++--
 lib/minitasn1/parser_aux.h |    3 +-
 lib/minitasn1/structure.c  |    7 +-
 lib/minitasn1/structure.h  |    3 +-
 lib/minitasn1/version.c    |    3 +-
 16 files changed, 303 insertions(+), 234 deletions(-)

diff --git a/.gitignore b/.gitignore
index eefc468..666ec5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -559,3 +559,4 @@ lib/gl/tests/test-sys_types
 lib/gl/tests/test-sys_uio
 tests/rng-fork
 tests/x509cert
+lib/gl/stdalign.h
diff --git a/NEWS b/NEWS
index 68912a4..ef00cc6 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ See the end for copying conditions.
 
 Version 2.12.18 (unreleased)
 
+** minitasn1: Upgraded to libtasn1 version 2.12.
+
 ** Corrected SRP-RSA ciphersuites when used under TLS 1.2.
 
 ** Fixed leaks in key generation. Reported by Sam Varshavchik,
diff --git a/lib/minitasn1/coding.c b/lib/minitasn1/coding.c
index 3cc0ef8..8b72eba 100644
--- a/lib/minitasn1/coding.c
+++ b/lib/minitasn1/coding.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -183,14 +182,15 @@ _asn1_time_der (unsigned char *str, unsigned char *der, 
int *der_len)
 {
   int len_len;
   int max_len;
+  int str_len = _asn1_strlen (str);
 
   max_len = *der_len;
 
-  asn1_length_der (strlen (str), (max_len > 0) ? der : NULL, &len_len);
+  asn1_length_der (str_len, (max_len > 0) ? der : NULL, &len_len);
 
-  if ((len_len + (int) strlen (str)) <= max_len)
-    memcpy (der + len_len, str, strlen (str));
-  *der_len = len_len + strlen (str);
+  if ((len_len + str_len) <= max_len)
+    memcpy (der + len_len, str, str_len);
+  *der_len = len_len + str_len;
 
   if ((*der_len) > max_len)
     return ASN1_MEM_ERROR;
@@ -256,7 +256,7 @@ _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);
+  int str_len = _asn1_strlen(str);
 
   max_len = *der_len;
 
@@ -322,7 +322,8 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, 
int *der_len)
 }
 
 
-const char bit_mask[] = { 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x80 };
+static const unsigned char bit_mask[] =
+  { 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x80 };
 
 /**
  * asn1_bit_der:
@@ -452,7 +453,7 @@ _asn1_insert_tag_der (ASN1_TYPE node, unsigned char *der, 
int *counter,
   int tag_len, is_tag_implicit;
   unsigned char class, class_implicit = 0, temp[SIZEOF_UNSIGNED_INT * 3 + 1];
   unsigned long tag_implicit = 0;
-  char tag_der[MAX_TAG_LEN];
+  unsigned char tag_der[MAX_TAG_LEN];
 
   is_tag_implicit = 0;
 
@@ -479,16 +480,16 @@ _asn1_insert_tag_der (ASN1_TYPE node, unsigned char *der, 
int *counter,
                                   &tag_len);
                  else
                    _asn1_tag_der (class | ASN1_CLASS_STRUCTURED,
-                                  strtoul (p->value, NULL, 10), tag_der,
-                                  &tag_len);
+                                  _asn1_strtoul (p->value, NULL, 10),
+                                  tag_der, &tag_len);
 
                  *max_len -= tag_len;
                  if (*max_len >= 0)
                    memcpy (der + *counter, tag_der, tag_len);
                  *counter += tag_len;
 
-                 _asn1_ltostr (*counter, temp);
-                 _asn1_set_name (p, temp);
+                 _asn1_ltostr (*counter, (char *) temp);
+                 _asn1_set_name (p, (const char *) temp);
 
                  is_tag_implicit = 0;
                }
@@ -502,7 +503,7 @@ _asn1_insert_tag_der (ASN1_TYPE node, unsigned char *der, 
int *counter,
                          (type_field (node->type) == TYPE_SET_OF))
                        class |= ASN1_CLASS_STRUCTURED;
                      class_implicit = class;
-                     tag_implicit = strtoul (p->value, NULL, 10);
+                     tag_implicit = _asn1_strtoul (p->value, NULL, 10);
                      is_tag_implicit = 1;
                    }
                }
@@ -870,7 +871,7 @@ asn1_der_coding (ASN1_TYPE element, const char *name, void 
*ider, int *len,
                 char *ErrorDescription)
 {
   ASN1_TYPE node, p, p2;
-  char temp[SIZEOF_UNSIGNED_LONG_INT * 3 + 1];
+  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;
   unsigned char *der = ider;
@@ -1072,8 +1073,8 @@ asn1_der_coding (ASN1_TYPE element, const char *name, 
void *ider, int *len,
        case TYPE_SET:
          if (move != UP)
            {
-             _asn1_ltostr (counter, temp);
-             tlen = strlen (temp);
+             _asn1_ltostr (counter, (char *) temp);
+             tlen = _asn1_strlen (temp);
              if (tlen > 0)
                _asn1_set_value (p, temp, tlen + 1);
              if (p->down == NULL)
@@ -1098,7 +1099,7 @@ asn1_der_coding (ASN1_TYPE element, const char *name, 
void *ider, int *len,
            }
          else
            {                   /* move==UP */
-             len2 = strtol (p->value, NULL, 10);
+             len2 = _asn1_strtol (p->value, NULL, 10);
              _asn1_set_value (p, NULL, 0);
              if ((type_field (p->type) == TYPE_SET) && (max_len >= 0))
                _asn1_ordering_set (der + len2, max_len - len2, p);
@@ -1117,8 +1118,8 @@ asn1_der_coding (ASN1_TYPE element, const char *name, 
void *ider, int *len,
        case TYPE_SET_OF:
          if (move != UP)
            {
-             _asn1_ltostr (counter, temp);
-             tlen = strlen (temp);
+             _asn1_ltostr (counter, (char *) temp);
+             tlen = _asn1_strlen (temp);
 
              if (tlen > 0)
                _asn1_set_value (p, temp, tlen + 1);
@@ -1138,7 +1139,7 @@ asn1_der_coding (ASN1_TYPE element, const char *name, 
void *ider, int *len,
            }
          if (move == UP)
            {
-             len2 = strtol (p->value, NULL, 10);
+             len2 = _asn1_strtol (p->value, NULL, 10);
              _asn1_set_value (p, NULL, 0);
              if ((type_field (p->type) == TYPE_SET_OF)
                  && (max_len - len2 > 0))
diff --git a/lib/minitasn1/decoding.c b/lib/minitasn1/decoding.c
index 3849375..968fa96 100644
--- a/lib/minitasn1/decoding.c
+++ b/lib/minitasn1/decoding.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -55,12 +54,13 @@ _asn1_error_description_tag_error (ASN1_TYPE node, char 
*ErrorDescription)
  * Extract a length field from DER data.
  *
  * Returns: Return the decoded length value, or -1 on indefinite
- *   length, or -2 when the value was too big.
+ *   length, or -2 when the value was too big to fit in a int, or -4
+ *   when the decoded length value plus @len would exceed @der_len.
  **/
 signed long
 asn1_get_length_der (const unsigned char *der, int der_len, int *len)
 {
-  unsigned long ans;
+  int ans;
   int k, punt;
 
   *len = 0;
@@ -83,7 +83,7 @@ asn1_get_length_der (const unsigned char *der, int der_len, 
int *len)
          ans = 0;
          while (punt <= k && punt < der_len)
            {
-             unsigned long last = ans;
+             int last = ans;
 
              ans = ans * 256 + der[punt++];
              if (ans < last)
@@ -93,10 +93,13 @@ asn1_get_length_der (const unsigned char *der, int der_len, 
int *len)
        }
       else
        {                       /* indefinite length method */
-         ans = -1;
+         *len = punt;
+         return -1;
        }
 
       *len = punt;
+      if (ans + *len < ans || ans + *len > der_len)
+       return -4;
       return ans;
     }
 }
@@ -724,8 +727,6 @@ _asn1_get_octet_string (const unsigned char *der, ASN1_TYPE 
node, int *len)
       len2 = asn1_get_length_der (der, *len, &len3);
       if (len2 < 0)
        return ASN1_DER_ERROR;
-      if (len3 + len2 > *len)
-       return ASN1_DER_ERROR;
       if (node)
        _asn1_set_value (node, der, len3 + len2);
       counter = len3 + len2;
@@ -824,8 +825,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
 
   if (node->type & CONST_OPTION)
     {
-      asn1_delete_structure (element);
-      return ASN1_GENERIC_ERROR;
+      result = ASN1_GENERIC_ERROR;
+      goto cleanup;
     }
 
   counter = 0;
@@ -839,7 +840,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
          if (p->type & CONST_SET)
            {
              p2 = _asn1_find_up (p);
-             len2 = strtol (p2->value, NULL, 10);
+             len2 = _asn1_strtol (p2->value, NULL, 10);
              if (len2 == -1)
                {
                  if (!der[counter] && !der[counter + 1])
@@ -858,8 +859,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                }
              else if (counter > len2)
                {
-                 asn1_delete_structure (element);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
              p2 = p2->down;
              while (p2)
@@ -894,15 +895,15 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                }
              if (p2 == NULL)
                {
-                 asn1_delete_structure (element);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
            }
 
          if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT))
            {
              p2 = _asn1_find_up (p);
-             len2 = strtol (p2->value, NULL, 10);
+             len2 = _asn1_strtol (p2->value, NULL, 10);
              if (counter == len2)
                {
                  if (p->right)
@@ -942,8 +943,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                    }
                  else if (ris == ASN1_ERROR_TYPE_ANY)
                    {
-                     asn1_delete_structure (element);
-                     return ASN1_ERROR_TYPE_ANY;
+                     result = ASN1_ERROR_TYPE_ANY;
+                     goto cleanup;
                    }
                  else
                    {
@@ -956,8 +957,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                {
                  if (!(p->type & CONST_OPTION))
                    {
-                     asn1_delete_structure (element);
-                     return ASN1_DER_ERROR;
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
                    }
                }
              else
@@ -967,7 +968,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
          if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT))
            {
              p2 = _asn1_find_up (p);
-             len2 = strtol (p2->value, NULL, 10);
+             len2 = _asn1_strtol (p2->value, NULL, 10);
              if ((len2 != -1) && (counter > len2))
                ris = ASN1_TAG_ERROR;
            }
@@ -992,8 +993,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                  if (errorDescription != NULL)
                    _asn1_error_description_tag_error (p, errorDescription);
 
-                 asn1_delete_structure (element);
-                 return ASN1_TAG_ERROR;
+                 result = ASN1_TAG_ERROR;
+                 goto cleanup;
                }
            }
          else
@@ -1007,8 +1008,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
            case TYPE_NULL:
              if (der[counter])
                {
-                 asn1_delete_structure (element);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
              counter++;
              move = RIGHT;
@@ -1016,8 +1017,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
            case TYPE_BOOLEAN:
              if (der[counter++] != 1)
                {
-                 asn1_delete_structure (element);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
              if (der[counter++] == 0)
                _asn1_set_value (p, "F", 1);
@@ -1030,9 +1031,11 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
-             if (len2 + len3 > len - counter)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
+
              _asn1_set_value (p, der + counter, len3 + len2);
              counter += len3 + len2;
              move = RIGHT;
@@ -1042,10 +1045,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                _asn1_get_objectid_der (der + counter, len - counter, &len2,
                                        temp, sizeof (temp));
              if (result != ASN1_SUCCESS)
-               {
-                 asn1_delete_structure (element);
-                 return result;
-               }
+                goto cleanup;
 
              tlen = strlen (temp);
              if (tlen > 0)
@@ -1058,10 +1058,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                _asn1_get_time_der (der + counter, len - counter, &len2, temp,
                                    sizeof (temp) - 1);
              if (result != ASN1_SUCCESS)
-               {
-                 asn1_delete_structure (element);
-                 return result;
-               }
+               goto cleanup;
+
              tlen = strlen (temp);
              if (tlen > 0)
                _asn1_set_value (p, temp, tlen + 1);
@@ -1070,9 +1068,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
              break;
            case TYPE_OCTET_STRING:
              len3 = len - counter;
-             ris = _asn1_get_octet_string (der + counter, p, &len3);
-             if (ris != ASN1_SUCCESS)
-               return ris;
+             result = _asn1_get_octet_string (der + counter, p, &len3);
+             if (result != ASN1_SUCCESS)
+                goto cleanup;
+
              counter += len3;
              move = RIGHT;
              break;
@@ -1080,9 +1079,11 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
-             if (len3 + len2 > len - counter)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
+
              _asn1_set_value (p, der + counter, len3 + len2);
              counter += len3 + len2;
              move = RIGHT;
@@ -1091,9 +1092,11 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
-             if (len3 + len2 > len - counter)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
+
              _asn1_set_value (p, der + counter, len3 + len2);
              counter += len3 + len2;
              move = RIGHT;
@@ -1102,7 +1105,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
            case TYPE_SET:
              if (move == UP)
                {
-                 len2 = strtol (p->value, NULL, 10);
+                 len2 = _asn1_strtol (p->value, NULL, 10);
                  _asn1_set_value (p, NULL, 0);
                  if (len2 == -1)
                    {           /* indefinite length method */
@@ -1110,20 +1113,23 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                        {
                          if ((der[counter]) || der[counter + 1])
                            {
-                             asn1_delete_structure (element);
-                             return ASN1_DER_ERROR;
+                             result = ASN1_DER_ERROR;
+                             goto cleanup;
                            }
                        }
                      else
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                        }
                      counter += 2;
                    }
                  else
                    {           /* definite length method */
                      if (len2 != counter)
                        {
-                         asn1_delete_structure (element);
-                         return ASN1_DER_ERROR;
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
                        }
                    }
                  move = RIGHT;
@@ -1133,7 +1139,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                  len3 =
                    asn1_get_length_der (der + counter, len - counter, &len2);
                  if (len3 < -1)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                    }
                  counter += len2;
                  if (len3 > 0)
                    {
@@ -1170,11 +1179,15 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
            case TYPE_SET_OF:
              if (move == UP)
                {
-                 len2 = strtol (p->value, NULL, 10);
+                 len2 = _asn1_strtol (p->value, NULL, 10);
                  if (len2 == -1)
                    {           /* indefinite length method */
                      if ((counter + 2) > len)
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                        }
+
                      if ((der[counter]) || der[counter + 1])
                        {
                          _asn1_append_sequence_set (p);
@@ -1201,8 +1214,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                      _asn1_set_value (p, NULL, 0);
                      if (len2 != counter)
                        {
-                         asn1_delete_structure (element);
-                         return ASN1_DER_ERROR;
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
                        }
                    }
                }
@@ -1211,7 +1224,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                  len3 =
                    asn1_get_length_der (der + counter, len - counter, &len2);
                  if (len3 < -1)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                    }
                  counter += len2;
                  if (len3)
                    {
@@ -1242,16 +1258,24 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
              if (asn1_get_tag_der
                  (der + counter, len - counter, &class, &len2,
                   &tag) != ASN1_SUCCESS)
-               return ASN1_DER_ERROR;
+                {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
+
              if (counter + len2 > len)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
              len4 =
                asn1_get_length_der (der + counter + len2,
                                     len - counter - len2, &len3);
              if (len4 < -1)
-               return ASN1_DER_ERROR;
-             if (len4 > len - counter + len2 + len3)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
              if (len4 != -1)
                {
                  len2 += len4;
@@ -1267,13 +1291,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
                    indefinite = 0;
 
                  len2 = len - counter;
-                 ris =
+                 result =
                    _asn1_get_indefinite_length_string (der + counter, &len2);
-                 if (ris != ASN1_SUCCESS)
-                   {
-                     asn1_delete_structure (element);
-                     return ris;
-                   }
+                 if (result != ASN1_SUCCESS)
+                   goto cleanup;
 
                  _asn1_set_value_octet (p, der + counter, len2);
                  counter += len2;
@@ -1288,9 +1309,9 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, 
int len,
                        }
                      else
                        {
-                         asn1_delete_structure (element);
-                         return ASN1_DER_ERROR;
-                       }
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                        }
                    }
                }
              move = RIGHT;
@@ -1326,11 +1347,15 @@ asn1_der_decoding (ASN1_TYPE * element, const void 
*ider, int len,
 
   if (counter != len)
     {
-      asn1_delete_structure (element);
-      return ASN1_DER_ERROR;
+      result = ASN1_DER_ERROR;
+      goto cleanup;
     }
 
   return ASN1_SUCCESS;
+
+cleanup:
+  asn1_delete_structure (element);
+  return result;
 }
 
 #define FOUND        1
@@ -1379,14 +1404,14 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
 
   if (elementName == NULL)
     {
-      asn1_delete_structure (structure);
-      return ASN1_ELEMENT_NOT_FOUND;
+      result = ASN1_ELEMENT_NOT_FOUND;
+      goto cleanup;
     }
 
   if (node->type & CONST_OPTION)
     {
-      asn1_delete_structure (structure);
-      return ASN1_GENERIC_ERROR;
+      result = ASN1_GENERIC_ERROR;
+      goto cleanup;
     }
 
   if ((*structure)->name)
@@ -1396,8 +1421,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
        strcpy (currentName, (*structure)->name);
       else
        {
-         asn1_delete_structure (structure);
-         return ASN1_MEM_ERROR;
+         result = ASN1_MEM_ERROR;
+         goto cleanup;
        }
       if (!(strcmp (currentName, elementName)))
        {
@@ -1436,7 +1461,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
          if (p->type & CONST_SET)
            {
              p2 = _asn1_find_up (p);
-             len2 = strtol (p2->value, NULL, 10);
+             len2 = _asn1_strtol (p2->value, NULL, 10);
              if (counter == len2)
                {
                  p = p2;
@@ -1445,8 +1470,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                }
              else if (counter > len2)
                {
-                 asn1_delete_structure (structure);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
              p2 = p2->down;
              while (p2)
@@ -1481,15 +1506,15 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                }
              if (p2 == NULL)
                {
-                 asn1_delete_structure (structure);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
            }
 
          if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT))
            {
              p2 = _asn1_find_up (p);
-             len2 = strtol (p2->value, NULL, 10);
+             len2 = _asn1_strtol (p2->value, NULL, 10);
              if (counter == len2)
                {
                  if (p->right)
@@ -1529,8 +1554,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    }
                  else if (ris == ASN1_ERROR_TYPE_ANY)
                    {
-                     asn1_delete_structure (structure);
-                     return ASN1_ERROR_TYPE_ANY;
+                     result = ASN1_ERROR_TYPE_ANY;
+                     goto cleanup;
                    }
                  else
                    {
@@ -1543,8 +1568,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                {
                  if (!(p->type & CONST_OPTION))
                    {
-                     asn1_delete_structure (structure);
-                     return ASN1_DER_ERROR;
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
                    }
                }
              else
@@ -1554,7 +1579,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
          if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT))
            {
              p2 = _asn1_find_up (p);
-             len2 = strtol (p2->value, NULL, 10);
+             len2 = _asn1_strtol (p2->value, NULL, 10);
              if (counter > len2)
                ris = ASN1_TAG_ERROR;
            }
@@ -1579,8 +1604,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                  if (errorDescription != NULL)
                    _asn1_error_description_tag_error (p, errorDescription);
 
-                 asn1_delete_structure (structure);
-                 return ASN1_TAG_ERROR;
+                 result = ASN1_TAG_ERROR;
+                 goto cleanup;
                }
            }
          else
@@ -1594,8 +1619,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
            case TYPE_NULL:
              if (der[counter])
                {
-                 asn1_delete_structure (structure);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
 
              if (p == nodeFound)
@@ -1607,8 +1632,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
            case TYPE_BOOLEAN:
              if (der[counter++] != 1)
                {
-                 asn1_delete_structure (structure);
-                 return ASN1_DER_ERROR;
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
                }
 
              if (state == FOUND)
@@ -1632,11 +1657,18 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
+
              if (state == FOUND)
                {
                  if (len3 + len2 > len - counter)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                    }
                  _asn1_set_value (p, der + counter, len3 + len2);
 
                  if (p == nodeFound)
@@ -1652,9 +1684,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    _asn1_get_objectid_der (der + counter, len - counter,
                                            &len2, temp, sizeof (temp));
                  if (result != ASN1_SUCCESS)
-                   {
-                     return result;
-                   }
+                   goto cleanup;
 
                  tlen = strlen (temp);
 
@@ -1669,7 +1699,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                  len2 =
                    asn1_get_length_der (der + counter, len - counter, &len3);
                  if (len2 < 0)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                    }
                  len2 += len3;
                }
 
@@ -1683,10 +1716,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    _asn1_get_time_der (der + counter, len - counter, &len2,
                                        temp, sizeof (temp) - 1);
                  if (result != ASN1_SUCCESS)
-                   {
-                     asn1_delete_structure (structure);
-                     return result;
-                   }
+                   goto cleanup;
 
                  tlen = strlen (temp);
                  if (tlen > 0)
@@ -1700,7 +1730,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                  len2 =
                    asn1_get_length_der (der + counter, len - counter, &len3);
                  if (len2 < 0)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                    }
                  len2 += len3;
                }
 
@@ -1711,15 +1744,16 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
              len3 = len - counter;
              if (state == FOUND)
                {
-                 ris = _asn1_get_octet_string (der + counter, p, &len3);
+                 result = _asn1_get_octet_string (der + counter, p, &len3);
                  if (p == nodeFound)
                    state = EXIT;
                }
              else
-               ris = _asn1_get_octet_string (der + counter, NULL, &len3);
+               result = _asn1_get_octet_string (der + counter, NULL, &len3);
+
+             if (result != ASN1_SUCCESS)
+               goto cleanup;
 
-             if (ris != ASN1_SUCCESS)
-               return ris;
              counter += len3;
              move = RIGHT;
              break;
@@ -1727,11 +1761,18 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
+
              if (state == FOUND)
                {
                  if (len3 + len2 > len - counter)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                    }
                  _asn1_set_value (p, der + counter, len3 + len2);
 
                  if (p == nodeFound)
@@ -1744,11 +1785,17 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
              len2 =
                asn1_get_length_der (der + counter, len - counter, &len3);
              if (len2 < 0)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
              if (state == FOUND)
                {
                  if (len3 + len2 > len - counter)
-                   return ASN1_DER_ERROR;
+                   {
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
+                    }
                  _asn1_set_value (p, der + counter, len3 + len2);
 
                  if (p == nodeFound)
@@ -1761,14 +1808,14 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
            case TYPE_SET:
              if (move == UP)
                {
-                 len2 = strtol (p->value, NULL, 10);
+                 len2 = _asn1_strtol (p->value, NULL, 10);
                  _asn1_set_value (p, NULL, 0);
                  if (len2 == -1)
                    {           /* indefinite length method */
                      if ((der[counter]) || der[counter + 1])
                        {
-                         asn1_delete_structure (structure);
-                         return ASN1_DER_ERROR;
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
                        }
                      counter += 2;
                    }
@@ -1776,8 +1823,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    {           /* definite length method */
                      if (len2 != counter)
                        {
-                         asn1_delete_structure (structure);
-                         return ASN1_DER_ERROR;
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
                        }
                    }
                  if (p == nodeFound)
@@ -1792,7 +1839,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                        asn1_get_length_der (der + counter, len - counter,
                                             &len2);
                      if (len3 < 0)
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                        }
                      counter += len2 + len3;
                      move = RIGHT;
                    }
@@ -1802,7 +1852,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                        asn1_get_length_der (der + counter, len - counter,
                                             &len2);
                      if (len3 < 0)
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                        }
                      counter += len2;
                      if (len3 > 0)
                        {
@@ -1841,7 +1894,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
            case TYPE_SET_OF:
              if (move == UP)
                {
-                 len2 = strtol (p->value, NULL, 10);
+                 len2 = _asn1_strtol (p->value, NULL, 10);
                  if (len2 > counter)
                    {
                      _asn1_append_sequence_set (p);
@@ -1854,8 +1907,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                  _asn1_set_value (p, NULL, 0);
                  if (len2 != counter)
                    {
-                     asn1_delete_structure (structure);
-                     return ASN1_DER_ERROR;
+                     result = ASN1_DER_ERROR;
+                     goto cleanup;
                    }
 
                  if (p == nodeFound)
@@ -1869,7 +1922,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                        asn1_get_length_der (der + counter, len - counter,
                                             &len2);
                      if (len3 < 0)
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                        }
                      counter += len2 + len3;
                      move = RIGHT;
                    }
@@ -1879,7 +1935,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                        asn1_get_length_der (der + counter, len - counter,
                                             &len2);
                      if (len3 < 0)
-                       return ASN1_DER_ERROR;
+                       {
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
+                        }
                      counter += len2;
                      if (len3)
                        {
@@ -1905,15 +1964,25 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
              if (asn1_get_tag_der
                  (der + counter, len - counter, &class, &len2,
                   &tag) != ASN1_SUCCESS)
-               return ASN1_DER_ERROR;
+                {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
+
              if (counter + len2 > len)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
 
              len4 =
                asn1_get_length_der (der + counter + len2,
                                     len - counter - len2, &len3);
              if (len4 < -1)
-               return ASN1_DER_ERROR;
+               {
+                 result = ASN1_DER_ERROR;
+                 goto cleanup;
+                }
 
              if (len4 != -1)
                {
@@ -1936,13 +2005,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    indefinite = 0;
 
                  len2 = len - counter;
-                 ris =
+                 result =
                    _asn1_get_indefinite_length_string (der + counter, &len2);
-                 if (ris != ASN1_SUCCESS)
-                   {
-                     asn1_delete_structure (structure);
-                     return ris;
-                   }
+                 if (result != ASN1_SUCCESS)
+                   goto cleanup;
 
                  if (state == FOUND)
                    {
@@ -1964,8 +2030,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                        }
                      else
                        {
-                         asn1_delete_structure (structure);
-                         return ASN1_DER_ERROR;
+                         result = ASN1_DER_ERROR;
+                         goto cleanup;
                        }
                    }
                }
@@ -1998,8 +2064,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    }
                  else
                    {
-                     asn1_delete_structure (structure);
-                     return ASN1_MEM_ERROR;
+                     result = ASN1_MEM_ERROR;
+                     goto cleanup;
                    }
                  if (!(strcmp (currentName, elementName)))
                    {
@@ -2041,8 +2107,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
                    strcat (currentName, p->name);
                  else
                    {
-                     asn1_delete_structure (structure);
-                     return ASN1_MEM_ERROR;
+                     result = ASN1_MEM_ERROR;
+                     goto cleanup;
                    }
 
                  if (!(strcmp (currentName, elementName)))
@@ -2096,11 +2162,15 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
 
   if (counter > len)
     {
-      asn1_delete_structure (structure);
-      return ASN1_DER_ERROR;
+      result = ASN1_DER_ERROR;
+      goto cleanup;
     }
 
   return ASN1_SUCCESS;
+
+cleanup:
+  asn1_delete_structure (structure);
+  return result;
 }
 
 /**
@@ -2171,7 +2241,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void 
*ider, int len,
          if (p->type & CONST_SET)
            {
              p2 = _asn1_find_up (p);
-             len2 = strtol (p2->value, NULL, 10);
+             len2 = _asn1_strtol (p2->value, NULL, 10);
              if (len2 == -1)
                {
                  if (!der[counter] && !der[counter + 1])
@@ -2562,7 +2632,7 @@ asn1_expand_any_defined_by (ASN1_TYPE definitions, 
ASN1_TYPE * element)
                        asn1_read_value (definitions, name, value, &len);
 
                      if ((result == ASN1_SUCCESS)
-                         && (!strcmp (p3->value, value)))
+                         && (!_asn1_strcmp (p3->value, value)))
                        {
                          p2 = p2->right;       /* pointer to the structure to
                                                   use for expansion */
@@ -2743,7 +2813,7 @@ asn1_expand_octet_string (ASN1_TYPE definitions, 
ASN1_TYPE * element,
          result = asn1_read_value (definitions, name, value, &len);
 
          if ((result == ASN1_SUCCESS)
-             && (!strcmp (objectNode->value, value)))
+             && (!_asn1_strcmp (objectNode->value, value)))
            {
 
              p2 = p2->right;   /* pointer to the structure to
diff --git a/lib/minitasn1/element.c b/lib/minitasn1/element.c
index a8fdc92..ead899c 100644
--- a/lib/minitasn1/element.c
+++ b/lib/minitasn1/element.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2008, 2009, 2010,
- * 2011 Free Software Foundation, Inc.
+ * Copyright (C) 2000-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -76,7 +75,7 @@ _asn1_hierarchical_name (ASN1_TYPE node, char *name, int 
name_size)
 /* Return: ASN1_MEM_ERROR or ASN1_SUCCESS                         */
 /******************************************************************/
 asn1_retCode
-_asn1_convert_integer (const char *value, unsigned char *value_out,
+_asn1_convert_integer (const unsigned char *value, unsigned char *value_out,
                       int value_out_size, int *len)
 {
   char negative;
@@ -84,7 +83,7 @@ _asn1_convert_integer (const char *value, unsigned char 
*value_out,
   long valtmp;
   int k, k2;
 
-  valtmp = strtol (value, NULL, 10);
+  valtmp = _asn1_strtol (value, NULL, 10);
 
   for (k = 0; k < SIZEOF_UNSIGNED_LONG_INT; k++)
     {
@@ -305,7 +304,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
   switch (type_field (node->type))
     {
     case TYPE_BOOLEAN:
-      if (!strcmp (value, "TRUE"))
+      if (!_asn1_strcmp (value, "TRUE"))
        {
          if (node->type & CONST_DEFAULT)
            {
@@ -320,7 +319,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
          else
            _asn1_set_value (node, "T", 1);
        }
-      else if (!strcmp (value, "FALSE"))
+      else if (!_asn1_strcmp (value, "FALSE"))
        {
          if (node->type & CONST_DEFAULT)
            {
@@ -361,7 +360,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
                {
                  if (type_field (p->type) == TYPE_CONSTANT)
                    {
-                     if ((p->name) && (!strcmp (p->name, value)))
+                     if ((p->name) && (!_asn1_strcmp (p->name, value)))
                        {
                          value_temp =
                            (unsigned char *)
@@ -444,7 +443,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
                {
                  if (type_field (p2->type) == TYPE_CONSTANT)
                    {
-                     if ((p2->name) && (!strcmp (p2->name, p->value)))
+                     if ((p2->name) && (!_asn1_strcmp (p2->name, p->value)))
                        {
                          default_temp =
                            (unsigned char *)
@@ -487,7 +486,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
       _asn1_free (value_temp);
       break;
     case TYPE_OBJECT_ID:
-      for (i = 0; i < strlen (value); i++)
+      for (i = 0; i < _asn1_strlen (value); i++)
        if ((!isdigit (value[i])) && (value[i] != '.') && (value[i] != '+'))
          return ASN1_VALUE_NOT_VALID;
       if (node->type & CONST_DEFAULT)
@@ -495,23 +494,23 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
          p = node->down;
          while (type_field (p->type) != TYPE_DEFAULT)
            p = p->right;
-         if (!strcmp (value, p->value))
+         if (!_asn1_strcmp (value, p->value))
            {
              _asn1_set_value (node, NULL, 0);
              break;
            }
        }
-      _asn1_set_value (node, value, strlen (value) + 1);
+      _asn1_set_value (node, value, _asn1_strlen (value) + 1);
       break;
     case TYPE_TIME:
       if (node->type & CONST_UTC)
        {
-         if (strlen (value) < 11)
+         if (_asn1_strlen (value) < 11)
            return ASN1_VALUE_NOT_VALID;
          for (k = 0; k < 10; k++)
            if (!isdigit (value[k]))
              return ASN1_VALUE_NOT_VALID;
-         switch (strlen (value))
+         switch (_asn1_strlen (value))
            {
            case 11:
              if (value[10] != 'Z')
@@ -541,27 +540,27 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
            default:
              return ASN1_VALUE_NOT_FOUND;
            }
-         _asn1_set_value (node, value, strlen (value) + 1);
+         _asn1_set_value (node, value, _asn1_strlen (value) + 1);
        }
       else
        {                       /* GENERALIZED TIME */
          if (value)
-           _asn1_set_value (node, value, strlen (value) + 1);
+           _asn1_set_value (node, value, _asn1_strlen (value) + 1);
        }
       break;
     case TYPE_OCTET_STRING:
       if (len == 0)
-       len = strlen (value);
+       len = _asn1_strlen (value);
       _asn1_set_value_octet (node, value, len);
       break;
     case TYPE_GENERALSTRING:
       if (len == 0)
-       len = strlen (value);
+       len = _asn1_strlen (value);
       _asn1_set_value_octet (node, value, len);
       break;
     case TYPE_BIT_STRING:
       if (len == 0)
-       len = strlen (value);
+       len = _asn1_strlen (value);
       asn1_length_der ((len >> 3) + 2, NULL, &len2);
       temp = (unsigned char *) _asn1_malloc ((len >> 3) + 2 + len2);
       if (temp == NULL)
@@ -575,7 +574,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
       p = node->down;
       while (p)
        {
-         if (!strcmp (p->name, value))
+         if (!_asn1_strcmp (p->name, value))
            {
              p2 = node->down;
              while (p2)
@@ -600,7 +599,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
       break;
     case TYPE_SEQUENCE_OF:
     case TYPE_SET_OF:
-      if (strcmp (value, "NEW"))
+      if (_asn1_strcmp (value, "NEW"))
        return ASN1_VALUE_NOT_VALID;
       _asn1_append_sequence_set (node);
       break;
@@ -622,21 +621,21 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
        }
 
 #define PUT_STR_VALUE( ptr, ptr_size, data) \
-       *len = strlen(data) + 1; \
+       *len = _asn1_strlen(data) + 1; \
        if (ptr_size < *len) { \
                return ASN1_MEM_ERROR; \
        } else { \
                /* this strcpy is checked */ \
-               strcpy(ptr, data); \
+               _asn1_strcpy(ptr, data); \
        }
 
 #define ADD_STR_VALUE( ptr, ptr_size, data) \
-       *len = (int) strlen(data) + 1; \
-       if (ptr_size < (int) strlen(ptr)+(*len)) { \
+       *len = (int) _asn1_strlen(data) + 1; \
+       if (ptr_size < (int) _asn1_strlen(ptr)+(*len)) { \
                return ASN1_MEM_ERROR; \
        } else { \
                /* this strcat is checked */ \
-               strcat(ptr, data); \
+               _asn1_strcat(ptr, data); \
        }
 
 /**
@@ -768,7 +767,7 @@ asn1_read_value (ASN1_TYPE root, const char *name, void 
*ivalue, int *len)
                {
                  if (type_field (p2->type) == TYPE_CONSTANT)
                    {
-                     if ((p2->name) && (!strcmp (p2->name, p->value)))
+                     if ((p2->name) && (!_asn1_strcmp (p2->name, p->value)))
                        {
                          if (_asn1_convert_integer
                              (p2->value, value, value_size,
@@ -807,7 +806,7 @@ asn1_read_value (ASN1_TYPE root, const char *name, void 
*ivalue, int *len)
                }
              p = p->right;
            }
-         *len = strlen (value) + 1;
+         *len = _asn1_strlen (value) + 1;
        }
       else if ((node->type & CONST_DEFAULT) && (node->value == NULL))
        {
@@ -909,7 +908,7 @@ asn1_read_tag (ASN1_TYPE root, const char *name, int 
*tagValue,
 
   if (pTag)
     {
-      *tagValue = strtoul (pTag->value, NULL, 10);
+      *tagValue = _asn1_strtoul (pTag->value, NULL, 10);
 
       if (pTag->type & CONST_APPLICATION)
        *classValue = ASN1_CLASS_APPLICATION;
diff --git a/lib/minitasn1/element.h b/lib/minitasn1/element.h
index 67a234f..9cad46e 100644
--- a/lib/minitasn1/element.h
+++ b/lib/minitasn1/element.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2008, 2009, 2010,
- * 2011 Free Software Foundation, Inc.
+ * Copyright (C) 2000-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -26,7 +25,7 @@
 
 asn1_retCode _asn1_append_sequence_set (ASN1_TYPE node);
 
-asn1_retCode _asn1_convert_integer (const char *value,
+asn1_retCode _asn1_convert_integer (const unsigned char *value,
                                    unsigned char *value_out,
                                    int value_out_size, int *len);
 
diff --git a/lib/minitasn1/errors.c b/lib/minitasn1/errors.c
index c5508da..7878c50 100644
--- a/lib/minitasn1/errors.c
+++ b/lib/minitasn1/errors.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
diff --git a/lib/minitasn1/gstr.c b/lib/minitasn1/gstr.c
index 32ab904..9590b45 100644
--- a/lib/minitasn1/gstr.c
+++ b/lib/minitasn1/gstr.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
diff --git a/lib/minitasn1/gstr.h b/lib/minitasn1/gstr.h
index 33bdec9..baaa6a0 100644
--- a/lib/minitasn1/gstr.h
+++ b/lib/minitasn1/gstr.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
diff --git a/lib/minitasn1/int.h b/lib/minitasn1/int.h
index 6b2b5eb..fcaf0d8 100644
--- a/lib/minitasn1/int.h
+++ b/lib/minitasn1/int.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -63,6 +62,12 @@ struct node_asn_struct
 #define _asn1_calloc calloc
 #define _asn1_realloc realloc
 #define _asn1_strdup strdup
+#define _asn1_strlen(s) strlen((const char *) s)
+#define _asn1_strtol(n,e,b) strtol((const char *) n, e, b)
+#define _asn1_strtoul(n,e,b) strtoul((const char *) n, e, b)
+#define _asn1_strcmp(a,b) strcmp((const char *)a, (const char *)b)
+#define _asn1_strcpy(a,b) strcpy((char *)a, (const char *)b)
+#define _asn1_strcat(a,b) strcat((char *)a, (const char *)b)
 
 #define MAX_LOG_SIZE 1024      /* maximum number of characters of a log 
message */
 
diff --git a/lib/minitasn1/libtasn1.h b/lib/minitasn1/libtasn1.h
index 78f7b54..289fb57 100644
--- a/lib/minitasn1/libtasn1.h
+++ b/lib/minitasn1/libtasn1.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -45,7 +44,7 @@ extern "C"
 {
 #endif
 
-#define ASN1_VERSION "2.10"
+#define ASN1_VERSION "2.12"
 
   typedef int asn1_retCode;    /* type returned by libtasn1 functions */
 
diff --git a/lib/minitasn1/parser_aux.c b/lib/minitasn1/parser_aux.c
index 597fe6d..ce55253 100644
--- a/lib/minitasn1/parser_aux.c
+++ b/lib/minitasn1/parser_aux.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2000-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -719,7 +718,7 @@ _asn1_expand_object_id (ASN1_TYPE node)
                    {
                      _asn1_str_cpy (name2, sizeof (name2), name_root);
                      _asn1_str_cat (name2, sizeof (name2), ".");
-                     _asn1_str_cat (name2, sizeof (name2), p2->value);
+                     _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
                      p3 = asn1_find_node (node, name2);
                      if (!p3 || (type_field (p3->type) != TYPE_OBJECT_ID) ||
                          !(p3->type & CONST_ASSIGN))
@@ -734,7 +733,7 @@ _asn1_expand_object_id (ASN1_TYPE node)
                            {
                              p5 = _asn1_add_node_only (TYPE_CONSTANT);
                              _asn1_set_name (p5, p4->name);
-                             tlen = strlen (p4->value);
+                             tlen = _asn1_strlen (p4->value);
                              if (tlen > 0)
                                _asn1_set_value (p5, p4->value, tlen + 1);
                              if (p2 == p)
@@ -805,7 +804,7 @@ _asn1_expand_object_id (ASN1_TYPE node)
                {
                  _asn1_str_cpy (name2, sizeof (name2), name_root);
                  _asn1_str_cat (name2, sizeof (name2), ".");
-                 _asn1_str_cat (name2, sizeof (name2), p2->value);
+                 _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
                  p3 = asn1_find_node (node, name2);
                  if (!p3 || (type_field (p3->type) != TYPE_OBJECT_ID) ||
                      !(p3->type & CONST_ASSIGN))
@@ -818,7 +817,8 @@ _asn1_expand_object_id (ASN1_TYPE node)
                        {
                          if (name2[0])
                            _asn1_str_cat (name2, sizeof (name2), ".");
-                         _asn1_str_cat (name2, sizeof (name2), p4->value);
+                         _asn1_str_cat (name2, sizeof (name2),
+                                        (char *) p4->value);
                        }
                      p4 = p4->right;
                    }
@@ -960,11 +960,11 @@ _asn1_check_identifier (ASN1_TYPE node)
        {
          _asn1_str_cpy (name2, sizeof (name2), node->name);
          _asn1_str_cat (name2, sizeof (name2), ".");
-         _asn1_str_cat (name2, sizeof (name2), p->value);
+         _asn1_str_cat (name2, sizeof (name2), (char *) p->value);
          p2 = asn1_find_node (node, name2);
          if (p2 == NULL)
            {
-             strcpy (_asn1_identifierMissing, p->value);
+             _asn1_strcpy (_asn1_identifierMissing, p->value);
              return ASN1_IDENTIFIER_NOT_FOUND;
            }
        }
@@ -976,8 +976,8 @@ _asn1_check_identifier (ASN1_TYPE node)
            {
              _asn1_str_cpy (name2, sizeof (name2), node->name);
              _asn1_str_cat (name2, sizeof (name2), ".");
-             _asn1_str_cat (name2, sizeof (name2), p2->value);
-             strcpy (_asn1_identifierMissing, p2->value);
+             _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
+             _asn1_strcpy (_asn1_identifierMissing, p2->value);
              p2 = asn1_find_node (node, name2);
              if (!p2 || (type_field (p2->type) != TYPE_OBJECT_ID) ||
                  !(p2->type & CONST_ASSIGN))
@@ -996,8 +996,8 @@ _asn1_check_identifier (ASN1_TYPE node)
                {
                  _asn1_str_cpy (name2, sizeof (name2), node->name);
                  _asn1_str_cat (name2, sizeof (name2), ".");
-                 _asn1_str_cat (name2, sizeof (name2), p2->value);
-                 strcpy (_asn1_identifierMissing, p2->value);
+                 _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
+                 _asn1_strcpy (_asn1_identifierMissing, p2->value);
                  p2 = asn1_find_node (node, name2);
                  if (!p2 || (type_field (p2->type) != TYPE_OBJECT_ID) ||
                      !(p2->type & CONST_ASSIGN))
diff --git a/lib/minitasn1/parser_aux.h b/lib/minitasn1/parser_aux.h
index ca9e66c..374f599 100644
--- a/lib/minitasn1/parser_aux.h
+++ b/lib/minitasn1/parser_aux.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2000-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
diff --git a/lib/minitasn1/structure.c b/lib/minitasn1/structure.c
index c3d7896..41cebe4 100644
--- a/lib/minitasn1/structure.c
+++ b/lib/minitasn1/structure.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Free
- * Software Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -483,7 +482,7 @@ _asn1_type_choice_config (ASN1_TYPE node)
                          if (type_field (p3->type) == TYPE_TAG)
                            {
                              p4 = _asn1_add_node_only (p3->type);
-                             tlen = strlen (p3->value);
+                             tlen = _asn1_strlen (p3->value);
                              if (tlen > 0)
                                _asn1_set_value (p4, p3->value, tlen + 1);
                              _asn1_set_right (p4, p2->down);
@@ -559,7 +558,7 @@ _asn1_expand_identifier (ASN1_TYPE * node, ASN1_TYPE root)
            {
              _asn1_str_cpy (name2, sizeof (name2), root->name);
              _asn1_str_cat (name2, sizeof (name2), ".");
-             _asn1_str_cat (name2, sizeof (name2), p->value);
+             _asn1_str_cat (name2, sizeof (name2), (char *) p->value);
              p2 = _asn1_copy_structure2 (root, name2);
              if (p2 == NULL)
                {
diff --git a/lib/minitasn1/structure.h b/lib/minitasn1/structure.h
index 98d32ab..0a84e26 100644
--- a/lib/minitasn1/structure.h
+++ b/lib/minitasn1/structure.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Free
- * Software Foundation, Inc.
+ * Copyright (C) 2002-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
diff --git a/lib/minitasn1/version.c b/lib/minitasn1/version.c
index c0cf1f2..fb17223 100644
--- a/lib/minitasn1/version.c
+++ b/lib/minitasn1/version.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2000-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *


hooks/post-receive
-- 
GNU gnutls



reply via email to

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