diff options
author | Christian Grothoff <christian@grothoff.org> | 2008-10-12 22:12:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2008-10-12 22:12:05 +0000 |
commit | 33b93e08da883c7180bc268f5be30acc26139326 (patch) | |
tree | 95f29c294c4792bdb8dfe873f084f9232ff3e65e | |
parent | f7947e0ad9a7cc4c770b149699f2ef096278c062 (diff) | |
download | libmicrohttpd-33b93e08da883c7180bc268f5be30acc26139326.tar.gz libmicrohttpd-33b93e08da883c7180bc268f5be30acc26139326.zip |
more dead code and warning elimination
-rw-r--r-- | src/daemon/https/x509/pkcs12_encr.c | 8 | ||||
-rw-r--r-- | src/daemon/https/x509/x509.c | 72 | ||||
-rw-r--r-- | src/daemon/https/x509/x509_verify.c | 30 |
3 files changed, 7 insertions, 103 deletions
diff --git a/src/daemon/https/x509/pkcs12_encr.c b/src/daemon/https/x509/pkcs12_encr.c index b50520e7..0cfb59e5 100644 --- a/src/daemon/https/x509/pkcs12_encr.c +++ b/src/daemon/https/x509/pkcs12_encr.c | |||
@@ -35,7 +35,7 @@ | |||
35 | static int | 35 | static int |
36 | MHD_pkcs12_check_pass (const char *pass, size_t plen) | 36 | MHD_pkcs12_check_pass (const char *pass, size_t plen) |
37 | { | 37 | { |
38 | const unsigned char *p = pass; | 38 | const char *p = pass; |
39 | unsigned int i; | 39 | unsigned int i; |
40 | 40 | ||
41 | for (i = 0; i < plen; i++) | 41 | for (i = 0; i < plen; i++) |
@@ -115,13 +115,13 @@ MHD_pkcs12_string_to_key (unsigned int id, const opaque * salt, | |||
115 | for (i = 0; i < 64; i++) | 115 | for (i = 0; i < 64; i++) |
116 | { | 116 | { |
117 | unsigned char lid = id & 0xFF; | 117 | unsigned char lid = id & 0xFF; |
118 | MHD_gc_hash_write (md, 1, &lid); | 118 | MHD_gc_hash_write (md, 1, (const char*) &lid); |
119 | } | 119 | } |
120 | MHD_gc_hash_write (md, pw ? 128 : 64, buf_i); | 120 | MHD_gc_hash_write (md, pw ? 128 : 64, (const char*) buf_i); |
121 | memcpy (hash, MHD_gc_hash_read (md), 20); | 121 | memcpy (hash, MHD_gc_hash_read (md), 20); |
122 | MHD_gc_hash_close (md); | 122 | MHD_gc_hash_close (md); |
123 | for (i = 1; i < iter; i++) | 123 | for (i = 1; i < iter; i++) |
124 | MHD_gc_hash_buffer (GC_SHA1, hash, 20, hash); | 124 | MHD_gc_hash_buffer (GC_SHA1, hash, 20, (char*) hash); |
125 | for (i = 0; i < 20 && cur_keylen < req_keylen; i++) | 125 | for (i = 0; i < 20 && cur_keylen < req_keylen; i++) |
126 | keybuf[cur_keylen++] = hash[i]; | 126 | keybuf[cur_keylen++] = hash[i]; |
127 | if (cur_keylen == req_keylen) | 127 | if (cur_keylen == req_keylen) |
diff --git a/src/daemon/https/x509/x509.c b/src/daemon/https/x509/x509.c index 343030cc..7bb907ab 100644 --- a/src/daemon/https/x509/x509.c +++ b/src/daemon/https/x509/x509.c | |||
@@ -256,7 +256,7 @@ MHD_gnutls_x509_crt_get_signature_algorithm (MHD_gnutls_x509_crt_t cert) | |||
256 | return result; | 256 | return result; |
257 | } | 257 | } |
258 | 258 | ||
259 | result = MHD_gtls_x509_oid2sign_algorithm (sa.data); | 259 | result = MHD_gtls_x509_oid2sign_algorithm ((const char*) sa.data); |
260 | 260 | ||
261 | MHD__gnutls_free_datum (&sa); | 261 | MHD__gnutls_free_datum (&sa); |
262 | 262 | ||
@@ -533,7 +533,7 @@ parse_general_name (ASN1_TYPE src, | |||
533 | return MHD_gtls_asn2err (result); | 533 | return MHD_gtls_asn2err (result); |
534 | } | 534 | } |
535 | 535 | ||
536 | type = MHD__gnutls_x509_san_find_type (choice_type); | 536 | type = MHD__gnutls_x509_san_find_type ((char*) choice_type); |
537 | if (type == (MHD_gnutls_x509_subject_alt_name_t) - 1) | 537 | if (type == (MHD_gnutls_x509_subject_alt_name_t) - 1) |
538 | { | 538 | { |
539 | MHD_gnutls_assert (); | 539 | MHD_gnutls_assert (); |
@@ -636,7 +636,7 @@ parse_general_name (ASN1_TYPE src, | |||
636 | size_t orig_name_size = *name_size; | 636 | size_t orig_name_size = *name_size; |
637 | 637 | ||
638 | MHD_gtls_str_cat (nptr, sizeof (nptr), "."); | 638 | MHD_gtls_str_cat (nptr, sizeof (nptr), "."); |
639 | MHD_gtls_str_cat (nptr, sizeof (nptr), choice_type); | 639 | MHD_gtls_str_cat (nptr, sizeof (nptr), (const char*) choice_type); |
640 | 640 | ||
641 | len = *name_size; | 641 | len = *name_size; |
642 | result = MHD__asn1_read_value (src, nptr, name, &len); | 642 | 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, | |||
942 | } | 942 | } |
943 | 943 | ||
944 | 944 | ||
945 | /** | ||
946 | * MHD_gnutls_x509_crt_get_extension_by_oid - This function returns the specified extension | ||
947 | * @cert: should contain a MHD_gnutls_x509_crt_t structure | ||
948 | * @oid: holds an Object Identified in null terminated string | ||
949 | * @indx: In case multiple same OIDs exist in the extensions, this specifies which to send. Use zero to get the first one. | ||
950 | * @buf: a pointer to a structure to hold the name (may be null) | ||
951 | * @sizeof_buf: initially holds the size of @buf | ||
952 | * @critical: will be non zero if the extension is marked as critical | ||
953 | * | ||
954 | * This function will return the extension specified by the OID in the certificate. | ||
955 | * The extensions will be returned as binary data DER encoded, in the provided | ||
956 | * buffer. | ||
957 | * | ||
958 | * A negative value may be returned in case of parsing error. | ||
959 | * If the certificate does not contain the specified extension | ||
960 | * GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. | ||
961 | * | ||
962 | **/ | ||
963 | static int | ||
964 | MHD_gnutls_x509_crt_get_extension_by_oid (MHD_gnutls_x509_crt_t cert, | ||
965 | const char *oid, | ||
966 | int indx, | ||
967 | void *buf, | ||
968 | size_t * sizeof_buf, | ||
969 | unsigned int *critical) | ||
970 | { | ||
971 | int result; | ||
972 | MHD_gnutls_datum_t output; | ||
973 | |||
974 | if (cert == NULL) | ||
975 | { | ||
976 | MHD_gnutls_assert (); | ||
977 | return GNUTLS_E_INVALID_REQUEST; | ||
978 | } | ||
979 | |||
980 | if ((result = MHD__gnutls_x509_crt_get_extension (cert, oid, indx, &output, | ||
981 | critical)) < 0) | ||
982 | { | ||
983 | MHD_gnutls_assert (); | ||
984 | return result; | ||
985 | } | ||
986 | |||
987 | if (output.size == 0 || output.data == NULL) | ||
988 | { | ||
989 | MHD_gnutls_assert (); | ||
990 | return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; | ||
991 | } | ||
992 | |||
993 | if (output.size > (unsigned int) *sizeof_buf) | ||
994 | { | ||
995 | *sizeof_buf = output.size; | ||
996 | MHD__gnutls_free_datum (&output); | ||
997 | return GNUTLS_E_SHORT_MEMORY_BUFFER; | ||
998 | } | ||
999 | |||
1000 | *sizeof_buf = output.size; | ||
1001 | |||
1002 | if (buf) | ||
1003 | memcpy (buf, output.data, output.size); | ||
1004 | |||
1005 | MHD__gnutls_free_datum (&output); | ||
1006 | |||
1007 | return 0; | ||
1008 | |||
1009 | } | ||
1010 | |||
1011 | static int | 945 | static int |
1012 | MHD__gnutls_x509_crt_get_raw_dn2 (MHD_gnutls_x509_crt_t cert, | 946 | MHD__gnutls_x509_crt_get_raw_dn2 (MHD_gnutls_x509_crt_t cert, |
1013 | const char *whom, MHD_gnutls_datum_t * start) | 947 | const char *whom, MHD_gnutls_datum_t * start) |
diff --git a/src/daemon/https/x509/x509_verify.c b/src/daemon/https/x509/x509_verify.c index cbeb7670..c85aa52e 100644 --- a/src/daemon/https/x509/x509_verify.c +++ b/src/daemon/https/x509/x509_verify.c | |||
@@ -601,36 +601,6 @@ _pkcs1_rsa_verify_sig (const MHD_gnutls_datum_t * text, | |||
601 | return 0; | 601 | return 0; |
602 | } | 602 | } |
603 | 603 | ||
604 | /* Hashes input data and verifies a DSA signature. | ||
605 | */ | ||
606 | static int | ||
607 | dsa_verify_sig (const MHD_gnutls_datum_t * text, | ||
608 | const MHD_gnutls_datum_t * signature, | ||
609 | mpi_t * params, int params_len) | ||
610 | { | ||
611 | int ret; | ||
612 | opaque _digest[MAX_HASH_SIZE]; | ||
613 | MHD_gnutls_datum_t digest; | ||
614 | GNUTLS_HASH_HANDLE hd; | ||
615 | |||
616 | hd = MHD_gtls_hash_init (MHD_GNUTLS_MAC_SHA1); | ||
617 | if (hd == NULL) | ||
618 | { | ||
619 | MHD_gnutls_assert (); | ||
620 | return GNUTLS_E_HASH_FAILED; | ||
621 | } | ||
622 | |||
623 | MHD_gnutls_hash (hd, text->data, text->size); | ||
624 | MHD_gnutls_hash_deinit (hd, _digest); | ||
625 | |||
626 | digest.data = _digest; | ||
627 | digest.size = 20; | ||
628 | |||
629 | ret = MHD_gtls_dsa_verify (&digest, signature, params, params_len); | ||
630 | |||
631 | return ret; | ||
632 | } | ||
633 | |||
634 | /* Verifies the signature data, and returns 0 if not verified, | 604 | /* Verifies the signature data, and returns 0 if not verified, |
635 | * or 1 otherwise. | 605 | * or 1 otherwise. |
636 | */ | 606 | */ |