gnutls-commit
[Top][All Lists]
Advanced

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

[SCM] GNU gnutls branch, master, updated. gnutls_3_1_0-138-gd7453fa


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_1_0-138-gd7453fa
Date: Wed, 26 Sep 2012 18:50:44 +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=d7453faa7d8a88a8a3e0af268373071d8219a800

The branch, master has been updated
       via  d7453faa7d8a88a8a3e0af268373071d8219a800 (commit)
       via  c469f7e6b4445475863ed87242d2b4546ec21b58 (commit)
       via  907b684926cdf8a1ae6026d7f43b7fb282364c01 (commit)
       via  bff8fab15b5a95ef41926e581fe6f9c34b25fb7a (commit)
       via  7068f99b4dee7dbed48db26ef25d16c7e6a65978 (commit)
      from  931db698efcf6570df64f97f93f857bb0eae8a10 (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 d7453faa7d8a88a8a3e0af268373071d8219a800
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Wed Sep 26 20:50:35 2012 +0200

    more files to ignore

commit c469f7e6b4445475863ed87242d2b4546ec21b58
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Wed Sep 26 20:32:44 2012 +0200

    released 3.1.2

commit 907b684926cdf8a1ae6026d7f43b7fb282364c01
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Wed Sep 26 20:19:48 2012 +0200

    Handle heartbeat packets with zero payload, and account for the payload 
length when sending a heartbeat of fixed size.

commit bff8fab15b5a95ef41926e581fe6f9c34b25fb7a
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Tue Sep 25 21:27:30 2012 +0200

    benchmark time was increased.

commit 7068f99b4dee7dbed48db26ef25d16c7e6a65978
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Tue Sep 25 21:16:39 2012 +0200

    Updated to minitasn1 3.0

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

Summary of changes:
 .gitignore                 |    3 +
 NEWS                       |    2 +-
 lib/ext/heartbeat.c        |   20 +++--
 lib/minitasn1/Makefile.am  |    2 +-
 lib/minitasn1/coding.c     |   20 ++--
 lib/minitasn1/decoding.c   |   31 +++++--
 lib/minitasn1/element.c    |   42 ++++-----
 lib/minitasn1/errors.c     |   41 ---------
 lib/minitasn1/gstr.c       |   11 ++-
 lib/minitasn1/gstr.h       |    2 +-
 lib/{ => minitasn1}/hash.c |    9 +-
 lib/minitasn1/int.h        |    9 +--
 lib/minitasn1/libtasn1.h   |   56 +-----------
 lib/minitasn1/parser_aux.c |  203 ++++++++++++++++---------------------------
 lib/minitasn1/parser_aux.h |  101 +++++++++++++++++++---
 lib/minitasn1/structure.c  |   81 ++++++++----------
 lib/minitasn1/structure.h  |    2 +-
 src/benchmark.c            |    6 +-
 18 files changed, 296 insertions(+), 345 deletions(-)
 copy lib/{ => minitasn1}/hash.c (98%)

diff --git a/.gitignore b/.gitignore
index 5e125cf..5b291d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -588,3 +588,6 @@ tests/x509sign-verify
 tests/x509signself
 win32
 win64
+tests/chainverify-unsorted
+tests/mini-dtls-heartbeat
+tests/mini-handshake-timeout
diff --git a/NEWS b/NEWS
index e7c772b..167e996 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,7 @@ GnuTLS NEWS -- History of user-visible changes.                
-*- outline -*-
 Copyright (C) 2000-2012 Free Software Foundation, Inc.
 See the end for copying conditions.
 
-* Version 3.1.2 (unreleased)
+* Version 3.1.2 (released 2012-09-26)
 
 ** libgnutls: Fixed bug in gnutls_x509_trust_list_add_system_trust()
 and gnutls_x509_trust_list_add_trust_mem() that prevented the loading
diff --git a/lib/ext/heartbeat.c b/lib/ext/heartbeat.c
index 8e1c5ce..89d0120 100644
--- a/lib/ext/heartbeat.c
+++ b/lib/ext/heartbeat.c
@@ -108,6 +108,8 @@ heartbeat_allow_send (gnutls_session_t session)
   return gnutls_heartbeat_allowed(session, GNUTLS_HB_LOCAL_ALLOWED_TO_SEND);
 }
 
+#define DEFAULT_PAYLOAD_SIZE 16
+
 /*-
  * heartbeat_send_data:
  * @session: is a #gnutls_session_t structure.
@@ -133,17 +135,17 @@ heartbeat_send_data (gnutls_session_t session, const void 
*data,
 {
   int ret;
   gnutls_buffer_st response;
-  uint8_t payload[16];
+  uint8_t payload[DEFAULT_PAYLOAD_SIZE];
   _gnutls_buffer_init (&response);
 
-  ret = gnutls_rnd (GNUTLS_RND_RANDOM, payload, 16);
+  ret = gnutls_rnd (GNUTLS_RND_RANDOM, payload, DEFAULT_PAYLOAD_SIZE);
   if (ret < 0)
     return gnutls_assert_val(ret);
 
   BUFFER_APPEND (&response, &type, 1);
   BUFFER_APPEND_PFX2 (&response, data, data_size);
 
-  BUFFER_APPEND (&response, payload, 16);
+  BUFFER_APPEND (&response, payload, DEFAULT_PAYLOAD_SIZE);
   ret = _gnutls_send_int (session, GNUTLS_HEARTBEAT, -1,
                           EPOCH_WRITE_CURRENT, response.data,
                           response.length, MBUFFER_FLUSH);
@@ -185,12 +187,17 @@ gnutls_heartbeat_ping (gnutls_session_t session, size_t 
data_size,
 
   if (!heartbeat_allow_send (session))
     return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
-
+  
   switch(session->internals.hb_state)
     {
       case SHB_SEND1:
         _gnutls_record_log
          ("REC[%p]: sending HB_REQUEST with length: %zu to peer\n", session, 
data_size);
+         
+        if (data_size > DEFAULT_PAYLOAD_SIZE)
+          data_size -= DEFAULT_PAYLOAD_SIZE;
+        else
+          data_size = 0;
 
         _gnutls_buffer_reset(&session->internals.hb_local_data);
 
@@ -331,7 +338,8 @@ _gnutls_heartbeat_handle (gnutls_session_t session, 
mbuffer_st * bufel)
       if (ret < 0)
         return gnutls_assert_val(ret);
       
-      memcpy(session->internals.hb_remote_data.data, msg+3, hb_len);
+      if (hb_len > 0)
+        memcpy(session->internals.hb_remote_data.data, msg+3, hb_len);
       session->internals.hb_remote_data.length = hb_len;
 
       return gnutls_assert_val(GNUTLS_E_HEARTBEAT_PING_RECEIVED);
@@ -341,7 +349,7 @@ _gnutls_heartbeat_handle (gnutls_session_t session, 
mbuffer_st * bufel)
       if (hb_len != session->internals.hb_local_data.length)
         return gnutls_assert_val (GNUTLS_E_UNEXPECTED_PACKET);
 
-      if (memcmp (msg + 3, session->internals.hb_local_data.data,
+      if (hb_len > 0 && memcmp (msg + 3, session->internals.hb_local_data.data,
                   hb_len) != 0)
         {
           _gnutls_record_log ("REC[%p]: HB: %s - received\n", session,
diff --git a/lib/minitasn1/Makefile.am b/lib/minitasn1/Makefile.am
index 7de6a75..dc26f1f 100644
--- a/lib/minitasn1/Makefile.am
+++ b/lib/minitasn1/Makefile.am
@@ -29,4 +29,4 @@ noinst_LTLIBRARIES = libminitasn1.la
 
 libminitasn1_la_SOURCES = libtasn1.h gstr.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 version.c
+        structure.c element.c coding.c version.c hash.c
diff --git a/lib/minitasn1/coding.c b/lib/minitasn1/coding.c
index 307dd40..11f8f48 100644
--- a/lib/minitasn1/coding.c
+++ b/lib/minitasn1/coding.c
@@ -260,7 +260,7 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, 
int *der_len)
 
   max_len = *der_len;
 
-  temp = _asn1_malloc (str_len + 2);
+  temp = malloc (str_len + 2);
   if (temp == NULL)
     return ASN1_MEM_ALLOC_ERROR;
 
@@ -313,7 +313,7 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, 
int *der_len)
     }
   *der_len += len_len;
 
-  _asn1_free (temp);
+  free (temp);
 
   if (max_len < (*der_len))
     return ASN1_MEM_ERROR;
@@ -638,7 +638,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, 
ASN1_TYPE node)
   first = last = NULL;
   while (p)
     {
-      p_vet = (struct vet *) _asn1_malloc (sizeof (struct vet));
+      p_vet = malloc (sizeof (struct vet));
       if (p_vet == NULL)
        return;
 
@@ -679,7 +679,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, 
ASN1_TYPE node)
          if (p_vet->value > p2_vet->value)
            {
              /* change position */
-             temp = (unsigned char *) _asn1_malloc (p_vet->end - counter);
+             temp = malloc (p_vet->end - counter);
              if (temp == NULL)
                return;
 
@@ -688,7 +688,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, 
ASN1_TYPE node)
                      p2_vet->end - p_vet->end);
              memcpy (der + counter + p2_vet->end - p_vet->end, temp,
                      p_vet->end - counter);
-             _asn1_free (temp);
+             free (temp);
 
              tag = p_vet->value;
              p_vet->value = p2_vet->value;
@@ -706,7 +706,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, 
ASN1_TYPE node)
        p_vet->prev->next = NULL;
       else
        first = NULL;
-      _asn1_free (p_vet);
+      free (p_vet);
       p_vet = first;
     }
 }
@@ -752,7 +752,7 @@ _asn1_ordering_set_of (unsigned char *der, int der_len, 
ASN1_TYPE node)
   first = last = NULL;
   while (p)
     {
-      p_vet = (struct vet *) _asn1_malloc (sizeof (struct vet));
+      p_vet = malloc (sizeof (struct vet));
       if (p_vet == NULL)
        return;
 
@@ -817,7 +817,7 @@ _asn1_ordering_set_of (unsigned char *der, int der_len, 
ASN1_TYPE node)
          if (change == 1)
            {
              /* change position */
-             temp = (unsigned char *) _asn1_malloc (p_vet->end - counter);
+             temp = malloc (p_vet->end - counter);
              if (temp == NULL)
                return;
 
@@ -826,7 +826,7 @@ _asn1_ordering_set_of (unsigned char *der, int der_len, 
ASN1_TYPE node)
                      (p2_vet->end) - (p_vet->end));
              memcpy (der + counter + (p2_vet->end) - (p_vet->end), temp,
                      (p_vet->end) - counter);
-             _asn1_free (temp);
+             free (temp);
 
              p_vet->end = counter + (p2_vet->end - p_vet->end);
            }
@@ -840,7 +840,7 @@ _asn1_ordering_set_of (unsigned char *der, int der_len, 
ASN1_TYPE node)
        p_vet->prev->next = NULL;
       else
        first = NULL;
-      _asn1_free (p_vet);
+      free (p_vet);
       p_vet = first;
     }
 }
diff --git a/lib/minitasn1/decoding.c b/lib/minitasn1/decoding.c
index e6cdb98..717112b 100644
--- a/lib/minitasn1/decoding.c
+++ b/lib/minitasn1/decoding.c
@@ -728,8 +728,6 @@ _asn1_get_octet_string (const unsigned char *der, ASN1_TYPE 
node, int *len)
          asn1_length_der (tot_len, temp, &len2);
          _asn1_set_value (node, temp, len2);
 
-         tot_len += len2;
-
          ret = _asn1_extract_der_octet (node, der, *len);
          if (ret != ASN1_SUCCESS)
            return ret;
@@ -741,9 +739,10 @@ _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 (node)
-       _asn1_set_value (node, der, len3 + len2);
+
       counter = len3 + len2;
+      if (node)
+       _asn1_set_value (node, der, counter);
     }
 
   *len = counter;
@@ -1428,7 +1427,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const 
char *elementName,
       goto cleanup;
     }
 
-  if ((*structure)->name)
+  if ((*structure)->name[0] != 0)
     {                          /* Has *structure got a name? */
       nameLen -= strlen ((*structure)->name);
       if (nameLen > 0)
@@ -2248,6 +2247,9 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void 
*ider, int len,
   p = node;
   while (1)
     {
+      if (p == NULL)
+        return ASN1_DER_ERROR;
+
       ris = ASN1_SUCCESS;
 
       if (move != UP)
@@ -2255,6 +2257,9 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void 
*ider, int len,
          if (p->type & CONST_SET)
            {
              p2 = _asn1_find_up (p);
+              if (p2 == NULL)
+                return ASN1_DER_ERROR;
+
              len2 = _asn1_strtol (p2->value, NULL, 10);
              if (len2 == -1)
                {
@@ -2274,7 +2279,9 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void 
*ider, int len,
                }
              else if (counter > len2)
                return ASN1_DER_ERROR;
+
              p2 = p2->down;
+
              while (p2)
                {
                  if ((p2->type & CONST_SET) && (p2->type & CONST_NOT_USED))
@@ -2286,6 +2293,9 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void 
*ider, int len,
                      else
                        {
                          p3 = p2->down;
+                          if (p3 == NULL)
+                            return ASN1_DER_ERROR;
+
                          ris =
                            _asn1_extract_tag_der (p3, der + counter,
                                                   len - counter, &len2);
@@ -2309,6 +2319,9 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void 
*ider, int len,
          if (type_field (p->type) == TYPE_CHOICE)
            {
              p = p->down;
+              if (p == NULL)
+                return ASN1_DER_ERROR;
+
              ris =
                _asn1_extract_tag_der (p, der + counter, len - counter,
                                       &len2);
@@ -2596,7 +2609,7 @@ asn1_expand_any_defined_by (ASN1_TYPE definitions, 
ASN1_TYPE * element)
              p3 = p3->down;
              while (p3)
                {
-                 if ((p3->name) && !(strcmp (p3->name, p2->name)))
+                 if (!(strcmp (p3->name, p2->name)))
                    break;
                  p3 = p3->right;
                }
@@ -2618,7 +2631,7 @@ asn1_expand_any_defined_by (ASN1_TYPE definitions, 
ASN1_TYPE * element)
 
                  while (p3)
                    {
-                     if ((p3->name) && !(strcmp (p3->name, p2->name)))
+                     if (!(strcmp (p3->name, p2->name)))
                        break;
                      p3 = p3->right;
                    }
@@ -2662,7 +2675,7 @@ asn1_expand_any_defined_by (ASN1_TYPE definitions, 
ASN1_TYPE * element)
                                asn1_create_element (definitions, name, &aux);
                              if (result == ASN1_SUCCESS)
                                {
-                                 _asn1_set_name (aux, p->name);
+                                 _asn1_cpy_name (aux, p);
                                  len2 =
                                    asn1_get_length_der (p->value,
                                                         p->value_len, &len3);
@@ -2844,7 +2857,7 @@ asn1_expand_octet_string (ASN1_TYPE definitions, 
ASN1_TYPE * element,
                  result = asn1_create_element (definitions, name, &aux);
                  if (result == ASN1_SUCCESS)
                    {
-                     _asn1_set_name (aux, octetNode->name);
+                     _asn1_cpy_name (aux, octetNode);
                      len2 =
                        asn1_get_length_der (octetNode->value,
                                             octetNode->value_len, &len3);
diff --git a/lib/minitasn1/element.c b/lib/minitasn1/element.c
index 8e8807b..2ee4950 100644
--- a/lib/minitasn1/element.c
+++ b/lib/minitasn1/element.c
@@ -45,7 +45,7 @@ _asn1_hierarchical_name (ASN1_TYPE node, char *name, int 
name_size)
 
   while (p != NULL)
     {
-      if (p->name != NULL)
+      if (p->name[0] != 0)
        {
          _asn1_str_cpy (tmp_name, sizeof (tmp_name), name),
            _asn1_str_cpy (name, name_size, p->name);
@@ -145,7 +145,7 @@ _asn1_append_sequence_set (ASN1_TYPE node)
     p = p->right;
   _asn1_set_right (p, p2);
 
-  if (p->name == NULL)
+  if (p->name[0] == 0)
     _asn1_str_cpy (temp, sizeof (temp), "?1");
   else
     {
@@ -343,8 +343,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
        {
          if ((isdigit (value[0])) || (value[0] == '-'))
            {
-             value_temp =
-               (unsigned char *) _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT);
+             value_temp = malloc (SIZEOF_UNSIGNED_LONG_INT);
              if (value_temp == NULL)
                return ASN1_MEM_ALLOC_ERROR;
 
@@ -360,11 +359,9 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
                {
                  if (type_field (p->type) == TYPE_CONSTANT)
                    {
-                     if ((p->name) && (!_asn1_strcmp (p->name, value)))
+                     if (!_asn1_strcmp (p->name, value))
                        {
-                         value_temp =
-                           (unsigned char *)
-                           _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT);
+                         value_temp = malloc (SIZEOF_UNSIGNED_LONG_INT);
                          if (value_temp == NULL)
                            return ASN1_MEM_ALLOC_ERROR;
 
@@ -383,7 +380,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
        }
       else
        {                       /* len != 0 */
-         value_temp = (unsigned char *) _asn1_malloc (len);
+         value_temp = malloc (len);
          if (value_temp == NULL)
            return ASN1_MEM_ALLOC_ERROR;
          memcpy (value_temp, value, len);
@@ -397,7 +394,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
 
       if (negative && (type_field (node->type) == TYPE_ENUMERATED))
        {
-         _asn1_free (value_temp);
+         free (value_temp);
          return ASN1_VALUE_NOT_VALID;
        }
 
@@ -420,11 +417,10 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
            p = p->right;
          if ((isdigit (p->value[0])) || (p->value[0] == '-'))
            {
-             default_temp =
-               (unsigned char *) _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT);
+             default_temp = malloc (SIZEOF_UNSIGNED_LONG_INT);
              if (default_temp == NULL)
                {
-                 _asn1_free (value_temp);
+                 free (value_temp);
                  return ASN1_MEM_ALLOC_ERROR;
                }
 
@@ -435,7 +431,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
            {                   /* is an identifier like v1 */
              if (!(node->type & CONST_LIST))
                {
-                 _asn1_free (value_temp);
+                 free (value_temp);
                  return ASN1_VALUE_NOT_VALID;
                }
              p2 = node->down;
@@ -443,14 +439,12 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
                {
                  if (type_field (p2->type) == TYPE_CONSTANT)
                    {
-                     if ((p2->name) && (!_asn1_strcmp (p2->name, p->value)))
+                     if (!_asn1_strcmp (p2->name, p->value))
                        {
-                         default_temp =
-                           (unsigned char *)
-                           _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT);
+                         default_temp = malloc (SIZEOF_UNSIGNED_LONG_INT);
                          if (default_temp == NULL)
                            {
-                             _asn1_free (value_temp);
+                             free (value_temp);
                              return ASN1_MEM_ALLOC_ERROR;
                            }
 
@@ -465,7 +459,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
                }
              if (p2 == NULL)
                {
-                 _asn1_free (value_temp);
+                 free (value_temp);
                  return ASN1_VALUE_NOT_VALID;
                }
            }
@@ -481,9 +475,9 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
              if (k2 == len2)
                _asn1_set_value (node, NULL, 0);
            }
-         _asn1_free (default_temp);
+         free (default_temp);
        }
-      _asn1_free (value_temp);
+      free (value_temp);
       break;
     case TYPE_OBJECT_ID:
       for (i = 0; i < _asn1_strlen (value); i++)
@@ -562,7 +556,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
       if (len == 0)
        len = _asn1_strlen (value);
       asn1_length_der ((len >> 3) + 2, NULL, &len2);
-      temp = (unsigned char *) _asn1_malloc ((len >> 3) + 2 + len2);
+      temp = malloc ((len >> 3) + 2 + len2);
       if (temp == NULL)
        return ASN1_MEM_ALLOC_ERROR;
 
@@ -767,7 +761,7 @@ asn1_read_value (ASN1_TYPE root, const char *name, void 
*ivalue, int *len)
                {
                  if (type_field (p2->type) == TYPE_CONSTANT)
                    {
-                     if ((p2->name) && (!_asn1_strcmp (p2->name, p->value)))
+                     if (!_asn1_strcmp (p2->name, p->value))
                        {
                          if (_asn1_convert_integer
                              (p2->value, value, value_size,
diff --git a/lib/minitasn1/errors.c b/lib/minitasn1/errors.c
index 76611d8..8b6e5e4 100644
--- a/lib/minitasn1/errors.c
+++ b/lib/minitasn1/errors.c
@@ -100,44 +100,3 @@ asn1_strerror (asn1_retCode error)
 
   return NULL;
 }
-
-#ifndef ASN1_DISABLE_DEPRECATED
-
-/* Compatibility mappings to preserve ABI. */
-
-/**
- * libtasn1_perror:
- * @error: is an error returned by a libtasn1 function.
- *
- * Prints a string to stderr with a description of an error.  This
- * function is like perror(). The only difference is that it accepts
- * an error returned by a libtasn1 function.
- *
- * Deprecated: Use asn1_perror() instead.
- **/
-void
-libtasn1_perror (asn1_retCode error)
-{
-  asn1_perror (error);
-}
-
-/**
- * libtasn1_strerror:
- * @error: is an error returned by a libtasn1 function.
- *
- * Returns a string with a description of an error.  This function is
- * similar to strerror.  The only difference is that it accepts an
- * error (number) returned by a libtasn1 function.
- *
- * Returns: Pointer to static zero-terminated string describing error
- *   code.
- *
- * Deprecated: Use asn1_strerror() instead.
- **/
-const char *
-libtasn1_strerror (asn1_retCode error)
-{
-  return asn1_strerror (error);
-}
-
-#endif
diff --git a/lib/minitasn1/gstr.c b/lib/minitasn1/gstr.c
index 4785073..0558c77 100644
--- a/lib/minitasn1/gstr.c
+++ b/lib/minitasn1/gstr.c
@@ -48,7 +48,8 @@ _asn1_str_cat (char *dest, size_t dest_tot_size, const char 
*src)
     }
 }
 
-void
+/* Returns the bytes copied (not including the null terminator) */
+unsigned int
 _asn1_str_cpy (char *dest, size_t dest_tot_size, const char *src)
 {
   size_t str_size = strlen (src);
@@ -56,13 +57,17 @@ _asn1_str_cpy (char *dest, size_t dest_tot_size, const char 
*src)
   if (dest_tot_size > str_size)
     {
       strcpy (dest, src);
+      return str_size;
     }
   else
     {
       if (dest_tot_size > 0)
        {
-         memcpy (dest, src, dest_tot_size - 1);
-         dest[dest_tot_size - 1] = 0;
+         str_size = dest_tot_size - 1;
+         memcpy (dest, src, str_size);
+         dest[str_size] = 0;
+         return str_size;
        }
+      else return 0;
     }
 }
diff --git a/lib/minitasn1/gstr.h b/lib/minitasn1/gstr.h
index baaa6a0..672d59e 100644
--- a/lib/minitasn1/gstr.h
+++ b/lib/minitasn1/gstr.h
@@ -19,7 +19,7 @@
  * 02110-1301, USA
  */
 
-void _asn1_str_cpy (char *dest, size_t dest_tot_size, const char *src);
+unsigned int _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);
 
 #define Estrcpy(x,y) _asn1_str_cpy(x,ASN1_MAX_ERROR_DESCRIPTION_SIZE,y)
diff --git a/lib/hash.c b/lib/minitasn1/hash.c
similarity index 98%
copy from lib/hash.c
copy to lib/minitasn1/hash.c
index 8ba36f5..50da70c 100644
--- a/lib/hash.c
+++ b/lib/minitasn1/hash.c
@@ -20,8 +20,9 @@
  *
  */
 
-#include <gnutls_int.h>
-#include <hash.h>
+#include <int.h>
+
+#define INIT_VAL 0x33a1
 /*
 -------------------------------------------------------------------------------
 lookup3.c, by Bob Jenkins, May 2006, Public Domain.
@@ -177,13 +178,13 @@ acceptable.  Do NOT use for cryptographic purposes.
 -------------------------------------------------------------------------------
 */
 
-uint32_t _gnutls_bhash( const void *key, size_t length, uint32_t initval)
+uint32_t _asn1_bhash( const void *key, size_t length)
 {
   uint32_t a,b,c;                                          /* internal state */
   const uint8_t *k;
 
   /* Set up the internal state */
-  a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
+  a = b = c = 0xdeadbeef + ((uint32_t)length) + INIT_VAL;
 
   k = (const uint8_t *)key;
 
diff --git a/lib/minitasn1/int.h b/lib/minitasn1/int.h
index aad7ba6..9e6bc89 100644
--- a/lib/minitasn1/int.h
+++ b/lib/minitasn1/int.h
@@ -46,7 +46,8 @@
 struct node_asn_struct
 {
   /* public fields: */
-  char *name;                  /* Node name */
+  char name[ASN1_MAX_NAME_SIZE+1];                     /* Node name */
+  unsigned int name_hash;
   unsigned int type;           /* Node type */
   unsigned char *value;                /* Node value */
   int value_len;
@@ -57,17 +58,13 @@ struct node_asn_struct
   unsigned char small_value[ASN1_SMALL_VALUE_SIZE];    /* For small values */
 };
 
-#define _asn1_malloc malloc
-#define _asn1_free free
-#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)
+uint32_t _asn1_bhash( const void *key, size_t length);
 
 #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 e9337e2..6293e7d 100644
--- a/lib/minitasn1/libtasn1.h
+++ b/lib/minitasn1/libtasn1.h
@@ -44,7 +44,7 @@ extern "C"
 {
 #endif
 
-#define ASN1_VERSION "2.14"
+#define ASN1_VERSION "3.0"
 
   typedef int asn1_retCode;    /* type returned by libtasn1 functions */
 
@@ -108,26 +108,14 @@ extern "C"
   /* that represent an ASN.1 DEFINITION.                */
   /******************************************************/
 
-#if !defined ASN1_BUILDING
-  /* This structure is also in internal.h, but then contains more
-     fields.  You cannot make any modifications to these fields
-     without breaking ABI.  */
-  struct node_asn_struct
-  {
-    char *name;                        /* Node name */
-    unsigned int type;         /* Node type */
-    unsigned char *value;      /* Node value */
-    int value_len;
-    struct node_asn_struct *down;      /* Pointer to the son node */
-    struct node_asn_struct *right;     /* Pointer to the brother node */
-    struct node_asn_struct *left;      /* Pointer to the next list element */
-  };
-#endif
-
   typedef struct node_asn_struct node_asn;
 
   typedef node_asn *ASN1_TYPE;
 
+  /* maximum number of characters of a name */
+  /* inside a file with ASN1 definitons     */
+#define ASN1_MAX_NAME_SIZE 64
+
 #define ASN1_TYPE_EMPTY  NULL
 
   /*****************************************/
@@ -178,9 +166,6 @@ extern "C"
   /*  Fixed constants                */
   /***********************************/
 
-  /* maximum number of characters of a name */
-  /* inside a file with ASN1 definitons     */
-#define ASN1_MAX_NAME_SIZE 128
 
   /* maximum number of characters */
   /* of a description message     */
@@ -315,37 +300,6 @@ extern "C"
     asn1_copy_node (ASN1_TYPE dst, const char *dst_name,
                    ASN1_TYPE src, const char *src_name);
 
-  /* Deprecated stuff. */
-
-#ifndef ASN1_DISABLE_DEPRECATED
-
-#define LIBTASN1_VERSION ASN1_VERSION
-
-#ifndef MAX_NAME_SIZE
-# define MAX_NAME_SIZE ASN1_MAX_NAME_SIZE
-#endif
-
-#ifndef MAX_ERROR_DESCRIPTION_SIZE
-# define MAX_ERROR_DESCRIPTION_SIZE ASN1_MAX_ERROR_DESCRIPTION_SIZE
-#endif
-
-#ifndef __attribute__
-  /* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec)  /* empty */
-# endif
-#endif
-
-  /* Use asn1_strerror instead. */
-  extern ASN1_API const char *libtasn1_strerror (asn1_retCode error)
-    __attribute__ ((deprecated));
-
-  /* Use asn1_perror instead. */
-  extern ASN1_API void
-    libtasn1_perror (asn1_retCode error) __attribute__ ((deprecated));
-
-#endif
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/minitasn1/parser_aux.c b/lib/minitasn1/parser_aux.c
index 2e1f7ee..ff701bc 100644
--- a/lib/minitasn1/parser_aux.c
+++ b/lib/minitasn1/parser_aux.c
@@ -43,7 +43,7 @@ typedef struct list_struct
 list_type *firstElement = NULL;
 
 /******************************************************/
-/* Function : _asn1_add_node                          */
+/* Function : _asn1_add_static_node                   */
 /* Description: creates a new NODE_ASN element and    */
 /* puts it in the list pointed by firstElement.       */
 /* Parameters:                                        */
@@ -52,19 +52,19 @@ list_type *firstElement = NULL;
 /* Return: pointer to the new element.                */
 /******************************************************/
 ASN1_TYPE
-_asn1_add_node (unsigned int type)
+_asn1_add_static_node (unsigned int type)
 {
   list_type *listElement;
   ASN1_TYPE punt;
 
-  punt = (ASN1_TYPE) _asn1_calloc (1, sizeof (struct node_asn_struct));
+  punt = calloc (1, sizeof (struct node_asn_struct));
   if (punt == NULL)
     return NULL;
 
-  listElement = (list_type *) _asn1_malloc (sizeof (list_type));
+  listElement = malloc (sizeof (list_type));
   if (listElement == NULL)
     {
-      _asn1_free (punt);
+      free (punt);
       return NULL;
     }
 
@@ -95,6 +95,8 @@ asn1_find_node (ASN1_TYPE pointer, const char *name)
   ASN1_TYPE p;
   char *n_end, n[ASN1_MAX_NAME_SIZE + 1];
   const char *n_start;
+  unsigned int nsize;
+  unsigned int nhash;
 
   if (pointer == NULL)
     return NULL;
@@ -105,25 +107,30 @@ asn1_find_node (ASN1_TYPE pointer, const char *name)
   p = pointer;
   n_start = name;
 
-  if (p->name != NULL)
+  if (p->name[0] != 0)
     {                          /* has *pointer got a name ? */
       n_end = strchr (n_start, '.');   /* search the first dot */
       if (n_end)
        {
-         memcpy (n, n_start, n_end - n_start);
-         n[n_end - n_start] = 0;
+         nsize = n_end - n_start;
+         memcpy (n, n_start, nsize);
+         n[nsize] = 0;
          n_start = n_end;
          n_start++;
+
+          nhash = _asn1_bhash(n, nsize);
        }
       else
        {
-         _asn1_str_cpy (n, sizeof (n), n_start);
+         nsize = _asn1_str_cpy (n, sizeof (n), n_start);
+          nhash = _asn1_bhash(n, nsize);
+
          n_start = NULL;
        }
 
       while (p)
        {
-         if ((p->name) && (!strcmp (p->name, n)))
+         if ((p->name) && nhash == p->name_hash && (!strcmp (p->name, n)))
            break;
          else
            p = p->right;
@@ -143,14 +150,18 @@ asn1_find_node (ASN1_TYPE pointer, const char *name)
       n_end = strchr (n_start, '.');   /* search the next dot */
       if (n_end)
        {
-         memcpy (n, n_start, n_end - n_start);
-         n[n_end - n_start] = 0;
+         nsize = n_end - n_start;
+         memcpy (n, n_start, nsize);
+         n[nsize] = 0;
          n_start = n_end;
          n_start++;
+
+          nhash = _asn1_bhash(n, nsize);
        }
       else
        {
-         _asn1_str_cpy (n, sizeof (n), n_start);
+         nsize = _asn1_str_cpy (n, sizeof (n), n_start);
+          nhash = _asn1_bhash(n, nsize);
          n_start = NULL;
        }
 
@@ -172,7 +183,7 @@ asn1_find_node (ASN1_TYPE pointer, const char *name)
        {                       /* no "?LAST" */
          while (p)
            {
-             if ((p->name) && (!strcmp (p->name, n)))
+             if (p->name_hash == nhash && !strcmp (p->name, n))
                break;
              else
                p = p->right;
@@ -204,7 +215,7 @@ _asn1_set_value (ASN1_TYPE node, const void *value, 
unsigned int len)
   if (node->value)
     {
       if (node->value != node->small_value)
-       _asn1_free (node->value);
+       free (node->value);
       node->value = NULL;
       node->value_len = 0;
     }
@@ -218,7 +229,7 @@ _asn1_set_value (ASN1_TYPE node, const void *value, 
unsigned int len)
     }
   else
     {
-      node->value = _asn1_malloc (len);
+      node->value = malloc (len);
       if (node->value == NULL)
        return NULL;
     }
@@ -249,7 +260,7 @@ _asn1_set_value_octet (ASN1_TYPE node, const void *value, 
unsigned int len)
     return node;
 
   asn1_length_der (len, NULL, &len2);
-  temp = (unsigned char *) _asn1_malloc (len + len2);
+  temp = malloc (len + len2);
   if (temp == NULL)
     return NULL;
 
@@ -269,7 +280,7 @@ _asn1_set_value_m (ASN1_TYPE node, void *value, unsigned 
int len)
   if (node->value)
     {
       if (node->value != node->small_value)
-       _asn1_free (node->value);
+       free (node->value);
       node->value = NULL;
       node->value_len = 0;
     }
@@ -303,7 +314,7 @@ _asn1_append_value (ASN1_TYPE node, const void *value, 
unsigned int len)
       /* value is allocated */
       int prev_len = node->value_len;
       node->value_len += len;
-      node->value = _asn1_realloc (node->value, node->value_len);
+      node->value = realloc (node->value, node->value_len);
       if (node->value == NULL)
        {
          node->value_len = 0;
@@ -318,7 +329,7 @@ _asn1_append_value (ASN1_TYPE node, const void *value, 
unsigned int len)
       /* value is in node */
       int prev_len = node->value_len;
       node->value_len += len;
-      node->value = _asn1_malloc (node->value_len);
+      node->value = malloc (node->value_len);
       if (node->value == NULL)
        {
          node->value_len = 0;
@@ -346,27 +357,51 @@ _asn1_append_value (ASN1_TYPE node, const void *value, 
unsigned int len)
 ASN1_TYPE
 _asn1_set_name (ASN1_TYPE node, const char *name)
 {
+unsigned int nsize;
+
   if (node == NULL)
     return node;
 
-  if (node->name)
+  if (name == NULL)
     {
-      _asn1_free (node->name);
-      node->name = NULL;
+      node->name[0] = 0;
+      node->name_hash = _asn1_bhash(node->name, 0);
+      return node;
     }
 
-  if (name == NULL)
-    return node;
+  nsize = _asn1_str_cpy (node->name, sizeof (node->name), name);
+  node->name_hash = _asn1_bhash(node->name, nsize);
+
+  return node;
+}
+
+/******************************************************************/
+/* Function : _asn1_cpy_name                                      */
+/* Description: copies the field NAME in a NODE_ASN element.      */
+/* Parameters:                                                    */
+/*   dst: a dest element pointer.                                 */
+/*   src: a source element pointer.                               */
+/* Return: pointer to the NODE_ASN element.                       */
+/******************************************************************/
+ASN1_TYPE
+_asn1_cpy_name (ASN1_TYPE dst, ASN1_TYPE src)
+{
+unsigned int nsize;
 
-  if (strlen (name))
+  if (dst == NULL)
+    return dst;
+
+  if (src == NULL)
     {
-      node->name = (char *) _asn1_strdup (name);
-      if (node->name == NULL)
-       return NULL;
+      dst->name[0] = 0;
+      dst->name_hash = _asn1_bhash(dst->name, 0);
+      return dst;
     }
-  else
-    node->name = NULL;
-  return node;
+
+  nsize = _asn1_str_cpy (dst->name, sizeof (dst->name), src->name);
+  dst->name_hash = src->name_hash;
+
+  return dst;
 }
 
 /******************************************************************/
@@ -389,21 +424,6 @@ _asn1_set_right (ASN1_TYPE node, ASN1_TYPE right)
   return node;
 }
 
-/******************************************************************/
-/* Function : _asn1_get_right                                     */
-/* Description: returns the element pointed by the RIGHT field of */
-/*              a NODE_ASN element.                               */
-/* Parameters:                                                    */
-/*   node: NODE_ASN element pointer.                              */
-/* Return: field RIGHT of NODE.                                   */
-/******************************************************************/
-ASN1_TYPE
-_asn1_get_right (ASN1_TYPE node)
-{
-  if (node == NULL)
-    return NULL;
-  return node->right;
-}
 
 /******************************************************************/
 /* Function : _asn1_get_last_right                                */
@@ -426,78 +446,6 @@ _asn1_get_last_right (ASN1_TYPE node)
 }
 
 /******************************************************************/
-/* Function : _asn1_set_down                                      */
-/* Description: sets the field DOWN in a NODE_ASN element.        */
-/* Parameters:                                                    */
-/*   node: element pointer.                                       */
-/*   down: pointer to a NODE_ASN element that you want be pointed */
-/*          by NODE.                                              */
-/* Return: pointer to *NODE.                                      */
-/******************************************************************/
-ASN1_TYPE
-_asn1_set_down (ASN1_TYPE node, ASN1_TYPE down)
-{
-  if (node == NULL)
-    return node;
-  node->down = down;
-  if (down)
-    down->left = node;
-  return node;
-}
-
-/******************************************************************/
-/* Function : _asn1_get_down                                      */
-/* Description: returns the element pointed by the DOWN field of  */
-/*              a NODE_ASN element.                               */
-/* Parameters:                                                    */
-/*   node: NODE_ASN element pointer.                              */
-/* Return: field DOWN of NODE.                                    */
-/******************************************************************/
-ASN1_TYPE
-_asn1_get_down (ASN1_TYPE node)
-{
-  if (node == NULL)
-    return NULL;
-  return node->down;
-}
-
-/******************************************************************/
-/* Function : _asn1_get_name                                      */
-/* Description: returns the name of a NODE_ASN element.           */
-/* Parameters:                                                    */
-/*   node: NODE_ASN element pointer.                              */
-/* Return: a null terminated string.                              */
-/******************************************************************/
-char *
-_asn1_get_name (ASN1_TYPE node)
-{
-  if (node == NULL)
-    return NULL;
-  return node->name;
-}
-
-/******************************************************************/
-/* Function : _asn1_mod_type                                      */
-/* Description: change the field TYPE of an NODE_ASN element.     */
-/*              The new value is the old one | (bitwise or) the   */
-/*              paramener VALUE.                                  */
-/* Parameters:                                                    */
-/*   node: NODE_ASN element pointer.                              */
-/*   value: the integer value that must be or-ed with the current */
-/*          value of field TYPE.                                  */
-/* Return: NODE pointer.                                          */
-/******************************************************************/
-ASN1_TYPE
-_asn1_mod_type (ASN1_TYPE node, unsigned int value)
-{
-  if (node == NULL)
-    return node;
-  node->type |= value;
-  return node;
-}
-
-
-/******************************************************************/
 /* Function : _asn1_remove_node                                   */
 /* Description: gets free the memory allocated for an NODE_ASN    */
 /*              element (not the elements pointed by it).         */
@@ -510,11 +458,9 @@ _asn1_remove_node (ASN1_TYPE node)
   if (node == NULL)
     return;
 
-  if (node->name != NULL)
-    _asn1_free (node->name);
   if (node->value != NULL && node->value != node->small_value)
-    _asn1_free (node->value);
-  _asn1_free (node);
+    free (node->value);
+  free (node);
 }
 
 /******************************************************************/
@@ -554,7 +500,7 @@ _asn1_delete_list (void)
     {
       listElement = firstElement;
       firstElement = firstElement->next;
-      _asn1_free (listElement);
+      free (listElement);
     }
 }
 
@@ -573,7 +519,7 @@ _asn1_delete_list_and_nodes (void)
       listElement = firstElement;
       firstElement = firstElement->next;
       _asn1_remove_node (listElement->node);
-      _asn1_free (listElement);
+      free (listElement);
     }
 }
 
@@ -732,7 +678,7 @@ _asn1_expand_object_id (ASN1_TYPE node)
                        {
                          if (type_field (p4->type) == TYPE_CONSTANT)
                            {
-                             p5 = _asn1_add_node_only (TYPE_CONSTANT);
+                             p5 = _asn1_add_single_node (TYPE_CONSTANT);
                              _asn1_set_name (p5, p4->name);
                              tlen = _asn1_strlen (p4->value);
                              if (tlen > 0)
@@ -965,7 +911,10 @@ _asn1_check_identifier (ASN1_TYPE node)
          p2 = asn1_find_node (node, name2);
          if (p2 == NULL)
            {
-             _asn1_strcpy (_asn1_identifierMissing, p->value);
+             if (p->value)
+               _asn1_strcpy (_asn1_identifierMissing, p->value);
+              else
+               _asn1_strcpy (_asn1_identifierMissing, "(null)");
              return ASN1_IDENTIFIER_NOT_FOUND;
            }
        }
diff --git a/lib/minitasn1/parser_aux.h b/lib/minitasn1/parser_aux.h
index 374f599..f3aeb54 100644
--- a/lib/minitasn1/parser_aux.h
+++ b/lib/minitasn1/parser_aux.h
@@ -27,7 +27,7 @@
 /***************************************/
 /*  Functions used by ASN.1 parser     */
 /***************************************/
-ASN1_TYPE _asn1_add_node (unsigned int type);
+ASN1_TYPE _asn1_add_static_node (unsigned int type);
 
 ASN1_TYPE
 _asn1_set_value (ASN1_TYPE node, const void *value, unsigned int len);
@@ -42,20 +42,12 @@ _asn1_append_value (ASN1_TYPE node, const void *value, 
unsigned int len);
 
 ASN1_TYPE _asn1_set_name (ASN1_TYPE node, const char *name);
 
-ASN1_TYPE _asn1_set_right (ASN1_TYPE node, ASN1_TYPE right);
+ASN1_TYPE _asn1_cpy_name (ASN1_TYPE dst, ASN1_TYPE src);
 
-ASN1_TYPE _asn1_get_right (ASN1_TYPE node);
+ASN1_TYPE _asn1_set_right (ASN1_TYPE node, ASN1_TYPE right);
 
 ASN1_TYPE _asn1_get_last_right (ASN1_TYPE node);
 
-ASN1_TYPE _asn1_set_down (ASN1_TYPE node, ASN1_TYPE down);
-
-char *_asn1_get_name (ASN1_TYPE node);
-
-ASN1_TYPE _asn1_get_down (ASN1_TYPE node);
-
-ASN1_TYPE _asn1_mod_type (ASN1_TYPE node, unsigned int value);
-
 void _asn1_remove_node (ASN1_TYPE node);
 
 void _asn1_delete_list (void);
@@ -76,4 +68,91 @@ asn1_retCode _asn1_check_identifier (ASN1_TYPE node);
 
 asn1_retCode _asn1_set_default_tag (ASN1_TYPE node);
 
+/******************************************************************/
+/* Function : _asn1_get_right                                     */
+/* Description: returns the element pointed by the RIGHT field of */
+/*              a NODE_ASN element.                               */
+/* Parameters:                                                    */
+/*   node: NODE_ASN element pointer.                              */
+/* Return: field RIGHT of NODE.                                   */
+/******************************************************************/
+inline static ASN1_TYPE
+_asn1_get_right (ASN1_TYPE node)
+{
+  if (node == NULL)
+    return NULL;
+  return node->right;
+}
+
+/******************************************************************/
+/* Function : _asn1_set_down                                      */
+/* Description: sets the field DOWN in a NODE_ASN element.        */
+/* Parameters:                                                    */
+/*   node: element pointer.                                       */
+/*   down: pointer to a NODE_ASN element that you want be pointed */
+/*          by NODE.                                              */
+/* Return: pointer to *NODE.                                      */
+/******************************************************************/
+inline static ASN1_TYPE
+_asn1_set_down (ASN1_TYPE node, ASN1_TYPE down)
+{
+  if (node == NULL)
+    return node;
+  node->down = down;
+  if (down)
+    down->left = node;
+  return node;
+}
+
+/******************************************************************/
+/* Function : _asn1_get_down                                      */
+/* Description: returns the element pointed by the DOWN field of  */
+/*              a NODE_ASN element.                               */
+/* Parameters:                                                    */
+/*   node: NODE_ASN element pointer.                              */
+/* Return: field DOWN of NODE.                                    */
+/******************************************************************/
+inline static ASN1_TYPE
+_asn1_get_down (ASN1_TYPE node)
+{
+  if (node == NULL)
+    return NULL;
+  return node->down;
+}
+
+/******************************************************************/
+/* Function : _asn1_get_name                                      */
+/* Description: returns the name of a NODE_ASN element.           */
+/* Parameters:                                                    */
+/*   node: NODE_ASN element pointer.                              */
+/* Return: a null terminated string.                              */
+/******************************************************************/
+inline static char *
+_asn1_get_name (ASN1_TYPE node)
+{
+  if (node == NULL)
+    return NULL;
+  return node->name;
+}
+
+/******************************************************************/
+/* Function : _asn1_mod_type                                      */
+/* Description: change the field TYPE of an NODE_ASN element.     */
+/*              The new value is the old one | (bitwise or) the   */
+/*              paramener VALUE.                                  */
+/* Parameters:                                                    */
+/*   node: NODE_ASN element pointer.                              */
+/*   value: the integer value that must be or-ed with the current */
+/*          value of field TYPE.                                  */
+/* Return: NODE pointer.                                          */
+/******************************************************************/
+inline static ASN1_TYPE
+_asn1_mod_type (ASN1_TYPE node, unsigned int value)
+{
+  if (node == NULL)
+    return node;
+  node->type |= value;
+  return node;
+}
+
 #endif
diff --git a/lib/minitasn1/structure.c b/lib/minitasn1/structure.c
index 41cebe4..7d622ce 100644
--- a/lib/minitasn1/structure.c
+++ b/lib/minitasn1/structure.c
@@ -37,7 +37,7 @@ extern char _asn1_identifierMissing[];
 
 
 /******************************************************/
-/* Function : _asn1_add_node_only                     */
+/* Function : _asn1_add_single_node                     */
 /* Description: creates a new NODE_ASN element.       */
 /* Parameters:                                        */
 /*   type: type of the new element (see TYPE_         */
@@ -45,11 +45,11 @@ extern char _asn1_identifierMissing[];
 /* Return: pointer to the new element.                */
 /******************************************************/
 ASN1_TYPE
-_asn1_add_node_only (unsigned int type)
+_asn1_add_single_node (unsigned int type)
 {
   ASN1_TYPE punt;
 
-  punt = (ASN1_TYPE) _asn1_calloc (1, sizeof (struct node_asn_struct));
+  punt = calloc (1, sizeof (struct node_asn_struct));
   if (punt == NULL)
     return NULL;
 
@@ -104,7 +104,7 @@ _asn1_create_static_structure (ASN1_TYPE pointer, char 
*output_file_name,
     {
       fprintf (file, "  { ");
 
-      if (p->name)
+      if (p->name[0] != 0)
        fprintf (file, "\"%s\", ", p->name);
       else
        fprintf (file, "NULL, ");
@@ -191,7 +191,7 @@ asn1_array2tree (const ASN1_ARRAY_TYPE * array, ASN1_TYPE * 
definitions,
   k = 0;
   while (array[k].value || array[k].type || array[k].name)
     {
-      p = _asn1_add_node (array[k].type & (~CONST_DOWN));
+      p = _asn1_add_static_node (array[k].type & (~CONST_DOWN));
       if (array[k].name)
        _asn1_set_name (p, array[k].name);
       if (array[k].value)
@@ -380,7 +380,7 @@ _asn1_copy_structure3 (ASN1_TYPE source_node)
   if (source_node == NULL)
     return NULL;
 
-  dest_node = _asn1_add_node_only (source_node->type);
+  dest_node = _asn1_add_single_node (source_node->type);
 
   p_s = source_node;
   p_d = dest_node;
@@ -391,48 +391,37 @@ _asn1_copy_structure3 (ASN1_TYPE source_node)
     {
       if (move != UP)
        {
-         if (p_s->name)
-           _asn1_set_name (p_d, p_s->name);
+         if (p_s->name[0] != 0)
+           _asn1_cpy_name (p_d, p_s);
          if (p_s->value)
            _asn1_set_value (p_d, p_s->value, p_s->value_len);
-         move = DOWN;
-       }
-      else
-       move = RIGHT;
-
-      if (move == DOWN)
-       {
          if (p_s->down)
            {
              p_s = p_s->down;
              p_d_prev = p_d;
-             p_d = _asn1_add_node_only (p_s->type);
+             p_d = _asn1_add_single_node (p_s->type);
              _asn1_set_down (p_d_prev, p_d);
+             continue;
            }
-         else
-           move = RIGHT;
        }
 
       if (p_s == source_node)
-       break;
+        break;
 
-      if (move == RIGHT)
-       {
-         if (p_s->right)
-           {
-             p_s = p_s->right;
-             p_d_prev = p_d;
-             p_d = _asn1_add_node_only (p_s->type);
-             _asn1_set_right (p_d_prev, p_d);
-           }
-         else
+      if (p_s->right)
+        {
+           move = RIGHT;
+           p_s = p_s->right;
+           p_d_prev = p_d;
+           p_d = _asn1_add_single_node (p_s->type);
+           _asn1_set_right (p_d_prev, p_d);
+        }
+      else
+        {
            move = UP;
-       }
-      if (move == UP)
-       {
-         p_s = _asn1_find_up (p_s);
-         p_d = _asn1_find_up (p_d);
-       }
+           p_s = _asn1_find_up (p_s);
+           p_d = _asn1_find_up (p_d);
+        }
     }
   while (p_s != source_node);
 
@@ -481,7 +470,7 @@ _asn1_type_choice_config (ASN1_TYPE node)
                        {
                          if (type_field (p3->type) == TYPE_TAG)
                            {
-                             p4 = _asn1_add_node_only (p3->type);
+                             p4 = _asn1_add_single_node (p3->type);
                              tlen = _asn1_strlen (p3->value);
                              if (tlen > 0)
                                _asn1_set_value (p4, p3->value, tlen + 1);
@@ -556,15 +545,13 @@ _asn1_expand_identifier (ASN1_TYPE * node, ASN1_TYPE root)
        {
          if (type_field (p->type) == TYPE_IDENTIFIER)
            {
-             _asn1_str_cpy (name2, sizeof (name2), root->name);
-             _asn1_str_cat (name2, sizeof (name2), ".");
-             _asn1_str_cat (name2, sizeof (name2), (char *) p->value);
+             snprintf(name2, sizeof (name2), "%s.%s", root->name, p->value);
              p2 = _asn1_copy_structure2 (root, name2);
              if (p2 == NULL)
                {
                  return ASN1_IDENTIFIER_NOT_FOUND;
                }
-             _asn1_set_name (p2, p->name);
+             _asn1_cpy_name (p2, p);
              p2->right = p->right;
              p2->left = p->left;
              if (p->right)
@@ -719,7 +706,7 @@ asn1_print_structure (FILE * out, ASN1_TYPE structure, 
const char *name,
          for (k = 0; k < indent; k++)
            fprintf (out, " ");
          fprintf (out, "name:");
-         if (p->name)
+         if (p->name[0] != 0)
            fprintf (out, "%s  ", p->name);
          else
            fprintf (out, "NULL  ");
@@ -736,7 +723,7 @@ asn1_print_structure (FILE * out, ASN1_TYPE structure, 
const char *name,
              for (k = 0; k < indent; k++)
                fprintf (out, " ");
              fprintf (out, "name:");
-             if (p->name)
+             if (p->name[0] != 0)
                fprintf (out, "%s  ", p->name);
              else
                fprintf (out, "NULL  ");
@@ -1078,7 +1065,7 @@ asn1_number_of_elements (ASN1_TYPE element, const char 
*name, int *num)
 
   while (p)
     {
-      if ((p->name) && (p->name[0] == '?'))
+      if (p->name[0] == '?')
        (*num)++;
       p = p->right;
     }
@@ -1169,27 +1156,27 @@ asn1_copy_node (ASN1_TYPE dst, const char *dst_name,
   if (result != ASN1_MEM_ERROR)
     return result;
 
-  data = _asn1_malloc (size);
+  data = malloc (size);
   if (data == NULL)
     return ASN1_MEM_ERROR;
 
   result = asn1_der_coding (src, src_name, data, &size, NULL);
   if (result != ASN1_SUCCESS)
     {
-      _asn1_free (data);
+      free (data);
       return result;
     }
 
   dst_node = asn1_find_node (dst, dst_name);
   if (dst_node == NULL)
     {
-      _asn1_free (data);
+      free (data);
       return ASN1_ELEMENT_NOT_FOUND;
     }
 
   result = asn1_der_decoding (&dst_node, data, size, NULL);
 
-  _asn1_free (data);
+  free (data);
 
   return result;
 }
diff --git a/lib/minitasn1/structure.h b/lib/minitasn1/structure.h
index 0a84e26..cf4205b 100644
--- a/lib/minitasn1/structure.h
+++ b/lib/minitasn1/structure.h
@@ -34,7 +34,7 @@ asn1_retCode _asn1_create_static_structure (ASN1_TYPE pointer,
 
 ASN1_TYPE _asn1_copy_structure3 (ASN1_TYPE source_node);
 
-ASN1_TYPE _asn1_add_node_only (unsigned int type);
+ASN1_TYPE _asn1_add_single_node (unsigned int type);
 
 ASN1_TYPE _asn1_find_left (ASN1_TYPE node);
 
diff --git a/src/benchmark.c b/src/benchmark.c
index 8ab3f8c..ea19764 100644
--- a/src/benchmark.c
+++ b/src/benchmark.c
@@ -26,6 +26,8 @@
 #include <unistd.h>
 #include "benchmark.h"
 
+#define BSECS 5
+
 int benchmark_must_finish = 0;
 
 #if defined(_WIN32)
@@ -102,14 +104,14 @@ void start_benchmark(struct benchmark_st * st)
       fprintf (stderr, "error: CreateThread %u\n", GetLastError ());
       exit(1);
     }
-  st->alarm_timeout.QuadPart = (2) * 10000000;
+  st->alarm_timeout.QuadPart = (BSECS) * 10000000;
   if (SetWaitableTimer (st->wtimer, &st->alarm_timeout, 0, NULL, NULL, FALSE) 
== 0)
     {
       fprintf (stderr, "error: SetWaitableTimer %u\n", GetLastError ());
       exit(1);
     }
 #else
-  alarm (2);
+  alarm (BSECS);
 #endif
   
 }


hooks/post-receive
-- 
GNU gnutls



reply via email to

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