Răsfoiți Sursa

eliminating dead code and warnings in minitasn1

Christian Grothoff 17 ani în urmă
părinte
comite
796d310d53

+ 40 - 75
src/daemon/https/minitasn1/coding.c

@@ -45,7 +45,7 @@
 /*   ErrorDescription: string returned.               */
 /* Return:                                            */
 /******************************************************/
-void
+static void
 MHD__asn1_error_description_value_not_found (node_asn * node,
                                          char *ErrorDescription)
 {
@@ -113,7 +113,7 @@ MHD__asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len)
 /*            (ans[0]..ans[ans_len-1]).               */
 /* Return:                                            */
 /******************************************************/
-void
+static void
 MHD__asn1_tag_der (unsigned char class, unsigned int tag_value,
                unsigned char *ans, int *ans_len)
 {
@@ -179,7 +179,7 @@ MHD__asn1_octet_der (const unsigned char *str, int str_len,
 /*   ASN1_MEM_ERROR when DER isn't big enough         */
 /*   ASN1_SUCCESS otherwise                           */
 /******************************************************/
-MHD__asn1_retCode
+static MHD__asn1_retCode
 MHD__asn1_time_der (unsigned char *str, unsigned char *der, int *der_len)
 {
   int len_len;
@@ -187,11 +187,11 @@ MHD__asn1_time_der (unsigned char *str, unsigned char *der, int *der_len)
 
   max_len = *der_len;
 
-  MHD__asn1_length_der (strlen (str), (max_len > 0) ? der : NULL, &len_len);
+  MHD__asn1_length_der (strlen ((const char*) str), (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 + (int) strlen ((const char*) str)) <= max_len)
+    memcpy (der + len_len, str, strlen ((const char*) str));
+  *der_len = len_len + strlen ((const char*) str);
 
   if ((*der_len) > max_len)
     return ASN1_MEM_ERROR;
@@ -199,43 +199,6 @@ MHD__asn1_time_der (unsigned char *str, unsigned char *der, int *der_len)
   return ASN1_SUCCESS;
 }
 
-
-/*
-void
-MHD__asn1_get_utctime_der(unsigned char *der,int *der_len,unsigned char *str)
-{
-  int len_len,str_len;
-  char temp[20];
-
-  if(str==NULL) return;
-  str_len=MHD__asn1_get_length_der(der,*der_len,&len_len);
-  if (str_len<0) return;
-  memcpy(temp,der+len_len,str_len);
-  *der_len=str_len+len_len;
-  switch(str_len){
-  case 11:
-    temp[10]=0;
-    strcat(temp,"00+0000");
-    break;
-  case 13:
-    temp[12]=0;
-    strcat(temp,"+0000");
-    break;
-  case 15:
-    temp[15]=0;
-    memmove(temp+12,temp+10,6);
-    temp[10]=temp[11]='0';
-    break;
-  case 17:
-    temp[17]=0;
-    break;
-  default:
-    return;
-  }
-  strcpy(str,temp);
-}
-*/
-
 /******************************************************/
 /* Function : MHD__asn1_objectid_der                      */
 /* Description: creates the DER coding for an         */
@@ -250,7 +213,7 @@ MHD__asn1_get_utctime_der(unsigned char *der,int *der_len,unsigned char *str)
 /*   ASN1_MEM_ERROR when DER isn't big enough         */
 /*   ASN1_SUCCESS otherwise                           */
 /******************************************************/
-MHD__asn1_retCode
+static MHD__asn1_retCode
 MHD__asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len)
 {
   int len_len, counter, k, first, max_len;
@@ -260,11 +223,11 @@ MHD__asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len)
 
   max_len = *der_len;
 
-  temp = (char *) MHD__asn1_alloca (strlen (str) + 2);
+  temp = (char *) MHD__asn1_alloca (strlen ((const char*)str) + 2);
   if (temp == NULL)
     return ASN1_MEM_ALLOC_ERROR;
 
-  strcpy (temp, str);
+  strcpy (temp, (const char*) str);
   strcat (temp, ".");
 
   counter = 0;
@@ -370,7 +333,7 @@ MHD__asn1_bit_der (const unsigned char *str, int bit_len,
 /*   ASN1_MEM_ERROR if der vector isn't big enough,   */
 /*   otherwise ASN1_SUCCESS.                          */
 /******************************************************/
-MHD__asn1_retCode
+static MHD__asn1_retCode
 MHD__asn1_complete_explicit_tag (node_asn * node, unsigned char *der,
                              int *counter, int *max_len)
 {
@@ -443,7 +406,7 @@ MHD__asn1_complete_explicit_tag (node_asn * node, unsigned char *der,
 /*   ASN1_MEM_ERROR if der vector isn't big enough,   */
 /*   otherwise ASN1_SUCCESS.                          */
 /******************************************************/
-MHD__asn1_retCode
+static MHD__asn1_retCode
 MHD__asn1_insert_tag_der (node_asn * node, unsigned char *der, int *counter,
                       int *max_len)
 {
@@ -474,20 +437,22 @@ MHD__asn1_insert_tag_der (node_asn * node, unsigned char *der, int *counter,
               if (p->type & CONST_EXPLICIT)
                 {
                   if (is_tag_implicit)
-                    MHD__asn1_tag_der (class_implicit, tag_implicit, tag_der,
-                                   &tag_len);
+                    MHD__asn1_tag_der (class_implicit, tag_implicit,
+				       (unsigned char*) tag_der,
+				       &tag_len);
                   else
                     MHD__asn1_tag_der (class | ASN1_CLASS_STRUCTURED,
-                                   strtoul (p->value, NULL, 10), tag_der,
-                                   &tag_len);
+				       strtoul ( (const char*) p->value, NULL, 10), 
+				       (unsigned char*) tag_der,
+				       &tag_len);
 
                   *max_len -= tag_len;
                   if (*max_len >= 0)
                     memcpy (der + *counter, tag_der, tag_len);
                   *counter += tag_len;
 
-                  MHD__asn1_ltostr (*counter, temp);
-                  MHD__asn1_set_name (p, temp);
+                  MHD__asn1_ltostr (*counter, (char*) temp);
+                  MHD__asn1_set_name (p, (const char*) temp);
 
                   is_tag_implicit = 0;
                 }
@@ -501,7 +466,7 @@ MHD__asn1_insert_tag_der (node_asn * 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 = strtoul ( (const char*) p->value, NULL, 10);
                       is_tag_implicit = 1;
                     }
                 }
@@ -512,63 +477,63 @@ MHD__asn1_insert_tag_der (node_asn * node, unsigned char *der, int *counter,
 
   if (is_tag_implicit)
     {
-      MHD__asn1_tag_der (class_implicit, tag_implicit, tag_der, &tag_len);
+      MHD__asn1_tag_der (class_implicit, tag_implicit, (unsigned char*) tag_der, &tag_len);
     }
   else
     {
       switch (type_field (node->type))
         {
         case TYPE_NULL:
-          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_NULL, tag_der,
+          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_NULL, (unsigned char*) tag_der,
                          &tag_len);
           break;
         case TYPE_BOOLEAN:
-          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_BOOLEAN, tag_der,
+          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_BOOLEAN, (unsigned char*) tag_der,
                          &tag_len);
           break;
         case TYPE_INTEGER:
-          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_INTEGER, tag_der,
+          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_INTEGER, (unsigned char*) tag_der,
                          &tag_len);
           break;
         case TYPE_ENUMERATED:
-          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_ENUMERATED, tag_der,
+          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_ENUMERATED, (unsigned char*) tag_der,
                          &tag_len);
           break;
         case TYPE_OBJECT_ID:
-          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_OBJECT_ID, tag_der,
+          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_OBJECT_ID, (unsigned char*) tag_der,
                          &tag_len);
           break;
         case TYPE_TIME:
           if (node->type & CONST_UTC)
             {
-              MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_UTCTime, tag_der,
+              MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_UTCTime, (unsigned char*) tag_der,
                              &tag_len);
             }
           else
             MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_GENERALIZEDTime,
-                           tag_der, &tag_len);
+                           (unsigned char*) tag_der, &tag_len);
           break;
         case TYPE_OCTET_STRING:
-          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_OCTET_STRING, tag_der,
+          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_OCTET_STRING, (unsigned char*) tag_der,
                          &tag_len);
           break;
         case TYPE_GENERALSTRING:
           MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_GENERALSTRING,
-                         tag_der, &tag_len);
+                         (unsigned char*) tag_der, &tag_len);
           break;
         case TYPE_BIT_STRING:
-          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_BIT_STRING, tag_der,
+          MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL, ASN1_TAG_BIT_STRING, (unsigned char*) tag_der,
                          &tag_len);
           break;
         case TYPE_SEQUENCE:
         case TYPE_SEQUENCE_OF:
           MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL | ASN1_CLASS_STRUCTURED,
-                         ASN1_TAG_SEQUENCE, tag_der, &tag_len);
+                         ASN1_TAG_SEQUENCE, (unsigned char*) tag_der, &tag_len);
           break;
         case TYPE_SET:
         case TYPE_SET_OF:
           MHD__asn1_tag_der (ASN1_CLASS_UNIVERSAL | ASN1_CLASS_STRUCTURED,
-                         ASN1_TAG_SET, tag_der, &tag_len);
+                         ASN1_TAG_SET, (unsigned char*) tag_der, &tag_len);
           break;
         case TYPE_TAG:
           tag_len = 0;
@@ -604,7 +569,7 @@ MHD__asn1_insert_tag_der (node_asn * node, unsigned char *der, int *counter,
 /*   node: pointer to the SET element.                */
 /* Return:                                            */
 /******************************************************/
-void
+static void
 MHD__asn1_ordering_set (unsigned char *der, int der_len, node_asn * node)
 {
   struct vet
@@ -719,7 +684,7 @@ MHD__asn1_ordering_set (unsigned char *der, int der_len, node_asn * node)
 /*   node: pointer to the SET OF element.             */
 /* Return:                                            */
 /******************************************************/
-void
+static void
 MHD__asn1_ordering_set_of (unsigned char *der, int der_len, node_asn * node)
 {
   struct vet
@@ -1104,11 +1069,11 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len,
             }
           else
             {                   /* move==UP */
-              len2 = strtol (p->value, NULL, 10);
+              len2 = strtol ( (const char*) p->value, NULL, 10);
               MHD__asn1_set_value (p, NULL, 0);
               if ((type_field (p->type) == TYPE_SET) && (max_len >= 0))
                 MHD__asn1_ordering_set (der + len2, max_len - len2, p);
-              MHD__asn1_length_der (counter - len2, temp, &len3);
+              MHD__asn1_length_der (counter - len2, (unsigned char*) temp, &len3);
               max_len -= len3;
               if (max_len >= 0)
                 {
@@ -1144,14 +1109,14 @@ MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len,
             }
           if (move == UP)
             {
-              len2 = strtol (p->value, NULL, 10);
+              len2 = strtol ( (const char*) p->value, NULL, 10);
               MHD__asn1_set_value (p, NULL, 0);
               if ((type_field (p->type) == TYPE_SET_OF)
                   && (max_len - len2 > 0))
                 {
                   MHD__asn1_ordering_set_of (der + len2, max_len - len2, p);
                 }
-              MHD__asn1_length_der (counter - len2, temp, &len3);
+              MHD__asn1_length_der (counter - len2, (unsigned char*) temp, &len3);
               max_len -= len3;
               if (max_len >= 0)
                 {

Fișier diff suprimat deoarece este prea mare
+ 90 - 884
src/daemon/https/minitasn1/decoding.c


+ 25 - 145
src/daemon/https/minitasn1/element.c

@@ -281,7 +281,7 @@ MHD__asn1_write_value (ASN1_TYPE node_root, const char *name,
   node_asn *node, *p, *p2;
   unsigned char *temp, *value_temp = NULL, *default_temp = NULL;
   int len2, k, k2, negative;
-  const unsigned char *value = ivalue;
+  const char *value = ivalue;
 
   node = MHD__asn1_find_node (node_root, name);
   if (node == NULL)
@@ -374,10 +374,10 @@ MHD__asn1_write_value (ASN1_TYPE node_root, const char *name,
                           if (value_temp == NULL)
                             return ASN1_MEM_ALLOC_ERROR;
 
-                          MHD__asn1_convert_integer (p->value,
-                                                 value_temp,
-                                                 SIZEOF_UNSIGNED_LONG_INT,
-                                                 &len);
+                          MHD__asn1_convert_integer ((const char*) p->value,
+						     value_temp,
+						     SIZEOF_UNSIGNED_LONG_INT,
+						     &len);
                           break;
                         }
                     }
@@ -446,7 +446,7 @@ MHD__asn1_write_value (ASN1_TYPE node_root, const char *name,
 		  return ASN1_MEM_ALLOC_ERROR;
 		}
 
-              MHD__asn1_convert_integer (p->value, default_temp,
+              MHD__asn1_convert_integer ((const char*) p->value, default_temp,
                                      SIZEOF_UNSIGNED_LONG_INT, &len2);
             }
           else
@@ -461,7 +461,7 @@ MHD__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) && (!strcmp (p2->name,(const char*)  p->value)))
                         {
                           default_temp =
                             (unsigned char *)
@@ -472,7 +472,7 @@ MHD__asn1_write_value (ASN1_TYPE node_root, const char *name,
 			      return ASN1_MEM_ALLOC_ERROR;
 			    }
 
-                          MHD__asn1_convert_integer (p2->value,
+                          MHD__asn1_convert_integer ((const char*) p2->value,
                                                  default_temp,
                                                  SIZEOF_UNSIGNED_LONG_INT,
                                                  &len2);
@@ -512,7 +512,7 @@ MHD__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 (!strcmp (value,(const char*)  p->value))
             {
               MHD__asn1_set_value (node, NULL, 0);
               break;
@@ -574,7 +574,7 @@ MHD__asn1_write_value (ASN1_TYPE node_root, const char *name,
       if (temp == NULL)
         return ASN1_MEM_ALLOC_ERROR;
 
-      MHD__asn1_octet_der (value, len, temp, &len2);
+      MHD__asn1_octet_der ((const unsigned char*) value, len, temp, &len2);
       MHD__asn1_set_value (node, temp, len2);
       MHD__asn1_afree (temp);
       break;
@@ -586,7 +586,7 @@ MHD__asn1_write_value (ASN1_TYPE node_root, const char *name,
       if (temp == NULL)
         return ASN1_MEM_ALLOC_ERROR;
 
-      MHD__asn1_octet_der (value, len, temp, &len2);
+      MHD__asn1_octet_der ((const unsigned char*)value, len, temp, &len2);
       MHD__asn1_set_value (node, temp, len2);
       MHD__asn1_afree (temp);
       break;
@@ -598,7 +598,7 @@ MHD__asn1_write_value (ASN1_TYPE node_root, const char *name,
       if (temp == NULL)
         return ASN1_MEM_ALLOC_ERROR;
 
-      MHD__asn1_bit_der (value, len, temp, &len2);
+      MHD__asn1_bit_der ((const unsigned char*)value, len, temp, &len2);
       MHD__asn1_set_value (node, temp, len2);
       MHD__asn1_afree (temp);
       break;
@@ -632,7 +632,7 @@ MHD__asn1_write_value (ASN1_TYPE node_root, const char *name,
       if (temp == NULL)
         return ASN1_MEM_ALLOC_ERROR;
 
-      MHD__asn1_octet_der (value, len, temp, &len2);
+      MHD__asn1_octet_der ((const unsigned char*)value, len, temp, &len2);
       MHD__asn1_set_value (node, temp, len2);
       MHD__asn1_afree (temp);
       break;
@@ -749,7 +749,7 @@ MHD__asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
   node_asn *node, *p, *p2;
   int len2, len3;
   int value_size = *len;
-  unsigned char *value = ivalue;
+  char *value = ivalue;
 
   node = MHD__asn1_find_node (root, name);
   if (node == NULL)
@@ -801,7 +801,7 @@ MHD__asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
               || (p->value[0] == '+'))
             {
               if (MHD__asn1_convert_integer
-                  (p->value, value, value_size, len) != ASN1_SUCCESS)
+                  ((const char*) p->value, (unsigned char*) value, value_size, len) != ASN1_SUCCESS)
                 return ASN1_MEM_ERROR;
             }
           else
@@ -811,10 +811,10 @@ MHD__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) && (!strcmp (p2->name, (const char*) p->value)))
                         {
                           if (MHD__asn1_convert_integer
-                              (p2->value, value, value_size,
+                              ((const char*) p2->value, (unsigned char*) value, value_size,
                                len) != ASN1_SUCCESS)
                             return ASN1_MEM_ERROR;
                           break;
@@ -828,7 +828,7 @@ MHD__asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
         {
           len2 = -1;
           if (MHD__asn1_get_octet_der
-              (node->value, node->value_len, &len2, value, value_size,
+              (node->value, node->value_len, &len2, (unsigned char*) value, value_size,
                len) != ASN1_SUCCESS)
             return ASN1_MEM_ERROR;
         }
@@ -842,7 +842,7 @@ MHD__asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
             {
               if (type_field (p->type) == TYPE_CONSTANT)
                 {
-                  ADD_STR_VALUE (value, value_size, p->value);
+                  ADD_STR_VALUE (value, value_size, (const char*) p->value);
                   if (p->right)
                     {
                       ADD_STR_VALUE (value, value_size, ".");
@@ -857,34 +857,34 @@ MHD__asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
           p = node->down;
           while (type_field (p->type) != TYPE_DEFAULT)
             p = p->right;
-          PUT_STR_VALUE (value, value_size, p->value);
+          PUT_STR_VALUE (value, value_size, (const char*)  p->value);
         }
       else
         {
-          PUT_STR_VALUE (value, value_size, node->value);
+          PUT_STR_VALUE (value, value_size, (const char*)  node->value);
         }
       break;
     case TYPE_TIME:
-      PUT_STR_VALUE (value, value_size, node->value);
+      PUT_STR_VALUE (value, value_size, (const char*) node->value);
       break;
     case TYPE_OCTET_STRING:
       len2 = -1;
       if (MHD__asn1_get_octet_der
-          (node->value, node->value_len, &len2, value, value_size,
+          (node->value, node->value_len, &len2, (unsigned char*) value, value_size,
            len) != ASN1_SUCCESS)
         return ASN1_MEM_ERROR;
       break;
     case TYPE_GENERALSTRING:
       len2 = -1;
       if (MHD__asn1_get_octet_der
-          (node->value, node->value_len, &len2, value, value_size,
+          (node->value, node->value_len, &len2, (unsigned char*) value, value_size,
            len) != ASN1_SUCCESS)
         return ASN1_MEM_ERROR;
       break;
     case TYPE_BIT_STRING:
       len2 = -1;
       if (MHD__asn1_get_bit_der
-          (node->value, node->value_len, &len2, value, value_size,
+          (node->value, node->value_len, &len2, (unsigned char*) value, value_size,
            len) != ASN1_SUCCESS)
         return ASN1_MEM_ERROR;
       break;
@@ -906,123 +906,3 @@ MHD__asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
 }
 
 
-/**
-  * MHD__asn1_read_tag - Returns the TAG of one element inside a structure
-  * @root: pointer to a structure
-  * @name: the name of the element inside a structure.
-  * @tagValue:  variable that will contain the TAG value.
-  * @classValue: variable that will specify the TAG type.
-  *
-  * Returns the TAG and the CLASS of one element inside a structure.
-  * CLASS can have one of these constants: %ASN1_CLASS_APPLICATION,
-  * %ASN1_CLASS_UNIVERSAL, %ASN1_CLASS_PRIVATE or
-  * %ASN1_CLASS_CONTEXT_SPECIFIC.
-  *
-  * Returns:
-  *
-  *   ASN1_SUCCESS: Set value OK.
-  *
-  *   ASN1_ELEMENT_NOT_FOUND: NAME is not a valid element.
-  *
-  **/
-MHD__asn1_retCode
-MHD__asn1_read_tag (node_asn * root, const char *name, int *tagValue,
-               int *classValue)
-{
-  node_asn *node, *p, *pTag;
-
-  node = MHD__asn1_find_node (root, name);
-  if (node == NULL)
-    return ASN1_ELEMENT_NOT_FOUND;
-
-  p = node->down;
-
-  /* pTag will points to the IMPLICIT TAG */
-  pTag = NULL;
-  if (node->type & CONST_TAG)
-    {
-      while (p)
-        {
-          if (type_field (p->type) == TYPE_TAG)
-            {
-              if ((p->type & CONST_IMPLICIT) && (pTag == NULL))
-                pTag = p;
-              else if (p->type & CONST_EXPLICIT)
-                pTag = NULL;
-            }
-          p = p->right;
-        }
-    }
-
-  if (pTag)
-    {
-      *tagValue = strtoul (pTag->value, NULL, 10);
-
-      if (pTag->type & CONST_APPLICATION)
-        *classValue = ASN1_CLASS_APPLICATION;
-      else if (pTag->type & CONST_UNIVERSAL)
-        *classValue = ASN1_CLASS_UNIVERSAL;
-      else if (pTag->type & CONST_PRIVATE)
-        *classValue = ASN1_CLASS_PRIVATE;
-      else
-        *classValue = ASN1_CLASS_CONTEXT_SPECIFIC;
-    }
-  else
-    {
-      *classValue = ASN1_CLASS_UNIVERSAL;
-
-      switch (type_field (node->type))
-        {
-        case TYPE_NULL:
-          *tagValue = ASN1_TAG_NULL;
-          break;
-        case TYPE_BOOLEAN:
-          *tagValue = ASN1_TAG_BOOLEAN;
-          break;
-        case TYPE_INTEGER:
-          *tagValue = ASN1_TAG_INTEGER;
-          break;
-        case TYPE_ENUMERATED:
-          *tagValue = ASN1_TAG_ENUMERATED;
-          break;
-        case TYPE_OBJECT_ID:
-          *tagValue = ASN1_TAG_OBJECT_ID;
-          break;
-        case TYPE_TIME:
-          if (node->type & CONST_UTC)
-            {
-              *tagValue = ASN1_TAG_UTCTime;
-            }
-          else
-            *tagValue = ASN1_TAG_GENERALIZEDTime;
-          break;
-        case TYPE_OCTET_STRING:
-          *tagValue = ASN1_TAG_OCTET_STRING;
-          break;
-        case TYPE_GENERALSTRING:
-          *tagValue = ASN1_TAG_GENERALSTRING;
-          break;
-        case TYPE_BIT_STRING:
-          *tagValue = ASN1_TAG_BIT_STRING;
-          break;
-        case TYPE_SEQUENCE:
-        case TYPE_SEQUENCE_OF:
-          *tagValue = ASN1_TAG_SEQUENCE;
-          break;
-        case TYPE_SET:
-        case TYPE_SET_OF:
-          *tagValue = ASN1_TAG_SET;
-          break;
-        case TYPE_TAG:
-        case TYPE_CHOICE:
-        case TYPE_ANY:
-          break;
-        default:
-          break;
-        }
-    }
-
-
-  return ASN1_SUCCESS;
-
-}

+ 0 - 21
src/daemon/https/minitasn1/libtasn1.h

@@ -150,9 +150,6 @@ extern "C"
                                 ASN1_TYPE * definitions,
                                 char *errorDescription);
 
-  void MHD__asn1_print_structure (FILE * out, ASN1_TYPE structure,
-                             const char *name, int mode);
-
   MHD__asn1_retCode MHD__asn1_create_element (ASN1_TYPE definitions,
                                     const char *source_name,
                                     ASN1_TYPE * element);
@@ -177,32 +174,14 @@ extern "C"
   MHD__asn1_retCode MHD__asn1_der_decoding (ASN1_TYPE * element, const void *ider,
                                   int len, char *errorDescription);
 
-  MHD__asn1_retCode MHD__asn1_der_decoding_element (ASN1_TYPE * structure,
-                                          const char *elementName,
-                                          const void *ider, int len,
-                                          char *errorDescription);
-
   MHD__asn1_retCode MHD__asn1_der_decoding_startEnd (ASN1_TYPE element,
                                            const void *ider, int len,
                                            const char *name_element,
                                            int *start, int *end);
 
-  MHD__asn1_retCode MHD__asn1_expand_any_defined_by (ASN1_TYPE definitions,
-                                           ASN1_TYPE * element);
-
-  MHD__asn1_retCode MHD__asn1_expand_octet_string (ASN1_TYPE definitions,
-                                         ASN1_TYPE * element,
-                                         const char *octetName,
-                                         const char *objectName);
-
-  MHD__asn1_retCode MHD__asn1_read_tag (node_asn * root, const char *name,
-                              int *tagValue, int *classValue);
-
   const char *MHD__asn1_find_structure_from_oid (ASN1_TYPE definitions,
                                             const char *oidValue);
 
-  const char *MHD__asn1_check_version (const char *req_version);
-
   const char *MHD__libtasn1_strerror (MHD__asn1_retCode error);
 
   void MHD__libtasn1_perror (MHD__asn1_retCode error);

+ 13 - 317
src/daemon/https/minitasn1/parser_aux.c

@@ -27,6 +27,8 @@
 #include "structure.h"
 #include "element.h"
 
+
+
 char MHD__asn1_identifierMissing[MAX_NAME_SIZE + 1];        /* identifier name not found */
 
 /***********************************************/
@@ -278,42 +280,6 @@ MHD__asn1_set_right (node_asn * node, node_asn * right)
   return node;
 }
 
-/******************************************************************/
-/* Function : MHD__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.                                   */
-/******************************************************************/
-node_asn *
-MHD__asn1_get_right (node_asn * node)
-{
-  if (node == NULL)
-    return NULL;
-  return node->right;
-}
-
-/******************************************************************/
-/* Function : MHD__asn1_get_last_right                                */
-/* Description: return the last element along the right chain.    */
-/* Parameters:                                                    */
-/*   node: starting element pointer.                              */
-/* Return: pointer to the last element along the right chain.     */
-/******************************************************************/
-node_asn *
-MHD__asn1_get_last_right (node_asn * node)
-{
-  node_asn *p;
-
-  if (node == NULL)
-    return NULL;
-  p = node;
-  while (p->right)
-    p = p->right;
-  return p;
-}
-
 /******************************************************************/
 /* Function : MHD__asn1_set_down                                      */
 /* Description: sets the field DOWN in a NODE_ASN element.        */
@@ -334,58 +300,6 @@ MHD__asn1_set_down (node_asn * node, node_asn * down)
   return node;
 }
 
-/******************************************************************/
-/* Function : MHD__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.                                    */
-/******************************************************************/
-node_asn *
-MHD__asn1_get_down (node_asn * node)
-{
-  if (node == NULL)
-    return NULL;
-  return node->down;
-}
-
-/******************************************************************/
-/* Function : MHD__asn1_get_name                                      */
-/* Description: returns the name of a NODE_ASN element.           */
-/* Parameters:                                                    */
-/*   node: NODE_ASN element pointer.                              */
-/* Return: a null terminated string.                              */
-/******************************************************************/
-char *
-MHD__asn1_get_name (node_asn * node)
-{
-  if (node == NULL)
-    return NULL;
-  return node->name;
-}
-
-/******************************************************************/
-/* Function : MHD__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.                                          */
-/******************************************************************/
-node_asn *
-MHD__asn1_mod_type (node_asn * node, unsigned int value)
-{
-  if (node == NULL)
-    return node;
-  node->type |= value;
-  return node;
-}
-
-
 /******************************************************************/
 /* Function : MHD__asn1_remove_node                                   */
 /* Description: gets free the memory allocated for an NODE_ASN    */
@@ -529,7 +443,7 @@ MHD__asn1_change_integer_value (ASN1_TYPE node)
         {
           if (p->value)
             {
-              MHD__asn1_convert_integer (p->value, val, sizeof (val), &len);
+              MHD__asn1_convert_integer ((const char*) p->value, val, sizeof (val), &len);
               MHD__asn1_octet_der (val, len, val2, &len);
               MHD__asn1_set_value (p, val2, len);
             }
@@ -607,7 +521,7 @@ MHD__asn1_expand_object_id (ASN1_TYPE node)
                     {
                       MHD__asn1_str_cpy (name2, sizeof (name2), name_root);
                       MHD__asn1_str_cat (name2, sizeof (name2), ".");
-                      MHD__asn1_str_cat (name2, sizeof (name2), p2->value);
+                      MHD__asn1_str_cat (name2, sizeof (name2), (const char*)  p2->value);
                       p3 = MHD__asn1_find_node (node, name2);
                       if (!p3 || (type_field (p3->type) != TYPE_OBJECT_ID) ||
                           !(p3->type & CONST_ASSIGN))
@@ -622,7 +536,7 @@ MHD__asn1_expand_object_id (ASN1_TYPE node)
                             {
                               p5 = MHD__asn1_add_node_only (TYPE_CONSTANT);
                               MHD__asn1_set_name (p5, p4->name);
-                              tlen = strlen (p4->value);
+                              tlen = strlen ( (const char*) p4->value);
                               if (tlen > 0)
                                 MHD__asn1_set_value (p5, p4->value, tlen + 1);
                               if (p2 == p)
@@ -693,7 +607,7 @@ MHD__asn1_expand_object_id (ASN1_TYPE node)
                 {
                   MHD__asn1_str_cpy (name2, sizeof (name2), name_root);
                   MHD__asn1_str_cat (name2, sizeof (name2), ".");
-                  MHD__asn1_str_cat (name2, sizeof (name2), p2->value);
+                  MHD__asn1_str_cat (name2, sizeof (name2), (const char*) p2->value);
                   p3 = MHD__asn1_find_node (node, name2);
                   if (!p3 || (type_field (p3->type) != TYPE_OBJECT_ID) ||
                       !(p3->type & CONST_ASSIGN))
@@ -706,7 +620,7 @@ MHD__asn1_expand_object_id (ASN1_TYPE node)
                         {
                           if (name2[0])
                             MHD__asn1_str_cat (name2, sizeof (name2), ".");
-                          MHD__asn1_str_cat (name2, sizeof (name2), p4->value);
+                          MHD__asn1_str_cat (name2, sizeof (name2), (const char*) p4->value);
                         }
                       p4 = p4->right;
                     }
@@ -748,77 +662,6 @@ MHD__asn1_expand_object_id (ASN1_TYPE node)
   return ASN1_SUCCESS;
 }
 
-
-/******************************************************************/
-/* Function : MHD__asn1_type_set_config                               */
-/* Description: sets the CONST_SET and CONST_NOT_USED properties  */
-/*   in the fields of the SET elements.                           */
-/* Parameters:                                                    */
-/*   node: root of an ASN1 element.                               */
-/* Return:                                                        */
-/*   ASN1_ELEMENT_NOT_FOUND if NODE is NULL,                       */
-/*   otherwise ASN1_SUCCESS                                             */
-/******************************************************************/
-MHD__asn1_retCode
-MHD__asn1_type_set_config (ASN1_TYPE node)
-{
-  node_asn *p, *p2;
-  int move;
-
-  if (node == NULL)
-    return ASN1_ELEMENT_NOT_FOUND;
-
-  p = node;
-  move = DOWN;
-
-  while (!((p == node) && (move == UP)))
-    {
-      if (move != UP)
-        {
-          if (type_field (p->type) == TYPE_SET)
-            {
-              p2 = p->down;
-              while (p2)
-                {
-                  if (type_field (p2->type) != TYPE_TAG)
-                    p2->type |= CONST_SET | CONST_NOT_USED;
-                  p2 = p2->right;
-                }
-            }
-          move = DOWN;
-        }
-      else
-        move = RIGHT;
-
-      if (move == DOWN)
-        {
-          if (p->down)
-            p = p->down;
-          else
-            move = RIGHT;
-        }
-
-      if (p == node)
-        {
-          move = UP;
-          continue;
-        }
-
-      if (move == RIGHT)
-        {
-          if (p->right)
-            p = p->right;
-          else
-            move = UP;
-        }
-      if (move == UP)
-        p = MHD__asn1_find_up (p);
-    }
-
-  return ASN1_SUCCESS;
-}
-
-
 /******************************************************************/
 /* Function : MHD__asn1_check_identifier                              */
 /* Description: checks the definitions of all the identifiers     */
@@ -848,11 +691,11 @@ MHD__asn1_check_identifier (ASN1_TYPE node)
         {
           MHD__asn1_str_cpy (name2, sizeof (name2), node->name);
           MHD__asn1_str_cat (name2, sizeof (name2), ".");
-          MHD__asn1_str_cat (name2, sizeof (name2), p->value);
+          MHD__asn1_str_cat (name2, sizeof (name2), (const char*) p->value);
           p2 = MHD__asn1_find_node (node, name2);
           if (p2 == NULL)
             {
-              strcpy (MHD__asn1_identifierMissing, p->value);
+              strcpy (MHD__asn1_identifierMissing, (const char*) p->value);
               return ASN1_IDENTIFIER_NOT_FOUND;
             }
         }
@@ -864,8 +707,8 @@ MHD__asn1_check_identifier (ASN1_TYPE node)
             {
               MHD__asn1_str_cpy (name2, sizeof (name2), node->name);
               MHD__asn1_str_cat (name2, sizeof (name2), ".");
-              MHD__asn1_str_cat (name2, sizeof (name2), p2->value);
-              strcpy (MHD__asn1_identifierMissing, p2->value);
+              MHD__asn1_str_cat (name2, sizeof (name2), (const char*) p2->value);
+              strcpy (MHD__asn1_identifierMissing, (const char*) p2->value);
               p2 = MHD__asn1_find_node (node, name2);
               if (!p2 || (type_field (p2->type) != TYPE_OBJECT_ID) ||
                   !(p2->type & CONST_ASSIGN))
@@ -884,8 +727,8 @@ MHD__asn1_check_identifier (ASN1_TYPE node)
                 {
                   MHD__asn1_str_cpy (name2, sizeof (name2), node->name);
                   MHD__asn1_str_cat (name2, sizeof (name2), ".");
-                  MHD__asn1_str_cat (name2, sizeof (name2), p2->value);
-                  strcpy (MHD__asn1_identifierMissing, p2->value);
+                  MHD__asn1_str_cat (name2, sizeof (name2), (const char*) p2->value);
+                  strcpy (MHD__asn1_identifierMissing, (const char*) p2->value);
                   p2 = MHD__asn1_find_node (node, name2);
                   if (!p2 || (type_field (p2->type) != TYPE_OBJECT_ID) ||
                       !(p2->type & CONST_ASSIGN))
@@ -923,150 +766,3 @@ MHD__asn1_check_identifier (ASN1_TYPE node)
 
   return ASN1_SUCCESS;
 }
-
-
-/******************************************************************/
-/* Function : MHD__asn1_set_default_tag                               */
-/* Description: sets the default IMPLICIT or EXPLICIT property in */
-/*   the tagged elements that don't have this declaration.        */
-/* Parameters:                                                    */
-/*   node: pointer to a DEFINITIONS element.                      */
-/* Return:                                                        */
-/*   ASN1_ELEMENT_NOT_FOUND if NODE is NULL or not a pointer to   */
-/*     a DEFINITIONS element,                                     */
-/*   otherwise ASN1_SUCCESS                                       */
-/******************************************************************/
-MHD__asn1_retCode
-MHD__asn1_set_default_tag (ASN1_TYPE node)
-{
-  node_asn *p;
-
-  if ((node == NULL) || (type_field (node->type) != TYPE_DEFINITIONS))
-    return ASN1_ELEMENT_NOT_FOUND;
-
-  p = node;
-  while (p)
-    {
-      if ((type_field (p->type) == TYPE_TAG) &&
-          !(p->type & CONST_EXPLICIT) && !(p->type & CONST_IMPLICIT))
-        {
-          if (node->type & CONST_EXPLICIT)
-            p->type |= CONST_EXPLICIT;
-          else
-            p->type |= CONST_IMPLICIT;
-        }
-
-      if (p->down)
-        {
-          p = p->down;
-        }
-      else if (p->right)
-        p = p->right;
-      else
-        {
-          while (1)
-            {
-              p = MHD__asn1_find_up (p);
-              if (p == node)
-                {
-                  p = NULL;
-                  break;
-                }
-              if (p->right)
-                {
-                  p = p->right;
-                  break;
-                }
-            }
-        }
-    }
-
-  return ASN1_SUCCESS;
-}
-
-
-
-static const char *
-parse_version_number (const char *s, int *number)
-{
-  int val = 0;
-
-  if (*s == '0' && isdigit (s[1]))
-    return NULL;                /* leading zeros are not allowed */
-  for (; isdigit (*s); s++)
-    {
-      val *= 10;
-      val += *s - '0';
-    }
-  *number = val;
-  return val < 0 ? NULL : s;
-}
-
-/* The parse version functions were copied from libgcrypt.
- */
-static const char *
-parse_version_string (const char *s, int *major, int *minor, int *micro)
-{
-  s = parse_version_number (s, major);
-  if (!s || *s != '.')
-    return NULL;
-  s++;
-  s = parse_version_number (s, minor);
-  if (!s)
-    return NULL;
-  if (*s != '.')
-    {
-      *micro = 0;
-      return s;
-    }
-  s++;
-  s = parse_version_number (s, micro);
-  if (!s)
-    return NULL;
-  return s;                     /* patchlevel */
-}
-
-/**
- * MHD__asn1_check_version - check for library version
- * @req_version: Required version number, or NULL.
- *
- * Check that the the version of the library is at minimum the
- * requested one and return the version string; return %NULL if the
- * condition is not satisfied.  If a %NULL is passed to this function,
- * no check is done, but the version string is simply returned.
- *
- * See %LIBTASN1_VERSION for a suitable @req_version string.
- *
- * Return value: Version string of run-time library, or %NULL if the
- *   run-time library does not meet the required version number.
- */
-const char *
-MHD__asn1_check_version (const char *req_version)
-{
-  const char *ver = LIBTASN1_VERSION;
-  int my_major, my_minor, my_micro;
-  int rq_major, rq_minor, rq_micro;
-  const char *my_plvl, *rq_plvl;
-
-  if (!req_version)
-    return ver;
-
-  my_plvl = parse_version_string (ver, &my_major, &my_minor, &my_micro);
-  if (!my_plvl)
-    return NULL;                /* very strange our own version is bogus */
-  rq_plvl = parse_version_string (req_version, &rq_major, &rq_minor,
-                                  &rq_micro);
-  if (!rq_plvl)
-    return NULL;                /* req version string is invalid */
-
-  if (my_major > rq_major
-      || (my_major == rq_major && my_minor > rq_minor)
-      || (my_major == rq_major && my_minor == rq_minor
-          && my_micro > rq_micro)
-      || (my_major == rq_major && my_minor == rq_minor
-          && my_micro == rq_micro && strcmp (my_plvl, rq_plvl) >= 0))
-    {
-      return ver;
-    }
-  return NULL;
-}

+ 0 - 13
src/daemon/https/minitasn1/parser_aux.h

@@ -15,18 +15,8 @@ node_asn *MHD__asn1_set_name (node_asn * node, const char *name);
 
 node_asn *MHD__asn1_set_right (node_asn * node, node_asn * right);
 
-node_asn *MHD__asn1_get_right (node_asn * node);
-
-node_asn *MHD__asn1_get_last_right (node_asn * node);
-
 node_asn *MHD__asn1_set_down (node_asn * node, node_asn * down);
 
-char *MHD__asn1_get_name (node_asn * node);
-
-node_asn *MHD__asn1_get_down (node_asn * node);
-
-node_asn *MHD__asn1_mod_type (node_asn * node, unsigned int value);
-
 void MHD__asn1_remove_node (node_asn * node);
 
 void MHD__asn1_delete_list (void);
@@ -41,10 +31,7 @@ MHD__asn1_retCode MHD__asn1_change_integer_value (ASN1_TYPE node);
 
 MHD__asn1_retCode MHD__asn1_expand_object_id (ASN1_TYPE node);
 
-MHD__asn1_retCode MHD__asn1_type_set_config (ASN1_TYPE node);
-
 MHD__asn1_retCode MHD__asn1_check_identifier (ASN1_TYPE node);
 
-MHD__asn1_retCode MHD__asn1_set_default_tag (ASN1_TYPE node);
 
 #endif

+ 8 - 448
src/daemon/https/minitasn1/structure.c

@@ -37,6 +37,9 @@
 
 extern char MHD__asn1_identifierMissing[];
 
+static node_asn *MHD__asn1_copy_structure2 (node_asn * root, const char *source_name);
+
+
 
 /******************************************************/
 /* Function : MHD__asn1_add_node_only                     */
@@ -79,85 +82,6 @@ MHD__asn1_find_left (node_asn * node)
 }
 
 
-MHD__asn1_retCode
-MHD__asn1_create_static_structure (ASN1_TYPE pointer, char *output_file_name,
-                               char *vector_name)
-{
-  FILE *file;
-  node_asn *p;
-  unsigned long t;
-
-  file = fopen (output_file_name, "w");
-
-  if (file == NULL)
-    return ASN1_FILE_NOT_FOUND;
-
-  fprintf (file, "#if HAVE_CONFIG_H\n");
-  fprintf (file, "# include \"config.h\"\n");
-  fprintf (file, "#endif\n\n");
-
-  fprintf (file, "#include <libtasn1.h>\n\n");
-
-  fprintf (file, "extern const ASN1_ARRAY_TYPE %s[]={\n", vector_name);
-
-  p = pointer;
-
-  while (p)
-    {
-      fprintf (file, "  {");
-
-      if (p->name)
-        fprintf (file, "\"%s\",", p->name);
-      else
-        fprintf (file, "0,");
-
-      t = p->type;
-      if (p->down)
-        t |= CONST_DOWN;
-      if (p->right)
-        t |= CONST_RIGHT;
-
-      fprintf (file, "%lu,", t);
-
-      if (p->value)
-        fprintf (file, "\"%s\"},\n", p->value);
-      else
-        fprintf (file, "0},\n");
-
-      if (p->down)
-        {
-          p = p->down;
-        }
-      else if (p->right)
-        {
-          p = p->right;
-        }
-      else
-        {
-          while (1)
-            {
-              p = MHD__asn1_find_up (p);
-              if (p == pointer)
-                {
-                  p = NULL;
-                  break;
-                }
-              if (p->right)
-                {
-                  p = p->right;
-                  break;
-                }
-            }
-        }
-    }
-
-  fprintf (file, "  {0,0,0}\n};\n");
-
-  fclose (file);
-
-  return ASN1_SUCCESS;
-}
-
 
 /**
   * MHD__asn1_array2tree - Creates the structures needed to manage the ASN1 definitions.
@@ -455,7 +379,7 @@ MHD__asn1_copy_structure3 (node_asn * source_node)
 }
 
 
-node_asn *
+static node_asn *
 MHD__asn1_copy_structure2 (node_asn * root, const char *source_name)
 {
   node_asn *source_node;
@@ -467,7 +391,7 @@ MHD__asn1_copy_structure2 (node_asn * root, const char *source_name)
 }
 
 
-MHD__asn1_retCode
+static MHD__asn1_retCode
 MHD__asn1_type_choice_config (node_asn * node)
 {
   node_asn *p, *p2, *p3, *p4;
@@ -497,7 +421,7 @@ MHD__asn1_type_choice_config (node_asn * node)
                           if (type_field (p3->type) == TYPE_TAG)
                             {
                               p4 = MHD__asn1_add_node_only (p3->type);
-                              tlen = strlen (p3->value);
+                              tlen = strlen ((const char*) p3->value);
                               if (tlen > 0)
                                 MHD__asn1_set_value (p4, p3->value, tlen + 1);
                               MHD__asn1_set_right (p4, p2->down);
@@ -552,7 +476,7 @@ MHD__asn1_type_choice_config (node_asn * node)
 }
 
 
-MHD__asn1_retCode
+static MHD__asn1_retCode
 MHD__asn1_expand_identifier (node_asn ** node, node_asn * root)
 {
   node_asn *p, *p2, *p3;
@@ -573,7 +497,7 @@ MHD__asn1_expand_identifier (node_asn ** node, node_asn * root)
             {
               MHD__asn1_str_cpy (name2, sizeof (name2), root->name);
               MHD__asn1_str_cat (name2, sizeof (name2), ".");
-              MHD__asn1_str_cat (name2, sizeof (name2), p->value);
+              MHD__asn1_str_cat (name2, sizeof (name2), (const char*) p->value);
               p2 = MHD__asn1_copy_structure2 (root, name2);
               if (p2 == NULL)
                 {
@@ -703,370 +627,6 @@ MHD__asn1_create_element (ASN1_TYPE definitions, const char *source_name,
 }
 
 
-/**
-  * MHD__asn1_print_structure - Prints on the standard output the structure's tree
-  * @out: pointer to the output file (e.g. stdout).
-  * @structure: pointer to the structure that you want to visit.
-  * @name: an element of the structure
-  * @mode: specify how much of the structure to print, can be
-  *   %ASN1_PRINT_NAME, %ASN1_PRINT_NAME_TYPE,
-  *   %ASN1_PRINT_NAME_TYPE_VALUE, or %ASN1_PRINT_ALL.
-  *
-  * Prints on the @out file descriptor the structure's tree starting
-  * from the @name element inside the structure @structure.
-  **/
-void
-MHD__asn1_print_structure (FILE * out, ASN1_TYPE structure, const char *name,
-                      int mode)
-{
-  node_asn *p, *root;
-  int k, indent = 0, len, len2, len3;
-
-  if (out == NULL)
-    return;
-
-  root = MHD__asn1_find_node (structure, name);
-
-  if (root == NULL)
-    return;
-
-  p = root;
-  while (p)
-    {
-      if (mode == ASN1_PRINT_ALL)
-        {
-          for (k = 0; k < indent; k++)
-            fprintf (out, " ");
-          fprintf (out, "name:");
-          if (p->name)
-            fprintf (out, "%s  ", p->name);
-          else
-            fprintf (out, "NULL  ");
-        }
-      else
-        {
-          switch (type_field (p->type))
-            {
-            case TYPE_CONSTANT:
-            case TYPE_TAG:
-            case TYPE_SIZE:
-              break;
-            default:
-              for (k = 0; k < indent; k++)
-                fprintf (out, " ");
-              fprintf (out, "name:");
-              if (p->name)
-                fprintf (out, "%s  ", p->name);
-              else
-                fprintf (out, "NULL  ");
-            }
-        }
-
-      if (mode != ASN1_PRINT_NAME)
-        {
-          switch (type_field (p->type))
-            {
-            case TYPE_CONSTANT:
-              if (mode == ASN1_PRINT_ALL)
-                fprintf (out, "type:CONST");
-              break;
-            case TYPE_TAG:
-              if (mode == ASN1_PRINT_ALL)
-                fprintf (out, "type:TAG");
-              break;
-            case TYPE_SIZE:
-              if (mode == ASN1_PRINT_ALL)
-                fprintf (out, "type:SIZE");
-              break;
-            case TYPE_DEFAULT:
-              fprintf (out, "type:DEFAULT");
-              break;
-            case TYPE_NULL:
-              fprintf (out, "type:NULL");
-              break;
-            case TYPE_IDENTIFIER:
-              fprintf (out, "type:IDENTIFIER");
-              break;
-            case TYPE_INTEGER:
-              fprintf (out, "type:INTEGER");
-              break;
-            case TYPE_ENUMERATED:
-              fprintf (out, "type:ENUMERATED");
-              break;
-            case TYPE_TIME:
-              fprintf (out, "type:TIME");
-              break;
-            case TYPE_BOOLEAN:
-              fprintf (out, "type:BOOLEAN");
-              break;
-            case TYPE_SEQUENCE:
-              fprintf (out, "type:SEQUENCE");
-              break;
-            case TYPE_BIT_STRING:
-              fprintf (out, "type:BIT_STR");
-              break;
-            case TYPE_OCTET_STRING:
-              fprintf (out, "type:OCT_STR");
-              break;
-            case TYPE_GENERALSTRING:
-              fprintf (out, "type:GENERALSTRING");
-              break;
-            case TYPE_SEQUENCE_OF:
-              fprintf (out, "type:SEQ_OF");
-              break;
-            case TYPE_OBJECT_ID:
-              fprintf (out, "type:OBJ_ID");
-              break;
-            case TYPE_ANY:
-              fprintf (out, "type:ANY");
-              break;
-            case TYPE_SET:
-              fprintf (out, "type:SET");
-              break;
-            case TYPE_SET_OF:
-              fprintf (out, "type:SET_OF");
-              break;
-            case TYPE_CHOICE:
-              fprintf (out, "type:CHOICE");
-              break;
-            case TYPE_DEFINITIONS:
-              fprintf (out, "type:DEFINITIONS");
-              break;
-            default:
-              break;
-            }
-        }
-
-      if ((mode == ASN1_PRINT_NAME_TYPE_VALUE) || (mode == ASN1_PRINT_ALL))
-        {
-          switch (type_field (p->type))
-            {
-            case TYPE_CONSTANT:
-              if (mode == ASN1_PRINT_ALL)
-                if (p->value)
-                  fprintf (out, "  value:%s", p->value);
-              break;
-            case TYPE_TAG:
-              if (mode == ASN1_PRINT_ALL)
-                if (p->value)
-                  fprintf (out, "  value:%s", p->value);
-              break;
-            case TYPE_SIZE:
-              if (mode == ASN1_PRINT_ALL)
-                if (p->value)
-                  fprintf (out, "  value:%s", p->value);
-              break;
-            case TYPE_DEFAULT:
-              if (p->value)
-                fprintf (out, "  value:%s", p->value);
-              else if (p->type & CONST_TRUE)
-                fprintf (out, "  value:TRUE");
-              else if (p->type & CONST_FALSE)
-                fprintf (out, "  value:FALSE");
-              break;
-            case TYPE_IDENTIFIER:
-              if (p->value)
-                fprintf (out, "  value:%s", p->value);
-              break;
-            case TYPE_INTEGER:
-              if (p->value)
-                {
-                  len2 = -1;
-                  len = MHD__asn1_get_length_der (p->value, p->value_len, &len2);
-                  fprintf (out, "  value:0x");
-                  if (len > 0)
-                    for (k = 0; k < len; k++)
-                      fprintf (out, "%02x", (p->value)[k + len2]);
-                }
-              break;
-            case TYPE_ENUMERATED:
-              if (p->value)
-                {
-                  len2 = -1;
-                  len = MHD__asn1_get_length_der (p->value, p->value_len, &len2);
-                  fprintf (out, "  value:0x");
-                  if (len > 0)
-                    for (k = 0; k < len; k++)
-                      fprintf (out, "%02x", (p->value)[k + len2]);
-                }
-              break;
-            case TYPE_TIME:
-              if (p->value)
-                fprintf (out, "  value:%s", p->value);
-              break;
-            case TYPE_BOOLEAN:
-              if (p->value)
-                {
-                  if (p->value[0] == 'T')
-                    fprintf (out, "  value:TRUE");
-                  else if (p->value[0] == 'F')
-                    fprintf (out, "  value:FALSE");
-                }
-              break;
-            case TYPE_BIT_STRING:
-              if (p->value)
-                {
-                  len2 = -1;
-                  len = MHD__asn1_get_length_der (p->value, p->value_len, &len2);
-                  if (len > 0)
-                    {
-                      fprintf (out, "  value(%i):",
-                               (len - 1) * 8 - (p->value[len2]));
-                      for (k = 1; k < len; k++)
-                        fprintf (out, "%02x", (p->value)[k + len2]);
-                    }
-                }
-              break;
-            case TYPE_OCTET_STRING:
-              if (p->value)
-                {
-                  len2 = -1;
-                  len = MHD__asn1_get_length_der (p->value, p->value_len, &len2);
-                  fprintf (out, "  value:");
-                  if (len > 0)
-                    for (k = 0; k < len; k++)
-                      fprintf (out, "%02x", (p->value)[k + len2]);
-                }
-              break;
-            case TYPE_GENERALSTRING:
-              if (p->value)
-                {
-                  len2 = -1;
-                  len = MHD__asn1_get_length_der (p->value, p->value_len, &len2);
-                  fprintf (out, "  value:");
-                  if (len > 0)
-                    for (k = 0; k < len; k++)
-                      fprintf (out, "%02x", (p->value)[k + len2]);
-                }
-              break;
-            case TYPE_OBJECT_ID:
-              if (p->value)
-                fprintf (out, "  value:%s", p->value);
-              break;
-            case TYPE_ANY:
-              if (p->value)
-                {
-                  len3 = -1;
-                  len2 = MHD__asn1_get_length_der (p->value, p->value_len, &len3);
-                  fprintf (out, "  value:");
-                  if (len2 > 0)
-                    for (k = 0; k < len2; k++)
-                      fprintf (out, "%02x", (p->value)[k + len3]);
-                }
-              break;
-            case TYPE_SET:
-            case TYPE_SET_OF:
-            case TYPE_CHOICE:
-            case TYPE_DEFINITIONS:
-            case TYPE_SEQUENCE_OF:
-            case TYPE_SEQUENCE:
-            case TYPE_NULL:
-              break;
-            default:
-              break;
-            }
-        }
-
-      if (mode == ASN1_PRINT_ALL)
-        {
-          if (p->type & 0x1FFFFF00)
-            {
-              fprintf (out, "  attr:");
-              if (p->type & CONST_UNIVERSAL)
-                fprintf (out, "UNIVERSAL,");
-              if (p->type & CONST_PRIVATE)
-                fprintf (out, "PRIVATE,");
-              if (p->type & CONST_APPLICATION)
-                fprintf (out, "APPLICATION,");
-              if (p->type & CONST_EXPLICIT)
-                fprintf (out, "EXPLICIT,");
-              if (p->type & CONST_IMPLICIT)
-                fprintf (out, "IMPLICIT,");
-              if (p->type & CONST_TAG)
-                fprintf (out, "TAG,");
-              if (p->type & CONST_DEFAULT)
-                fprintf (out, "DEFAULT,");
-              if (p->type & CONST_TRUE)
-                fprintf (out, "TRUE,");
-              if (p->type & CONST_FALSE)
-                fprintf (out, "FALSE,");
-              if (p->type & CONST_LIST)
-                fprintf (out, "LIST,");
-              if (p->type & CONST_MIN_MAX)
-                fprintf (out, "MIN_MAX,");
-              if (p->type & CONST_OPTION)
-                fprintf (out, "OPTION,");
-              if (p->type & CONST_1_PARAM)
-                fprintf (out, "1_PARAM,");
-              if (p->type & CONST_SIZE)
-                fprintf (out, "SIZE,");
-              if (p->type & CONST_DEFINED_BY)
-                fprintf (out, "DEF_BY,");
-              if (p->type & CONST_GENERALIZED)
-                fprintf (out, "GENERALIZED,");
-              if (p->type & CONST_UTC)
-                fprintf (out, "UTC,");
-              if (p->type & CONST_SET)
-                fprintf (out, "SET,");
-              if (p->type & CONST_NOT_USED)
-                fprintf (out, "NOT_USED,");
-              if (p->type & CONST_ASSIGN)
-                fprintf (out, "ASSIGNMENT,");
-            }
-        }
-
-      if (mode == ASN1_PRINT_ALL)
-        {
-          fprintf (out, "\n");
-        }
-      else
-        {
-          switch (type_field (p->type))
-            {
-            case TYPE_CONSTANT:
-            case TYPE_TAG:
-            case TYPE_SIZE:
-              break;
-            default:
-              fprintf (out, "\n");
-            }
-        }
-
-      if (p->down)
-        {
-          p = p->down;
-          indent += 2;
-        }
-      else if (p == root)
-        {
-          p = NULL;
-          break;
-        }
-      else if (p->right)
-        p = p->right;
-      else
-        {
-          while (1)
-            {
-              p = MHD__asn1_find_up (p);
-              if (p == root)
-                {
-                  p = NULL;
-                  break;
-                }
-              indent -= 2;
-              if (p->right)
-                {
-                  p = p->right;
-                  break;
-                }
-            }
-        }
-    }
-}
-
-
-
 /**
   * MHD__asn1_number_of_elements - Counts the number of elements of a structure.
   * @element: pointer to the root of an ASN1 structure.

+ 0 - 5
src/daemon/https/minitasn1/structure.h

@@ -8,13 +8,8 @@
 #ifndef _STRUCTURE_H
 #define _STRUCTURE_H
 
-MHD__asn1_retCode MHD__asn1_create_static_structure (node_asn * pointer,
-                                            char *output_file_name,
-                                            char *vector_name);
-
 node_asn *MHD__asn1_copy_structure3 (node_asn * source_node);
 
-node_asn *MHD__asn1_copy_structure2 (node_asn * root, const char *source_name);
 
 node_asn *MHD__asn1_add_node_only (unsigned int type);
 

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff