diff options
Diffstat (limited to 'src/lib/libcrypto/conf')
-rw-r--r-- | src/lib/libcrypto/conf/README | 78 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf.h | 250 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_api.c | 308 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_api.h | 89 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_def.c | 750 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_def.h | 180 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_err.c | 130 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_lib.c | 401 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_mall.c | 80 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_mod.c | 616 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_sap.c | 111 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/keysets.pl | 185 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/ssleay.cnf | 78 |
13 files changed, 0 insertions, 3256 deletions
diff --git a/src/lib/libcrypto/conf/README b/src/lib/libcrypto/conf/README deleted file mode 100644 index ca58d0240f..0000000000 --- a/src/lib/libcrypto/conf/README +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | WARNING WARNING WARNING!!! | ||
2 | |||
3 | This stuff is experimental, may change radically or be deleted altogether | ||
4 | before OpenSSL 0.9.7 release. You have been warned! | ||
5 | |||
6 | Configuration modules. These are a set of modules which can perform | ||
7 | various configuration functions. | ||
8 | |||
9 | Currently the routines should be called at most once when an application | ||
10 | starts up: that is before it starts any threads. | ||
11 | |||
12 | The routines read a configuration file set up like this: | ||
13 | |||
14 | ----- | ||
15 | #default section | ||
16 | openssl_init=init_section | ||
17 | |||
18 | [init_section] | ||
19 | |||
20 | module1=value1 | ||
21 | #Second instance of module1 | ||
22 | module1.1=valueX | ||
23 | module2=value2 | ||
24 | module3=dso_literal | ||
25 | module4=dso_section | ||
26 | |||
27 | [dso_section] | ||
28 | |||
29 | path=/some/path/to/some/dso.so | ||
30 | other_stuff=other_value | ||
31 | ---- | ||
32 | |||
33 | When this file is loaded a configuration module with the specified | ||
34 | string (module* in the above example) is looked up and its init | ||
35 | function called as: | ||
36 | |||
37 | int conf_init_func(CONF_IMODULE *md, CONF *cnf); | ||
38 | |||
39 | The function can then take whatever action is appropriate, for example | ||
40 | further lookups based on the value. Multiple instances of the same | ||
41 | config module can be loaded. | ||
42 | |||
43 | When the application closes down the modules are cleaned up by calling | ||
44 | an optional finish function: | ||
45 | |||
46 | void conf_finish_func(CONF_IMODULE *md); | ||
47 | |||
48 | The finish functions are called in reverse order: that is the last module | ||
49 | loaded is the first one cleaned up. | ||
50 | |||
51 | If no module exists with a given name then an attempt is made to load | ||
52 | a DSO with the supplied name. This might mean that "module3" attempts | ||
53 | to load a DSO called libmodule3.so or module3.dll for example. An explicit | ||
54 | DSO name can be given by including a separate section as in the module4 example | ||
55 | above. | ||
56 | |||
57 | The DSO is expected to at least contain an initialization function: | ||
58 | |||
59 | int OPENSSL_init(CONF_IMODULE *md, CONF *cnf); | ||
60 | |||
61 | and may also include a finish function: | ||
62 | |||
63 | void OPENSSL_finish(CONF_IMODULE *md); | ||
64 | |||
65 | Static modules can also be added using, | ||
66 | |||
67 | int CONF_module_add(char *name, dso_mod_init_func *ifunc, dso_mod_finish_func *ffunc); | ||
68 | |||
69 | where "name" is the name in the configuration file this function corresponds to. | ||
70 | |||
71 | A set of builtin modules (currently only an ASN1 non functional test module) can be | ||
72 | added by calling OPENSSL_load_builtin_modules(). | ||
73 | |||
74 | The function OPENSSL_config() is intended as a simple configuration function that | ||
75 | any application can call to perform various default configuration tasks. It uses the | ||
76 | file openssl.cnf in the usual locations. | ||
77 | |||
78 | |||
diff --git a/src/lib/libcrypto/conf/conf.h b/src/lib/libcrypto/conf/conf.h deleted file mode 100644 index f4671442ab..0000000000 --- a/src/lib/libcrypto/conf/conf.h +++ /dev/null | |||
@@ -1,250 +0,0 @@ | |||
1 | /* crypto/conf/conf.h */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef HEADER_CONF_H | ||
60 | #define HEADER_CONF_H | ||
61 | |||
62 | #include <openssl/bio.h> | ||
63 | #include <openssl/lhash.h> | ||
64 | #include <openssl/stack.h> | ||
65 | #include <openssl/safestack.h> | ||
66 | #include <openssl/e_os2.h> | ||
67 | |||
68 | #ifdef __cplusplus | ||
69 | extern "C" { | ||
70 | #endif | ||
71 | |||
72 | typedef struct | ||
73 | { | ||
74 | char *section; | ||
75 | char *name; | ||
76 | char *value; | ||
77 | } CONF_VALUE; | ||
78 | |||
79 | DECLARE_STACK_OF(CONF_VALUE) | ||
80 | DECLARE_STACK_OF(CONF_MODULE) | ||
81 | DECLARE_STACK_OF(CONF_IMODULE) | ||
82 | |||
83 | struct conf_st; | ||
84 | typedef struct conf_st CONF; | ||
85 | struct conf_method_st; | ||
86 | typedef struct conf_method_st CONF_METHOD; | ||
87 | |||
88 | struct conf_method_st | ||
89 | { | ||
90 | const char *name; | ||
91 | CONF *(*create)(CONF_METHOD *meth); | ||
92 | int (*init)(CONF *conf); | ||
93 | int (*destroy)(CONF *conf); | ||
94 | int (*destroy_data)(CONF *conf); | ||
95 | int (*load_bio)(CONF *conf, BIO *bp, long *eline); | ||
96 | int (*dump)(const CONF *conf, BIO *bp); | ||
97 | int (*is_number)(const CONF *conf, char c); | ||
98 | int (*to_int)(const CONF *conf, char c); | ||
99 | int (*load)(CONF *conf, const char *name, long *eline); | ||
100 | }; | ||
101 | |||
102 | /* Module definitions */ | ||
103 | |||
104 | typedef struct conf_imodule_st CONF_IMODULE; | ||
105 | typedef struct conf_module_st CONF_MODULE; | ||
106 | |||
107 | /* DSO module function typedefs */ | ||
108 | typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf); | ||
109 | typedef void conf_finish_func(CONF_IMODULE *md); | ||
110 | |||
111 | #define CONF_MFLAGS_IGNORE_ERRORS 0x1 | ||
112 | #define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 | ||
113 | #define CONF_MFLAGS_SILENT 0x4 | ||
114 | #define CONF_MFLAGS_NO_DSO 0x8 | ||
115 | #define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 | ||
116 | |||
117 | int CONF_set_default_method(CONF_METHOD *meth); | ||
118 | void CONF_set_nconf(CONF *conf,LHASH *hash); | ||
119 | LHASH *CONF_load(LHASH *conf,const char *file,long *eline); | ||
120 | #ifndef OPENSSL_NO_FP_API | ||
121 | LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline); | ||
122 | #endif | ||
123 | LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline); | ||
124 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section); | ||
125 | char *CONF_get_string(LHASH *conf,const char *group,const char *name); | ||
126 | long CONF_get_number(LHASH *conf,const char *group,const char *name); | ||
127 | void CONF_free(LHASH *conf); | ||
128 | int CONF_dump_fp(LHASH *conf, FILE *out); | ||
129 | int CONF_dump_bio(LHASH *conf, BIO *out); | ||
130 | |||
131 | void OPENSSL_config(const char *config_name); | ||
132 | void OPENSSL_no_config(void); | ||
133 | |||
134 | /* New conf code. The semantics are different from the functions above. | ||
135 | If that wasn't the case, the above functions would have been replaced */ | ||
136 | |||
137 | struct conf_st | ||
138 | { | ||
139 | CONF_METHOD *meth; | ||
140 | void *meth_data; | ||
141 | LHASH *data; | ||
142 | }; | ||
143 | |||
144 | CONF *NCONF_new(CONF_METHOD *meth); | ||
145 | CONF_METHOD *NCONF_default(void); | ||
146 | CONF_METHOD *NCONF_WIN32(void); | ||
147 | #if 0 /* Just to give you an idea of what I have in mind */ | ||
148 | CONF_METHOD *NCONF_XML(void); | ||
149 | #endif | ||
150 | void NCONF_free(CONF *conf); | ||
151 | void NCONF_free_data(CONF *conf); | ||
152 | |||
153 | int NCONF_load(CONF *conf,const char *file,long *eline); | ||
154 | #ifndef OPENSSL_NO_FP_API | ||
155 | int NCONF_load_fp(CONF *conf, FILE *fp,long *eline); | ||
156 | #endif | ||
157 | int NCONF_load_bio(CONF *conf, BIO *bp,long *eline); | ||
158 | STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section); | ||
159 | char *NCONF_get_string(const CONF *conf,const char *group,const char *name); | ||
160 | int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, | ||
161 | long *result); | ||
162 | int NCONF_dump_fp(const CONF *conf, FILE *out); | ||
163 | int NCONF_dump_bio(const CONF *conf, BIO *out); | ||
164 | |||
165 | #if 0 /* The following function has no error checking, | ||
166 | and should therefore be avoided */ | ||
167 | long NCONF_get_number(CONF *conf,char *group,char *name); | ||
168 | #else | ||
169 | #define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) | ||
170 | #endif | ||
171 | |||
172 | /* Module functions */ | ||
173 | |||
174 | int CONF_modules_load(const CONF *cnf, const char *appname, | ||
175 | unsigned long flags); | ||
176 | int CONF_modules_load_file(const char *filename, const char *appname, | ||
177 | unsigned long flags); | ||
178 | void CONF_modules_unload(int all); | ||
179 | void CONF_modules_finish(void); | ||
180 | void CONF_modules_free(void); | ||
181 | int CONF_module_add(const char *name, conf_init_func *ifunc, | ||
182 | conf_finish_func *ffunc); | ||
183 | |||
184 | const char *CONF_imodule_get_name(const CONF_IMODULE *md); | ||
185 | const char *CONF_imodule_get_value(const CONF_IMODULE *md); | ||
186 | void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); | ||
187 | void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); | ||
188 | CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); | ||
189 | unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); | ||
190 | void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); | ||
191 | void *CONF_module_get_usr_data(CONF_MODULE *pmod); | ||
192 | void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); | ||
193 | |||
194 | char *CONF_get1_default_config_file(void); | ||
195 | |||
196 | int CONF_parse_list(const char *list, int sep, int nospc, | ||
197 | int (*list_cb)(const char *elem, int len, void *usr), void *arg); | ||
198 | |||
199 | void OPENSSL_load_builtin_modules(void); | ||
200 | |||
201 | /* BEGIN ERROR CODES */ | ||
202 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
203 | * made after this point may be overwritten when the script is next run. | ||
204 | */ | ||
205 | void ERR_load_CONF_strings(void); | ||
206 | |||
207 | /* Error codes for the CONF functions. */ | ||
208 | |||
209 | /* Function codes. */ | ||
210 | #define CONF_F_CONF_DUMP_FP 104 | ||
211 | #define CONF_F_CONF_LOAD 100 | ||
212 | #define CONF_F_CONF_LOAD_BIO 102 | ||
213 | #define CONF_F_CONF_LOAD_FP 103 | ||
214 | #define CONF_F_CONF_MODULES_LOAD 116 | ||
215 | #define CONF_F_MODULE_INIT 115 | ||
216 | #define CONF_F_MODULE_LOAD_DSO 117 | ||
217 | #define CONF_F_MODULE_RUN 118 | ||
218 | #define CONF_F_NCONF_DUMP_BIO 105 | ||
219 | #define CONF_F_NCONF_DUMP_FP 106 | ||
220 | #define CONF_F_NCONF_GET_NUMBER 107 | ||
221 | #define CONF_F_NCONF_GET_NUMBER_E 112 | ||
222 | #define CONF_F_NCONF_GET_SECTION 108 | ||
223 | #define CONF_F_NCONF_GET_STRING 109 | ||
224 | #define CONF_F_NCONF_LOAD 113 | ||
225 | #define CONF_F_NCONF_LOAD_BIO 110 | ||
226 | #define CONF_F_NCONF_LOAD_FP 114 | ||
227 | #define CONF_F_NCONF_NEW 111 | ||
228 | #define CONF_F_STR_COPY 101 | ||
229 | |||
230 | /* Reason codes. */ | ||
231 | #define CONF_R_ERROR_LOADING_DSO 110 | ||
232 | #define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 | ||
233 | #define CONF_R_MISSING_EQUAL_SIGN 101 | ||
234 | #define CONF_R_MISSING_FINISH_FUNCTION 111 | ||
235 | #define CONF_R_MISSING_INIT_FUNCTION 112 | ||
236 | #define CONF_R_MODULE_INITIALIZATION_ERROR 109 | ||
237 | #define CONF_R_NO_CLOSE_BRACE 102 | ||
238 | #define CONF_R_NO_CONF 105 | ||
239 | #define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 | ||
240 | #define CONF_R_NO_SECTION 107 | ||
241 | #define CONF_R_NO_SUCH_FILE 114 | ||
242 | #define CONF_R_NO_VALUE 108 | ||
243 | #define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 | ||
244 | #define CONF_R_UNKNOWN_MODULE_NAME 113 | ||
245 | #define CONF_R_VARIABLE_HAS_NO_VALUE 104 | ||
246 | |||
247 | #ifdef __cplusplus | ||
248 | } | ||
249 | #endif | ||
250 | #endif | ||
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c deleted file mode 100644 index 0032baa711..0000000000 --- a/src/lib/libcrypto/conf/conf_api.c +++ /dev/null | |||
@@ -1,308 +0,0 @@ | |||
1 | /* conf_api.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* Part of the code in here was originally in conf.c, which is now removed */ | ||
60 | |||
61 | #ifndef CONF_DEBUG | ||
62 | # undef NDEBUG /* avoid conflicting definitions */ | ||
63 | # define NDEBUG | ||
64 | #endif | ||
65 | |||
66 | #include <assert.h> | ||
67 | #include <string.h> | ||
68 | #include <openssl/conf.h> | ||
69 | #include <openssl/conf_api.h> | ||
70 | #include "e_os.h" | ||
71 | |||
72 | static void value_free_hash(CONF_VALUE *a, LHASH *conf); | ||
73 | static void value_free_stack(CONF_VALUE *a,LHASH *conf); | ||
74 | static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE *, LHASH *) | ||
75 | static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_stack, CONF_VALUE *, LHASH *) | ||
76 | /* We don't use function pointer casting or wrapper functions - but cast each | ||
77 | * callback parameter inside the callback functions. */ | ||
78 | /* static unsigned long hash(CONF_VALUE *v); */ | ||
79 | static unsigned long hash(const void *v_void); | ||
80 | /* static int cmp_conf(CONF_VALUE *a,CONF_VALUE *b); */ | ||
81 | static int cmp_conf(const void *a_void,const void *b_void); | ||
82 | |||
83 | /* Up until OpenSSL 0.9.5a, this was get_section */ | ||
84 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section) | ||
85 | { | ||
86 | CONF_VALUE *v,vv; | ||
87 | |||
88 | if ((conf == NULL) || (section == NULL)) return(NULL); | ||
89 | vv.name=NULL; | ||
90 | vv.section=(char *)section; | ||
91 | v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); | ||
92 | return(v); | ||
93 | } | ||
94 | |||
95 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ | ||
96 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, | ||
97 | const char *section) | ||
98 | { | ||
99 | CONF_VALUE *v; | ||
100 | |||
101 | v=_CONF_get_section(conf,section); | ||
102 | if (v != NULL) | ||
103 | return((STACK_OF(CONF_VALUE) *)v->value); | ||
104 | else | ||
105 | return(NULL); | ||
106 | } | ||
107 | |||
108 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) | ||
109 | { | ||
110 | CONF_VALUE *v = NULL; | ||
111 | STACK_OF(CONF_VALUE) *ts; | ||
112 | |||
113 | ts = (STACK_OF(CONF_VALUE) *)section->value; | ||
114 | |||
115 | value->section=section->section; | ||
116 | if (!sk_CONF_VALUE_push(ts,value)) | ||
117 | { | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | v = (CONF_VALUE *)lh_insert(conf->data, value); | ||
122 | if (v != NULL) | ||
123 | { | ||
124 | sk_CONF_VALUE_delete_ptr(ts,v); | ||
125 | OPENSSL_free(v->name); | ||
126 | OPENSSL_free(v->value); | ||
127 | OPENSSL_free(v); | ||
128 | } | ||
129 | return 1; | ||
130 | } | ||
131 | |||
132 | char *_CONF_get_string(const CONF *conf, const char *section, const char *name) | ||
133 | { | ||
134 | CONF_VALUE *v,vv; | ||
135 | char *p; | ||
136 | |||
137 | if (name == NULL) return(NULL); | ||
138 | if (conf != NULL) | ||
139 | { | ||
140 | if (section != NULL) | ||
141 | { | ||
142 | vv.name=(char *)name; | ||
143 | vv.section=(char *)section; | ||
144 | v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); | ||
145 | if (v != NULL) return(v->value); | ||
146 | if (strcmp(section,"ENV") == 0) | ||
147 | { | ||
148 | p=Getenv(name); | ||
149 | if (p != NULL) return(p); | ||
150 | } | ||
151 | } | ||
152 | vv.section="default"; | ||
153 | vv.name=(char *)name; | ||
154 | v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); | ||
155 | if (v != NULL) | ||
156 | return(v->value); | ||
157 | else | ||
158 | return(NULL); | ||
159 | } | ||
160 | else | ||
161 | return(Getenv(name)); | ||
162 | } | ||
163 | |||
164 | #if 0 /* There's no way to provide error checking with this function, so | ||
165 | force implementors of the higher levels to get a string and read | ||
166 | the number themselves. */ | ||
167 | long _CONF_get_number(CONF *conf, char *section, char *name) | ||
168 | { | ||
169 | char *str; | ||
170 | long ret=0; | ||
171 | |||
172 | str=_CONF_get_string(conf,section,name); | ||
173 | if (str == NULL) return(0); | ||
174 | for (;;) | ||
175 | { | ||
176 | if (conf->meth->is_number(conf, *str)) | ||
177 | ret=ret*10+conf->meth->to_int(conf, *str); | ||
178 | else | ||
179 | return(ret); | ||
180 | str++; | ||
181 | } | ||
182 | } | ||
183 | #endif | ||
184 | |||
185 | int _CONF_new_data(CONF *conf) | ||
186 | { | ||
187 | if (conf == NULL) | ||
188 | { | ||
189 | return 0; | ||
190 | } | ||
191 | if (conf->data == NULL) | ||
192 | if ((conf->data = lh_new(hash, cmp_conf)) == NULL) | ||
193 | { | ||
194 | return 0; | ||
195 | } | ||
196 | return 1; | ||
197 | } | ||
198 | |||
199 | void _CONF_free_data(CONF *conf) | ||
200 | { | ||
201 | if (conf == NULL || conf->data == NULL) return; | ||
202 | |||
203 | conf->data->down_load=0; /* evil thing to make sure the 'OPENSSL_free()' | ||
204 | * works as expected */ | ||
205 | lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(value_free_hash), | ||
206 | conf->data); | ||
207 | |||
208 | /* We now have only 'section' entries in the hash table. | ||
209 | * Due to problems with */ | ||
210 | |||
211 | lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(value_free_stack), | ||
212 | conf->data); | ||
213 | lh_free(conf->data); | ||
214 | } | ||
215 | |||
216 | static void value_free_hash(CONF_VALUE *a, LHASH *conf) | ||
217 | { | ||
218 | if (a->name != NULL) | ||
219 | { | ||
220 | a=(CONF_VALUE *)lh_delete(conf,a); | ||
221 | } | ||
222 | } | ||
223 | |||
224 | static void value_free_stack(CONF_VALUE *a, LHASH *conf) | ||
225 | { | ||
226 | CONF_VALUE *vv; | ||
227 | STACK *sk; | ||
228 | int i; | ||
229 | |||
230 | if (a->name != NULL) return; | ||
231 | |||
232 | sk=(STACK *)a->value; | ||
233 | for (i=sk_num(sk)-1; i>=0; i--) | ||
234 | { | ||
235 | vv=(CONF_VALUE *)sk_value(sk,i); | ||
236 | OPENSSL_free(vv->value); | ||
237 | OPENSSL_free(vv->name); | ||
238 | OPENSSL_free(vv); | ||
239 | } | ||
240 | if (sk != NULL) sk_free(sk); | ||
241 | OPENSSL_free(a->section); | ||
242 | OPENSSL_free(a); | ||
243 | } | ||
244 | |||
245 | /* static unsigned long hash(CONF_VALUE *v) */ | ||
246 | static unsigned long hash(const void *v_void) | ||
247 | { | ||
248 | CONF_VALUE *v = (CONF_VALUE *)v_void; | ||
249 | return((lh_strhash(v->section)<<2)^lh_strhash(v->name)); | ||
250 | } | ||
251 | |||
252 | /* static int cmp_conf(CONF_VALUE *a, CONF_VALUE *b) */ | ||
253 | static int cmp_conf(const void *a_void,const void *b_void) | ||
254 | { | ||
255 | int i; | ||
256 | CONF_VALUE *a = (CONF_VALUE *)a_void; | ||
257 | CONF_VALUE *b = (CONF_VALUE *)b_void; | ||
258 | |||
259 | if (a->section != b->section) | ||
260 | { | ||
261 | i=strcmp(a->section,b->section); | ||
262 | if (i) return(i); | ||
263 | } | ||
264 | |||
265 | if ((a->name != NULL) && (b->name != NULL)) | ||
266 | { | ||
267 | i=strcmp(a->name,b->name); | ||
268 | return(i); | ||
269 | } | ||
270 | else if (a->name == b->name) | ||
271 | return(0); | ||
272 | else | ||
273 | return((a->name == NULL)?-1:1); | ||
274 | } | ||
275 | |||
276 | /* Up until OpenSSL 0.9.5a, this was new_section */ | ||
277 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) | ||
278 | { | ||
279 | STACK *sk=NULL; | ||
280 | int ok=0,i; | ||
281 | CONF_VALUE *v=NULL,*vv; | ||
282 | |||
283 | if ((sk=sk_new_null()) == NULL) | ||
284 | goto err; | ||
285 | if ((v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL) | ||
286 | goto err; | ||
287 | i=strlen(section)+1; | ||
288 | if ((v->section=(char *)OPENSSL_malloc(i)) == NULL) | ||
289 | goto err; | ||
290 | |||
291 | memcpy(v->section,section,i); | ||
292 | v->name=NULL; | ||
293 | v->value=(char *)sk; | ||
294 | |||
295 | vv=(CONF_VALUE *)lh_insert(conf->data,v); | ||
296 | assert(vv == NULL); | ||
297 | ok=1; | ||
298 | err: | ||
299 | if (!ok) | ||
300 | { | ||
301 | if (sk != NULL) sk_free(sk); | ||
302 | if (v != NULL) OPENSSL_free(v); | ||
303 | v=NULL; | ||
304 | } | ||
305 | return(v); | ||
306 | } | ||
307 | |||
308 | IMPLEMENT_STACK_OF(CONF_VALUE) | ||
diff --git a/src/lib/libcrypto/conf/conf_api.h b/src/lib/libcrypto/conf/conf_api.h deleted file mode 100644 index 87a954aff6..0000000000 --- a/src/lib/libcrypto/conf/conf_api.h +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | /* conf_api.h */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef HEADER_CONF_API_H | ||
60 | #define HEADER_CONF_API_H | ||
61 | |||
62 | #include <openssl/lhash.h> | ||
63 | #include <openssl/conf.h> | ||
64 | |||
65 | #ifdef __cplusplus | ||
66 | extern "C" { | ||
67 | #endif | ||
68 | |||
69 | /* Up until OpenSSL 0.9.5a, this was new_section */ | ||
70 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); | ||
71 | /* Up until OpenSSL 0.9.5a, this was get_section */ | ||
72 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); | ||
73 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ | ||
74 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, | ||
75 | const char *section); | ||
76 | |||
77 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); | ||
78 | char *_CONF_get_string(const CONF *conf, const char *section, | ||
79 | const char *name); | ||
80 | long _CONF_get_number(const CONF *conf, const char *section, const char *name); | ||
81 | |||
82 | int _CONF_new_data(CONF *conf); | ||
83 | void _CONF_free_data(CONF *conf); | ||
84 | |||
85 | #ifdef __cplusplus | ||
86 | } | ||
87 | #endif | ||
88 | #endif | ||
89 | |||
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c deleted file mode 100644 index 2464f8ed90..0000000000 --- a/src/lib/libcrypto/conf/conf_def.c +++ /dev/null | |||
@@ -1,750 +0,0 @@ | |||
1 | /* crypto/conf/conf.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* Part of the code in here was originally in conf.c, which is now removed */ | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include <string.h> | ||
63 | #include <openssl/stack.h> | ||
64 | #include <openssl/lhash.h> | ||
65 | #include <openssl/conf.h> | ||
66 | #include <openssl/conf_api.h> | ||
67 | #include "conf_def.h" | ||
68 | #include <openssl/buffer.h> | ||
69 | #include <openssl/err.h> | ||
70 | #include "cryptlib.h" | ||
71 | |||
72 | static char *eat_ws(CONF *conf, char *p); | ||
73 | static char *eat_alpha_numeric(CONF *conf, char *p); | ||
74 | static void clear_comments(CONF *conf, char *p); | ||
75 | static int str_copy(CONF *conf,char *section,char **to, char *from); | ||
76 | static char *scan_quote(CONF *conf, char *p); | ||
77 | static char *scan_dquote(CONF *conf, char *p); | ||
78 | #define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2))) | ||
79 | |||
80 | static CONF *def_create(CONF_METHOD *meth); | ||
81 | static int def_init_default(CONF *conf); | ||
82 | static int def_init_WIN32(CONF *conf); | ||
83 | static int def_destroy(CONF *conf); | ||
84 | static int def_destroy_data(CONF *conf); | ||
85 | static int def_load(CONF *conf, const char *name, long *eline); | ||
86 | static int def_load_bio(CONF *conf, BIO *bp, long *eline); | ||
87 | static int def_dump(const CONF *conf, BIO *bp); | ||
88 | static int def_is_number(const CONF *conf, char c); | ||
89 | static int def_to_int(const CONF *conf, char c); | ||
90 | |||
91 | const char *CONF_def_version="CONF_def" OPENSSL_VERSION_PTEXT; | ||
92 | |||
93 | static CONF_METHOD default_method = { | ||
94 | "OpenSSL default", | ||
95 | def_create, | ||
96 | def_init_default, | ||
97 | def_destroy, | ||
98 | def_destroy_data, | ||
99 | def_load_bio, | ||
100 | def_dump, | ||
101 | def_is_number, | ||
102 | def_to_int, | ||
103 | def_load | ||
104 | }; | ||
105 | |||
106 | static CONF_METHOD WIN32_method = { | ||
107 | "WIN32", | ||
108 | def_create, | ||
109 | def_init_WIN32, | ||
110 | def_destroy, | ||
111 | def_destroy_data, | ||
112 | def_load_bio, | ||
113 | def_dump, | ||
114 | def_is_number, | ||
115 | def_to_int, | ||
116 | def_load | ||
117 | }; | ||
118 | |||
119 | CONF_METHOD *NCONF_default() | ||
120 | { | ||
121 | return &default_method; | ||
122 | } | ||
123 | CONF_METHOD *NCONF_WIN32() | ||
124 | { | ||
125 | return &WIN32_method; | ||
126 | } | ||
127 | |||
128 | static CONF *def_create(CONF_METHOD *meth) | ||
129 | { | ||
130 | CONF *ret; | ||
131 | |||
132 | ret = (CONF *)OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *)); | ||
133 | if (ret) | ||
134 | if (meth->init(ret) == 0) | ||
135 | { | ||
136 | OPENSSL_free(ret); | ||
137 | ret = NULL; | ||
138 | } | ||
139 | return ret; | ||
140 | } | ||
141 | |||
142 | static int def_init_default(CONF *conf) | ||
143 | { | ||
144 | if (conf == NULL) | ||
145 | return 0; | ||
146 | |||
147 | conf->meth = &default_method; | ||
148 | conf->meth_data = (void *)CONF_type_default; | ||
149 | conf->data = NULL; | ||
150 | |||
151 | return 1; | ||
152 | } | ||
153 | |||
154 | static int def_init_WIN32(CONF *conf) | ||
155 | { | ||
156 | if (conf == NULL) | ||
157 | return 0; | ||
158 | |||
159 | conf->meth = &WIN32_method; | ||
160 | conf->meth_data = (void *)CONF_type_win32; | ||
161 | conf->data = NULL; | ||
162 | |||
163 | return 1; | ||
164 | } | ||
165 | |||
166 | static int def_destroy(CONF *conf) | ||
167 | { | ||
168 | if (def_destroy_data(conf)) | ||
169 | { | ||
170 | OPENSSL_free(conf); | ||
171 | return 1; | ||
172 | } | ||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static int def_destroy_data(CONF *conf) | ||
177 | { | ||
178 | if (conf == NULL) | ||
179 | return 0; | ||
180 | _CONF_free_data(conf); | ||
181 | return 1; | ||
182 | } | ||
183 | |||
184 | static int def_load(CONF *conf, const char *name, long *line) | ||
185 | { | ||
186 | int ret; | ||
187 | BIO *in=NULL; | ||
188 | |||
189 | #ifdef OPENSSL_SYS_VMS | ||
190 | in=BIO_new_file(name, "r"); | ||
191 | #else | ||
192 | in=BIO_new_file(name, "rb"); | ||
193 | #endif | ||
194 | if (in == NULL) | ||
195 | { | ||
196 | if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE) | ||
197 | CONFerr(CONF_F_CONF_LOAD,CONF_R_NO_SUCH_FILE); | ||
198 | else | ||
199 | CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); | ||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | ret = def_load_bio(conf, in, line); | ||
204 | BIO_free(in); | ||
205 | |||
206 | return ret; | ||
207 | } | ||
208 | |||
209 | static int def_load_bio(CONF *conf, BIO *in, long *line) | ||
210 | { | ||
211 | /* The macro BUFSIZE conflicts with a system macro in VxWorks */ | ||
212 | #define CONFBUFSIZE 512 | ||
213 | int bufnum=0,i,ii; | ||
214 | BUF_MEM *buff=NULL; | ||
215 | char *s,*p,*end; | ||
216 | int again,n; | ||
217 | long eline=0; | ||
218 | char btmp[DECIMAL_SIZE(eline)+1]; | ||
219 | CONF_VALUE *v=NULL,*tv; | ||
220 | CONF_VALUE *sv=NULL; | ||
221 | char *section=NULL,*buf; | ||
222 | STACK_OF(CONF_VALUE) *section_sk=NULL,*ts; | ||
223 | char *start,*psection,*pname; | ||
224 | void *h = (void *)(conf->data); | ||
225 | |||
226 | if ((buff=BUF_MEM_new()) == NULL) | ||
227 | { | ||
228 | CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB); | ||
229 | goto err; | ||
230 | } | ||
231 | |||
232 | section=(char *)OPENSSL_malloc(10); | ||
233 | if (section == NULL) | ||
234 | { | ||
235 | CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE); | ||
236 | goto err; | ||
237 | } | ||
238 | BUF_strlcpy(section,"default",10); | ||
239 | |||
240 | if (_CONF_new_data(conf) == 0) | ||
241 | { | ||
242 | CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE); | ||
243 | goto err; | ||
244 | } | ||
245 | |||
246 | sv=_CONF_new_section(conf,section); | ||
247 | if (sv == NULL) | ||
248 | { | ||
249 | CONFerr(CONF_F_CONF_LOAD_BIO, | ||
250 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
251 | goto err; | ||
252 | } | ||
253 | section_sk=(STACK_OF(CONF_VALUE) *)sv->value; | ||
254 | |||
255 | bufnum=0; | ||
256 | again=0; | ||
257 | for (;;) | ||
258 | { | ||
259 | if (!BUF_MEM_grow(buff,bufnum+CONFBUFSIZE)) | ||
260 | { | ||
261 | CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB); | ||
262 | goto err; | ||
263 | } | ||
264 | p= &(buff->data[bufnum]); | ||
265 | *p='\0'; | ||
266 | BIO_gets(in, p, CONFBUFSIZE-1); | ||
267 | p[CONFBUFSIZE-1]='\0'; | ||
268 | ii=i=strlen(p); | ||
269 | if (i == 0 && !again) break; | ||
270 | again=0; | ||
271 | while (i > 0) | ||
272 | { | ||
273 | if ((p[i-1] != '\r') && (p[i-1] != '\n')) | ||
274 | break; | ||
275 | else | ||
276 | i--; | ||
277 | } | ||
278 | /* we removed some trailing stuff so there is a new | ||
279 | * line on the end. */ | ||
280 | if (ii && i == ii) | ||
281 | again=1; /* long line */ | ||
282 | else | ||
283 | { | ||
284 | p[i]='\0'; | ||
285 | eline++; /* another input line */ | ||
286 | } | ||
287 | |||
288 | /* we now have a line with trailing \r\n removed */ | ||
289 | |||
290 | /* i is the number of bytes */ | ||
291 | bufnum+=i; | ||
292 | |||
293 | v=NULL; | ||
294 | /* check for line continuation */ | ||
295 | if (bufnum >= 1) | ||
296 | { | ||
297 | /* If we have bytes and the last char '\\' and | ||
298 | * second last char is not '\\' */ | ||
299 | p= &(buff->data[bufnum-1]); | ||
300 | if (IS_ESC(conf,p[0]) && | ||
301 | ((bufnum <= 1) || !IS_ESC(conf,p[-1]))) | ||
302 | { | ||
303 | bufnum--; | ||
304 | again=1; | ||
305 | } | ||
306 | } | ||
307 | if (again) continue; | ||
308 | bufnum=0; | ||
309 | buf=buff->data; | ||
310 | |||
311 | clear_comments(conf, buf); | ||
312 | n=strlen(buf); | ||
313 | s=eat_ws(conf, buf); | ||
314 | if (IS_EOF(conf,*s)) continue; /* blank line */ | ||
315 | if (*s == '[') | ||
316 | { | ||
317 | char *ss; | ||
318 | |||
319 | s++; | ||
320 | start=eat_ws(conf, s); | ||
321 | ss=start; | ||
322 | again: | ||
323 | end=eat_alpha_numeric(conf, ss); | ||
324 | p=eat_ws(conf, end); | ||
325 | if (*p != ']') | ||
326 | { | ||
327 | if (*p != '\0') | ||
328 | { | ||
329 | ss=p; | ||
330 | goto again; | ||
331 | } | ||
332 | CONFerr(CONF_F_CONF_LOAD_BIO, | ||
333 | CONF_R_MISSING_CLOSE_SQUARE_BRACKET); | ||
334 | goto err; | ||
335 | } | ||
336 | *end='\0'; | ||
337 | if (!str_copy(conf,NULL,§ion,start)) goto err; | ||
338 | if ((sv=_CONF_get_section(conf,section)) == NULL) | ||
339 | sv=_CONF_new_section(conf,section); | ||
340 | if (sv == NULL) | ||
341 | { | ||
342 | CONFerr(CONF_F_CONF_LOAD_BIO, | ||
343 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
344 | goto err; | ||
345 | } | ||
346 | section_sk=(STACK_OF(CONF_VALUE) *)sv->value; | ||
347 | continue; | ||
348 | } | ||
349 | else | ||
350 | { | ||
351 | pname=s; | ||
352 | psection=NULL; | ||
353 | end=eat_alpha_numeric(conf, s); | ||
354 | if ((end[0] == ':') && (end[1] == ':')) | ||
355 | { | ||
356 | *end='\0'; | ||
357 | end+=2; | ||
358 | psection=pname; | ||
359 | pname=end; | ||
360 | end=eat_alpha_numeric(conf, end); | ||
361 | } | ||
362 | p=eat_ws(conf, end); | ||
363 | if (*p != '=') | ||
364 | { | ||
365 | CONFerr(CONF_F_CONF_LOAD_BIO, | ||
366 | CONF_R_MISSING_EQUAL_SIGN); | ||
367 | goto err; | ||
368 | } | ||
369 | *end='\0'; | ||
370 | p++; | ||
371 | start=eat_ws(conf, p); | ||
372 | while (!IS_EOF(conf,*p)) | ||
373 | p++; | ||
374 | p--; | ||
375 | while ((p != start) && (IS_WS(conf,*p))) | ||
376 | p--; | ||
377 | p++; | ||
378 | *p='\0'; | ||
379 | |||
380 | if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) | ||
381 | { | ||
382 | CONFerr(CONF_F_CONF_LOAD_BIO, | ||
383 | ERR_R_MALLOC_FAILURE); | ||
384 | goto err; | ||
385 | } | ||
386 | if (psection == NULL) psection=section; | ||
387 | v->name=(char *)OPENSSL_malloc(strlen(pname)+1); | ||
388 | v->value=NULL; | ||
389 | if (v->name == NULL) | ||
390 | { | ||
391 | CONFerr(CONF_F_CONF_LOAD_BIO, | ||
392 | ERR_R_MALLOC_FAILURE); | ||
393 | goto err; | ||
394 | } | ||
395 | BUF_strlcpy(v->name,pname,strlen(pname)+1); | ||
396 | if (!str_copy(conf,psection,&(v->value),start)) goto err; | ||
397 | |||
398 | if (strcmp(psection,section) != 0) | ||
399 | { | ||
400 | if ((tv=_CONF_get_section(conf,psection)) | ||
401 | == NULL) | ||
402 | tv=_CONF_new_section(conf,psection); | ||
403 | if (tv == NULL) | ||
404 | { | ||
405 | CONFerr(CONF_F_CONF_LOAD_BIO, | ||
406 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
407 | goto err; | ||
408 | } | ||
409 | ts=(STACK_OF(CONF_VALUE) *)tv->value; | ||
410 | } | ||
411 | else | ||
412 | { | ||
413 | tv=sv; | ||
414 | ts=section_sk; | ||
415 | } | ||
416 | #if 1 | ||
417 | if (_CONF_add_string(conf, tv, v) == 0) | ||
418 | { | ||
419 | CONFerr(CONF_F_CONF_LOAD_BIO, | ||
420 | ERR_R_MALLOC_FAILURE); | ||
421 | goto err; | ||
422 | } | ||
423 | #else | ||
424 | v->section=tv->section; | ||
425 | if (!sk_CONF_VALUE_push(ts,v)) | ||
426 | { | ||
427 | CONFerr(CONF_F_CONF_LOAD_BIO, | ||
428 | ERR_R_MALLOC_FAILURE); | ||
429 | goto err; | ||
430 | } | ||
431 | vv=(CONF_VALUE *)lh_insert(conf->data,v); | ||
432 | if (vv != NULL) | ||
433 | { | ||
434 | sk_CONF_VALUE_delete_ptr(ts,vv); | ||
435 | OPENSSL_free(vv->name); | ||
436 | OPENSSL_free(vv->value); | ||
437 | OPENSSL_free(vv); | ||
438 | } | ||
439 | #endif | ||
440 | v=NULL; | ||
441 | } | ||
442 | } | ||
443 | if (buff != NULL) BUF_MEM_free(buff); | ||
444 | if (section != NULL) OPENSSL_free(section); | ||
445 | return(1); | ||
446 | err: | ||
447 | if (buff != NULL) BUF_MEM_free(buff); | ||
448 | if (section != NULL) OPENSSL_free(section); | ||
449 | if (line != NULL) *line=eline; | ||
450 | BIO_snprintf(btmp,sizeof btmp,"%ld",eline); | ||
451 | ERR_add_error_data(2,"line ",btmp); | ||
452 | if ((h != conf->data) && (conf->data != NULL)) | ||
453 | { | ||
454 | CONF_free(conf->data); | ||
455 | conf->data=NULL; | ||
456 | } | ||
457 | if (v != NULL) | ||
458 | { | ||
459 | if (v->name != NULL) OPENSSL_free(v->name); | ||
460 | if (v->value != NULL) OPENSSL_free(v->value); | ||
461 | if (v != NULL) OPENSSL_free(v); | ||
462 | } | ||
463 | return(0); | ||
464 | } | ||
465 | |||
466 | static void clear_comments(CONF *conf, char *p) | ||
467 | { | ||
468 | char *to; | ||
469 | |||
470 | to=p; | ||
471 | for (;;) | ||
472 | { | ||
473 | if (IS_FCOMMENT(conf,*p)) | ||
474 | { | ||
475 | *p='\0'; | ||
476 | return; | ||
477 | } | ||
478 | if (!IS_WS(conf,*p)) | ||
479 | { | ||
480 | break; | ||
481 | } | ||
482 | p++; | ||
483 | } | ||
484 | |||
485 | for (;;) | ||
486 | { | ||
487 | if (IS_COMMENT(conf,*p)) | ||
488 | { | ||
489 | *p='\0'; | ||
490 | return; | ||
491 | } | ||
492 | if (IS_DQUOTE(conf,*p)) | ||
493 | { | ||
494 | p=scan_dquote(conf, p); | ||
495 | continue; | ||
496 | } | ||
497 | if (IS_QUOTE(conf,*p)) | ||
498 | { | ||
499 | p=scan_quote(conf, p); | ||
500 | continue; | ||
501 | } | ||
502 | if (IS_ESC(conf,*p)) | ||
503 | { | ||
504 | p=scan_esc(conf,p); | ||
505 | continue; | ||
506 | } | ||
507 | if (IS_EOF(conf,*p)) | ||
508 | return; | ||
509 | else | ||
510 | p++; | ||
511 | } | ||
512 | } | ||
513 | |||
514 | static int str_copy(CONF *conf, char *section, char **pto, char *from) | ||
515 | { | ||
516 | int q,r,rr=0,to=0,len=0; | ||
517 | char *s,*e,*rp,*p,*rrp,*np,*cp,v; | ||
518 | BUF_MEM *buf; | ||
519 | |||
520 | if ((buf=BUF_MEM_new()) == NULL) return(0); | ||
521 | |||
522 | len=strlen(from)+1; | ||
523 | if (!BUF_MEM_grow(buf,len)) goto err; | ||
524 | |||
525 | for (;;) | ||
526 | { | ||
527 | if (IS_QUOTE(conf,*from)) | ||
528 | { | ||
529 | q= *from; | ||
530 | from++; | ||
531 | while (!IS_EOF(conf,*from) && (*from != q)) | ||
532 | { | ||
533 | if (IS_ESC(conf,*from)) | ||
534 | { | ||
535 | from++; | ||
536 | if (IS_EOF(conf,*from)) break; | ||
537 | } | ||
538 | buf->data[to++]= *(from++); | ||
539 | } | ||
540 | if (*from == q) from++; | ||
541 | } | ||
542 | else if (IS_DQUOTE(conf,*from)) | ||
543 | { | ||
544 | q= *from; | ||
545 | from++; | ||
546 | while (!IS_EOF(conf,*from)) | ||
547 | { | ||
548 | if (*from == q) | ||
549 | { | ||
550 | if (*(from+1) == q) | ||
551 | { | ||
552 | from++; | ||
553 | } | ||
554 | else | ||
555 | { | ||
556 | break; | ||
557 | } | ||
558 | } | ||
559 | buf->data[to++]= *(from++); | ||
560 | } | ||
561 | if (*from == q) from++; | ||
562 | } | ||
563 | else if (IS_ESC(conf,*from)) | ||
564 | { | ||
565 | from++; | ||
566 | v= *(from++); | ||
567 | if (IS_EOF(conf,v)) break; | ||
568 | else if (v == 'r') v='\r'; | ||
569 | else if (v == 'n') v='\n'; | ||
570 | else if (v == 'b') v='\b'; | ||
571 | else if (v == 't') v='\t'; | ||
572 | buf->data[to++]= v; | ||
573 | } | ||
574 | else if (IS_EOF(conf,*from)) | ||
575 | break; | ||
576 | else if (*from == '$') | ||
577 | { | ||
578 | /* try to expand it */ | ||
579 | rrp=NULL; | ||
580 | s= &(from[1]); | ||
581 | if (*s == '{') | ||
582 | q='}'; | ||
583 | else if (*s == '(') | ||
584 | q=')'; | ||
585 | else q=0; | ||
586 | |||
587 | if (q) s++; | ||
588 | cp=section; | ||
589 | e=np=s; | ||
590 | while (IS_ALPHA_NUMERIC(conf,*e)) | ||
591 | e++; | ||
592 | if ((e[0] == ':') && (e[1] == ':')) | ||
593 | { | ||
594 | cp=np; | ||
595 | rrp=e; | ||
596 | rr= *e; | ||
597 | *rrp='\0'; | ||
598 | e+=2; | ||
599 | np=e; | ||
600 | while (IS_ALPHA_NUMERIC(conf,*e)) | ||
601 | e++; | ||
602 | } | ||
603 | r= *e; | ||
604 | *e='\0'; | ||
605 | rp=e; | ||
606 | if (q) | ||
607 | { | ||
608 | if (r != q) | ||
609 | { | ||
610 | CONFerr(CONF_F_STR_COPY,CONF_R_NO_CLOSE_BRACE); | ||
611 | goto err; | ||
612 | } | ||
613 | e++; | ||
614 | } | ||
615 | /* So at this point we have | ||
616 | * np which is the start of the name string which is | ||
617 | * '\0' terminated. | ||
618 | * cp which is the start of the section string which is | ||
619 | * '\0' terminated. | ||
620 | * e is the 'next point after'. | ||
621 | * r and rr are the chars replaced by the '\0' | ||
622 | * rp and rrp is where 'r' and 'rr' came from. | ||
623 | */ | ||
624 | p=_CONF_get_string(conf,cp,np); | ||
625 | if (rrp != NULL) *rrp=rr; | ||
626 | *rp=r; | ||
627 | if (p == NULL) | ||
628 | { | ||
629 | CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE); | ||
630 | goto err; | ||
631 | } | ||
632 | BUF_MEM_grow_clean(buf,(strlen(p)+len-(e-from))); | ||
633 | while (*p) | ||
634 | buf->data[to++]= *(p++); | ||
635 | |||
636 | /* Since we change the pointer 'from', we also have | ||
637 | to change the perceived length of the string it | ||
638 | points at. /RL */ | ||
639 | len -= e-from; | ||
640 | from=e; | ||
641 | |||
642 | /* In case there were no braces or parenthesis around | ||
643 | the variable reference, we have to put back the | ||
644 | character that was replaced with a '\0'. /RL */ | ||
645 | *rp = r; | ||
646 | } | ||
647 | else | ||
648 | buf->data[to++]= *(from++); | ||
649 | } | ||
650 | buf->data[to]='\0'; | ||
651 | if (*pto != NULL) OPENSSL_free(*pto); | ||
652 | *pto=buf->data; | ||
653 | OPENSSL_free(buf); | ||
654 | return(1); | ||
655 | err: | ||
656 | if (buf != NULL) BUF_MEM_free(buf); | ||
657 | return(0); | ||
658 | } | ||
659 | |||
660 | static char *eat_ws(CONF *conf, char *p) | ||
661 | { | ||
662 | while (IS_WS(conf,*p) && (!IS_EOF(conf,*p))) | ||
663 | p++; | ||
664 | return(p); | ||
665 | } | ||
666 | |||
667 | static char *eat_alpha_numeric(CONF *conf, char *p) | ||
668 | { | ||
669 | for (;;) | ||
670 | { | ||
671 | if (IS_ESC(conf,*p)) | ||
672 | { | ||
673 | p=scan_esc(conf,p); | ||
674 | continue; | ||
675 | } | ||
676 | if (!IS_ALPHA_NUMERIC_PUNCT(conf,*p)) | ||
677 | return(p); | ||
678 | p++; | ||
679 | } | ||
680 | } | ||
681 | |||
682 | static char *scan_quote(CONF *conf, char *p) | ||
683 | { | ||
684 | int q= *p; | ||
685 | |||
686 | p++; | ||
687 | while (!(IS_EOF(conf,*p)) && (*p != q)) | ||
688 | { | ||
689 | if (IS_ESC(conf,*p)) | ||
690 | { | ||
691 | p++; | ||
692 | if (IS_EOF(conf,*p)) return(p); | ||
693 | } | ||
694 | p++; | ||
695 | } | ||
696 | if (*p == q) p++; | ||
697 | return(p); | ||
698 | } | ||
699 | |||
700 | |||
701 | static char *scan_dquote(CONF *conf, char *p) | ||
702 | { | ||
703 | int q= *p; | ||
704 | |||
705 | p++; | ||
706 | while (!(IS_EOF(conf,*p))) | ||
707 | { | ||
708 | if (*p == q) | ||
709 | { | ||
710 | if (*(p+1) == q) | ||
711 | { | ||
712 | p++; | ||
713 | } | ||
714 | else | ||
715 | { | ||
716 | break; | ||
717 | } | ||
718 | } | ||
719 | p++; | ||
720 | } | ||
721 | if (*p == q) p++; | ||
722 | return(p); | ||
723 | } | ||
724 | |||
725 | static void dump_value(CONF_VALUE *a, BIO *out) | ||
726 | { | ||
727 | if (a->name) | ||
728 | BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value); | ||
729 | else | ||
730 | BIO_printf(out, "[[%s]]\n", a->section); | ||
731 | } | ||
732 | |||
733 | static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE *, BIO *) | ||
734 | |||
735 | static int def_dump(const CONF *conf, BIO *out) | ||
736 | { | ||
737 | lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), out); | ||
738 | return 1; | ||
739 | } | ||
740 | |||
741 | static int def_is_number(const CONF *conf, char c) | ||
742 | { | ||
743 | return IS_NUMBER(conf,c); | ||
744 | } | ||
745 | |||
746 | static int def_to_int(const CONF *conf, char c) | ||
747 | { | ||
748 | return c - '0'; | ||
749 | } | ||
750 | |||
diff --git a/src/lib/libcrypto/conf/conf_def.h b/src/lib/libcrypto/conf/conf_def.h deleted file mode 100644 index 92a7d8ad77..0000000000 --- a/src/lib/libcrypto/conf/conf_def.h +++ /dev/null | |||
@@ -1,180 +0,0 @@ | |||
1 | /* crypto/conf/conf_def.h */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* THIS FILE WAS AUTOMAGICALLY GENERATED! | ||
60 | Please modify and use keysets.pl to regenerate it. */ | ||
61 | |||
62 | #define CONF_NUMBER 1 | ||
63 | #define CONF_UPPER 2 | ||
64 | #define CONF_LOWER 4 | ||
65 | #define CONF_UNDER 256 | ||
66 | #define CONF_PUNCTUATION 512 | ||
67 | #define CONF_WS 16 | ||
68 | #define CONF_ESC 32 | ||
69 | #define CONF_QUOTE 64 | ||
70 | #define CONF_DQUOTE 1024 | ||
71 | #define CONF_COMMENT 128 | ||
72 | #define CONF_FCOMMENT 2048 | ||
73 | #define CONF_EOF 8 | ||
74 | #define CONF_HIGHBIT 4096 | ||
75 | #define CONF_ALPHA (CONF_UPPER|CONF_LOWER) | ||
76 | #define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) | ||
77 | #define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \ | ||
78 | CONF_PUNCTUATION) | ||
79 | |||
80 | #define KEYTYPES(c) ((unsigned short *)((c)->meth_data)) | ||
81 | #ifndef CHARSET_EBCDIC | ||
82 | #define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT) | ||
83 | #define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT) | ||
84 | #define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF) | ||
85 | #define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC) | ||
86 | #define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER) | ||
87 | #define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS) | ||
88 | #define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC) | ||
89 | #define IS_ALPHA_NUMERIC_PUNCT(c,a) \ | ||
90 | (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT) | ||
91 | #define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE) | ||
92 | #define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE) | ||
93 | #define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT) | ||
94 | |||
95 | #else /*CHARSET_EBCDIC*/ | ||
96 | |||
97 | #define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_COMMENT) | ||
98 | #define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_FCOMMENT) | ||
99 | #define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_EOF) | ||
100 | #define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ESC) | ||
101 | #define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_NUMBER) | ||
102 | #define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_WS) | ||
103 | #define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC) | ||
104 | #define IS_ALPHA_NUMERIC_PUNCT(c,a) \ | ||
105 | (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC_PUNCT) | ||
106 | #define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_QUOTE) | ||
107 | #define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_DQUOTE) | ||
108 | #define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_HIGHBIT) | ||
109 | #endif /*CHARSET_EBCDIC*/ | ||
110 | |||
111 | static unsigned short CONF_type_default[256]={ | ||
112 | 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | ||
113 | 0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000, | ||
114 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | ||
115 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | ||
116 | 0x0010,0x0200,0x0040,0x0080,0x0000,0x0200,0x0200,0x0040, | ||
117 | 0x0000,0x0000,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200, | ||
118 | 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001, | ||
119 | 0x0001,0x0001,0x0000,0x0200,0x0000,0x0000,0x0000,0x0200, | ||
120 | 0x0200,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | ||
121 | 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | ||
122 | 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | ||
123 | 0x0002,0x0002,0x0002,0x0000,0x0020,0x0000,0x0200,0x0100, | ||
124 | 0x0040,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | ||
125 | 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | ||
126 | 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | ||
127 | 0x0004,0x0004,0x0004,0x0000,0x0200,0x0000,0x0200,0x0000, | ||
128 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
129 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
130 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
131 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
132 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
133 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
134 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
135 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
136 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
137 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
138 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
139 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
140 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
141 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
142 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
143 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
144 | }; | ||
145 | |||
146 | static unsigned short CONF_type_win32[256]={ | ||
147 | 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | ||
148 | 0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000, | ||
149 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | ||
150 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | ||
151 | 0x0010,0x0200,0x0400,0x0000,0x0000,0x0200,0x0200,0x0000, | ||
152 | 0x0000,0x0000,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200, | ||
153 | 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001, | ||
154 | 0x0001,0x0001,0x0000,0x0A00,0x0000,0x0000,0x0000,0x0200, | ||
155 | 0x0200,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | ||
156 | 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | ||
157 | 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | ||
158 | 0x0002,0x0002,0x0002,0x0000,0x0000,0x0000,0x0200,0x0100, | ||
159 | 0x0000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | ||
160 | 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | ||
161 | 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | ||
162 | 0x0004,0x0004,0x0004,0x0000,0x0200,0x0000,0x0200,0x0000, | ||
163 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
164 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
165 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
166 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
167 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
168 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
169 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
170 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
171 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
172 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
173 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
174 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
175 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
176 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
177 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
178 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
179 | }; | ||
180 | |||
diff --git a/src/lib/libcrypto/conf/conf_err.c b/src/lib/libcrypto/conf/conf_err.c deleted file mode 100644 index f5e2ca4bf0..0000000000 --- a/src/lib/libcrypto/conf/conf_err.c +++ /dev/null | |||
@@ -1,130 +0,0 @@ | |||
1 | /* crypto/conf/conf_err.c */ | ||
2 | /* ==================================================================== | ||
3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in | ||
14 | * the documentation and/or other materials provided with the | ||
15 | * distribution. | ||
16 | * | ||
17 | * 3. All advertising materials mentioning features or use of this | ||
18 | * software must display the following acknowledgment: | ||
19 | * "This product includes software developed by the OpenSSL Project | ||
20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
21 | * | ||
22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
23 | * endorse or promote products derived from this software without | ||
24 | * prior written permission. For written permission, please contact | ||
25 | * openssl-core@OpenSSL.org. | ||
26 | * | ||
27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
28 | * nor may "OpenSSL" appear in their names without prior written | ||
29 | * permission of the OpenSSL Project. | ||
30 | * | ||
31 | * 6. Redistributions of any form whatsoever must retain the following | ||
32 | * acknowledgment: | ||
33 | * "This product includes software developed by the OpenSSL Project | ||
34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
35 | * | ||
36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
48 | * ==================================================================== | ||
49 | * | ||
50 | * This product includes cryptographic software written by Eric Young | ||
51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
52 | * Hudson (tjh@cryptsoft.com). | ||
53 | * | ||
54 | */ | ||
55 | |||
56 | /* NOTE: this file was auto generated by the mkerr.pl script: any changes | ||
57 | * made to it will be overwritten when the script next updates this file, | ||
58 | * only reason strings will be preserved. | ||
59 | */ | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include <openssl/err.h> | ||
63 | #include <openssl/conf.h> | ||
64 | |||
65 | /* BEGIN ERROR CODES */ | ||
66 | #ifndef OPENSSL_NO_ERR | ||
67 | |||
68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0) | ||
69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason) | ||
70 | |||
71 | static ERR_STRING_DATA CONF_str_functs[]= | ||
72 | { | ||
73 | {ERR_FUNC(CONF_F_CONF_DUMP_FP), "CONF_dump_fp"}, | ||
74 | {ERR_FUNC(CONF_F_CONF_LOAD), "CONF_load"}, | ||
75 | {ERR_FUNC(CONF_F_CONF_LOAD_BIO), "CONF_load_bio"}, | ||
76 | {ERR_FUNC(CONF_F_CONF_LOAD_FP), "CONF_load_fp"}, | ||
77 | {ERR_FUNC(CONF_F_CONF_MODULES_LOAD), "CONF_modules_load"}, | ||
78 | {ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"}, | ||
79 | {ERR_FUNC(CONF_F_MODULE_LOAD_DSO), "MODULE_LOAD_DSO"}, | ||
80 | {ERR_FUNC(CONF_F_MODULE_RUN), "MODULE_RUN"}, | ||
81 | {ERR_FUNC(CONF_F_NCONF_DUMP_BIO), "NCONF_dump_bio"}, | ||
82 | {ERR_FUNC(CONF_F_NCONF_DUMP_FP), "NCONF_dump_fp"}, | ||
83 | {ERR_FUNC(CONF_F_NCONF_GET_NUMBER), "NCONF_get_number"}, | ||
84 | {ERR_FUNC(CONF_F_NCONF_GET_NUMBER_E), "NCONF_get_number_e"}, | ||
85 | {ERR_FUNC(CONF_F_NCONF_GET_SECTION), "NCONF_get_section"}, | ||
86 | {ERR_FUNC(CONF_F_NCONF_GET_STRING), "NCONF_get_string"}, | ||
87 | {ERR_FUNC(CONF_F_NCONF_LOAD), "NCONF_load"}, | ||
88 | {ERR_FUNC(CONF_F_NCONF_LOAD_BIO), "NCONF_load_bio"}, | ||
89 | {ERR_FUNC(CONF_F_NCONF_LOAD_FP), "NCONF_load_fp"}, | ||
90 | {ERR_FUNC(CONF_F_NCONF_NEW), "NCONF_new"}, | ||
91 | {ERR_FUNC(CONF_F_STR_COPY), "STR_COPY"}, | ||
92 | {0,NULL} | ||
93 | }; | ||
94 | |||
95 | static ERR_STRING_DATA CONF_str_reasons[]= | ||
96 | { | ||
97 | {ERR_REASON(CONF_R_ERROR_LOADING_DSO) ,"error loading dso"}, | ||
98 | {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET),"missing close square bracket"}, | ||
99 | {ERR_REASON(CONF_R_MISSING_EQUAL_SIGN) ,"missing equal sign"}, | ||
100 | {ERR_REASON(CONF_R_MISSING_FINISH_FUNCTION),"missing finish function"}, | ||
101 | {ERR_REASON(CONF_R_MISSING_INIT_FUNCTION),"missing init function"}, | ||
102 | {ERR_REASON(CONF_R_MODULE_INITIALIZATION_ERROR),"module initialization error"}, | ||
103 | {ERR_REASON(CONF_R_NO_CLOSE_BRACE) ,"no close brace"}, | ||
104 | {ERR_REASON(CONF_R_NO_CONF) ,"no conf"}, | ||
105 | {ERR_REASON(CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE),"no conf or environment variable"}, | ||
106 | {ERR_REASON(CONF_R_NO_SECTION) ,"no section"}, | ||
107 | {ERR_REASON(CONF_R_NO_SUCH_FILE) ,"no such file"}, | ||
108 | {ERR_REASON(CONF_R_NO_VALUE) ,"no value"}, | ||
109 | {ERR_REASON(CONF_R_UNABLE_TO_CREATE_NEW_SECTION),"unable to create new section"}, | ||
110 | {ERR_REASON(CONF_R_UNKNOWN_MODULE_NAME) ,"unknown module name"}, | ||
111 | {ERR_REASON(CONF_R_VARIABLE_HAS_NO_VALUE),"variable has no value"}, | ||
112 | {0,NULL} | ||
113 | }; | ||
114 | |||
115 | #endif | ||
116 | |||
117 | void ERR_load_CONF_strings(void) | ||
118 | { | ||
119 | static int init=1; | ||
120 | |||
121 | if (init) | ||
122 | { | ||
123 | init=0; | ||
124 | #ifndef OPENSSL_NO_ERR | ||
125 | ERR_load_strings(0,CONF_str_functs); | ||
126 | ERR_load_strings(0,CONF_str_reasons); | ||
127 | #endif | ||
128 | |||
129 | } | ||
130 | } | ||
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c deleted file mode 100644 index 6a3cf109dd..0000000000 --- a/src/lib/libcrypto/conf/conf_lib.c +++ /dev/null | |||
@@ -1,401 +0,0 @@ | |||
1 | /* conf_lib.c */ | ||
2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
3 | * project 2000. | ||
4 | */ | ||
5 | /* ==================================================================== | ||
6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions | ||
10 | * are met: | ||
11 | * | ||
12 | * 1. Redistributions of source code must retain the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer. | ||
14 | * | ||
15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer in | ||
17 | * the documentation and/or other materials provided with the | ||
18 | * distribution. | ||
19 | * | ||
20 | * 3. All advertising materials mentioning features or use of this | ||
21 | * software must display the following acknowledgment: | ||
22 | * "This product includes software developed by the OpenSSL Project | ||
23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
24 | * | ||
25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
26 | * endorse or promote products derived from this software without | ||
27 | * prior written permission. For written permission, please contact | ||
28 | * licensing@OpenSSL.org. | ||
29 | * | ||
30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
31 | * nor may "OpenSSL" appear in their names without prior written | ||
32 | * permission of the OpenSSL Project. | ||
33 | * | ||
34 | * 6. Redistributions of any form whatsoever must retain the following | ||
35 | * acknowledgment: | ||
36 | * "This product includes software developed by the OpenSSL Project | ||
37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
38 | * | ||
39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | * ==================================================================== | ||
52 | * | ||
53 | * This product includes cryptographic software written by Eric Young | ||
54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
55 | * Hudson (tjh@cryptsoft.com). | ||
56 | * | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <openssl/crypto.h> | ||
61 | #include <openssl/err.h> | ||
62 | #include <openssl/conf.h> | ||
63 | #include <openssl/conf_api.h> | ||
64 | #include <openssl/lhash.h> | ||
65 | |||
66 | const char *CONF_version="CONF" OPENSSL_VERSION_PTEXT; | ||
67 | |||
68 | static CONF_METHOD *default_CONF_method=NULL; | ||
69 | |||
70 | /* Init a 'CONF' structure from an old LHASH */ | ||
71 | |||
72 | void CONF_set_nconf(CONF *conf, LHASH *hash) | ||
73 | { | ||
74 | if (default_CONF_method == NULL) | ||
75 | default_CONF_method = NCONF_default(); | ||
76 | |||
77 | default_CONF_method->init(conf); | ||
78 | conf->data = hash; | ||
79 | } | ||
80 | |||
81 | /* The following section contains the "CONF classic" functions, | ||
82 | rewritten in terms of the new CONF interface. */ | ||
83 | |||
84 | int CONF_set_default_method(CONF_METHOD *meth) | ||
85 | { | ||
86 | default_CONF_method = meth; | ||
87 | return 1; | ||
88 | } | ||
89 | |||
90 | LHASH *CONF_load(LHASH *conf, const char *file, long *eline) | ||
91 | { | ||
92 | LHASH *ltmp; | ||
93 | BIO *in=NULL; | ||
94 | |||
95 | #ifdef OPENSSL_SYS_VMS | ||
96 | in=BIO_new_file(file, "r"); | ||
97 | #else | ||
98 | in=BIO_new_file(file, "rb"); | ||
99 | #endif | ||
100 | if (in == NULL) | ||
101 | { | ||
102 | CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); | ||
103 | return NULL; | ||
104 | } | ||
105 | |||
106 | ltmp = CONF_load_bio(conf, in, eline); | ||
107 | BIO_free(in); | ||
108 | |||
109 | return ltmp; | ||
110 | } | ||
111 | |||
112 | #ifndef OPENSSL_NO_FP_API | ||
113 | LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline) | ||
114 | { | ||
115 | BIO *btmp; | ||
116 | LHASH *ltmp; | ||
117 | if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { | ||
118 | CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB); | ||
119 | return NULL; | ||
120 | } | ||
121 | ltmp = CONF_load_bio(conf, btmp, eline); | ||
122 | BIO_free(btmp); | ||
123 | return ltmp; | ||
124 | } | ||
125 | #endif | ||
126 | |||
127 | LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline) | ||
128 | { | ||
129 | CONF ctmp; | ||
130 | int ret; | ||
131 | |||
132 | CONF_set_nconf(&ctmp, conf); | ||
133 | |||
134 | ret = NCONF_load_bio(&ctmp, bp, eline); | ||
135 | if (ret) | ||
136 | return ctmp.data; | ||
137 | return NULL; | ||
138 | } | ||
139 | |||
140 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section) | ||
141 | { | ||
142 | if (conf == NULL) | ||
143 | { | ||
144 | return NULL; | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | CONF ctmp; | ||
149 | CONF_set_nconf(&ctmp, conf); | ||
150 | return NCONF_get_section(&ctmp, section); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | char *CONF_get_string(LHASH *conf,const char *group,const char *name) | ||
155 | { | ||
156 | if (conf == NULL) | ||
157 | { | ||
158 | return NCONF_get_string(NULL, group, name); | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | CONF ctmp; | ||
163 | CONF_set_nconf(&ctmp, conf); | ||
164 | return NCONF_get_string(&ctmp, group, name); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | long CONF_get_number(LHASH *conf,const char *group,const char *name) | ||
169 | { | ||
170 | int status; | ||
171 | long result = 0; | ||
172 | |||
173 | if (conf == NULL) | ||
174 | { | ||
175 | status = NCONF_get_number_e(NULL, group, name, &result); | ||
176 | } | ||
177 | else | ||
178 | { | ||
179 | CONF ctmp; | ||
180 | CONF_set_nconf(&ctmp, conf); | ||
181 | status = NCONF_get_number_e(&ctmp, group, name, &result); | ||
182 | } | ||
183 | |||
184 | if (status == 0) | ||
185 | { | ||
186 | /* This function does not believe in errors... */ | ||
187 | ERR_get_error(); | ||
188 | } | ||
189 | return result; | ||
190 | } | ||
191 | |||
192 | void CONF_free(LHASH *conf) | ||
193 | { | ||
194 | CONF ctmp; | ||
195 | CONF_set_nconf(&ctmp, conf); | ||
196 | NCONF_free_data(&ctmp); | ||
197 | } | ||
198 | |||
199 | #ifndef OPENSSL_NO_FP_API | ||
200 | int CONF_dump_fp(LHASH *conf, FILE *out) | ||
201 | { | ||
202 | BIO *btmp; | ||
203 | int ret; | ||
204 | |||
205 | if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { | ||
206 | CONFerr(CONF_F_CONF_DUMP_FP,ERR_R_BUF_LIB); | ||
207 | return 0; | ||
208 | } | ||
209 | ret = CONF_dump_bio(conf, btmp); | ||
210 | BIO_free(btmp); | ||
211 | return ret; | ||
212 | } | ||
213 | #endif | ||
214 | |||
215 | int CONF_dump_bio(LHASH *conf, BIO *out) | ||
216 | { | ||
217 | CONF ctmp; | ||
218 | CONF_set_nconf(&ctmp, conf); | ||
219 | return NCONF_dump_bio(&ctmp, out); | ||
220 | } | ||
221 | |||
222 | /* The following section contains the "New CONF" functions. They are | ||
223 | completely centralised around a new CONF structure that may contain | ||
224 | basically anything, but at least a method pointer and a table of data. | ||
225 | These functions are also written in terms of the bridge functions used | ||
226 | by the "CONF classic" functions, for consistency. */ | ||
227 | |||
228 | CONF *NCONF_new(CONF_METHOD *meth) | ||
229 | { | ||
230 | CONF *ret; | ||
231 | |||
232 | if (meth == NULL) | ||
233 | meth = NCONF_default(); | ||
234 | |||
235 | ret = meth->create(meth); | ||
236 | if (ret == NULL) | ||
237 | { | ||
238 | CONFerr(CONF_F_NCONF_NEW,ERR_R_MALLOC_FAILURE); | ||
239 | return(NULL); | ||
240 | } | ||
241 | |||
242 | return ret; | ||
243 | } | ||
244 | |||
245 | void NCONF_free(CONF *conf) | ||
246 | { | ||
247 | if (conf == NULL) | ||
248 | return; | ||
249 | conf->meth->destroy(conf); | ||
250 | } | ||
251 | |||
252 | void NCONF_free_data(CONF *conf) | ||
253 | { | ||
254 | if (conf == NULL) | ||
255 | return; | ||
256 | conf->meth->destroy_data(conf); | ||
257 | } | ||
258 | |||
259 | int NCONF_load(CONF *conf, const char *file, long *eline) | ||
260 | { | ||
261 | if (conf == NULL) | ||
262 | { | ||
263 | CONFerr(CONF_F_NCONF_LOAD,CONF_R_NO_CONF); | ||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | return conf->meth->load(conf, file, eline); | ||
268 | } | ||
269 | |||
270 | #ifndef OPENSSL_NO_FP_API | ||
271 | int NCONF_load_fp(CONF *conf, FILE *fp,long *eline) | ||
272 | { | ||
273 | BIO *btmp; | ||
274 | int ret; | ||
275 | if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) | ||
276 | { | ||
277 | CONFerr(CONF_F_NCONF_LOAD_FP,ERR_R_BUF_LIB); | ||
278 | return 0; | ||
279 | } | ||
280 | ret = NCONF_load_bio(conf, btmp, eline); | ||
281 | BIO_free(btmp); | ||
282 | return ret; | ||
283 | } | ||
284 | #endif | ||
285 | |||
286 | int NCONF_load_bio(CONF *conf, BIO *bp,long *eline) | ||
287 | { | ||
288 | if (conf == NULL) | ||
289 | { | ||
290 | CONFerr(CONF_F_NCONF_LOAD_BIO,CONF_R_NO_CONF); | ||
291 | return 0; | ||
292 | } | ||
293 | |||
294 | return conf->meth->load_bio(conf, bp, eline); | ||
295 | } | ||
296 | |||
297 | STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section) | ||
298 | { | ||
299 | if (conf == NULL) | ||
300 | { | ||
301 | CONFerr(CONF_F_NCONF_GET_SECTION,CONF_R_NO_CONF); | ||
302 | return NULL; | ||
303 | } | ||
304 | |||
305 | if (section == NULL) | ||
306 | { | ||
307 | CONFerr(CONF_F_NCONF_GET_SECTION,CONF_R_NO_SECTION); | ||
308 | return NULL; | ||
309 | } | ||
310 | |||
311 | return _CONF_get_section_values(conf, section); | ||
312 | } | ||
313 | |||
314 | char *NCONF_get_string(const CONF *conf,const char *group,const char *name) | ||
315 | { | ||
316 | char *s = _CONF_get_string(conf, group, name); | ||
317 | |||
318 | /* Since we may get a value from an environment variable even | ||
319 | if conf is NULL, let's check the value first */ | ||
320 | if (s) return s; | ||
321 | |||
322 | if (conf == NULL) | ||
323 | { | ||
324 | CONFerr(CONF_F_NCONF_GET_STRING, | ||
325 | CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE); | ||
326 | return NULL; | ||
327 | } | ||
328 | CONFerr(CONF_F_NCONF_GET_STRING, | ||
329 | CONF_R_NO_VALUE); | ||
330 | ERR_add_error_data(4,"group=",group," name=",name); | ||
331 | return NULL; | ||
332 | } | ||
333 | |||
334 | int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, | ||
335 | long *result) | ||
336 | { | ||
337 | char *str; | ||
338 | |||
339 | if (result == NULL) | ||
340 | { | ||
341 | CONFerr(CONF_F_NCONF_GET_NUMBER_E,ERR_R_PASSED_NULL_PARAMETER); | ||
342 | return 0; | ||
343 | } | ||
344 | |||
345 | str = NCONF_get_string(conf,group,name); | ||
346 | |||
347 | if (str == NULL) | ||
348 | return 0; | ||
349 | |||
350 | for (*result = 0;conf->meth->is_number(conf, *str);) | ||
351 | { | ||
352 | *result = (*result)*10 + conf->meth->to_int(conf, *str); | ||
353 | str++; | ||
354 | } | ||
355 | |||
356 | return 1; | ||
357 | } | ||
358 | |||
359 | #ifndef OPENSSL_NO_FP_API | ||
360 | int NCONF_dump_fp(const CONF *conf, FILE *out) | ||
361 | { | ||
362 | BIO *btmp; | ||
363 | int ret; | ||
364 | if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { | ||
365 | CONFerr(CONF_F_NCONF_DUMP_FP,ERR_R_BUF_LIB); | ||
366 | return 0; | ||
367 | } | ||
368 | ret = NCONF_dump_bio(conf, btmp); | ||
369 | BIO_free(btmp); | ||
370 | return ret; | ||
371 | } | ||
372 | #endif | ||
373 | |||
374 | int NCONF_dump_bio(const CONF *conf, BIO *out) | ||
375 | { | ||
376 | if (conf == NULL) | ||
377 | { | ||
378 | CONFerr(CONF_F_NCONF_DUMP_BIO,CONF_R_NO_CONF); | ||
379 | return 0; | ||
380 | } | ||
381 | |||
382 | return conf->meth->dump(conf, out); | ||
383 | } | ||
384 | |||
385 | |||
386 | /* This function should be avoided */ | ||
387 | #if 0 | ||
388 | long NCONF_get_number(CONF *conf,char *group,char *name) | ||
389 | { | ||
390 | int status; | ||
391 | long ret=0; | ||
392 | |||
393 | status = NCONF_get_number_e(conf, group, name, &ret); | ||
394 | if (status == 0) | ||
395 | { | ||
396 | /* This function does not believe in errors... */ | ||
397 | ERR_get_error(); | ||
398 | } | ||
399 | return ret; | ||
400 | } | ||
401 | #endif | ||
diff --git a/src/lib/libcrypto/conf/conf_mall.c b/src/lib/libcrypto/conf/conf_mall.c deleted file mode 100644 index 4ba40cf44c..0000000000 --- a/src/lib/libcrypto/conf/conf_mall.c +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | /* conf_mall.c */ | ||
2 | /* Written by Stephen Henson (shenson@bigfoot.com) for the OpenSSL | ||
3 | * project 2001. | ||
4 | */ | ||
5 | /* ==================================================================== | ||
6 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions | ||
10 | * are met: | ||
11 | * | ||
12 | * 1. Redistributions of source code must retain the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer. | ||
14 | * | ||
15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer in | ||
17 | * the documentation and/or other materials provided with the | ||
18 | * distribution. | ||
19 | * | ||
20 | * 3. All advertising materials mentioning features or use of this | ||
21 | * software must display the following acknowledgment: | ||
22 | * "This product includes software developed by the OpenSSL Project | ||
23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
24 | * | ||
25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
26 | * endorse or promote products derived from this software without | ||
27 | * prior written permission. For written permission, please contact | ||
28 | * licensing@OpenSSL.org. | ||
29 | * | ||
30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
31 | * nor may "OpenSSL" appear in their names without prior written | ||
32 | * permission of the OpenSSL Project. | ||
33 | * | ||
34 | * 6. Redistributions of any form whatsoever must retain the following | ||
35 | * acknowledgment: | ||
36 | * "This product includes software developed by the OpenSSL Project | ||
37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
38 | * | ||
39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | * ==================================================================== | ||
52 | * | ||
53 | * This product includes cryptographic software written by Eric Young | ||
54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
55 | * Hudson (tjh@cryptsoft.com). | ||
56 | * | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <openssl/crypto.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/conf.h> | ||
63 | #include <openssl/dso.h> | ||
64 | #include <openssl/x509.h> | ||
65 | #include <openssl/asn1.h> | ||
66 | #ifndef OPENSSL_NO_ENGINE | ||
67 | #include <openssl/engine.h> | ||
68 | #endif | ||
69 | |||
70 | /* Load all OpenSSL builtin modules */ | ||
71 | |||
72 | void OPENSSL_load_builtin_modules(void) | ||
73 | { | ||
74 | /* Add builtin modules here */ | ||
75 | ASN1_add_oid_module(); | ||
76 | #ifndef OPENSSL_NO_ENGINE | ||
77 | ENGINE_add_conf_module(); | ||
78 | #endif | ||
79 | } | ||
80 | |||
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c deleted file mode 100644 index d45adea851..0000000000 --- a/src/lib/libcrypto/conf/conf_mod.c +++ /dev/null | |||
@@ -1,616 +0,0 @@ | |||
1 | /* conf_mod.c */ | ||
2 | /* Written by Stephen Henson (shenson@bigfoot.com) for the OpenSSL | ||
3 | * project 2001. | ||
4 | */ | ||
5 | /* ==================================================================== | ||
6 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions | ||
10 | * are met: | ||
11 | * | ||
12 | * 1. Redistributions of source code must retain the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer. | ||
14 | * | ||
15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer in | ||
17 | * the documentation and/or other materials provided with the | ||
18 | * distribution. | ||
19 | * | ||
20 | * 3. All advertising materials mentioning features or use of this | ||
21 | * software must display the following acknowledgment: | ||
22 | * "This product includes software developed by the OpenSSL Project | ||
23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
24 | * | ||
25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
26 | * endorse or promote products derived from this software without | ||
27 | * prior written permission. For written permission, please contact | ||
28 | * licensing@OpenSSL.org. | ||
29 | * | ||
30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
31 | * nor may "OpenSSL" appear in their names without prior written | ||
32 | * permission of the OpenSSL Project. | ||
33 | * | ||
34 | * 6. Redistributions of any form whatsoever must retain the following | ||
35 | * acknowledgment: | ||
36 | * "This product includes software developed by the OpenSSL Project | ||
37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
38 | * | ||
39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | * ==================================================================== | ||
52 | * | ||
53 | * This product includes cryptographic software written by Eric Young | ||
54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
55 | * Hudson (tjh@cryptsoft.com). | ||
56 | * | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <ctype.h> | ||
61 | #include <openssl/crypto.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include <openssl/conf.h> | ||
64 | #include <openssl/dso.h> | ||
65 | #include <openssl/x509.h> | ||
66 | |||
67 | |||
68 | #define DSO_mod_init_name "OPENSSL_init" | ||
69 | #define DSO_mod_finish_name "OPENSSL_finish" | ||
70 | |||
71 | |||
72 | /* This structure contains a data about supported modules. | ||
73 | * entries in this table correspond to either dynamic or | ||
74 | * static modules. | ||
75 | */ | ||
76 | |||
77 | struct conf_module_st | ||
78 | { | ||
79 | /* DSO of this module or NULL if static */ | ||
80 | DSO *dso; | ||
81 | /* Name of the module */ | ||
82 | char *name; | ||
83 | /* Init function */ | ||
84 | conf_init_func *init; | ||
85 | /* Finish function */ | ||
86 | conf_finish_func *finish; | ||
87 | /* Number of successfully initialized modules */ | ||
88 | int links; | ||
89 | void *usr_data; | ||
90 | }; | ||
91 | |||
92 | |||
93 | /* This structure contains information about modules that have been | ||
94 | * successfully initialized. There may be more than one entry for a | ||
95 | * given module. | ||
96 | */ | ||
97 | |||
98 | struct conf_imodule_st | ||
99 | { | ||
100 | CONF_MODULE *pmod; | ||
101 | char *name; | ||
102 | char *value; | ||
103 | unsigned long flags; | ||
104 | void *usr_data; | ||
105 | }; | ||
106 | |||
107 | static STACK_OF(CONF_MODULE) *supported_modules = NULL; | ||
108 | static STACK_OF(CONF_IMODULE) *initialized_modules = NULL; | ||
109 | |||
110 | static void module_free(CONF_MODULE *md); | ||
111 | static void module_finish(CONF_IMODULE *imod); | ||
112 | static int module_run(const CONF *cnf, char *name, char *value, | ||
113 | unsigned long flags); | ||
114 | static CONF_MODULE *module_add(DSO *dso, const char *name, | ||
115 | conf_init_func *ifunc, conf_finish_func *ffunc); | ||
116 | static CONF_MODULE *module_find(char *name); | ||
117 | static int module_init(CONF_MODULE *pmod, char *name, char *value, | ||
118 | const CONF *cnf); | ||
119 | static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, | ||
120 | unsigned long flags); | ||
121 | |||
122 | /* Main function: load modules from a CONF structure */ | ||
123 | |||
124 | int CONF_modules_load(const CONF *cnf, const char *appname, | ||
125 | unsigned long flags) | ||
126 | { | ||
127 | STACK_OF(CONF_VALUE) *values; | ||
128 | CONF_VALUE *vl; | ||
129 | char *vsection; | ||
130 | |||
131 | int ret, i; | ||
132 | |||
133 | if (!cnf) | ||
134 | return 1; | ||
135 | |||
136 | if (appname == NULL) | ||
137 | appname = "openssl_conf"; | ||
138 | |||
139 | vsection = NCONF_get_string(cnf, NULL, appname); | ||
140 | |||
141 | if (!vsection) | ||
142 | { | ||
143 | ERR_clear_error(); | ||
144 | return 1; | ||
145 | } | ||
146 | |||
147 | values = NCONF_get_section(cnf, vsection); | ||
148 | |||
149 | if (!values) | ||
150 | return 0; | ||
151 | |||
152 | for (i = 0; i < sk_CONF_VALUE_num(values); i++) | ||
153 | { | ||
154 | vl = sk_CONF_VALUE_value(values, i); | ||
155 | ret = module_run(cnf, vl->name, vl->value, flags); | ||
156 | if (ret <= 0) | ||
157 | if(!(flags & CONF_MFLAGS_IGNORE_ERRORS)) | ||
158 | return ret; | ||
159 | } | ||
160 | |||
161 | return 1; | ||
162 | |||
163 | } | ||
164 | |||
165 | int CONF_modules_load_file(const char *filename, const char *appname, | ||
166 | unsigned long flags) | ||
167 | { | ||
168 | char *file = NULL; | ||
169 | CONF *conf = NULL; | ||
170 | int ret = 0; | ||
171 | conf = NCONF_new(NULL); | ||
172 | if (!conf) | ||
173 | goto err; | ||
174 | |||
175 | if (filename == NULL) | ||
176 | { | ||
177 | file = CONF_get1_default_config_file(); | ||
178 | if (!file) | ||
179 | goto err; | ||
180 | } | ||
181 | else | ||
182 | file = (char *)filename; | ||
183 | |||
184 | if (NCONF_load(conf, file, NULL) <= 0) | ||
185 | { | ||
186 | if ((flags & CONF_MFLAGS_IGNORE_MISSING_FILE) && | ||
187 | (ERR_GET_REASON(ERR_peek_last_error()) == CONF_R_NO_SUCH_FILE)) | ||
188 | { | ||
189 | ERR_clear_error(); | ||
190 | ret = 1; | ||
191 | } | ||
192 | goto err; | ||
193 | } | ||
194 | |||
195 | ret = CONF_modules_load(conf, appname, flags); | ||
196 | |||
197 | err: | ||
198 | if (filename == NULL) | ||
199 | OPENSSL_free(file); | ||
200 | NCONF_free(conf); | ||
201 | |||
202 | return ret; | ||
203 | } | ||
204 | |||
205 | static int module_run(const CONF *cnf, char *name, char *value, | ||
206 | unsigned long flags) | ||
207 | { | ||
208 | CONF_MODULE *md; | ||
209 | int ret; | ||
210 | |||
211 | md = module_find(name); | ||
212 | |||
213 | /* Module not found: try to load DSO */ | ||
214 | if (!md && !(flags & CONF_MFLAGS_NO_DSO)) | ||
215 | md = module_load_dso(cnf, name, value, flags); | ||
216 | |||
217 | if (!md) | ||
218 | { | ||
219 | if (!(flags & CONF_MFLAGS_SILENT)) | ||
220 | { | ||
221 | CONFerr(CONF_F_MODULE_RUN, CONF_R_UNKNOWN_MODULE_NAME); | ||
222 | ERR_add_error_data(2, "module=", name); | ||
223 | } | ||
224 | return -1; | ||
225 | } | ||
226 | |||
227 | ret = module_init(md, name, value, cnf); | ||
228 | |||
229 | if (ret <= 0) | ||
230 | { | ||
231 | if (!(flags & CONF_MFLAGS_SILENT)) | ||
232 | { | ||
233 | char rcode[DECIMAL_SIZE(ret)+1]; | ||
234 | CONFerr(CONF_F_CONF_MODULES_LOAD, CONF_R_MODULE_INITIALIZATION_ERROR); | ||
235 | BIO_snprintf(rcode, sizeof rcode, "%-8d", ret); | ||
236 | ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); | ||
237 | } | ||
238 | } | ||
239 | |||
240 | return ret; | ||
241 | } | ||
242 | |||
243 | /* Load a module from a DSO */ | ||
244 | static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, | ||
245 | unsigned long flags) | ||
246 | { | ||
247 | DSO *dso = NULL; | ||
248 | conf_init_func *ifunc; | ||
249 | conf_finish_func *ffunc; | ||
250 | char *path = NULL; | ||
251 | int errcode = 0; | ||
252 | CONF_MODULE *md; | ||
253 | /* Look for alternative path in module section */ | ||
254 | path = NCONF_get_string(cnf, value, "path"); | ||
255 | if (!path) | ||
256 | { | ||
257 | ERR_get_error(); | ||
258 | path = name; | ||
259 | } | ||
260 | dso = DSO_load(NULL, path, NULL, 0); | ||
261 | if (!dso) | ||
262 | { | ||
263 | errcode = CONF_R_ERROR_LOADING_DSO; | ||
264 | goto err; | ||
265 | } | ||
266 | ifunc = (conf_init_func *)DSO_bind_func(dso, DSO_mod_init_name); | ||
267 | if (!ifunc) | ||
268 | { | ||
269 | errcode = CONF_R_MISSING_INIT_FUNCTION; | ||
270 | goto err; | ||
271 | } | ||
272 | ffunc = (conf_finish_func *)DSO_bind_func(dso, DSO_mod_finish_name); | ||
273 | /* All OK, add module */ | ||
274 | md = module_add(dso, name, ifunc, ffunc); | ||
275 | |||
276 | if (!md) | ||
277 | goto err; | ||
278 | |||
279 | return md; | ||
280 | |||
281 | err: | ||
282 | if (dso) | ||
283 | DSO_free(dso); | ||
284 | CONFerr(CONF_F_MODULE_LOAD_DSO, errcode); | ||
285 | ERR_add_error_data(4, "module=", name, ", path=", path); | ||
286 | return NULL; | ||
287 | } | ||
288 | |||
289 | /* add module to list */ | ||
290 | static CONF_MODULE *module_add(DSO *dso, const char *name, | ||
291 | conf_init_func *ifunc, conf_finish_func *ffunc) | ||
292 | { | ||
293 | CONF_MODULE *tmod = NULL; | ||
294 | if (supported_modules == NULL) | ||
295 | supported_modules = sk_CONF_MODULE_new_null(); | ||
296 | if (supported_modules == NULL) | ||
297 | return NULL; | ||
298 | tmod = OPENSSL_malloc(sizeof(CONF_MODULE)); | ||
299 | if (tmod == NULL) | ||
300 | return NULL; | ||
301 | |||
302 | tmod->dso = dso; | ||
303 | tmod->name = BUF_strdup(name); | ||
304 | tmod->init = ifunc; | ||
305 | tmod->finish = ffunc; | ||
306 | tmod->links = 0; | ||
307 | |||
308 | if (!sk_CONF_MODULE_push(supported_modules, tmod)) | ||
309 | { | ||
310 | OPENSSL_free(tmod); | ||
311 | return NULL; | ||
312 | } | ||
313 | |||
314 | return tmod; | ||
315 | } | ||
316 | |||
317 | /* Find a module from the list. We allow module names of the | ||
318 | * form modname.XXXX to just search for modname to allow the | ||
319 | * same module to be initialized more than once. | ||
320 | */ | ||
321 | |||
322 | static CONF_MODULE *module_find(char *name) | ||
323 | { | ||
324 | CONF_MODULE *tmod; | ||
325 | int i, nchar; | ||
326 | char *p; | ||
327 | p = strrchr(name, '.'); | ||
328 | |||
329 | if (p) | ||
330 | nchar = p - name; | ||
331 | else | ||
332 | nchar = strlen(name); | ||
333 | |||
334 | for (i = 0; i < sk_CONF_MODULE_num(supported_modules); i++) | ||
335 | { | ||
336 | tmod = sk_CONF_MODULE_value(supported_modules, i); | ||
337 | if (!strncmp(tmod->name, name, nchar)) | ||
338 | return tmod; | ||
339 | } | ||
340 | |||
341 | return NULL; | ||
342 | |||
343 | } | ||
344 | |||
345 | /* initialize a module */ | ||
346 | static int module_init(CONF_MODULE *pmod, char *name, char *value, | ||
347 | const CONF *cnf) | ||
348 | { | ||
349 | int ret = 1; | ||
350 | int init_called = 0; | ||
351 | CONF_IMODULE *imod = NULL; | ||
352 | |||
353 | /* Otherwise add initialized module to list */ | ||
354 | imod = OPENSSL_malloc(sizeof(CONF_IMODULE)); | ||
355 | if (!imod) | ||
356 | goto err; | ||
357 | |||
358 | imod->pmod = pmod; | ||
359 | imod->name = BUF_strdup(name); | ||
360 | imod->value = BUF_strdup(value); | ||
361 | imod->usr_data = NULL; | ||
362 | |||
363 | if (!imod->name || !imod->value) | ||
364 | goto memerr; | ||
365 | |||
366 | /* Try to initialize module */ | ||
367 | if(pmod->init) | ||
368 | { | ||
369 | ret = pmod->init(imod, cnf); | ||
370 | init_called = 1; | ||
371 | /* Error occurred, exit */ | ||
372 | if (ret <= 0) | ||
373 | goto err; | ||
374 | } | ||
375 | |||
376 | if (initialized_modules == NULL) | ||
377 | { | ||
378 | initialized_modules = sk_CONF_IMODULE_new_null(); | ||
379 | if (!initialized_modules) | ||
380 | { | ||
381 | CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE); | ||
382 | goto err; | ||
383 | } | ||
384 | } | ||
385 | |||
386 | if (!sk_CONF_IMODULE_push(initialized_modules, imod)) | ||
387 | { | ||
388 | CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE); | ||
389 | goto err; | ||
390 | } | ||
391 | |||
392 | pmod->links++; | ||
393 | |||
394 | return ret; | ||
395 | |||
396 | err: | ||
397 | |||
398 | /* We've started the module so we'd better finish it */ | ||
399 | if (pmod->finish && init_called) | ||
400 | pmod->finish(imod); | ||
401 | |||
402 | memerr: | ||
403 | if (imod) | ||
404 | { | ||
405 | if (imod->name) | ||
406 | OPENSSL_free(imod->name); | ||
407 | if (imod->value) | ||
408 | OPENSSL_free(imod->value); | ||
409 | OPENSSL_free(imod); | ||
410 | } | ||
411 | |||
412 | return -1; | ||
413 | |||
414 | } | ||
415 | |||
416 | /* Unload any dynamic modules that have a link count of zero: | ||
417 | * i.e. have no active initialized modules. If 'all' is set | ||
418 | * then all modules are unloaded including static ones. | ||
419 | */ | ||
420 | |||
421 | void CONF_modules_unload(int all) | ||
422 | { | ||
423 | int i; | ||
424 | CONF_MODULE *md; | ||
425 | CONF_modules_finish(); | ||
426 | /* unload modules in reverse order */ | ||
427 | for (i = sk_CONF_MODULE_num(supported_modules) - 1; i >= 0; i--) | ||
428 | { | ||
429 | md = sk_CONF_MODULE_value(supported_modules, i); | ||
430 | /* If static or in use and 'all' not set ignore it */ | ||
431 | if (((md->links > 0) || !md->dso) && !all) | ||
432 | continue; | ||
433 | /* Since we're working in reverse this is OK */ | ||
434 | sk_CONF_MODULE_delete(supported_modules, i); | ||
435 | module_free(md); | ||
436 | } | ||
437 | if (sk_CONF_MODULE_num(supported_modules) == 0) | ||
438 | { | ||
439 | sk_CONF_MODULE_free(supported_modules); | ||
440 | supported_modules = NULL; | ||
441 | } | ||
442 | } | ||
443 | |||
444 | /* unload a single module */ | ||
445 | static void module_free(CONF_MODULE *md) | ||
446 | { | ||
447 | if (md->dso) | ||
448 | DSO_free(md->dso); | ||
449 | OPENSSL_free(md->name); | ||
450 | OPENSSL_free(md); | ||
451 | } | ||
452 | |||
453 | /* finish and free up all modules instances */ | ||
454 | |||
455 | void CONF_modules_finish(void) | ||
456 | { | ||
457 | CONF_IMODULE *imod; | ||
458 | while (sk_CONF_IMODULE_num(initialized_modules) > 0) | ||
459 | { | ||
460 | imod = sk_CONF_IMODULE_pop(initialized_modules); | ||
461 | module_finish(imod); | ||
462 | } | ||
463 | sk_CONF_IMODULE_free(initialized_modules); | ||
464 | initialized_modules = NULL; | ||
465 | } | ||
466 | |||
467 | /* finish a module instance */ | ||
468 | |||
469 | static void module_finish(CONF_IMODULE *imod) | ||
470 | { | ||
471 | if (imod->pmod->finish) | ||
472 | imod->pmod->finish(imod); | ||
473 | imod->pmod->links--; | ||
474 | OPENSSL_free(imod->name); | ||
475 | OPENSSL_free(imod->value); | ||
476 | OPENSSL_free(imod); | ||
477 | } | ||
478 | |||
479 | /* Add a static module to OpenSSL */ | ||
480 | |||
481 | int CONF_module_add(const char *name, conf_init_func *ifunc, | ||
482 | conf_finish_func *ffunc) | ||
483 | { | ||
484 | if (module_add(NULL, name, ifunc, ffunc)) | ||
485 | return 1; | ||
486 | else | ||
487 | return 0; | ||
488 | } | ||
489 | |||
490 | void CONF_modules_free(void) | ||
491 | { | ||
492 | CONF_modules_finish(); | ||
493 | CONF_modules_unload(1); | ||
494 | } | ||
495 | |||
496 | /* Utility functions */ | ||
497 | |||
498 | const char *CONF_imodule_get_name(const CONF_IMODULE *md) | ||
499 | { | ||
500 | return md->name; | ||
501 | } | ||
502 | |||
503 | const char *CONF_imodule_get_value(const CONF_IMODULE *md) | ||
504 | { | ||
505 | return md->value; | ||
506 | } | ||
507 | |||
508 | void *CONF_imodule_get_usr_data(const CONF_IMODULE *md) | ||
509 | { | ||
510 | return md->usr_data; | ||
511 | } | ||
512 | |||
513 | void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data) | ||
514 | { | ||
515 | md->usr_data = usr_data; | ||
516 | } | ||
517 | |||
518 | CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md) | ||
519 | { | ||
520 | return md->pmod; | ||
521 | } | ||
522 | |||
523 | unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md) | ||
524 | { | ||
525 | return md->flags; | ||
526 | } | ||
527 | |||
528 | void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags) | ||
529 | { | ||
530 | md->flags = flags; | ||
531 | } | ||
532 | |||
533 | void *CONF_module_get_usr_data(CONF_MODULE *pmod) | ||
534 | { | ||
535 | return pmod->usr_data; | ||
536 | } | ||
537 | |||
538 | void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data) | ||
539 | { | ||
540 | pmod->usr_data = usr_data; | ||
541 | } | ||
542 | |||
543 | /* Return default config file name */ | ||
544 | |||
545 | char *CONF_get1_default_config_file(void) | ||
546 | { | ||
547 | char *file; | ||
548 | int len; | ||
549 | |||
550 | file = getenv("OPENSSL_CONF"); | ||
551 | if (file) | ||
552 | return BUF_strdup(file); | ||
553 | |||
554 | len = strlen(X509_get_default_cert_area()); | ||
555 | #ifndef OPENSSL_SYS_VMS | ||
556 | len++; | ||
557 | #endif | ||
558 | len += strlen(OPENSSL_CONF); | ||
559 | |||
560 | file = OPENSSL_malloc(len + 1); | ||
561 | |||
562 | if (!file) | ||
563 | return NULL; | ||
564 | BUF_strlcpy(file,X509_get_default_cert_area(),len + 1); | ||
565 | #ifndef OPENSSL_SYS_VMS | ||
566 | BUF_strlcat(file,"/",len + 1); | ||
567 | #endif | ||
568 | BUF_strlcat(file,OPENSSL_CONF,len + 1); | ||
569 | |||
570 | return file; | ||
571 | } | ||
572 | |||
573 | /* This function takes a list separated by 'sep' and calls the | ||
574 | * callback function giving the start and length of each member | ||
575 | * optionally stripping leading and trailing whitespace. This can | ||
576 | * be used to parse comma separated lists for example. | ||
577 | */ | ||
578 | |||
579 | int CONF_parse_list(const char *list_, int sep, int nospc, | ||
580 | int (*list_cb)(const char *elem, int len, void *usr), void *arg) | ||
581 | { | ||
582 | int ret; | ||
583 | const char *lstart, *tmpend, *p; | ||
584 | lstart = list_; | ||
585 | |||
586 | for(;;) | ||
587 | { | ||
588 | if (nospc) | ||
589 | { | ||
590 | while(*lstart && isspace((unsigned char)*lstart)) | ||
591 | lstart++; | ||
592 | } | ||
593 | p = strchr(lstart, sep); | ||
594 | if (p == lstart || !*lstart) | ||
595 | ret = list_cb(NULL, 0, arg); | ||
596 | else | ||
597 | { | ||
598 | if (p) | ||
599 | tmpend = p - 1; | ||
600 | else | ||
601 | tmpend = lstart + strlen(lstart) - 1; | ||
602 | if (nospc) | ||
603 | { | ||
604 | while(isspace((unsigned char)*tmpend)) | ||
605 | tmpend--; | ||
606 | } | ||
607 | ret = list_cb(lstart, tmpend - lstart + 1, arg); | ||
608 | } | ||
609 | if (ret <= 0) | ||
610 | return ret; | ||
611 | if (p == NULL) | ||
612 | return 1; | ||
613 | lstart = p + 1; | ||
614 | } | ||
615 | } | ||
616 | |||
diff --git a/src/lib/libcrypto/conf/conf_sap.c b/src/lib/libcrypto/conf/conf_sap.c deleted file mode 100644 index e15c2e5546..0000000000 --- a/src/lib/libcrypto/conf/conf_sap.c +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | /* conf_sap.c */ | ||
2 | /* Written by Stephen Henson (shenson@bigfoot.com) for the OpenSSL | ||
3 | * project 2001. | ||
4 | */ | ||
5 | /* ==================================================================== | ||
6 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions | ||
10 | * are met: | ||
11 | * | ||
12 | * 1. Redistributions of source code must retain the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer. | ||
14 | * | ||
15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer in | ||
17 | * the documentation and/or other materials provided with the | ||
18 | * distribution. | ||
19 | * | ||
20 | * 3. All advertising materials mentioning features or use of this | ||
21 | * software must display the following acknowledgment: | ||
22 | * "This product includes software developed by the OpenSSL Project | ||
23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
24 | * | ||
25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
26 | * endorse or promote products derived from this software without | ||
27 | * prior written permission. For written permission, please contact | ||
28 | * licensing@OpenSSL.org. | ||
29 | * | ||
30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
31 | * nor may "OpenSSL" appear in their names without prior written | ||
32 | * permission of the OpenSSL Project. | ||
33 | * | ||
34 | * 6. Redistributions of any form whatsoever must retain the following | ||
35 | * acknowledgment: | ||
36 | * "This product includes software developed by the OpenSSL Project | ||
37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
38 | * | ||
39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | * ==================================================================== | ||
52 | * | ||
53 | * This product includes cryptographic software written by Eric Young | ||
54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
55 | * Hudson (tjh@cryptsoft.com). | ||
56 | * | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <openssl/crypto.h> | ||
61 | #include "cryptlib.h" | ||
62 | #include <openssl/conf.h> | ||
63 | #include <openssl/dso.h> | ||
64 | #include <openssl/x509.h> | ||
65 | #include <openssl/asn1.h> | ||
66 | #ifndef OPENSSL_NO_ENGINE | ||
67 | #include <openssl/engine.h> | ||
68 | #endif | ||
69 | |||
70 | /* This is the automatic configuration loader: it is called automatically by | ||
71 | * OpenSSL when any of a number of standard initialisation functions are called, | ||
72 | * unless this is overridden by calling OPENSSL_no_config() | ||
73 | */ | ||
74 | |||
75 | static int openssl_configured = 0; | ||
76 | |||
77 | void OPENSSL_config(const char *config_name) | ||
78 | { | ||
79 | if (openssl_configured) | ||
80 | return; | ||
81 | |||
82 | OPENSSL_load_builtin_modules(); | ||
83 | #ifndef OPENSSL_NO_ENGINE | ||
84 | /* Need to load ENGINEs */ | ||
85 | ENGINE_load_builtin_engines(); | ||
86 | #endif | ||
87 | /* Add others here? */ | ||
88 | |||
89 | |||
90 | ERR_clear_error(); | ||
91 | if (CONF_modules_load_file(NULL, NULL, | ||
92 | CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) | ||
93 | { | ||
94 | BIO *bio_err; | ||
95 | ERR_load_crypto_strings(); | ||
96 | if ((bio_err=BIO_new_fp(stderr, BIO_NOCLOSE)) != NULL) | ||
97 | { | ||
98 | BIO_printf(bio_err,"Auto configuration failed\n"); | ||
99 | ERR_print_errors(bio_err); | ||
100 | BIO_free(bio_err); | ||
101 | } | ||
102 | exit(1); | ||
103 | } | ||
104 | |||
105 | return; | ||
106 | } | ||
107 | |||
108 | void OPENSSL_no_config() | ||
109 | { | ||
110 | openssl_configured = 1; | ||
111 | } | ||
diff --git a/src/lib/libcrypto/conf/keysets.pl b/src/lib/libcrypto/conf/keysets.pl deleted file mode 100644 index 50ed67fa52..0000000000 --- a/src/lib/libcrypto/conf/keysets.pl +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | $NUMBER=0x01; | ||
4 | $UPPER=0x02; | ||
5 | $LOWER=0x04; | ||
6 | $UNDER=0x100; | ||
7 | $PUNCTUATION=0x200; | ||
8 | $WS=0x10; | ||
9 | $ESC=0x20; | ||
10 | $QUOTE=0x40; | ||
11 | $DQUOTE=0x400; | ||
12 | $COMMENT=0x80; | ||
13 | $FCOMMENT=0x800; | ||
14 | $EOF=0x08; | ||
15 | $HIGHBIT=0x1000; | ||
16 | |||
17 | foreach (0 .. 255) | ||
18 | { | ||
19 | $v=0; | ||
20 | $c=sprintf("%c",$_); | ||
21 | $v|=$NUMBER if ($c =~ /[0-9]/); | ||
22 | $v|=$UPPER if ($c =~ /[A-Z]/); | ||
23 | $v|=$LOWER if ($c =~ /[a-z]/); | ||
24 | $v|=$UNDER if ($c =~ /_/); | ||
25 | $v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/); | ||
26 | $v|=$WS if ($c =~ /[ \t\r\n]/); | ||
27 | $v|=$ESC if ($c =~ /\\/); | ||
28 | $v|=$QUOTE if ($c =~ /['`"]/); # for emacs: "`'}/) | ||
29 | $v|=$COMMENT if ($c =~ /\#/); | ||
30 | $v|=$EOF if ($c =~ /\0/); | ||
31 | $v|=$HIGHBIT if ($c =~/[\x80-\xff]/); | ||
32 | |||
33 | push(@V_def,$v); | ||
34 | } | ||
35 | |||
36 | foreach (0 .. 255) | ||
37 | { | ||
38 | $v=0; | ||
39 | $c=sprintf("%c",$_); | ||
40 | $v|=$NUMBER if ($c =~ /[0-9]/); | ||
41 | $v|=$UPPER if ($c =~ /[A-Z]/); | ||
42 | $v|=$LOWER if ($c =~ /[a-z]/); | ||
43 | $v|=$UNDER if ($c =~ /_/); | ||
44 | $v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/); | ||
45 | $v|=$WS if ($c =~ /[ \t\r\n]/); | ||
46 | $v|=$DQUOTE if ($c =~ /["]/); # for emacs: "}/) | ||
47 | $v|=$FCOMMENT if ($c =~ /;/); | ||
48 | $v|=$EOF if ($c =~ /\0/); | ||
49 | $v|=$HIGHBIT if ($c =~/[\x80-\xff]/); | ||
50 | |||
51 | push(@V_w32,$v); | ||
52 | } | ||
53 | |||
54 | print <<"EOF"; | ||
55 | /* crypto/conf/conf_def.h */ | ||
56 | /* Copyright (C) 1995-1998 Eric Young (eay\@cryptsoft.com) | ||
57 | * All rights reserved. | ||
58 | * | ||
59 | * This package is an SSL implementation written | ||
60 | * by Eric Young (eay\@cryptsoft.com). | ||
61 | * The implementation was written so as to conform with Netscapes SSL. | ||
62 | * | ||
63 | * This library is free for commercial and non-commercial use as long as | ||
64 | * the following conditions are aheared to. The following conditions | ||
65 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
66 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
67 | * included with this distribution is covered by the same copyright terms | ||
68 | * except that the holder is Tim Hudson (tjh\@cryptsoft.com). | ||
69 | * | ||
70 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
71 | * the code are not to be removed. | ||
72 | * If this package is used in a product, Eric Young should be given attribution | ||
73 | * as the author of the parts of the library used. | ||
74 | * This can be in the form of a textual message at program startup or | ||
75 | * in documentation (online or textual) provided with the package. | ||
76 | * | ||
77 | * Redistribution and use in source and binary forms, with or without | ||
78 | * modification, are permitted provided that the following conditions | ||
79 | * are met: | ||
80 | * 1. Redistributions of source code must retain the copyright | ||
81 | * notice, this list of conditions and the following disclaimer. | ||
82 | * 2. Redistributions in binary form must reproduce the above copyright | ||
83 | * notice, this list of conditions and the following disclaimer in the | ||
84 | * documentation and/or other materials provided with the distribution. | ||
85 | * 3. All advertising materials mentioning features or use of this software | ||
86 | * must display the following acknowledgement: | ||
87 | * "This product includes cryptographic software written by | ||
88 | * Eric Young (eay\@cryptsoft.com)" | ||
89 | * The word 'cryptographic' can be left out if the rouines from the library | ||
90 | * being used are not cryptographic related :-). | ||
91 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
92 | * the apps directory (application code) you must include an acknowledgement: | ||
93 | * "This product includes software written by Tim Hudson (tjh\@cryptsoft.com)" | ||
94 | * | ||
95 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
96 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
97 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
98 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
99 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
100 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
101 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
102 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
103 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
104 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
105 | * SUCH DAMAGE. | ||
106 | * | ||
107 | * The licence and distribution terms for any publically available version or | ||
108 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
109 | * copied and put under another distribution licence | ||
110 | * [including the GNU Public Licence.] | ||
111 | */ | ||
112 | |||
113 | /* THIS FILE WAS AUTOMAGICALLY GENERATED! | ||
114 | Please modify and use keysets.pl to regenerate it. */ | ||
115 | |||
116 | #define CONF_NUMBER $NUMBER | ||
117 | #define CONF_UPPER $UPPER | ||
118 | #define CONF_LOWER $LOWER | ||
119 | #define CONF_UNDER $UNDER | ||
120 | #define CONF_PUNCTUATION $PUNCTUATION | ||
121 | #define CONF_WS $WS | ||
122 | #define CONF_ESC $ESC | ||
123 | #define CONF_QUOTE $QUOTE | ||
124 | #define CONF_DQUOTE $DQUOTE | ||
125 | #define CONF_COMMENT $COMMENT | ||
126 | #define CONF_FCOMMENT $FCOMMENT | ||
127 | #define CONF_EOF $EOF | ||
128 | #define CONF_HIGHBIT $HIGHBIT | ||
129 | #define CONF_ALPHA (CONF_UPPER|CONF_LOWER) | ||
130 | #define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) | ||
131 | #define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \\ | ||
132 | CONF_PUNCTUATION) | ||
133 | |||
134 | #define KEYTYPES(c) ((unsigned short *)((c)->meth_data)) | ||
135 | #ifndef CHARSET_EBCDIC | ||
136 | #define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT) | ||
137 | #define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT) | ||
138 | #define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF) | ||
139 | #define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC) | ||
140 | #define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER) | ||
141 | #define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS) | ||
142 | #define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC) | ||
143 | #define IS_ALPHA_NUMERIC_PUNCT(c,a) \\ | ||
144 | (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT) | ||
145 | #define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE) | ||
146 | #define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE) | ||
147 | #define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT) | ||
148 | |||
149 | #else /*CHARSET_EBCDIC*/ | ||
150 | |||
151 | #define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_COMMENT) | ||
152 | #define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_FCOMMENT) | ||
153 | #define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_EOF) | ||
154 | #define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ESC) | ||
155 | #define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_NUMBER) | ||
156 | #define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_WS) | ||
157 | #define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC) | ||
158 | #define IS_ALPHA_NUMERIC_PUNCT(c,a) \\ | ||
159 | (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC_PUNCT) | ||
160 | #define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_QUOTE) | ||
161 | #define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_DQUOTE) | ||
162 | #define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_HIGHBIT) | ||
163 | #endif /*CHARSET_EBCDIC*/ | ||
164 | |||
165 | EOF | ||
166 | |||
167 | print "static unsigned short CONF_type_default[256]={"; | ||
168 | |||
169 | for ($i=0; $i<256; $i++) | ||
170 | { | ||
171 | print "\n\t" if ($i % 8) == 0; | ||
172 | printf "0x%04X,",$V_def[$i]; | ||
173 | } | ||
174 | |||
175 | print "\n\t};\n\n"; | ||
176 | |||
177 | print "static unsigned short CONF_type_win32[256]={"; | ||
178 | |||
179 | for ($i=0; $i<256; $i++) | ||
180 | { | ||
181 | print "\n\t" if ($i % 8) == 0; | ||
182 | printf "0x%04X,",$V_w32[$i]; | ||
183 | } | ||
184 | |||
185 | print "\n\t};\n\n"; | ||
diff --git a/src/lib/libcrypto/conf/ssleay.cnf b/src/lib/libcrypto/conf/ssleay.cnf deleted file mode 100644 index ed33af601e..0000000000 --- a/src/lib/libcrypto/conf/ssleay.cnf +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | # | ||
2 | # This is a test configuration file for use in SSLeay etc... | ||
3 | # | ||
4 | |||
5 | init = 5 | ||
6 | in\#it1 =10 | ||
7 | init2='10' | ||
8 | init3='10\'' | ||
9 | init4="10'" | ||
10 | init5='='10\'' again' | ||
11 | |||
12 | SSLeay::version = 0.5.0 | ||
13 | |||
14 | [genrsa] | ||
15 | default_bits = 512 | ||
16 | SSLEAY::version = 0.5.0 | ||
17 | |||
18 | [gendh] | ||
19 | default_bits = 512 | ||
20 | def_generator = 2 | ||
21 | |||
22 | [s_client] | ||
23 | cipher1 = DES_CBC_MD5:DES_CBC_SHA:DES_EDE_SHA:RC4_MD5\ | ||
24 | cipher2 = 'DES_CBC_MD5 DES_CBC_SHA DES_EDE_SHA RC4_MD5' | ||
25 | cipher3 = "DES_CBC_MD5 DES_CBC_SHA DES_EDE_SHA RC4_MD5" | ||
26 | cipher4 = DES_CBC_MD5 DES_CBC_SHA DES_EDE_SHA RC4_MD5 | ||
27 | |||
28 | [ default ] | ||
29 | cert_dir = $ENV::HOME/.ca_certs | ||
30 | |||
31 | HOME = /tmp/eay | ||
32 | |||
33 | tmp_cert_dir = $HOME/.ca_certs | ||
34 | tmp2_cert_dir = thisis$(HOME)stuff | ||
35 | |||
36 | LOGNAME = Eric Young (home=$HOME) | ||
37 | |||
38 | [ special ] | ||
39 | |||
40 | H=$HOME | ||
41 | H=$default::HOME | ||
42 | H=$ENV::HOME | ||
43 | # | ||
44 | # SSLeay example configuration file. | ||
45 | # This is mostly being used for generation of certificate requests. | ||
46 | # | ||
47 | |||
48 | RANDFILE = $HOME/.rand | ||
49 | |||
50 | [ req ] | ||
51 | default_bits = 512 | ||
52 | default_keyfile = privkey.pem | ||
53 | |||
54 | Attribute_type_1 = countryName | ||
55 | Attribute_text_1 = Country Name (2 letter code) | ||
56 | Attribute_default_1 = AU | ||
57 | |||
58 | Attribute_type_2 = stateOrProvinceName | ||
59 | Attribute_text_2 = State or Province Name (full name) | ||
60 | Attribute_default_2 = Queensland | ||
61 | |||
62 | Attribute_type_3 = localityName | ||
63 | Attribute_text_3 = Locality Name (eg, city) | ||
64 | |||
65 | Attribute_type_4 = organizationName | ||
66 | Attribute_text_4 = Organization Name (eg, company) | ||
67 | Attribute_default_4 = Mincom Pty Ltd | ||
68 | |||
69 | Attribute_type_5 = organizationalUnitName | ||
70 | Attribute_text_5 = Organizational Unit Name (eg, section) | ||
71 | Attribute_default_5 = TR | ||
72 | |||
73 | Attribute_type_6 = commonName | ||
74 | Attribute_text_6 = Common Name (eg, YOUR name) | ||
75 | |||
76 | Attribute_type_7 = emailAddress | ||
77 | Attribute_text_7 = Email Address | ||
78 | |||