diff options
author | Christian Grothoff <christian@grothoff.org> | 2008-11-15 07:56:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2008-11-15 07:56:41 +0000 |
commit | b83c672f3e2656ad33dae2c38d1cc1a7eb4f106b (patch) | |
tree | 834d1e683d676843e0bf86632b30fcfabe011427 | |
parent | 5d9a9723b3269dc58600d526dc719fa0bd525d3c (diff) | |
download | libmicrohttpd-b83c672f3e2656ad33dae2c38d1cc1a7eb4f106b.tar.gz libmicrohttpd-b83c672f3e2656ad33dae2c38d1cc1a7eb4f106b.zip |
more dead code elimination
-rw-r--r-- | doc/Doxyfile | 2 | ||||
-rw-r--r-- | src/daemon/daemon.c | 1 | ||||
-rw-r--r-- | src/daemon/https/lgl/asnprintf.c | 35 | ||||
-rw-r--r-- | src/daemon/https/lgl/des.c | 107 | ||||
-rw-r--r-- | src/daemon/https/lgl/gc-gnulib.c | 17 | ||||
-rw-r--r-- | src/daemon/https/lgl/gc-libgcrypt.c | 17 | ||||
-rw-r--r-- | src/daemon/https/lgl/gc.h | 7 | ||||
-rw-r--r-- | src/daemon/https/minitasn1/Makefile.am | 3 | ||||
-rw-r--r-- | src/daemon/https/minitasn1/coding.c | 1 | ||||
-rw-r--r-- | src/daemon/https/minitasn1/decoding.c | 1 | ||||
-rw-r--r-- | src/daemon/https/minitasn1/element.c | 11 | ||||
-rw-r--r-- | src/daemon/https/minitasn1/errors.c | 135 | ||||
-rw-r--r-- | src/daemon/https/minitasn1/errors.h | 30 | ||||
-rw-r--r-- | src/daemon/https/minitasn1/libtasn1.h | 4 | ||||
-rw-r--r-- | src/daemon/https/minitasn1/parser_aux.c | 1 | ||||
-rw-r--r-- | src/daemon/https/minitasn1/structure.c | 1 |
16 files changed, 2 insertions, 371 deletions
diff --git a/doc/Doxyfile b/doc/Doxyfile index a354c5b9..22cfbe9c 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile | |||
@@ -5,7 +5,7 @@ | |||
5 | #--------------------------------------------------------------------------- | 5 | #--------------------------------------------------------------------------- |
6 | DOXYFILE_ENCODING = UTF-8 | 6 | DOXYFILE_ENCODING = UTF-8 |
7 | PROJECT_NAME = "GNU libmicrohttpd" | 7 | PROJECT_NAME = "GNU libmicrohttpd" |
8 | PROJECT_NUMBER = 0.3.0 | 8 | PROJECT_NUMBER = 0.4.0 |
9 | OUTPUT_DIRECTORY = doc/doxygen/ | 9 | OUTPUT_DIRECTORY = doc/doxygen/ |
10 | CREATE_SUBDIRS = YES | 10 | CREATE_SUBDIRS = YES |
11 | OUTPUT_LANGUAGE = English | 11 | OUTPUT_LANGUAGE = English |
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index a0a50992..1f85c4b2 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include "connection_https.h" | 34 | #include "connection_https.h" |
35 | #include "gnutls_int.h" | 35 | #include "gnutls_int.h" |
36 | #include "gnutls_global.h" | 36 | #include "gnutls_global.h" |
37 | #include "auth_anon.h" | ||
38 | #endif | 37 | #endif |
39 | 38 | ||
40 | /** | 39 | /** |
diff --git a/src/daemon/https/lgl/asnprintf.c b/src/daemon/https/lgl/asnprintf.c deleted file mode 100644 index c9dbc04e..00000000 --- a/src/daemon/https/lgl/asnprintf.c +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* Formatted output to strings. | ||
2 | Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU Lesser General Public License as published by | ||
6 | the Free Software Foundation; either version 2.1, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
17 | |||
18 | #include "MHD_config.h" | ||
19 | |||
20 | /* Specification. */ | ||
21 | #include "vasnprintf.h" | ||
22 | |||
23 | #include <stdarg.h> | ||
24 | |||
25 | char * | ||
26 | asnprintf (char *resultbuf, size_t * lengthp, const char *format, ...) | ||
27 | { | ||
28 | va_list args; | ||
29 | char *result; | ||
30 | |||
31 | va_start (args, format); | ||
32 | result = vasnprintf (resultbuf, lengthp, format, args); | ||
33 | va_end (args); | ||
34 | return result; | ||
35 | } | ||
diff --git a/src/daemon/https/lgl/des.c b/src/daemon/https/lgl/des.c index dbe5f3c6..ecb09e41 100644 --- a/src/daemon/https/lgl/des.c +++ b/src/daemon/https/lgl/des.c | |||
@@ -79,13 +79,6 @@ | |||
79 | * unsigned char recoverd[8]; | 79 | * unsigned char recoverd[8]; |
80 | * MHD_gl_3des_ctx context; | 80 | * MHD_gl_3des_ctx context; |
81 | * | 81 | * |
82 | * // If you would like to use two 64bit keys, fill 'key1' and'key2' | ||
83 | * // then setup the encryption context: | ||
84 | * MHD_gl_3des_set2keys(&context, key1, key2); | ||
85 | * | ||
86 | * // To use three 64bit keys with Triple-DES use: | ||
87 | * MHD_gl_3des_set3keys(&context, key1, key2, key3); | ||
88 | * | ||
89 | * // Encrypting plaintext with Triple-DES | 82 | * // Encrypting plaintext with Triple-DES |
90 | * MHD_gl_3des_ecb_encrypt(&context, plaintext, ciphertext); | 83 | * MHD_gl_3des_ecb_encrypt(&context, plaintext, ciphertext); |
91 | * | 84 | * |
@@ -319,35 +312,6 @@ static const unsigned char weak_keys[64][8] = { | |||
319 | {0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe} /*w */ | 312 | {0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe} /*w */ |
320 | }; | 313 | }; |
321 | 314 | ||
322 | bool | ||
323 | MHD_gl_des_is_weak_key (const char *key) | ||
324 | { | ||
325 | char work[8]; | ||
326 | int i, left, right, middle, cmp_result; | ||
327 | |||
328 | /* clear parity bits */ | ||
329 | for (i = 0; i < 8; ++i) | ||
330 | work[i] = ((unsigned char) key[i]) & 0xfe; | ||
331 | |||
332 | /* binary search in the weak key table */ | ||
333 | left = 0; | ||
334 | right = 63; | ||
335 | while (left <= right) | ||
336 | { | ||
337 | middle = (left + right) / 2; | ||
338 | |||
339 | if (!(cmp_result = memcmp (work, weak_keys[middle], 8))) | ||
340 | return -1; | ||
341 | |||
342 | if (cmp_result > 0) | ||
343 | left = middle + 1; | ||
344 | else | ||
345 | right = middle - 1; | ||
346 | } | ||
347 | |||
348 | return 0; | ||
349 | } | ||
350 | |||
351 | /* | 315 | /* |
352 | * Macro to swap bits across two words. | 316 | * Macro to swap bits across two words. |
353 | */ | 317 | */ |
@@ -531,17 +495,6 @@ MHD_gl_des_setkey (MHD_gl_des_ctx * ctx, const char *key) | |||
531 | } | 495 | } |
532 | } | 496 | } |
533 | 497 | ||
534 | bool | ||
535 | MHD_gl_des_makekey (MHD_gl_des_ctx * ctx, const char *key, size_t keylen) | ||
536 | { | ||
537 | if (keylen != 8) | ||
538 | return false; | ||
539 | |||
540 | MHD_gl_des_setkey (ctx, key); | ||
541 | |||
542 | return !MHD_gl_des_is_weak_key (key); | ||
543 | } | ||
544 | |||
545 | void | 498 | void |
546 | MHD_gl_des_ecb_crypt (MHD_gl_des_ctx * ctx, const char *_from, char *_to, | 499 | MHD_gl_des_ecb_crypt (MHD_gl_des_ctx * ctx, const char *_from, char *_to, |
547 | int mode) | 500 | int mode) |
@@ -566,54 +519,6 @@ READ_64BIT_DATA (from, left, right) | |||
566 | FINAL_PERMUTATION (right, work, left) WRITE_64BIT_DATA (to, right, left)} | 519 | FINAL_PERMUTATION (right, work, left) WRITE_64BIT_DATA (to, right, left)} |
567 | 520 | ||
568 | void | 521 | void |
569 | MHD_gl_3des_set2keys (MHD_gl_3des_ctx * ctx, const char *key1, | ||
570 | const char *key2) | ||
571 | { | ||
572 | int i; | ||
573 | |||
574 | des_key_schedule (key1, ctx->encrypt_subkeys); | ||
575 | des_key_schedule (key2, &(ctx->decrypt_subkeys[32])); | ||
576 | |||
577 | for (i = 0; i < 32; i += 2) | ||
578 | { | ||
579 | ctx->decrypt_subkeys[i] = ctx->encrypt_subkeys[30 - i]; | ||
580 | ctx->decrypt_subkeys[i + 1] = ctx->encrypt_subkeys[31 - i]; | ||
581 | |||
582 | ctx->encrypt_subkeys[i + 32] = ctx->decrypt_subkeys[62 - i]; | ||
583 | ctx->encrypt_subkeys[i + 33] = ctx->decrypt_subkeys[63 - i]; | ||
584 | |||
585 | ctx->encrypt_subkeys[i + 64] = ctx->encrypt_subkeys[i]; | ||
586 | ctx->encrypt_subkeys[i + 65] = ctx->encrypt_subkeys[i + 1]; | ||
587 | |||
588 | ctx->decrypt_subkeys[i + 64] = ctx->decrypt_subkeys[i]; | ||
589 | ctx->decrypt_subkeys[i + 65] = ctx->decrypt_subkeys[i + 1]; | ||
590 | } | ||
591 | } | ||
592 | |||
593 | void | ||
594 | MHD_gl_3des_set3keys (MHD_gl_3des_ctx * ctx, const char *key1, | ||
595 | const char *key2, const char *key3) | ||
596 | { | ||
597 | int i; | ||
598 | |||
599 | des_key_schedule (key1, ctx->encrypt_subkeys); | ||
600 | des_key_schedule (key2, &(ctx->decrypt_subkeys[32])); | ||
601 | des_key_schedule (key3, &(ctx->encrypt_subkeys[64])); | ||
602 | |||
603 | for (i = 0; i < 32; i += 2) | ||
604 | { | ||
605 | ctx->decrypt_subkeys[i] = ctx->encrypt_subkeys[94 - i]; | ||
606 | ctx->decrypt_subkeys[i + 1] = ctx->encrypt_subkeys[95 - i]; | ||
607 | |||
608 | ctx->encrypt_subkeys[i + 32] = ctx->decrypt_subkeys[62 - i]; | ||
609 | ctx->encrypt_subkeys[i + 33] = ctx->decrypt_subkeys[63 - i]; | ||
610 | |||
611 | ctx->decrypt_subkeys[i + 64] = ctx->encrypt_subkeys[30 - i]; | ||
612 | ctx->decrypt_subkeys[i + 65] = ctx->encrypt_subkeys[31 - i]; | ||
613 | } | ||
614 | } | ||
615 | |||
616 | void | ||
617 | MHD_gl_3des_ecb_crypt (MHD_gl_3des_ctx * ctx, const char *_from, char *_to, | 522 | MHD_gl_3des_ecb_crypt (MHD_gl_3des_ctx * ctx, const char *_from, char *_to, |
618 | int mode) | 523 | int mode) |
619 | { | 524 | { |
@@ -652,15 +557,3 @@ READ_64BIT_DATA (from, left, right) | |||
652 | DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) | 557 | DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) |
653 | FINAL_PERMUTATION (right, work, left) WRITE_64BIT_DATA (to, right, left)} | 558 | FINAL_PERMUTATION (right, work, left) WRITE_64BIT_DATA (to, right, left)} |
654 | 559 | ||
655 | bool | ||
656 | MHD_gl_3des_makekey (MHD_gl_3des_ctx * ctx, const char *key, size_t keylen) | ||
657 | { | ||
658 | if (keylen != 24) | ||
659 | return false; | ||
660 | |||
661 | MHD_gl_3des_set3keys (ctx, key, key + 8, key + 16); | ||
662 | |||
663 | return !(MHD_gl_des_is_weak_key (key) | ||
664 | || MHD_gl_des_is_weak_key (key + 8) | ||
665 | || MHD_gl_des_is_weak_key (key + 16)); | ||
666 | } | ||
diff --git a/src/daemon/https/lgl/gc-gnulib.c b/src/daemon/https/lgl/gc-gnulib.c index 52fce18b..d5478fa9 100644 --- a/src/daemon/https/lgl/gc-gnulib.c +++ b/src/daemon/https/lgl/gc-gnulib.c | |||
@@ -150,24 +150,7 @@ MHD_gc_pseudo_random (char *data, size_t datalen) | |||
150 | return randomize (1, data, datalen); | 150 | return randomize (1, data, datalen); |
151 | } | 151 | } |
152 | 152 | ||
153 | Gc_rc | ||
154 | MHD_gc_random (char *data, size_t datalen) | ||
155 | { | ||
156 | return randomize (2, data, datalen); | ||
157 | } | ||
158 | |||
159 | #endif | 153 | #endif |
160 | |||
161 | /* Memory allocation. */ | ||
162 | void | ||
163 | MHD_gc_set_allocators (MHD_gc_malloc_t func_malloc, | ||
164 | MHD_gc_malloc_t secure_malloc, | ||
165 | MHD_gc_secure_check_t secure_check, | ||
166 | MHD_gc_realloc_t func_realloc, MHD_gc_free_t func_free) | ||
167 | { | ||
168 | return; | ||
169 | } | ||
170 | |||
171 | /* Ciphers. */ | 154 | /* Ciphers. */ |
172 | 155 | ||
173 | typedef struct _MHD_gc_cipher_ctx | 156 | typedef struct _MHD_gc_cipher_ctx |
diff --git a/src/daemon/https/lgl/gc-libgcrypt.c b/src/daemon/https/lgl/gc-libgcrypt.c index e4429bd2..9d91c45c 100644 --- a/src/daemon/https/lgl/gc-libgcrypt.c +++ b/src/daemon/https/lgl/gc-libgcrypt.c | |||
@@ -77,27 +77,10 @@ MHD_gc_pseudo_random (char *data, size_t datalen) | |||
77 | return GC_OK; | 77 | return GC_OK; |
78 | } | 78 | } |
79 | 79 | ||
80 | Gc_rc | ||
81 | MHD_gc_random (char *data, size_t datalen) | ||
82 | { | ||
83 | gcry_randomize ((unsigned char *) data, datalen, GCRY_VERY_STRONG_RANDOM); | ||
84 | return GC_OK; | ||
85 | } | ||
86 | |||
87 | #endif | 80 | #endif |
88 | 81 | ||
89 | /* Memory allocation. */ | 82 | /* Memory allocation. */ |
90 | 83 | ||
91 | void | ||
92 | MHD_gc_set_allocators (MHD_gc_malloc_t func_malloc, | ||
93 | MHD_gc_malloc_t secure_malloc, | ||
94 | MHD_gc_secure_check_t secure_check, | ||
95 | MHD_gc_realloc_t func_realloc, MHD_gc_free_t func_free) | ||
96 | { | ||
97 | gcry_set_allocation_handler (func_malloc, secure_malloc, secure_check, | ||
98 | func_realloc, func_free); | ||
99 | } | ||
100 | |||
101 | /* Ciphers. */ | 84 | /* Ciphers. */ |
102 | 85 | ||
103 | Gc_rc | 86 | Gc_rc |
diff --git a/src/daemon/https/lgl/gc.h b/src/daemon/https/lgl/gc.h index 4d6b2c93..dc873a54 100644 --- a/src/daemon/https/lgl/gc.h +++ b/src/daemon/https/lgl/gc.h | |||
@@ -104,16 +104,9 @@ typedef void *(*MHD_gc_malloc_t) (size_t n); | |||
104 | typedef int (*MHD_gc_secure_check_t) (const void *); | 104 | typedef int (*MHD_gc_secure_check_t) (const void *); |
105 | typedef void *(*MHD_gc_realloc_t) (void *p, size_t n); | 105 | typedef void *(*MHD_gc_realloc_t) (void *p, size_t n); |
106 | typedef void (*MHD_gc_free_t) (void *); | 106 | typedef void (*MHD_gc_free_t) (void *); |
107 | void MHD_gc_set_allocators (MHD_gc_malloc_t func_malloc, | ||
108 | MHD_gc_malloc_t secure_malloc, | ||
109 | MHD_gc_secure_check_t secure_check, | ||
110 | MHD_gc_realloc_t func_realloc, | ||
111 | MHD_gc_free_t func_free); | ||
112 | |||
113 | /* Randomness. */ | 107 | /* Randomness. */ |
114 | Gc_rc MHD_gc_nonce (char *data, size_t datalen); | 108 | Gc_rc MHD_gc_nonce (char *data, size_t datalen); |
115 | Gc_rc MHD_gc_pseudo_random (char *data, size_t datalen); | 109 | Gc_rc MHD_gc_pseudo_random (char *data, size_t datalen); |
116 | Gc_rc MHD_gc_random (char *data, size_t datalen); | ||
117 | 110 | ||
118 | /* Ciphers. */ | 111 | /* Ciphers. */ |
119 | Gc_rc MHD_gc_cipher_open (Gc_cipher cipher, | 112 | Gc_rc MHD_gc_cipher_open (Gc_cipher cipher, |
diff --git a/src/daemon/https/minitasn1/Makefile.am b/src/daemon/https/minitasn1/Makefile.am index 4cd9f34e..34e56d13 100644 --- a/src/daemon/https/minitasn1/Makefile.am +++ b/src/daemon/https/minitasn1/Makefile.am | |||
@@ -10,7 +10,6 @@ libasn1_la_SOURCES = \ | |||
10 | libtasn1.h \ | 10 | libtasn1.h \ |
11 | mem.h \ | 11 | mem.h \ |
12 | gstr.h \ | 12 | gstr.h \ |
13 | errors.h \ | ||
14 | int.h \ | 13 | int.h \ |
15 | parser_aux.h structure.h element.h decoding.c gstr.c errors.c \ | 14 | parser_aux.h structure.h element.h decoding.c gstr.c \ |
16 | parser_aux.c structure.c element.c coding.c | 15 | parser_aux.c structure.c element.c coding.c |
diff --git a/src/daemon/https/minitasn1/coding.c b/src/daemon/https/minitasn1/coding.c index aa2aecb6..fe612299 100644 --- a/src/daemon/https/minitasn1/coding.c +++ b/src/daemon/https/minitasn1/coding.c | |||
@@ -28,7 +28,6 @@ | |||
28 | /*****************************************************/ | 28 | /*****************************************************/ |
29 | 29 | ||
30 | #include <int.h> | 30 | #include <int.h> |
31 | #include <errors.h> | ||
32 | #include "parser_aux.h" | 31 | #include "parser_aux.h" |
33 | #include <gstr.h> | 32 | #include <gstr.h> |
34 | #include "element.h" | 33 | #include "element.h" |
diff --git a/src/daemon/https/minitasn1/decoding.c b/src/daemon/https/minitasn1/decoding.c index fe0eaef7..9a4e23a3 100644 --- a/src/daemon/https/minitasn1/decoding.c +++ b/src/daemon/https/minitasn1/decoding.c | |||
@@ -27,7 +27,6 @@ | |||
27 | /*****************************************************/ | 27 | /*****************************************************/ |
28 | 28 | ||
29 | #include <int.h> | 29 | #include <int.h> |
30 | #include <errors.h> | ||
31 | #include "parser_aux.h" | 30 | #include "parser_aux.h" |
32 | #include <gstr.h> | 31 | #include <gstr.h> |
33 | #include "structure.h" | 32 | #include "structure.h" |
diff --git a/src/daemon/https/minitasn1/element.c b/src/daemon/https/minitasn1/element.c index 7cda2174..4834c604 100644 --- a/src/daemon/https/minitasn1/element.c +++ b/src/daemon/https/minitasn1/element.c | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | 29 | ||
30 | #include <int.h> | 30 | #include <int.h> |
31 | #include <errors.h> | ||
32 | #include "parser_aux.h" | 31 | #include "parser_aux.h" |
33 | #include <gstr.h> | 32 | #include <gstr.h> |
34 | #include "structure.h" | 33 | #include "structure.h" |
@@ -115,16 +114,6 @@ MHD__asn1_convert_integer (const char *value, unsigned char *value_out, | |||
115 | for (k2 = k; k2 < SIZEOF_UNSIGNED_LONG_INT; k2++) | 114 | for (k2 = k; k2 < SIZEOF_UNSIGNED_LONG_INT; k2++) |
116 | value_out[k2 - k] = val[k2]; | 115 | value_out[k2 - k] = val[k2]; |
117 | 116 | ||
118 | |||
119 | #ifdef LIBTASN1_DEBUG_INTEGER | ||
120 | MHD__libtasn1_log ("MHD__asn1_convert_integer: valueIn=%s, lenOut=%d", | ||
121 | value, *len); | ||
122 | for (k = 0; k < SIZEOF_UNSIGNED_LONG_INT; k++) | ||
123 | MHD__libtasn1_log (", vOut[%d]=%d", k, value_out[k]); | ||
124 | MHD__libtasn1_log ("\n"); | ||
125 | #endif | ||
126 | |||
127 | |||
128 | return ASN1_SUCCESS; | 117 | return ASN1_SUCCESS; |
129 | } | 118 | } |
130 | 119 | ||
diff --git a/src/daemon/https/minitasn1/errors.c b/src/daemon/https/minitasn1/errors.c deleted file mode 100644 index 72b61938..00000000 --- a/src/daemon/https/minitasn1/errors.c +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Free Software Foundation, Inc. | ||
3 | * Copyright (C) 2002, 2005 Fabio Fiorina | ||
4 | * | ||
5 | * This file is part of LIBTASN1. | ||
6 | * | ||
7 | * The LIBTASN1 library is free software; you can redistribute it | ||
8 | * and/or modify it under the terms of the GNU Lesser General Public | ||
9 | * License as published by the Free Software Foundation; either | ||
10 | * version 2.1 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This library is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * Lesser General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this library; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
20 | * 02110-1301, USA | ||
21 | */ | ||
22 | |||
23 | #include <int.h> | ||
24 | #include "errors.h" | ||
25 | #ifdef STDC_HEADERS | ||
26 | # include <stdarg.h> | ||
27 | #endif | ||
28 | |||
29 | |||
30 | #define LIBTASN1_ERROR_ENTRY(name) \ | ||
31 | { #name, name } | ||
32 | |||
33 | struct MHD__libtasn1_error_entry | ||
34 | { | ||
35 | const char *name; | ||
36 | int number; | ||
37 | }; | ||
38 | typedef struct MHD__libtasn1_error_entry MHD__libtasn1_error_entry; | ||
39 | |||
40 | static const MHD__libtasn1_error_entry error_algorithms[] = { | ||
41 | LIBTASN1_ERROR_ENTRY (ASN1_SUCCESS), | ||
42 | LIBTASN1_ERROR_ENTRY (ASN1_FILE_NOT_FOUND), | ||
43 | LIBTASN1_ERROR_ENTRY (ASN1_ELEMENT_NOT_FOUND), | ||
44 | LIBTASN1_ERROR_ENTRY (ASN1_IDENTIFIER_NOT_FOUND), | ||
45 | LIBTASN1_ERROR_ENTRY (ASN1_DER_ERROR), | ||
46 | LIBTASN1_ERROR_ENTRY (ASN1_VALUE_NOT_FOUND), | ||
47 | LIBTASN1_ERROR_ENTRY (ASN1_GENERIC_ERROR), | ||
48 | LIBTASN1_ERROR_ENTRY (ASN1_VALUE_NOT_VALID), | ||
49 | LIBTASN1_ERROR_ENTRY (ASN1_TAG_ERROR), | ||
50 | LIBTASN1_ERROR_ENTRY (ASN1_TAG_IMPLICIT), | ||
51 | LIBTASN1_ERROR_ENTRY (ASN1_ERROR_TYPE_ANY), | ||
52 | LIBTASN1_ERROR_ENTRY (ASN1_SYNTAX_ERROR), | ||
53 | LIBTASN1_ERROR_ENTRY (ASN1_MEM_ERROR), | ||
54 | LIBTASN1_ERROR_ENTRY (ASN1_MEM_ALLOC_ERROR), | ||
55 | LIBTASN1_ERROR_ENTRY (ASN1_DER_OVERFLOW), | ||
56 | LIBTASN1_ERROR_ENTRY (ASN1_NAME_TOO_LONG), | ||
57 | LIBTASN1_ERROR_ENTRY (ASN1_ARRAY_ERROR), | ||
58 | LIBTASN1_ERROR_ENTRY (ASN1_ELEMENT_NOT_EMPTY), | ||
59 | {0} | ||
60 | }; | ||
61 | |||
62 | #define LIBTASN1_ERROR_LOOP(b) \ | ||
63 | const MHD__libtasn1_error_entry *p; \ | ||
64 | for(p = error_algorithms; p->name != NULL; p++) { b ; } | ||
65 | |||
66 | #define LIBTASN1_ERROR_ALG_LOOP(a) \ | ||
67 | LIBTASN1_ERROR_LOOP( if(p->number == error) { a; break; } ) | ||
68 | |||
69 | |||
70 | |||
71 | /** | ||
72 | * MHD__libtasn1_perror - prints a string to stderr with a description of an error | ||
73 | * @error: is an error returned by a libtasn1 function. | ||
74 | * | ||
75 | * This function is like perror(). The only difference is that it | ||
76 | * accepts an error returned by a libtasn1 function. | ||
77 | **/ | ||
78 | void | ||
79 | MHD__libtasn1_perror (MHD__asn1_retCode error) | ||
80 | { | ||
81 | const char *ret = NULL; | ||
82 | |||
83 | /* avoid prefix */ | ||
84 | LIBTASN1_ERROR_ALG_LOOP (ret = p->name + sizeof ("ASN1_") - 1); | ||
85 | |||
86 | fprintf (stderr, "LIBTASN1 ERROR: %s\n", ret); | ||
87 | |||
88 | } | ||
89 | |||
90 | |||
91 | /** | ||
92 | * MHD__libtasn1_strerror - Returns a string with a description of an error | ||
93 | * @error: is an error returned by a libtasn1 function. | ||
94 | * | ||
95 | * This function is similar to strerror(). The only difference is | ||
96 | * that it accepts an error (number) returned by a libtasn1 function. | ||
97 | * | ||
98 | * Returns: Pointer to static zero-terminated string describing error | ||
99 | * code. | ||
100 | **/ | ||
101 | const char * | ||
102 | MHD__libtasn1_strerror (MHD__asn1_retCode error) | ||
103 | { | ||
104 | const char *ret = NULL; | ||
105 | |||
106 | /* avoid prefix */ | ||
107 | LIBTASN1_ERROR_ALG_LOOP (ret = p->name + sizeof ("ASN1_") - 1); | ||
108 | |||
109 | return ret; | ||
110 | } | ||
111 | |||
112 | /* this function will output a message. | ||
113 | */ | ||
114 | #ifdef LIBTASN1_DEBUG | ||
115 | void | ||
116 | MHD__libtasn1_log (const char *fmt, ...) | ||
117 | { | ||
118 | va_list args; | ||
119 | char str[MAX_LOG_SIZE]; | ||
120 | |||
121 | va_start (args, fmt); | ||
122 | vsprintf (str, fmt, args); /* Flawfinder: ignore */ | ||
123 | va_end (args); | ||
124 | |||
125 | fprintf (stderr, str); | ||
126 | |||
127 | return; | ||
128 | } | ||
129 | #else /* not DEBUG */ | ||
130 | void | ||
131 | MHD__libtasn1_log (const char *fmt, ...) | ||
132 | { | ||
133 | return; | ||
134 | } | ||
135 | #endif /* DEBUG */ | ||
diff --git a/src/daemon/https/minitasn1/errors.h b/src/daemon/https/minitasn1/errors.h deleted file mode 100644 index cb5536ba..00000000 --- a/src/daemon/https/minitasn1/errors.h +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004, 2006 Free Software Foundation, Inc. | ||
3 | * Copyright (C) 2002 Fabio Fiorina | ||
4 | * | ||
5 | * This file is part of LIBTASN1. | ||
6 | * | ||
7 | * The LIBTASN1 library is free software; you can redistribute it | ||
8 | * and/or modify it under the terms of the GNU Lesser General Public | ||
9 | * License as published by the Free Software Foundation; either | ||
10 | * version 2.1 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This library is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * Lesser General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this library; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
20 | * 02110-1301, USA | ||
21 | */ | ||
22 | |||
23 | #ifndef ERRORS_H | ||
24 | #define ERRORS_H | ||
25 | |||
26 | #include "int.h" | ||
27 | |||
28 | void MHD__libtasn1_log (const char *fmt, ...); | ||
29 | |||
30 | #endif /* ERRORS_H */ | ||
diff --git a/src/daemon/https/minitasn1/libtasn1.h b/src/daemon/https/minitasn1/libtasn1.h index 15292cd4..7cc3672b 100644 --- a/src/daemon/https/minitasn1/libtasn1.h +++ b/src/daemon/https/minitasn1/libtasn1.h | |||
@@ -186,10 +186,6 @@ extern "C" | |||
186 | const char *MHD__asn1_find_structure_from_oid (ASN1_TYPE definitions, | 186 | const char *MHD__asn1_find_structure_from_oid (ASN1_TYPE definitions, |
187 | const char *oidValue); | 187 | const char *oidValue); |
188 | 188 | ||
189 | const char *MHD__libtasn1_strerror (MHD__asn1_retCode error); | ||
190 | |||
191 | void MHD__libtasn1_perror (MHD__asn1_retCode error); | ||
192 | |||
193 | /* DER utility functions. */ | 189 | /* DER utility functions. */ |
194 | 190 | ||
195 | int MHD__asn1_get_tag_der (const unsigned char *der, int der_len, | 191 | int MHD__asn1_get_tag_der (const unsigned char *der, int der_len, |
diff --git a/src/daemon/https/minitasn1/parser_aux.c b/src/daemon/https/minitasn1/parser_aux.c index 438b8e76..0643ff4c 100644 --- a/src/daemon/https/minitasn1/parser_aux.c +++ b/src/daemon/https/minitasn1/parser_aux.c | |||
@@ -21,7 +21,6 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <int.h> | 23 | #include <int.h> |
24 | #include <errors.h> | ||
25 | #include "parser_aux.h" | 24 | #include "parser_aux.h" |
26 | #include "gstr.h" | 25 | #include "gstr.h" |
27 | #include "structure.h" | 26 | #include "structure.h" |
diff --git a/src/daemon/https/minitasn1/structure.c b/src/daemon/https/minitasn1/structure.c index 8a5c899d..7f72661f 100644 --- a/src/daemon/https/minitasn1/structure.c +++ b/src/daemon/https/minitasn1/structure.c | |||
@@ -29,7 +29,6 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | #include <int.h> | 31 | #include <int.h> |
32 | #include <errors.h> | ||
33 | #include <structure.h> | 32 | #include <structure.h> |
34 | #include "parser_aux.h" | 33 | #include "parser_aux.h" |
35 | #include <gstr.h> | 34 | #include <gstr.h> |