Jelajahi Sumber

more dead code and warning elimination

Christian Grothoff 17 tahun lalu
induk
melakukan
33b93e08da

+ 4 - 4
src/daemon/https/x509/pkcs12_encr.c

@@ -35,7 +35,7 @@
 static int
 MHD_pkcs12_check_pass (const char *pass, size_t plen)
 {
-  const unsigned char *p = pass;
+  const char *p = pass;
   unsigned int i;
 
   for (i = 0; i < plen; i++)
@@ -115,13 +115,13 @@ MHD_pkcs12_string_to_key (unsigned int id, const opaque * salt,
       for (i = 0; i < 64; i++)
         {
           unsigned char lid = id & 0xFF;
-          MHD_gc_hash_write (md, 1, &lid);
+          MHD_gc_hash_write (md, 1, (const char*) &lid);
         }
-      MHD_gc_hash_write (md, pw ? 128 : 64, buf_i);
+      MHD_gc_hash_write (md, pw ? 128 : 64, (const char*) buf_i);
       memcpy (hash, MHD_gc_hash_read (md), 20);
       MHD_gc_hash_close (md);
       for (i = 1; i < iter; i++)
-        MHD_gc_hash_buffer (GC_SHA1, hash, 20, hash);
+        MHD_gc_hash_buffer (GC_SHA1, hash, 20, (char*) hash);
       for (i = 0; i < 20 && cur_keylen < req_keylen; i++)
         keybuf[cur_keylen++] = hash[i];
       if (cur_keylen == req_keylen)

+ 3 - 69
src/daemon/https/x509/x509.c

@@ -256,7 +256,7 @@ MHD_gnutls_x509_crt_get_signature_algorithm (MHD_gnutls_x509_crt_t cert)
       return result;
     }
 
-  result = MHD_gtls_x509_oid2sign_algorithm (sa.data);
+  result = MHD_gtls_x509_oid2sign_algorithm ((const char*) sa.data);
 
   MHD__gnutls_free_datum (&sa);
 
@@ -533,7 +533,7 @@ parse_general_name (ASN1_TYPE src,
       return MHD_gtls_asn2err (result);
     }
 
-  type = MHD__gnutls_x509_san_find_type (choice_type);
+  type = MHD__gnutls_x509_san_find_type ((char*) choice_type);
   if (type == (MHD_gnutls_x509_subject_alt_name_t) - 1)
     {
       MHD_gnutls_assert ();
@@ -636,7 +636,7 @@ parse_general_name (ASN1_TYPE src,
       size_t orig_name_size = *name_size;
 
       MHD_gtls_str_cat (nptr, sizeof (nptr), ".");
-      MHD_gtls_str_cat (nptr, sizeof (nptr), choice_type);
+      MHD_gtls_str_cat (nptr, sizeof (nptr), (const char*) choice_type);
 
       len = *name_size;
       result = MHD__asn1_read_value (src, nptr, name, &len);
@@ -942,72 +942,6 @@ MHD_gnutls_x509_crt_get_key_usage (MHD_gnutls_x509_crt_t cert,
 }
 
 
-/**
- * MHD_gnutls_x509_crt_get_extension_by_oid - This function returns the specified extension
- * @cert: should contain a MHD_gnutls_x509_crt_t structure
- * @oid: holds an Object Identified in null terminated string
- * @indx: In case multiple same OIDs exist in the extensions, this specifies which to send. Use zero to get the first one.
- * @buf: a pointer to a structure to hold the name (may be null)
- * @sizeof_buf: initially holds the size of @buf
- * @critical: will be non zero if the extension is marked as critical
- *
- * This function will return the extension specified by the OID in the certificate.
- * The extensions will be returned as binary data DER encoded, in the provided
- * buffer.
- *
- * A negative value may be returned in case of parsing error.
- * If the certificate does not contain the specified extension
- * GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
- *
- **/
-static int
-MHD_gnutls_x509_crt_get_extension_by_oid (MHD_gnutls_x509_crt_t cert,
-                                      const char *oid,
-                                      int indx,
-                                      void *buf,
-                                      size_t * sizeof_buf,
-                                      unsigned int *critical)
-{
-  int result;
-  MHD_gnutls_datum_t output;
-
-  if (cert == NULL)
-    {
-      MHD_gnutls_assert ();
-      return GNUTLS_E_INVALID_REQUEST;
-    }
-
-  if ((result = MHD__gnutls_x509_crt_get_extension (cert, oid, indx, &output,
-                                                critical)) < 0)
-    {
-      MHD_gnutls_assert ();
-      return result;
-    }
-
-  if (output.size == 0 || output.data == NULL)
-    {
-      MHD_gnutls_assert ();
-      return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE;
-    }
-
-  if (output.size > (unsigned int) *sizeof_buf)
-    {
-      *sizeof_buf = output.size;
-      MHD__gnutls_free_datum (&output);
-      return GNUTLS_E_SHORT_MEMORY_BUFFER;
-    }
-
-  *sizeof_buf = output.size;
-
-  if (buf)
-    memcpy (buf, output.data, output.size);
-
-  MHD__gnutls_free_datum (&output);
-
-  return 0;
-
-}
-
 static int
 MHD__gnutls_x509_crt_get_raw_dn2 (MHD_gnutls_x509_crt_t cert,
                               const char *whom, MHD_gnutls_datum_t * start)

+ 0 - 30
src/daemon/https/x509/x509_verify.c

@@ -601,36 +601,6 @@ _pkcs1_rsa_verify_sig (const MHD_gnutls_datum_t * text,
   return 0;
 }
 
-/* Hashes input data and verifies a DSA signature.
- */
-static int
-dsa_verify_sig (const MHD_gnutls_datum_t * text,
-                const MHD_gnutls_datum_t * signature,
-                mpi_t * params, int params_len)
-{
-  int ret;
-  opaque _digest[MAX_HASH_SIZE];
-  MHD_gnutls_datum_t digest;
-  GNUTLS_HASH_HANDLE hd;
-
-  hd = MHD_gtls_hash_init (MHD_GNUTLS_MAC_SHA1);
-  if (hd == NULL)
-    {
-      MHD_gnutls_assert ();
-      return GNUTLS_E_HASH_FAILED;
-    }
-
-  MHD_gnutls_hash (hd, text->data, text->size);
-  MHD_gnutls_hash_deinit (hd, _digest);
-
-  digest.data = _digest;
-  digest.size = 20;
-
-  ret = MHD_gtls_dsa_verify (&digest, signature, params, params_len);
-
-  return ret;
-}
-
 /* Verifies the signature data, and returns 0 if not verified,
  * or 1 otherwise.
  */