diff options
author | cvs2svn <admin@example.com> | 2014-02-27 21:04:58 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 2014-02-27 21:04:58 +0000 |
commit | 726818f36b5221c023cd04c4b90bdbc08e94cd96 (patch) | |
tree | cf8221f3aa5bf5a578ddf1ecf5677ad08c04d342 /src/lib/libcrypto/conf | |
parent | 3b6d92e82b1421b811bcdec7f7fdfb31eeef18de (diff) | |
download | openbsd-OPENBSD_5_5_BASE.tar.gz openbsd-OPENBSD_5_5_BASE.tar.bz2 openbsd-OPENBSD_5_5_BASE.zip |
This commit was manufactured by cvs2git to create tag 'OPENBSD_5_5_BASE'.OPENBSD_5_5_BASE
Diffstat (limited to 'src/lib/libcrypto/conf')
-rw-r--r-- | src/lib/libcrypto/conf/README | 73 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf.h | 263 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_api.c | 301 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_api.h | 89 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_def.c | 740 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_def.h | 180 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_err.c | 131 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_lib.c | 407 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_mall.c | 80 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_mod.c | 623 | ||||
-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, 3261 deletions
diff --git a/src/lib/libcrypto/conf/README b/src/lib/libcrypto/conf/README deleted file mode 100644 index 96e53b34ed..0000000000 --- a/src/lib/libcrypto/conf/README +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | Configuration modules. These are a set of modules which can perform | ||
2 | various configuration functions. | ||
3 | |||
4 | Currently the routines should be called at most once when an application | ||
5 | starts up: that is before it starts any threads. | ||
6 | |||
7 | The routines read a configuration file set up like this: | ||
8 | |||
9 | ----- | ||
10 | #default section | ||
11 | openssl_conf=init_section | ||
12 | |||
13 | [init_section] | ||
14 | |||
15 | module1=value1 | ||
16 | #Second instance of module1 | ||
17 | module1.1=valueX | ||
18 | module2=value2 | ||
19 | module3=dso_literal | ||
20 | module4=dso_section | ||
21 | |||
22 | [dso_section] | ||
23 | |||
24 | path=/some/path/to/some/dso.so | ||
25 | other_stuff=other_value | ||
26 | ---- | ||
27 | |||
28 | When this file is loaded a configuration module with the specified string | ||
29 | (module* in the above example) is looked up and its init function called as: | ||
30 | |||
31 | int conf_init_func(CONF_IMODULE *md, CONF *cnf); | ||
32 | |||
33 | The function can then take whatever action is appropriate, for example further | ||
34 | lookups based on the value. Multiple instances of the same config module can be | ||
35 | loaded. | ||
36 | |||
37 | When the application closes down the modules are cleaned up by calling an | ||
38 | optional finish function: | ||
39 | |||
40 | void conf_finish_func(CONF_IMODULE *md); | ||
41 | |||
42 | The finish functions are called in reverse order: that is the last module | ||
43 | loaded is the first one cleaned up. | ||
44 | |||
45 | If no module exists with a given name then an attempt is made to load a DSO | ||
46 | with the supplied name. This might mean that "module3" attempts to load a DSO | ||
47 | called libmodule3.so or module3.dll for example. An explicit DSO name can be | ||
48 | given by including a separate section as in the module4 example above. | ||
49 | |||
50 | The DSO is expected to at least contain an initialization function: | ||
51 | |||
52 | int OPENSSL_init(CONF_IMODULE *md, CONF *cnf); | ||
53 | |||
54 | and may also include a finish function: | ||
55 | |||
56 | void OPENSSL_finish(CONF_IMODULE *md); | ||
57 | |||
58 | Static modules can also be added using, | ||
59 | |||
60 | int CONF_module_add(char *name, dso_mod_init_func *ifunc, dso_mod_finish_func | ||
61 | *ffunc); | ||
62 | |||
63 | where "name" is the name in the configuration file this function corresponds | ||
64 | to. | ||
65 | |||
66 | A set of builtin modules (currently only an ASN1 non functional test module) | ||
67 | can be added by calling OPENSSL_load_builtin_modules(). | ||
68 | |||
69 | The function OPENSSL_config() is intended as a simple configuration function | ||
70 | that any application can call to perform various default configuration tasks. | ||
71 | It uses the file openssl.cnf in the usual locations. | ||
72 | |||
73 | |||
diff --git a/src/lib/libcrypto/conf/conf.h b/src/lib/libcrypto/conf/conf.h deleted file mode 100644 index c2199978a3..0000000000 --- a/src/lib/libcrypto/conf/conf.h +++ /dev/null | |||
@@ -1,263 +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 | #include <openssl/ossl_typ.h> | ||
69 | |||
70 | #ifdef __cplusplus | ||
71 | extern "C" { | ||
72 | #endif | ||
73 | |||
74 | typedef struct | ||
75 | { | ||
76 | char *section; | ||
77 | char *name; | ||
78 | char *value; | ||
79 | } CONF_VALUE; | ||
80 | |||
81 | DECLARE_STACK_OF(CONF_VALUE) | ||
82 | DECLARE_LHASH_OF(CONF_VALUE); | ||
83 | |||
84 | struct conf_st; | ||
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 | DECLARE_STACK_OF(CONF_MODULE) | ||
108 | DECLARE_STACK_OF(CONF_IMODULE) | ||
109 | |||
110 | /* DSO module function typedefs */ | ||
111 | typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf); | ||
112 | typedef void conf_finish_func(CONF_IMODULE *md); | ||
113 | |||
114 | #define CONF_MFLAGS_IGNORE_ERRORS 0x1 | ||
115 | #define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 | ||
116 | #define CONF_MFLAGS_SILENT 0x4 | ||
117 | #define CONF_MFLAGS_NO_DSO 0x8 | ||
118 | #define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 | ||
119 | #define CONF_MFLAGS_DEFAULT_SECTION 0x20 | ||
120 | |||
121 | int CONF_set_default_method(CONF_METHOD *meth); | ||
122 | void CONF_set_nconf(CONF *conf,LHASH_OF(CONF_VALUE) *hash); | ||
123 | LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf,const char *file, | ||
124 | long *eline); | ||
125 | #ifndef OPENSSL_NO_FP_API | ||
126 | LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, | ||
127 | long *eline); | ||
128 | #endif | ||
129 | LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,long *eline); | ||
130 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, | ||
131 | const char *section); | ||
132 | char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group, | ||
133 | const char *name); | ||
134 | long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group, | ||
135 | const char *name); | ||
136 | void CONF_free(LHASH_OF(CONF_VALUE) *conf); | ||
137 | int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); | ||
138 | int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); | ||
139 | |||
140 | void OPENSSL_config(const char *config_name); | ||
141 | void OPENSSL_no_config(void); | ||
142 | |||
143 | /* New conf code. The semantics are different from the functions above. | ||
144 | If that wasn't the case, the above functions would have been replaced */ | ||
145 | |||
146 | struct conf_st | ||
147 | { | ||
148 | CONF_METHOD *meth; | ||
149 | void *meth_data; | ||
150 | LHASH_OF(CONF_VALUE) *data; | ||
151 | }; | ||
152 | |||
153 | CONF *NCONF_new(CONF_METHOD *meth); | ||
154 | CONF_METHOD *NCONF_default(void); | ||
155 | CONF_METHOD *NCONF_WIN32(void); | ||
156 | #if 0 /* Just to give you an idea of what I have in mind */ | ||
157 | CONF_METHOD *NCONF_XML(void); | ||
158 | #endif | ||
159 | void NCONF_free(CONF *conf); | ||
160 | void NCONF_free_data(CONF *conf); | ||
161 | |||
162 | int NCONF_load(CONF *conf,const char *file,long *eline); | ||
163 | #ifndef OPENSSL_NO_FP_API | ||
164 | int NCONF_load_fp(CONF *conf, FILE *fp,long *eline); | ||
165 | #endif | ||
166 | int NCONF_load_bio(CONF *conf, BIO *bp,long *eline); | ||
167 | STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section); | ||
168 | char *NCONF_get_string(const CONF *conf,const char *group,const char *name); | ||
169 | int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, | ||
170 | long *result); | ||
171 | int NCONF_dump_fp(const CONF *conf, FILE *out); | ||
172 | int NCONF_dump_bio(const CONF *conf, BIO *out); | ||
173 | |||
174 | #if 0 /* The following function has no error checking, | ||
175 | and should therefore be avoided */ | ||
176 | long NCONF_get_number(CONF *conf,char *group,char *name); | ||
177 | #else | ||
178 | #define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) | ||
179 | #endif | ||
180 | |||
181 | /* Module functions */ | ||
182 | |||
183 | int CONF_modules_load(const CONF *cnf, const char *appname, | ||
184 | unsigned long flags); | ||
185 | int CONF_modules_load_file(const char *filename, const char *appname, | ||
186 | unsigned long flags); | ||
187 | void CONF_modules_unload(int all); | ||
188 | void CONF_modules_finish(void); | ||
189 | void CONF_modules_free(void); | ||
190 | int CONF_module_add(const char *name, conf_init_func *ifunc, | ||
191 | conf_finish_func *ffunc); | ||
192 | |||
193 | const char *CONF_imodule_get_name(const CONF_IMODULE *md); | ||
194 | const char *CONF_imodule_get_value(const CONF_IMODULE *md); | ||
195 | void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); | ||
196 | void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); | ||
197 | CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); | ||
198 | unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); | ||
199 | void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); | ||
200 | void *CONF_module_get_usr_data(CONF_MODULE *pmod); | ||
201 | void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); | ||
202 | |||
203 | char *CONF_get1_default_config_file(void); | ||
204 | |||
205 | int CONF_parse_list(const char *list, int sep, int nospc, | ||
206 | int (*list_cb)(const char *elem, int len, void *usr), void *arg); | ||
207 | |||
208 | void OPENSSL_load_builtin_modules(void); | ||
209 | |||
210 | /* BEGIN ERROR CODES */ | ||
211 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
212 | * made after this point may be overwritten when the script is next run. | ||
213 | */ | ||
214 | void ERR_load_CONF_strings(void); | ||
215 | |||
216 | /* Error codes for the CONF functions. */ | ||
217 | |||
218 | /* Function codes. */ | ||
219 | #define CONF_F_CONF_DUMP_FP 104 | ||
220 | #define CONF_F_CONF_LOAD 100 | ||
221 | #define CONF_F_CONF_LOAD_BIO 102 | ||
222 | #define CONF_F_CONF_LOAD_FP 103 | ||
223 | #define CONF_F_CONF_MODULES_LOAD 116 | ||
224 | #define CONF_F_CONF_PARSE_LIST 119 | ||
225 | #define CONF_F_DEF_LOAD 120 | ||
226 | #define CONF_F_DEF_LOAD_BIO 121 | ||
227 | #define CONF_F_MODULE_INIT 115 | ||
228 | #define CONF_F_MODULE_LOAD_DSO 117 | ||
229 | #define CONF_F_MODULE_RUN 118 | ||
230 | #define CONF_F_NCONF_DUMP_BIO 105 | ||
231 | #define CONF_F_NCONF_DUMP_FP 106 | ||
232 | #define CONF_F_NCONF_GET_NUMBER 107 | ||
233 | #define CONF_F_NCONF_GET_NUMBER_E 112 | ||
234 | #define CONF_F_NCONF_GET_SECTION 108 | ||
235 | #define CONF_F_NCONF_GET_STRING 109 | ||
236 | #define CONF_F_NCONF_LOAD 113 | ||
237 | #define CONF_F_NCONF_LOAD_BIO 110 | ||
238 | #define CONF_F_NCONF_LOAD_FP 114 | ||
239 | #define CONF_F_NCONF_NEW 111 | ||
240 | #define CONF_F_STR_COPY 101 | ||
241 | |||
242 | /* Reason codes. */ | ||
243 | #define CONF_R_ERROR_LOADING_DSO 110 | ||
244 | #define CONF_R_LIST_CANNOT_BE_NULL 115 | ||
245 | #define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 | ||
246 | #define CONF_R_MISSING_EQUAL_SIGN 101 | ||
247 | #define CONF_R_MISSING_FINISH_FUNCTION 111 | ||
248 | #define CONF_R_MISSING_INIT_FUNCTION 112 | ||
249 | #define CONF_R_MODULE_INITIALIZATION_ERROR 109 | ||
250 | #define CONF_R_NO_CLOSE_BRACE 102 | ||
251 | #define CONF_R_NO_CONF 105 | ||
252 | #define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 | ||
253 | #define CONF_R_NO_SECTION 107 | ||
254 | #define CONF_R_NO_SUCH_FILE 114 | ||
255 | #define CONF_R_NO_VALUE 108 | ||
256 | #define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 | ||
257 | #define CONF_R_UNKNOWN_MODULE_NAME 113 | ||
258 | #define CONF_R_VARIABLE_HAS_NO_VALUE 104 | ||
259 | |||
260 | #ifdef __cplusplus | ||
261 | } | ||
262 | #endif | ||
263 | #endif | ||
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c deleted file mode 100644 index f5fcbb9f6b..0000000000 --- a/src/lib/libcrypto/conf/conf_api.c +++ /dev/null | |||
@@ -1,301 +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 <stdlib.h> | ||
68 | #include <string.h> | ||
69 | #include <openssl/conf.h> | ||
70 | #include <openssl/conf_api.h> | ||
71 | #include "e_os.h" | ||
72 | |||
73 | static void value_free_hash_doall_arg(CONF_VALUE *a, | ||
74 | LHASH_OF(CONF_VALUE) *conf); | ||
75 | static void value_free_stack_doall(CONF_VALUE *a); | ||
76 | static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE, | ||
77 | LHASH_OF(CONF_VALUE)) | ||
78 | static IMPLEMENT_LHASH_DOALL_FN(value_free_stack, CONF_VALUE) | ||
79 | |||
80 | /* Up until OpenSSL 0.9.5a, this was get_section */ | ||
81 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section) | ||
82 | { | ||
83 | CONF_VALUE *v,vv; | ||
84 | |||
85 | if ((conf == NULL) || (section == NULL)) return(NULL); | ||
86 | vv.name=NULL; | ||
87 | vv.section=(char *)section; | ||
88 | v=lh_CONF_VALUE_retrieve(conf->data,&vv); | ||
89 | return(v); | ||
90 | } | ||
91 | |||
92 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ | ||
93 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, | ||
94 | const char *section) | ||
95 | { | ||
96 | CONF_VALUE *v; | ||
97 | |||
98 | v=_CONF_get_section(conf,section); | ||
99 | if (v != NULL) | ||
100 | return((STACK_OF(CONF_VALUE) *)v->value); | ||
101 | else | ||
102 | return(NULL); | ||
103 | } | ||
104 | |||
105 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) | ||
106 | { | ||
107 | CONF_VALUE *v = NULL; | ||
108 | STACK_OF(CONF_VALUE) *ts; | ||
109 | |||
110 | ts = (STACK_OF(CONF_VALUE) *)section->value; | ||
111 | |||
112 | value->section=section->section; | ||
113 | if (!sk_CONF_VALUE_push(ts,value)) | ||
114 | { | ||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | v = lh_CONF_VALUE_insert(conf->data, value); | ||
119 | if (v != NULL) | ||
120 | { | ||
121 | (void)sk_CONF_VALUE_delete_ptr(ts,v); | ||
122 | OPENSSL_free(v->name); | ||
123 | OPENSSL_free(v->value); | ||
124 | OPENSSL_free(v); | ||
125 | } | ||
126 | return 1; | ||
127 | } | ||
128 | |||
129 | char *_CONF_get_string(const CONF *conf, const char *section, const char *name) | ||
130 | { | ||
131 | CONF_VALUE *v,vv; | ||
132 | char *p; | ||
133 | |||
134 | if (name == NULL) return(NULL); | ||
135 | if (conf != NULL) | ||
136 | { | ||
137 | if (section != NULL) | ||
138 | { | ||
139 | vv.name=(char *)name; | ||
140 | vv.section=(char *)section; | ||
141 | v=lh_CONF_VALUE_retrieve(conf->data,&vv); | ||
142 | if (v != NULL) return(v->value); | ||
143 | if (strcmp(section,"ENV") == 0) | ||
144 | { | ||
145 | p=getenv(name); | ||
146 | if (p != NULL) return(p); | ||
147 | } | ||
148 | } | ||
149 | vv.section="default"; | ||
150 | vv.name=(char *)name; | ||
151 | v=lh_CONF_VALUE_retrieve(conf->data,&vv); | ||
152 | if (v != NULL) | ||
153 | return(v->value); | ||
154 | else | ||
155 | return(NULL); | ||
156 | } | ||
157 | else | ||
158 | return(getenv(name)); | ||
159 | } | ||
160 | |||
161 | #if 0 /* There's no way to provide error checking with this function, so | ||
162 | force implementors of the higher levels to get a string and read | ||
163 | the number themselves. */ | ||
164 | long _CONF_get_number(CONF *conf, char *section, char *name) | ||
165 | { | ||
166 | char *str; | ||
167 | long ret=0; | ||
168 | |||
169 | str=_CONF_get_string(conf,section,name); | ||
170 | if (str == NULL) return(0); | ||
171 | for (;;) | ||
172 | { | ||
173 | if (conf->meth->is_number(conf, *str)) | ||
174 | ret=ret*10+conf->meth->to_int(conf, *str); | ||
175 | else | ||
176 | return(ret); | ||
177 | str++; | ||
178 | } | ||
179 | } | ||
180 | #endif | ||
181 | |||
182 | static unsigned long conf_value_hash(const CONF_VALUE *v) | ||
183 | { | ||
184 | return (lh_strhash(v->section)<<2)^lh_strhash(v->name); | ||
185 | } | ||
186 | static IMPLEMENT_LHASH_HASH_FN(conf_value, CONF_VALUE) | ||
187 | |||
188 | static int conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b) | ||
189 | { | ||
190 | int i; | ||
191 | |||
192 | if (a->section != b->section) | ||
193 | { | ||
194 | i=strcmp(a->section,b->section); | ||
195 | if (i) return(i); | ||
196 | } | ||
197 | |||
198 | if ((a->name != NULL) && (b->name != NULL)) | ||
199 | { | ||
200 | i=strcmp(a->name,b->name); | ||
201 | return(i); | ||
202 | } | ||
203 | else if (a->name == b->name) | ||
204 | return(0); | ||
205 | else | ||
206 | return((a->name == NULL)?-1:1); | ||
207 | } | ||
208 | static IMPLEMENT_LHASH_COMP_FN(conf_value, CONF_VALUE) | ||
209 | |||
210 | int _CONF_new_data(CONF *conf) | ||
211 | { | ||
212 | if (conf == NULL) | ||
213 | { | ||
214 | return 0; | ||
215 | } | ||
216 | if (conf->data == NULL) | ||
217 | if ((conf->data = lh_CONF_VALUE_new()) == NULL) | ||
218 | { | ||
219 | return 0; | ||
220 | } | ||
221 | return 1; | ||
222 | } | ||
223 | |||
224 | void _CONF_free_data(CONF *conf) | ||
225 | { | ||
226 | if (conf == NULL || conf->data == NULL) return; | ||
227 | |||
228 | lh_CONF_VALUE_down_load(conf->data)=0; /* evil thing to make | ||
229 | * sure the 'OPENSSL_free()' works as | ||
230 | * expected */ | ||
231 | lh_CONF_VALUE_doall_arg(conf->data, | ||
232 | LHASH_DOALL_ARG_FN(value_free_hash), | ||
233 | LHASH_OF(CONF_VALUE), conf->data); | ||
234 | |||
235 | /* We now have only 'section' entries in the hash table. | ||
236 | * Due to problems with */ | ||
237 | |||
238 | lh_CONF_VALUE_doall(conf->data, LHASH_DOALL_FN(value_free_stack)); | ||
239 | lh_CONF_VALUE_free(conf->data); | ||
240 | } | ||
241 | |||
242 | static void value_free_hash_doall_arg(CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf) | ||
243 | { | ||
244 | if (a->name != NULL) | ||
245 | (void)lh_CONF_VALUE_delete(conf,a); | ||
246 | } | ||
247 | |||
248 | static void value_free_stack_doall(CONF_VALUE *a) | ||
249 | { | ||
250 | CONF_VALUE *vv; | ||
251 | STACK_OF(CONF_VALUE) *sk; | ||
252 | int i; | ||
253 | |||
254 | if (a->name != NULL) return; | ||
255 | |||
256 | sk=(STACK_OF(CONF_VALUE) *)a->value; | ||
257 | for (i=sk_CONF_VALUE_num(sk)-1; i>=0; i--) | ||
258 | { | ||
259 | vv=sk_CONF_VALUE_value(sk,i); | ||
260 | OPENSSL_free(vv->value); | ||
261 | OPENSSL_free(vv->name); | ||
262 | OPENSSL_free(vv); | ||
263 | } | ||
264 | if (sk != NULL) sk_CONF_VALUE_free(sk); | ||
265 | OPENSSL_free(a->section); | ||
266 | OPENSSL_free(a); | ||
267 | } | ||
268 | |||
269 | /* Up until OpenSSL 0.9.5a, this was new_section */ | ||
270 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) | ||
271 | { | ||
272 | STACK_OF(CONF_VALUE) *sk=NULL; | ||
273 | int ok=0,i; | ||
274 | CONF_VALUE *v=NULL,*vv; | ||
275 | |||
276 | if ((sk=sk_CONF_VALUE_new_null()) == NULL) | ||
277 | goto err; | ||
278 | if ((v=OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL) | ||
279 | goto err; | ||
280 | i=strlen(section)+1; | ||
281 | if ((v->section=OPENSSL_malloc(i)) == NULL) | ||
282 | goto err; | ||
283 | |||
284 | memcpy(v->section,section,i); | ||
285 | v->name=NULL; | ||
286 | v->value=(char *)sk; | ||
287 | |||
288 | vv=lh_CONF_VALUE_insert(conf->data,v); | ||
289 | OPENSSL_assert(vv == NULL); | ||
290 | ok=1; | ||
291 | err: | ||
292 | if (!ok) | ||
293 | { | ||
294 | if (sk != NULL) sk_CONF_VALUE_free(sk); | ||
295 | if (v != NULL) OPENSSL_free(v); | ||
296 | v=NULL; | ||
297 | } | ||
298 | return(v); | ||
299 | } | ||
300 | |||
301 | 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 cf951320af..0000000000 --- a/src/lib/libcrypto/conf/conf_def.c +++ /dev/null | |||
@@ -1,740 +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 "cryptlib.h" | ||
64 | #include <openssl/stack.h> | ||
65 | #include <openssl/lhash.h> | ||
66 | #include <openssl/conf.h> | ||
67 | #include <openssl/conf_api.h> | ||
68 | #include "conf_def.h" | ||
69 | #include <openssl/buffer.h> | ||
70 | #include <openssl/err.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 = 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 = 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_DEF_LOAD,CONF_R_NO_SUCH_FILE); | ||
198 | else | ||
199 | CONFerr(CONF_F_DEF_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; | ||
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 | char *start,*psection,*pname; | ||
223 | void *h = (void *)(conf->data); | ||
224 | |||
225 | if ((buff=BUF_MEM_new()) == NULL) | ||
226 | { | ||
227 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_BUF_LIB); | ||
228 | goto err; | ||
229 | } | ||
230 | |||
231 | section=(char *)OPENSSL_malloc(10); | ||
232 | if (section == NULL) | ||
233 | { | ||
234 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE); | ||
235 | goto err; | ||
236 | } | ||
237 | BUF_strlcpy(section,"default",10); | ||
238 | |||
239 | if (_CONF_new_data(conf) == 0) | ||
240 | { | ||
241 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE); | ||
242 | goto err; | ||
243 | } | ||
244 | |||
245 | sv=_CONF_new_section(conf,section); | ||
246 | if (sv == NULL) | ||
247 | { | ||
248 | CONFerr(CONF_F_DEF_LOAD_BIO, | ||
249 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
250 | goto err; | ||
251 | } | ||
252 | |||
253 | bufnum=0; | ||
254 | again=0; | ||
255 | for (;;) | ||
256 | { | ||
257 | if (!BUF_MEM_grow(buff,bufnum+CONFBUFSIZE)) | ||
258 | { | ||
259 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_BUF_LIB); | ||
260 | goto err; | ||
261 | } | ||
262 | p= &(buff->data[bufnum]); | ||
263 | *p='\0'; | ||
264 | BIO_gets(in, p, CONFBUFSIZE-1); | ||
265 | p[CONFBUFSIZE-1]='\0'; | ||
266 | ii=i=strlen(p); | ||
267 | if (i == 0 && !again) break; | ||
268 | again=0; | ||
269 | while (i > 0) | ||
270 | { | ||
271 | if ((p[i-1] != '\r') && (p[i-1] != '\n')) | ||
272 | break; | ||
273 | else | ||
274 | i--; | ||
275 | } | ||
276 | /* we removed some trailing stuff so there is a new | ||
277 | * line on the end. */ | ||
278 | if (ii && i == ii) | ||
279 | again=1; /* long line */ | ||
280 | else | ||
281 | { | ||
282 | p[i]='\0'; | ||
283 | eline++; /* another input line */ | ||
284 | } | ||
285 | |||
286 | /* we now have a line with trailing \r\n removed */ | ||
287 | |||
288 | /* i is the number of bytes */ | ||
289 | bufnum+=i; | ||
290 | |||
291 | v=NULL; | ||
292 | /* check for line continuation */ | ||
293 | if (bufnum >= 1) | ||
294 | { | ||
295 | /* If we have bytes and the last char '\\' and | ||
296 | * second last char is not '\\' */ | ||
297 | p= &(buff->data[bufnum-1]); | ||
298 | if (IS_ESC(conf,p[0]) && | ||
299 | ((bufnum <= 1) || !IS_ESC(conf,p[-1]))) | ||
300 | { | ||
301 | bufnum--; | ||
302 | again=1; | ||
303 | } | ||
304 | } | ||
305 | if (again) continue; | ||
306 | bufnum=0; | ||
307 | buf=buff->data; | ||
308 | |||
309 | clear_comments(conf, buf); | ||
310 | s=eat_ws(conf, buf); | ||
311 | if (IS_EOF(conf,*s)) continue; /* blank line */ | ||
312 | if (*s == '[') | ||
313 | { | ||
314 | char *ss; | ||
315 | |||
316 | s++; | ||
317 | start=eat_ws(conf, s); | ||
318 | ss=start; | ||
319 | again: | ||
320 | end=eat_alpha_numeric(conf, ss); | ||
321 | p=eat_ws(conf, end); | ||
322 | if (*p != ']') | ||
323 | { | ||
324 | if (*p != '\0') | ||
325 | { | ||
326 | ss=p; | ||
327 | goto again; | ||
328 | } | ||
329 | CONFerr(CONF_F_DEF_LOAD_BIO, | ||
330 | CONF_R_MISSING_CLOSE_SQUARE_BRACKET); | ||
331 | goto err; | ||
332 | } | ||
333 | *end='\0'; | ||
334 | if (!str_copy(conf,NULL,§ion,start)) goto err; | ||
335 | if ((sv=_CONF_get_section(conf,section)) == NULL) | ||
336 | sv=_CONF_new_section(conf,section); | ||
337 | if (sv == NULL) | ||
338 | { | ||
339 | CONFerr(CONF_F_DEF_LOAD_BIO, | ||
340 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
341 | goto err; | ||
342 | } | ||
343 | continue; | ||
344 | } | ||
345 | else | ||
346 | { | ||
347 | pname=s; | ||
348 | psection=NULL; | ||
349 | end=eat_alpha_numeric(conf, s); | ||
350 | if ((end[0] == ':') && (end[1] == ':')) | ||
351 | { | ||
352 | *end='\0'; | ||
353 | end+=2; | ||
354 | psection=pname; | ||
355 | pname=end; | ||
356 | end=eat_alpha_numeric(conf, end); | ||
357 | } | ||
358 | p=eat_ws(conf, end); | ||
359 | if (*p != '=') | ||
360 | { | ||
361 | CONFerr(CONF_F_DEF_LOAD_BIO, | ||
362 | CONF_R_MISSING_EQUAL_SIGN); | ||
363 | goto err; | ||
364 | } | ||
365 | *end='\0'; | ||
366 | p++; | ||
367 | start=eat_ws(conf, p); | ||
368 | while (!IS_EOF(conf,*p)) | ||
369 | p++; | ||
370 | p--; | ||
371 | while ((p != start) && (IS_WS(conf,*p))) | ||
372 | p--; | ||
373 | p++; | ||
374 | *p='\0'; | ||
375 | |||
376 | if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) | ||
377 | { | ||
378 | CONFerr(CONF_F_DEF_LOAD_BIO, | ||
379 | ERR_R_MALLOC_FAILURE); | ||
380 | goto err; | ||
381 | } | ||
382 | if (psection == NULL) psection=section; | ||
383 | v->name=(char *)OPENSSL_malloc(strlen(pname)+1); | ||
384 | v->value=NULL; | ||
385 | if (v->name == NULL) | ||
386 | { | ||
387 | CONFerr(CONF_F_DEF_LOAD_BIO, | ||
388 | ERR_R_MALLOC_FAILURE); | ||
389 | goto err; | ||
390 | } | ||
391 | BUF_strlcpy(v->name,pname,strlen(pname)+1); | ||
392 | if (!str_copy(conf,psection,&(v->value),start)) goto err; | ||
393 | |||
394 | if (strcmp(psection,section) != 0) | ||
395 | { | ||
396 | if ((tv=_CONF_get_section(conf,psection)) | ||
397 | == NULL) | ||
398 | tv=_CONF_new_section(conf,psection); | ||
399 | if (tv == NULL) | ||
400 | { | ||
401 | CONFerr(CONF_F_DEF_LOAD_BIO, | ||
402 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
403 | goto err; | ||
404 | } | ||
405 | } | ||
406 | else | ||
407 | tv=sv; | ||
408 | #if 1 | ||
409 | if (_CONF_add_string(conf, tv, v) == 0) | ||
410 | { | ||
411 | CONFerr(CONF_F_DEF_LOAD_BIO, | ||
412 | ERR_R_MALLOC_FAILURE); | ||
413 | goto err; | ||
414 | } | ||
415 | #else | ||
416 | v->section=tv->section; | ||
417 | if (!sk_CONF_VALUE_push(ts,v)) | ||
418 | { | ||
419 | CONFerr(CONF_F_DEF_LOAD_BIO, | ||
420 | ERR_R_MALLOC_FAILURE); | ||
421 | goto err; | ||
422 | } | ||
423 | vv=(CONF_VALUE *)lh_insert(conf->data,v); | ||
424 | if (vv != NULL) | ||
425 | { | ||
426 | sk_CONF_VALUE_delete_ptr(ts,vv); | ||
427 | OPENSSL_free(vv->name); | ||
428 | OPENSSL_free(vv->value); | ||
429 | OPENSSL_free(vv); | ||
430 | } | ||
431 | #endif | ||
432 | v=NULL; | ||
433 | } | ||
434 | } | ||
435 | if (buff != NULL) BUF_MEM_free(buff); | ||
436 | if (section != NULL) OPENSSL_free(section); | ||
437 | return(1); | ||
438 | err: | ||
439 | if (buff != NULL) BUF_MEM_free(buff); | ||
440 | if (section != NULL) OPENSSL_free(section); | ||
441 | if (line != NULL) *line=eline; | ||
442 | BIO_snprintf(btmp,sizeof btmp,"%ld",eline); | ||
443 | ERR_add_error_data(2,"line ",btmp); | ||
444 | if ((h != conf->data) && (conf->data != NULL)) | ||
445 | { | ||
446 | CONF_free(conf->data); | ||
447 | conf->data=NULL; | ||
448 | } | ||
449 | if (v != NULL) | ||
450 | { | ||
451 | if (v->name != NULL) OPENSSL_free(v->name); | ||
452 | if (v->value != NULL) OPENSSL_free(v->value); | ||
453 | if (v != NULL) OPENSSL_free(v); | ||
454 | } | ||
455 | return(0); | ||
456 | } | ||
457 | |||
458 | static void clear_comments(CONF *conf, char *p) | ||
459 | { | ||
460 | for (;;) | ||
461 | { | ||
462 | if (IS_FCOMMENT(conf,*p)) | ||
463 | { | ||
464 | *p='\0'; | ||
465 | return; | ||
466 | } | ||
467 | if (!IS_WS(conf,*p)) | ||
468 | { | ||
469 | break; | ||
470 | } | ||
471 | p++; | ||
472 | } | ||
473 | |||
474 | for (;;) | ||
475 | { | ||
476 | if (IS_COMMENT(conf,*p)) | ||
477 | { | ||
478 | *p='\0'; | ||
479 | return; | ||
480 | } | ||
481 | if (IS_DQUOTE(conf,*p)) | ||
482 | { | ||
483 | p=scan_dquote(conf, p); | ||
484 | continue; | ||
485 | } | ||
486 | if (IS_QUOTE(conf,*p)) | ||
487 | { | ||
488 | p=scan_quote(conf, p); | ||
489 | continue; | ||
490 | } | ||
491 | if (IS_ESC(conf,*p)) | ||
492 | { | ||
493 | p=scan_esc(conf,p); | ||
494 | continue; | ||
495 | } | ||
496 | if (IS_EOF(conf,*p)) | ||
497 | return; | ||
498 | else | ||
499 | p++; | ||
500 | } | ||
501 | } | ||
502 | |||
503 | static int str_copy(CONF *conf, char *section, char **pto, char *from) | ||
504 | { | ||
505 | int q,r,rr=0,to=0,len=0; | ||
506 | char *s,*e,*rp,*p,*rrp,*np,*cp,v; | ||
507 | BUF_MEM *buf; | ||
508 | |||
509 | if ((buf=BUF_MEM_new()) == NULL) return(0); | ||
510 | |||
511 | len=strlen(from)+1; | ||
512 | if (!BUF_MEM_grow(buf,len)) goto err; | ||
513 | |||
514 | for (;;) | ||
515 | { | ||
516 | if (IS_QUOTE(conf,*from)) | ||
517 | { | ||
518 | q= *from; | ||
519 | from++; | ||
520 | while (!IS_EOF(conf,*from) && (*from != q)) | ||
521 | { | ||
522 | if (IS_ESC(conf,*from)) | ||
523 | { | ||
524 | from++; | ||
525 | if (IS_EOF(conf,*from)) break; | ||
526 | } | ||
527 | buf->data[to++]= *(from++); | ||
528 | } | ||
529 | if (*from == q) from++; | ||
530 | } | ||
531 | else if (IS_DQUOTE(conf,*from)) | ||
532 | { | ||
533 | q= *from; | ||
534 | from++; | ||
535 | while (!IS_EOF(conf,*from)) | ||
536 | { | ||
537 | if (*from == q) | ||
538 | { | ||
539 | if (*(from+1) == q) | ||
540 | { | ||
541 | from++; | ||
542 | } | ||
543 | else | ||
544 | { | ||
545 | break; | ||
546 | } | ||
547 | } | ||
548 | buf->data[to++]= *(from++); | ||
549 | } | ||
550 | if (*from == q) from++; | ||
551 | } | ||
552 | else if (IS_ESC(conf,*from)) | ||
553 | { | ||
554 | from++; | ||
555 | v= *(from++); | ||
556 | if (IS_EOF(conf,v)) break; | ||
557 | else if (v == 'r') v='\r'; | ||
558 | else if (v == 'n') v='\n'; | ||
559 | else if (v == 'b') v='\b'; | ||
560 | else if (v == 't') v='\t'; | ||
561 | buf->data[to++]= v; | ||
562 | } | ||
563 | else if (IS_EOF(conf,*from)) | ||
564 | break; | ||
565 | else if (*from == '$') | ||
566 | { | ||
567 | /* try to expand it */ | ||
568 | rrp=NULL; | ||
569 | s= &(from[1]); | ||
570 | if (*s == '{') | ||
571 | q='}'; | ||
572 | else if (*s == '(') | ||
573 | q=')'; | ||
574 | else q=0; | ||
575 | |||
576 | if (q) s++; | ||
577 | cp=section; | ||
578 | e=np=s; | ||
579 | while (IS_ALPHA_NUMERIC(conf,*e)) | ||
580 | e++; | ||
581 | if ((e[0] == ':') && (e[1] == ':')) | ||
582 | { | ||
583 | cp=np; | ||
584 | rrp=e; | ||
585 | rr= *e; | ||
586 | *rrp='\0'; | ||
587 | e+=2; | ||
588 | np=e; | ||
589 | while (IS_ALPHA_NUMERIC(conf,*e)) | ||
590 | e++; | ||
591 | } | ||
592 | r= *e; | ||
593 | *e='\0'; | ||
594 | rp=e; | ||
595 | if (q) | ||
596 | { | ||
597 | if (r != q) | ||
598 | { | ||
599 | CONFerr(CONF_F_STR_COPY,CONF_R_NO_CLOSE_BRACE); | ||
600 | goto err; | ||
601 | } | ||
602 | e++; | ||
603 | } | ||
604 | /* So at this point we have | ||
605 | * np which is the start of the name string which is | ||
606 | * '\0' terminated. | ||
607 | * cp which is the start of the section string which is | ||
608 | * '\0' terminated. | ||
609 | * e is the 'next point after'. | ||
610 | * r and rr are the chars replaced by the '\0' | ||
611 | * rp and rrp is where 'r' and 'rr' came from. | ||
612 | */ | ||
613 | p=_CONF_get_string(conf,cp,np); | ||
614 | if (rrp != NULL) *rrp=rr; | ||
615 | *rp=r; | ||
616 | if (p == NULL) | ||
617 | { | ||
618 | CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE); | ||
619 | goto err; | ||
620 | } | ||
621 | BUF_MEM_grow_clean(buf,(strlen(p)+buf->length-(e-from))); | ||
622 | while (*p) | ||
623 | buf->data[to++]= *(p++); | ||
624 | |||
625 | /* Since we change the pointer 'from', we also have | ||
626 | to change the perceived length of the string it | ||
627 | points at. /RL */ | ||
628 | len -= e-from; | ||
629 | from=e; | ||
630 | |||
631 | /* In case there were no braces or parenthesis around | ||
632 | the variable reference, we have to put back the | ||
633 | character that was replaced with a '\0'. /RL */ | ||
634 | *rp = r; | ||
635 | } | ||
636 | else | ||
637 | buf->data[to++]= *(from++); | ||
638 | } | ||
639 | buf->data[to]='\0'; | ||
640 | if (*pto != NULL) OPENSSL_free(*pto); | ||
641 | *pto=buf->data; | ||
642 | OPENSSL_free(buf); | ||
643 | return(1); | ||
644 | err: | ||
645 | if (buf != NULL) BUF_MEM_free(buf); | ||
646 | return(0); | ||
647 | } | ||
648 | |||
649 | static char *eat_ws(CONF *conf, char *p) | ||
650 | { | ||
651 | while (IS_WS(conf,*p) && (!IS_EOF(conf,*p))) | ||
652 | p++; | ||
653 | return(p); | ||
654 | } | ||
655 | |||
656 | static char *eat_alpha_numeric(CONF *conf, char *p) | ||
657 | { | ||
658 | for (;;) | ||
659 | { | ||
660 | if (IS_ESC(conf,*p)) | ||
661 | { | ||
662 | p=scan_esc(conf,p); | ||
663 | continue; | ||
664 | } | ||
665 | if (!IS_ALPHA_NUMERIC_PUNCT(conf,*p)) | ||
666 | return(p); | ||
667 | p++; | ||
668 | } | ||
669 | } | ||
670 | |||
671 | static char *scan_quote(CONF *conf, char *p) | ||
672 | { | ||
673 | int q= *p; | ||
674 | |||
675 | p++; | ||
676 | while (!(IS_EOF(conf,*p)) && (*p != q)) | ||
677 | { | ||
678 | if (IS_ESC(conf,*p)) | ||
679 | { | ||
680 | p++; | ||
681 | if (IS_EOF(conf,*p)) return(p); | ||
682 | } | ||
683 | p++; | ||
684 | } | ||
685 | if (*p == q) p++; | ||
686 | return(p); | ||
687 | } | ||
688 | |||
689 | |||
690 | static char *scan_dquote(CONF *conf, char *p) | ||
691 | { | ||
692 | int q= *p; | ||
693 | |||
694 | p++; | ||
695 | while (!(IS_EOF(conf,*p))) | ||
696 | { | ||
697 | if (*p == q) | ||
698 | { | ||
699 | if (*(p+1) == q) | ||
700 | { | ||
701 | p++; | ||
702 | } | ||
703 | else | ||
704 | { | ||
705 | break; | ||
706 | } | ||
707 | } | ||
708 | p++; | ||
709 | } | ||
710 | if (*p == q) p++; | ||
711 | return(p); | ||
712 | } | ||
713 | |||
714 | static void dump_value_doall_arg(CONF_VALUE *a, BIO *out) | ||
715 | { | ||
716 | if (a->name) | ||
717 | BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value); | ||
718 | else | ||
719 | BIO_printf(out, "[[%s]]\n", a->section); | ||
720 | } | ||
721 | |||
722 | static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE, BIO) | ||
723 | |||
724 | static int def_dump(const CONF *conf, BIO *out) | ||
725 | { | ||
726 | lh_CONF_VALUE_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), | ||
727 | BIO, out); | ||
728 | return 1; | ||
729 | } | ||
730 | |||
731 | static int def_is_number(const CONF *conf, char c) | ||
732 | { | ||
733 | return IS_NUMBER(conf,c); | ||
734 | } | ||
735 | |||
736 | static int def_to_int(const CONF *conf, char c) | ||
737 | { | ||
738 | return c - '0'; | ||
739 | } | ||
740 | |||
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 25bb5dc9aa..0000000000 --- a/src/lib/libcrypto/conf/conf_err.c +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | /* crypto/conf/conf_err.c */ | ||
2 | /* ==================================================================== | ||
3 | * Copyright (c) 1999-2007 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_CONF_PARSE_LIST), "CONF_parse_list"}, | ||
79 | {ERR_FUNC(CONF_F_DEF_LOAD), "DEF_LOAD"}, | ||
80 | {ERR_FUNC(CONF_F_DEF_LOAD_BIO), "DEF_LOAD_BIO"}, | ||
81 | {ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"}, | ||
82 | {ERR_FUNC(CONF_F_MODULE_LOAD_DSO), "MODULE_LOAD_DSO"}, | ||
83 | {ERR_FUNC(CONF_F_MODULE_RUN), "MODULE_RUN"}, | ||
84 | {ERR_FUNC(CONF_F_NCONF_DUMP_BIO), "NCONF_dump_bio"}, | ||
85 | {ERR_FUNC(CONF_F_NCONF_DUMP_FP), "NCONF_dump_fp"}, | ||
86 | {ERR_FUNC(CONF_F_NCONF_GET_NUMBER), "NCONF_get_number"}, | ||
87 | {ERR_FUNC(CONF_F_NCONF_GET_NUMBER_E), "NCONF_get_number_e"}, | ||
88 | {ERR_FUNC(CONF_F_NCONF_GET_SECTION), "NCONF_get_section"}, | ||
89 | {ERR_FUNC(CONF_F_NCONF_GET_STRING), "NCONF_get_string"}, | ||
90 | {ERR_FUNC(CONF_F_NCONF_LOAD), "NCONF_load"}, | ||
91 | {ERR_FUNC(CONF_F_NCONF_LOAD_BIO), "NCONF_load_bio"}, | ||
92 | {ERR_FUNC(CONF_F_NCONF_LOAD_FP), "NCONF_load_fp"}, | ||
93 | {ERR_FUNC(CONF_F_NCONF_NEW), "NCONF_new"}, | ||
94 | {ERR_FUNC(CONF_F_STR_COPY), "STR_COPY"}, | ||
95 | {0,NULL} | ||
96 | }; | ||
97 | |||
98 | static ERR_STRING_DATA CONF_str_reasons[]= | ||
99 | { | ||
100 | {ERR_REASON(CONF_R_ERROR_LOADING_DSO) ,"error loading dso"}, | ||
101 | {ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL) ,"list cannot be null"}, | ||
102 | {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET),"missing close square bracket"}, | ||
103 | {ERR_REASON(CONF_R_MISSING_EQUAL_SIGN) ,"missing equal sign"}, | ||
104 | {ERR_REASON(CONF_R_MISSING_FINISH_FUNCTION),"missing finish function"}, | ||
105 | {ERR_REASON(CONF_R_MISSING_INIT_FUNCTION),"missing init function"}, | ||
106 | {ERR_REASON(CONF_R_MODULE_INITIALIZATION_ERROR),"module initialization error"}, | ||
107 | {ERR_REASON(CONF_R_NO_CLOSE_BRACE) ,"no close brace"}, | ||
108 | {ERR_REASON(CONF_R_NO_CONF) ,"no conf"}, | ||
109 | {ERR_REASON(CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE),"no conf or environment variable"}, | ||
110 | {ERR_REASON(CONF_R_NO_SECTION) ,"no section"}, | ||
111 | {ERR_REASON(CONF_R_NO_SUCH_FILE) ,"no such file"}, | ||
112 | {ERR_REASON(CONF_R_NO_VALUE) ,"no value"}, | ||
113 | {ERR_REASON(CONF_R_UNABLE_TO_CREATE_NEW_SECTION),"unable to create new section"}, | ||
114 | {ERR_REASON(CONF_R_UNKNOWN_MODULE_NAME) ,"unknown module name"}, | ||
115 | {ERR_REASON(CONF_R_VARIABLE_HAS_NO_VALUE),"variable has no value"}, | ||
116 | {0,NULL} | ||
117 | }; | ||
118 | |||
119 | #endif | ||
120 | |||
121 | void ERR_load_CONF_strings(void) | ||
122 | { | ||
123 | #ifndef OPENSSL_NO_ERR | ||
124 | |||
125 | if (ERR_func_error_string(CONF_str_functs[0].error) == NULL) | ||
126 | { | ||
127 | ERR_load_strings(0,CONF_str_functs); | ||
128 | ERR_load_strings(0,CONF_str_reasons); | ||
129 | } | ||
130 | #endif | ||
131 | } | ||
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c deleted file mode 100644 index 54046defca..0000000000 --- a/src/lib/libcrypto/conf/conf_lib.c +++ /dev/null | |||
@@ -1,407 +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_OF(CONF_VALUE) *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_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, | ||
91 | long *eline) | ||
92 | { | ||
93 | LHASH_OF(CONF_VALUE) *ltmp; | ||
94 | BIO *in=NULL; | ||
95 | |||
96 | #ifdef OPENSSL_SYS_VMS | ||
97 | in=BIO_new_file(file, "r"); | ||
98 | #else | ||
99 | in=BIO_new_file(file, "rb"); | ||
100 | #endif | ||
101 | if (in == NULL) | ||
102 | { | ||
103 | CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); | ||
104 | return NULL; | ||
105 | } | ||
106 | |||
107 | ltmp = CONF_load_bio(conf, in, eline); | ||
108 | BIO_free(in); | ||
109 | |||
110 | return ltmp; | ||
111 | } | ||
112 | |||
113 | #ifndef OPENSSL_NO_FP_API | ||
114 | LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, | ||
115 | long *eline) | ||
116 | { | ||
117 | BIO *btmp; | ||
118 | LHASH_OF(CONF_VALUE) *ltmp; | ||
119 | if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { | ||
120 | CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB); | ||
121 | return NULL; | ||
122 | } | ||
123 | ltmp = CONF_load_bio(conf, btmp, eline); | ||
124 | BIO_free(btmp); | ||
125 | return ltmp; | ||
126 | } | ||
127 | #endif | ||
128 | |||
129 | LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, | ||
130 | long *eline) | ||
131 | { | ||
132 | CONF ctmp; | ||
133 | int ret; | ||
134 | |||
135 | CONF_set_nconf(&ctmp, conf); | ||
136 | |||
137 | ret = NCONF_load_bio(&ctmp, bp, eline); | ||
138 | if (ret) | ||
139 | return ctmp.data; | ||
140 | return NULL; | ||
141 | } | ||
142 | |||
143 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, | ||
144 | const char *section) | ||
145 | { | ||
146 | if (conf == NULL) | ||
147 | { | ||
148 | return NULL; | ||
149 | } | ||
150 | else | ||
151 | { | ||
152 | CONF ctmp; | ||
153 | CONF_set_nconf(&ctmp, conf); | ||
154 | return NCONF_get_section(&ctmp, section); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group, | ||
159 | const char *name) | ||
160 | { | ||
161 | if (conf == NULL) | ||
162 | { | ||
163 | return NCONF_get_string(NULL, group, name); | ||
164 | } | ||
165 | else | ||
166 | { | ||
167 | CONF ctmp; | ||
168 | CONF_set_nconf(&ctmp, conf); | ||
169 | return NCONF_get_string(&ctmp, group, name); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group, | ||
174 | const char *name) | ||
175 | { | ||
176 | int status; | ||
177 | long result = 0; | ||
178 | |||
179 | if (conf == NULL) | ||
180 | { | ||
181 | status = NCONF_get_number_e(NULL, group, name, &result); | ||
182 | } | ||
183 | else | ||
184 | { | ||
185 | CONF ctmp; | ||
186 | CONF_set_nconf(&ctmp, conf); | ||
187 | status = NCONF_get_number_e(&ctmp, group, name, &result); | ||
188 | } | ||
189 | |||
190 | if (status == 0) | ||
191 | { | ||
192 | /* This function does not believe in errors... */ | ||
193 | ERR_clear_error(); | ||
194 | } | ||
195 | return result; | ||
196 | } | ||
197 | |||
198 | void CONF_free(LHASH_OF(CONF_VALUE) *conf) | ||
199 | { | ||
200 | CONF ctmp; | ||
201 | CONF_set_nconf(&ctmp, conf); | ||
202 | NCONF_free_data(&ctmp); | ||
203 | } | ||
204 | |||
205 | #ifndef OPENSSL_NO_FP_API | ||
206 | int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out) | ||
207 | { | ||
208 | BIO *btmp; | ||
209 | int ret; | ||
210 | |||
211 | if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { | ||
212 | CONFerr(CONF_F_CONF_DUMP_FP,ERR_R_BUF_LIB); | ||
213 | return 0; | ||
214 | } | ||
215 | ret = CONF_dump_bio(conf, btmp); | ||
216 | BIO_free(btmp); | ||
217 | return ret; | ||
218 | } | ||
219 | #endif | ||
220 | |||
221 | int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out) | ||
222 | { | ||
223 | CONF ctmp; | ||
224 | CONF_set_nconf(&ctmp, conf); | ||
225 | return NCONF_dump_bio(&ctmp, out); | ||
226 | } | ||
227 | |||
228 | /* The following section contains the "New CONF" functions. They are | ||
229 | completely centralised around a new CONF structure that may contain | ||
230 | basically anything, but at least a method pointer and a table of data. | ||
231 | These functions are also written in terms of the bridge functions used | ||
232 | by the "CONF classic" functions, for consistency. */ | ||
233 | |||
234 | CONF *NCONF_new(CONF_METHOD *meth) | ||
235 | { | ||
236 | CONF *ret; | ||
237 | |||
238 | if (meth == NULL) | ||
239 | meth = NCONF_default(); | ||
240 | |||
241 | ret = meth->create(meth); | ||
242 | if (ret == NULL) | ||
243 | { | ||
244 | CONFerr(CONF_F_NCONF_NEW,ERR_R_MALLOC_FAILURE); | ||
245 | return(NULL); | ||
246 | } | ||
247 | |||
248 | return ret; | ||
249 | } | ||
250 | |||
251 | void NCONF_free(CONF *conf) | ||
252 | { | ||
253 | if (conf == NULL) | ||
254 | return; | ||
255 | conf->meth->destroy(conf); | ||
256 | } | ||
257 | |||
258 | void NCONF_free_data(CONF *conf) | ||
259 | { | ||
260 | if (conf == NULL) | ||
261 | return; | ||
262 | conf->meth->destroy_data(conf); | ||
263 | } | ||
264 | |||
265 | int NCONF_load(CONF *conf, const char *file, long *eline) | ||
266 | { | ||
267 | if (conf == NULL) | ||
268 | { | ||
269 | CONFerr(CONF_F_NCONF_LOAD,CONF_R_NO_CONF); | ||
270 | return 0; | ||
271 | } | ||
272 | |||
273 | return conf->meth->load(conf, file, eline); | ||
274 | } | ||
275 | |||
276 | #ifndef OPENSSL_NO_FP_API | ||
277 | int NCONF_load_fp(CONF *conf, FILE *fp,long *eline) | ||
278 | { | ||
279 | BIO *btmp; | ||
280 | int ret; | ||
281 | if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) | ||
282 | { | ||
283 | CONFerr(CONF_F_NCONF_LOAD_FP,ERR_R_BUF_LIB); | ||
284 | return 0; | ||
285 | } | ||
286 | ret = NCONF_load_bio(conf, btmp, eline); | ||
287 | BIO_free(btmp); | ||
288 | return ret; | ||
289 | } | ||
290 | #endif | ||
291 | |||
292 | int NCONF_load_bio(CONF *conf, BIO *bp,long *eline) | ||
293 | { | ||
294 | if (conf == NULL) | ||
295 | { | ||
296 | CONFerr(CONF_F_NCONF_LOAD_BIO,CONF_R_NO_CONF); | ||
297 | return 0; | ||
298 | } | ||
299 | |||
300 | return conf->meth->load_bio(conf, bp, eline); | ||
301 | } | ||
302 | |||
303 | STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section) | ||
304 | { | ||
305 | if (conf == NULL) | ||
306 | { | ||
307 | CONFerr(CONF_F_NCONF_GET_SECTION,CONF_R_NO_CONF); | ||
308 | return NULL; | ||
309 | } | ||
310 | |||
311 | if (section == NULL) | ||
312 | { | ||
313 | CONFerr(CONF_F_NCONF_GET_SECTION,CONF_R_NO_SECTION); | ||
314 | return NULL; | ||
315 | } | ||
316 | |||
317 | return _CONF_get_section_values(conf, section); | ||
318 | } | ||
319 | |||
320 | char *NCONF_get_string(const CONF *conf,const char *group,const char *name) | ||
321 | { | ||
322 | char *s = _CONF_get_string(conf, group, name); | ||
323 | |||
324 | /* Since we may get a value from an environment variable even | ||
325 | if conf is NULL, let's check the value first */ | ||
326 | if (s) return s; | ||
327 | |||
328 | if (conf == NULL) | ||
329 | { | ||
330 | CONFerr(CONF_F_NCONF_GET_STRING, | ||
331 | CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE); | ||
332 | return NULL; | ||
333 | } | ||
334 | CONFerr(CONF_F_NCONF_GET_STRING, | ||
335 | CONF_R_NO_VALUE); | ||
336 | ERR_add_error_data(4,"group=",group," name=",name); | ||
337 | return NULL; | ||
338 | } | ||
339 | |||
340 | int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, | ||
341 | long *result) | ||
342 | { | ||
343 | char *str; | ||
344 | |||
345 | if (result == NULL) | ||
346 | { | ||
347 | CONFerr(CONF_F_NCONF_GET_NUMBER_E,ERR_R_PASSED_NULL_PARAMETER); | ||
348 | return 0; | ||
349 | } | ||
350 | |||
351 | str = NCONF_get_string(conf,group,name); | ||
352 | |||
353 | if (str == NULL) | ||
354 | return 0; | ||
355 | |||
356 | for (*result = 0;conf->meth->is_number(conf, *str);) | ||
357 | { | ||
358 | *result = (*result)*10 + conf->meth->to_int(conf, *str); | ||
359 | str++; | ||
360 | } | ||
361 | |||
362 | return 1; | ||
363 | } | ||
364 | |||
365 | #ifndef OPENSSL_NO_FP_API | ||
366 | int NCONF_dump_fp(const CONF *conf, FILE *out) | ||
367 | { | ||
368 | BIO *btmp; | ||
369 | int ret; | ||
370 | if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { | ||
371 | CONFerr(CONF_F_NCONF_DUMP_FP,ERR_R_BUF_LIB); | ||
372 | return 0; | ||
373 | } | ||
374 | ret = NCONF_dump_bio(conf, btmp); | ||
375 | BIO_free(btmp); | ||
376 | return ret; | ||
377 | } | ||
378 | #endif | ||
379 | |||
380 | int NCONF_dump_bio(const CONF *conf, BIO *out) | ||
381 | { | ||
382 | if (conf == NULL) | ||
383 | { | ||
384 | CONFerr(CONF_F_NCONF_DUMP_BIO,CONF_R_NO_CONF); | ||
385 | return 0; | ||
386 | } | ||
387 | |||
388 | return conf->meth->dump(conf, out); | ||
389 | } | ||
390 | |||
391 | |||
392 | /* This function should be avoided */ | ||
393 | #if 0 | ||
394 | long NCONF_get_number(CONF *conf,char *group,char *name) | ||
395 | { | ||
396 | int status; | ||
397 | long ret=0; | ||
398 | |||
399 | status = NCONF_get_number_e(conf, group, name, &ret); | ||
400 | if (status == 0) | ||
401 | { | ||
402 | /* This function does not believe in errors... */ | ||
403 | ERR_get_error(); | ||
404 | } | ||
405 | return ret; | ||
406 | } | ||
407 | #endif | ||
diff --git a/src/lib/libcrypto/conf/conf_mall.c b/src/lib/libcrypto/conf/conf_mall.c deleted file mode 100644 index c6f4cb2d55..0000000000 --- a/src/lib/libcrypto/conf/conf_mall.c +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | /* conf_mall.c */ | ||
2 | /* Written by Stephen Henson (steve@openssl.org) 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 df1642a0a5..0000000000 --- a/src/lib/libcrypto/conf/conf_mod.c +++ /dev/null | |||
@@ -1,623 +0,0 @@ | |||
1 | /* conf_mod.c */ | ||
2 | /* Written by Stephen Henson (steve@openssl.org) 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 = NULL; | ||
130 | |||
131 | int ret, i; | ||
132 | |||
133 | if (!cnf) | ||
134 | return 1; | ||
135 | |||
136 | if (appname) | ||
137 | vsection = NCONF_get_string(cnf, NULL, appname); | ||
138 | |||
139 | if (!appname || (!vsection && (flags & CONF_MFLAGS_DEFAULT_SECTION))) | ||
140 | vsection = NCONF_get_string(cnf, NULL, "openssl_conf"); | ||
141 | |||
142 | if (!vsection) | ||
143 | { | ||
144 | ERR_clear_error(); | ||
145 | return 1; | ||
146 | } | ||
147 | |||
148 | values = NCONF_get_section(cnf, vsection); | ||
149 | |||
150 | if (!values) | ||
151 | return 0; | ||
152 | |||
153 | for (i = 0; i < sk_CONF_VALUE_num(values); i++) | ||
154 | { | ||
155 | vl = sk_CONF_VALUE_value(values, i); | ||
156 | ret = module_run(cnf, vl->name, vl->value, flags); | ||
157 | if (ret <= 0) | ||
158 | if(!(flags & CONF_MFLAGS_IGNORE_ERRORS)) | ||
159 | return ret; | ||
160 | } | ||
161 | |||
162 | return 1; | ||
163 | |||
164 | } | ||
165 | |||
166 | int CONF_modules_load_file(const char *filename, const char *appname, | ||
167 | unsigned long flags) | ||
168 | { | ||
169 | char *file = NULL; | ||
170 | CONF *conf = NULL; | ||
171 | int ret = 0; | ||
172 | conf = NCONF_new(NULL); | ||
173 | if (!conf) | ||
174 | goto err; | ||
175 | |||
176 | if (filename == NULL) | ||
177 | { | ||
178 | file = CONF_get1_default_config_file(); | ||
179 | if (!file) | ||
180 | goto err; | ||
181 | } | ||
182 | else | ||
183 | file = (char *)filename; | ||
184 | |||
185 | if (NCONF_load(conf, file, NULL) <= 0) | ||
186 | { | ||
187 | if ((flags & CONF_MFLAGS_IGNORE_MISSING_FILE) && | ||
188 | (ERR_GET_REASON(ERR_peek_last_error()) == CONF_R_NO_SUCH_FILE)) | ||
189 | { | ||
190 | ERR_clear_error(); | ||
191 | ret = 1; | ||
192 | } | ||
193 | goto err; | ||
194 | } | ||
195 | |||
196 | ret = CONF_modules_load(conf, appname, flags); | ||
197 | |||
198 | err: | ||
199 | if (filename == NULL) | ||
200 | OPENSSL_free(file); | ||
201 | NCONF_free(conf); | ||
202 | |||
203 | return ret; | ||
204 | } | ||
205 | |||
206 | static int module_run(const CONF *cnf, char *name, char *value, | ||
207 | unsigned long flags) | ||
208 | { | ||
209 | CONF_MODULE *md; | ||
210 | int ret; | ||
211 | |||
212 | md = module_find(name); | ||
213 | |||
214 | /* Module not found: try to load DSO */ | ||
215 | if (!md && !(flags & CONF_MFLAGS_NO_DSO)) | ||
216 | md = module_load_dso(cnf, name, value, flags); | ||
217 | |||
218 | if (!md) | ||
219 | { | ||
220 | if (!(flags & CONF_MFLAGS_SILENT)) | ||
221 | { | ||
222 | CONFerr(CONF_F_MODULE_RUN, CONF_R_UNKNOWN_MODULE_NAME); | ||
223 | ERR_add_error_data(2, "module=", name); | ||
224 | } | ||
225 | return -1; | ||
226 | } | ||
227 | |||
228 | ret = module_init(md, name, value, cnf); | ||
229 | |||
230 | if (ret <= 0) | ||
231 | { | ||
232 | if (!(flags & CONF_MFLAGS_SILENT)) | ||
233 | { | ||
234 | char rcode[DECIMAL_SIZE(ret)+1]; | ||
235 | CONFerr(CONF_F_MODULE_RUN, CONF_R_MODULE_INITIALIZATION_ERROR); | ||
236 | BIO_snprintf(rcode, sizeof rcode, "%-8d", ret); | ||
237 | ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | return ret; | ||
242 | } | ||
243 | |||
244 | /* Load a module from a DSO */ | ||
245 | static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, | ||
246 | unsigned long flags) | ||
247 | { | ||
248 | DSO *dso = NULL; | ||
249 | conf_init_func *ifunc; | ||
250 | conf_finish_func *ffunc; | ||
251 | char *path = NULL; | ||
252 | int errcode = 0; | ||
253 | CONF_MODULE *md; | ||
254 | /* Look for alternative path in module section */ | ||
255 | path = NCONF_get_string(cnf, value, "path"); | ||
256 | if (!path) | ||
257 | { | ||
258 | ERR_clear_error(); | ||
259 | path = name; | ||
260 | } | ||
261 | dso = DSO_load(NULL, path, NULL, 0); | ||
262 | if (!dso) | ||
263 | { | ||
264 | errcode = CONF_R_ERROR_LOADING_DSO; | ||
265 | goto err; | ||
266 | } | ||
267 | ifunc = (conf_init_func *)DSO_bind_func(dso, DSO_mod_init_name); | ||
268 | if (!ifunc) | ||
269 | { | ||
270 | errcode = CONF_R_MISSING_INIT_FUNCTION; | ||
271 | goto err; | ||
272 | } | ||
273 | ffunc = (conf_finish_func *)DSO_bind_func(dso, DSO_mod_finish_name); | ||
274 | /* All OK, add module */ | ||
275 | md = module_add(dso, name, ifunc, ffunc); | ||
276 | |||
277 | if (!md) | ||
278 | goto err; | ||
279 | |||
280 | return md; | ||
281 | |||
282 | err: | ||
283 | if (dso) | ||
284 | DSO_free(dso); | ||
285 | CONFerr(CONF_F_MODULE_LOAD_DSO, errcode); | ||
286 | ERR_add_error_data(4, "module=", name, ", path=", path); | ||
287 | return NULL; | ||
288 | } | ||
289 | |||
290 | /* add module to list */ | ||
291 | static CONF_MODULE *module_add(DSO *dso, const char *name, | ||
292 | conf_init_func *ifunc, conf_finish_func *ffunc) | ||
293 | { | ||
294 | CONF_MODULE *tmod = NULL; | ||
295 | if (supported_modules == NULL) | ||
296 | supported_modules = sk_CONF_MODULE_new_null(); | ||
297 | if (supported_modules == NULL) | ||
298 | return NULL; | ||
299 | tmod = OPENSSL_malloc(sizeof(CONF_MODULE)); | ||
300 | if (tmod == NULL) | ||
301 | return NULL; | ||
302 | |||
303 | tmod->dso = dso; | ||
304 | tmod->name = BUF_strdup(name); | ||
305 | tmod->init = ifunc; | ||
306 | tmod->finish = ffunc; | ||
307 | tmod->links = 0; | ||
308 | |||
309 | if (!sk_CONF_MODULE_push(supported_modules, tmod)) | ||
310 | { | ||
311 | OPENSSL_free(tmod); | ||
312 | return NULL; | ||
313 | } | ||
314 | |||
315 | return tmod; | ||
316 | } | ||
317 | |||
318 | /* Find a module from the list. We allow module names of the | ||
319 | * form modname.XXXX to just search for modname to allow the | ||
320 | * same module to be initialized more than once. | ||
321 | */ | ||
322 | |||
323 | static CONF_MODULE *module_find(char *name) | ||
324 | { | ||
325 | CONF_MODULE *tmod; | ||
326 | int i, nchar; | ||
327 | char *p; | ||
328 | p = strrchr(name, '.'); | ||
329 | |||
330 | if (p) | ||
331 | nchar = p - name; | ||
332 | else | ||
333 | nchar = strlen(name); | ||
334 | |||
335 | for (i = 0; i < sk_CONF_MODULE_num(supported_modules); i++) | ||
336 | { | ||
337 | tmod = sk_CONF_MODULE_value(supported_modules, i); | ||
338 | if (!strncmp(tmod->name, name, nchar)) | ||
339 | return tmod; | ||
340 | } | ||
341 | |||
342 | return NULL; | ||
343 | |||
344 | } | ||
345 | |||
346 | /* initialize a module */ | ||
347 | static int module_init(CONF_MODULE *pmod, char *name, char *value, | ||
348 | const CONF *cnf) | ||
349 | { | ||
350 | int ret = 1; | ||
351 | int init_called = 0; | ||
352 | CONF_IMODULE *imod = NULL; | ||
353 | |||
354 | /* Otherwise add initialized module to list */ | ||
355 | imod = OPENSSL_malloc(sizeof(CONF_IMODULE)); | ||
356 | if (!imod) | ||
357 | goto err; | ||
358 | |||
359 | imod->pmod = pmod; | ||
360 | imod->name = BUF_strdup(name); | ||
361 | imod->value = BUF_strdup(value); | ||
362 | imod->usr_data = NULL; | ||
363 | |||
364 | if (!imod->name || !imod->value) | ||
365 | goto memerr; | ||
366 | |||
367 | /* Try to initialize module */ | ||
368 | if(pmod->init) | ||
369 | { | ||
370 | ret = pmod->init(imod, cnf); | ||
371 | init_called = 1; | ||
372 | /* Error occurred, exit */ | ||
373 | if (ret <= 0) | ||
374 | goto err; | ||
375 | } | ||
376 | |||
377 | if (initialized_modules == NULL) | ||
378 | { | ||
379 | initialized_modules = sk_CONF_IMODULE_new_null(); | ||
380 | if (!initialized_modules) | ||
381 | { | ||
382 | CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE); | ||
383 | goto err; | ||
384 | } | ||
385 | } | ||
386 | |||
387 | if (!sk_CONF_IMODULE_push(initialized_modules, imod)) | ||
388 | { | ||
389 | CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE); | ||
390 | goto err; | ||
391 | } | ||
392 | |||
393 | pmod->links++; | ||
394 | |||
395 | return ret; | ||
396 | |||
397 | err: | ||
398 | |||
399 | /* We've started the module so we'd better finish it */ | ||
400 | if (pmod->finish && init_called) | ||
401 | pmod->finish(imod); | ||
402 | |||
403 | memerr: | ||
404 | if (imod) | ||
405 | { | ||
406 | if (imod->name) | ||
407 | OPENSSL_free(imod->name); | ||
408 | if (imod->value) | ||
409 | OPENSSL_free(imod->value); | ||
410 | OPENSSL_free(imod); | ||
411 | } | ||
412 | |||
413 | return -1; | ||
414 | |||
415 | } | ||
416 | |||
417 | /* Unload any dynamic modules that have a link count of zero: | ||
418 | * i.e. have no active initialized modules. If 'all' is set | ||
419 | * then all modules are unloaded including static ones. | ||
420 | */ | ||
421 | |||
422 | void CONF_modules_unload(int all) | ||
423 | { | ||
424 | int i; | ||
425 | CONF_MODULE *md; | ||
426 | CONF_modules_finish(); | ||
427 | /* unload modules in reverse order */ | ||
428 | for (i = sk_CONF_MODULE_num(supported_modules) - 1; i >= 0; i--) | ||
429 | { | ||
430 | md = sk_CONF_MODULE_value(supported_modules, i); | ||
431 | /* If static or in use and 'all' not set ignore it */ | ||
432 | if (((md->links > 0) || !md->dso) && !all) | ||
433 | continue; | ||
434 | /* Since we're working in reverse this is OK */ | ||
435 | (void)sk_CONF_MODULE_delete(supported_modules, i); | ||
436 | module_free(md); | ||
437 | } | ||
438 | if (sk_CONF_MODULE_num(supported_modules) == 0) | ||
439 | { | ||
440 | sk_CONF_MODULE_free(supported_modules); | ||
441 | supported_modules = NULL; | ||
442 | } | ||
443 | } | ||
444 | |||
445 | /* unload a single module */ | ||
446 | static void module_free(CONF_MODULE *md) | ||
447 | { | ||
448 | if (md->dso) | ||
449 | DSO_free(md->dso); | ||
450 | OPENSSL_free(md->name); | ||
451 | OPENSSL_free(md); | ||
452 | } | ||
453 | |||
454 | /* finish and free up all modules instances */ | ||
455 | |||
456 | void CONF_modules_finish(void) | ||
457 | { | ||
458 | CONF_IMODULE *imod; | ||
459 | while (sk_CONF_IMODULE_num(initialized_modules) > 0) | ||
460 | { | ||
461 | imod = sk_CONF_IMODULE_pop(initialized_modules); | ||
462 | module_finish(imod); | ||
463 | } | ||
464 | sk_CONF_IMODULE_free(initialized_modules); | ||
465 | initialized_modules = NULL; | ||
466 | } | ||
467 | |||
468 | /* finish a module instance */ | ||
469 | |||
470 | static void module_finish(CONF_IMODULE *imod) | ||
471 | { | ||
472 | if (imod->pmod->finish) | ||
473 | imod->pmod->finish(imod); | ||
474 | imod->pmod->links--; | ||
475 | OPENSSL_free(imod->name); | ||
476 | OPENSSL_free(imod->value); | ||
477 | OPENSSL_free(imod); | ||
478 | } | ||
479 | |||
480 | /* Add a static module to OpenSSL */ | ||
481 | |||
482 | int CONF_module_add(const char *name, conf_init_func *ifunc, | ||
483 | conf_finish_func *ffunc) | ||
484 | { | ||
485 | if (module_add(NULL, name, ifunc, ffunc)) | ||
486 | return 1; | ||
487 | else | ||
488 | return 0; | ||
489 | } | ||
490 | |||
491 | void CONF_modules_free(void) | ||
492 | { | ||
493 | CONF_modules_finish(); | ||
494 | CONF_modules_unload(1); | ||
495 | } | ||
496 | |||
497 | /* Utility functions */ | ||
498 | |||
499 | const char *CONF_imodule_get_name(const CONF_IMODULE *md) | ||
500 | { | ||
501 | return md->name; | ||
502 | } | ||
503 | |||
504 | const char *CONF_imodule_get_value(const CONF_IMODULE *md) | ||
505 | { | ||
506 | return md->value; | ||
507 | } | ||
508 | |||
509 | void *CONF_imodule_get_usr_data(const CONF_IMODULE *md) | ||
510 | { | ||
511 | return md->usr_data; | ||
512 | } | ||
513 | |||
514 | void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data) | ||
515 | { | ||
516 | md->usr_data = usr_data; | ||
517 | } | ||
518 | |||
519 | CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md) | ||
520 | { | ||
521 | return md->pmod; | ||
522 | } | ||
523 | |||
524 | unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md) | ||
525 | { | ||
526 | return md->flags; | ||
527 | } | ||
528 | |||
529 | void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags) | ||
530 | { | ||
531 | md->flags = flags; | ||
532 | } | ||
533 | |||
534 | void *CONF_module_get_usr_data(CONF_MODULE *pmod) | ||
535 | { | ||
536 | return pmod->usr_data; | ||
537 | } | ||
538 | |||
539 | void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data) | ||
540 | { | ||
541 | pmod->usr_data = usr_data; | ||
542 | } | ||
543 | |||
544 | /* Return default config file name */ | ||
545 | |||
546 | char *CONF_get1_default_config_file(void) | ||
547 | { | ||
548 | char *file; | ||
549 | int len; | ||
550 | |||
551 | file = getenv("OPENSSL_CONF"); | ||
552 | if (file) | ||
553 | return BUF_strdup(file); | ||
554 | |||
555 | len = strlen(X509_get_default_cert_area()); | ||
556 | #ifndef OPENSSL_SYS_VMS | ||
557 | len++; | ||
558 | #endif | ||
559 | len += strlen(OPENSSL_CONF); | ||
560 | |||
561 | file = OPENSSL_malloc(len + 1); | ||
562 | |||
563 | if (!file) | ||
564 | return NULL; | ||
565 | BUF_strlcpy(file,X509_get_default_cert_area(),len + 1); | ||
566 | #ifndef OPENSSL_SYS_VMS | ||
567 | BUF_strlcat(file,"/",len + 1); | ||
568 | #endif | ||
569 | BUF_strlcat(file,OPENSSL_CONF,len + 1); | ||
570 | |||
571 | return file; | ||
572 | } | ||
573 | |||
574 | /* This function takes a list separated by 'sep' and calls the | ||
575 | * callback function giving the start and length of each member | ||
576 | * optionally stripping leading and trailing whitespace. This can | ||
577 | * be used to parse comma separated lists for example. | ||
578 | */ | ||
579 | |||
580 | int CONF_parse_list(const char *list_, int sep, int nospc, | ||
581 | int (*list_cb)(const char *elem, int len, void *usr), void *arg) | ||
582 | { | ||
583 | int ret; | ||
584 | const char *lstart, *tmpend, *p; | ||
585 | |||
586 | if(list_ == NULL) | ||
587 | { | ||
588 | CONFerr(CONF_F_CONF_PARSE_LIST, CONF_R_LIST_CANNOT_BE_NULL); | ||
589 | return 0; | ||
590 | } | ||
591 | |||
592 | lstart = list_; | ||
593 | for(;;) | ||
594 | { | ||
595 | if (nospc) | ||
596 | { | ||
597 | while(*lstart && isspace((unsigned char)*lstart)) | ||
598 | lstart++; | ||
599 | } | ||
600 | p = strchr(lstart, sep); | ||
601 | if (p == lstart || !*lstart) | ||
602 | ret = list_cb(NULL, 0, arg); | ||
603 | else | ||
604 | { | ||
605 | if (p) | ||
606 | tmpend = p - 1; | ||
607 | else | ||
608 | tmpend = lstart + strlen(lstart) - 1; | ||
609 | if (nospc) | ||
610 | { | ||
611 | while(isspace((unsigned char)*tmpend)) | ||
612 | tmpend--; | ||
613 | } | ||
614 | ret = list_cb(lstart, tmpend - lstart + 1, arg); | ||
615 | } | ||
616 | if (ret <= 0) | ||
617 | return ret; | ||
618 | if (p == NULL) | ||
619 | return 1; | ||
620 | lstart = p + 1; | ||
621 | } | ||
622 | } | ||
623 | |||
diff --git a/src/lib/libcrypto/conf/conf_sap.c b/src/lib/libcrypto/conf/conf_sap.c deleted file mode 100644 index 760dc2632d..0000000000 --- a/src/lib/libcrypto/conf/conf_sap.c +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | /* conf_sap.c */ | ||
2 | /* Written by Stephen Henson (steve@openssl.org) 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, config_name, | ||
92 | CONF_MFLAGS_DEFAULT_SECTION|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 | |||