summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/conf
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/conf')
-rw-r--r--src/lib/libcrypto/conf/README73
-rw-r--r--src/lib/libcrypto/conf/conf.h263
-rw-r--r--src/lib/libcrypto/conf/conf_api.c300
-rw-r--r--src/lib/libcrypto/conf/conf_api.h89
-rw-r--r--src/lib/libcrypto/conf/conf_def.c751
-rw-r--r--src/lib/libcrypto/conf/conf_def.h180
-rw-r--r--src/lib/libcrypto/conf/conf_err.c131
-rw-r--r--src/lib/libcrypto/conf/conf_lib.c407
-rw-r--r--src/lib/libcrypto/conf/conf_mall.c80
-rw-r--r--src/lib/libcrypto/conf/conf_mod.c623
-rw-r--r--src/lib/libcrypto/conf/conf_sap.c111
-rw-r--r--src/lib/libcrypto/conf/keysets.pl185
-rw-r--r--src/lib/libcrypto/conf/ssleay.cnf78
13 files changed, 0 insertions, 3271 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 @@
1Configuration modules. These are a set of modules which can perform
2various configuration functions.
3
4Currently the routines should be called at most once when an application
5starts up: that is before it starts any threads.
6
7The routines read a configuration file set up like this:
8
9-----
10#default section
11openssl_conf=init_section
12
13[init_section]
14
15module1=value1
16#Second instance of module1
17module1.1=valueX
18module2=value2
19module3=dso_literal
20module4=dso_section
21
22[dso_section]
23
24path=/some/path/to/some/dso.so
25other_stuff=other_value
26----
27
28When 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
31int conf_init_func(CONF_IMODULE *md, CONF *cnf);
32
33The function can then take whatever action is appropriate, for example further
34lookups based on the value. Multiple instances of the same config module can be
35loaded.
36
37When the application closes down the modules are cleaned up by calling an
38optional finish function:
39
40void conf_finish_func(CONF_IMODULE *md);
41
42The finish functions are called in reverse order: that is the last module
43loaded is the first one cleaned up.
44
45If no module exists with a given name then an attempt is made to load a DSO
46with the supplied name. This might mean that "module3" attempts to load a DSO
47called libmodule3.so or module3.dll for example. An explicit DSO name can be
48given by including a separate section as in the module4 example above.
49
50The DSO is expected to at least contain an initialization function:
51
52int OPENSSL_init(CONF_IMODULE *md, CONF *cnf);
53
54and may also include a finish function:
55
56void OPENSSL_finish(CONF_IMODULE *md);
57
58Static modules can also be added using,
59
60int CONF_module_add(char *name, dso_mod_init_func *ifunc, dso_mod_finish_func
61*ffunc);
62
63where "name" is the name in the configuration file this function corresponds
64to.
65
66A set of builtin modules (currently only an ASN1 non functional test module)
67can be added by calling OPENSSL_load_builtin_modules().
68
69The function OPENSSL_config() is intended as a simple configuration function
70that any application can call to perform various default configuration tasks.
71It 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
71extern "C" {
72#endif
73
74typedef struct
75 {
76 char *section;
77 char *name;
78 char *value;
79 } CONF_VALUE;
80
81DECLARE_STACK_OF(CONF_VALUE)
82DECLARE_LHASH_OF(CONF_VALUE);
83
84struct conf_st;
85struct conf_method_st;
86typedef struct conf_method_st CONF_METHOD;
87
88struct 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
104typedef struct conf_imodule_st CONF_IMODULE;
105typedef struct conf_module_st CONF_MODULE;
106
107DECLARE_STACK_OF(CONF_MODULE)
108DECLARE_STACK_OF(CONF_IMODULE)
109
110/* DSO module function typedefs */
111typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);
112typedef 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
121int CONF_set_default_method(CONF_METHOD *meth);
122void CONF_set_nconf(CONF *conf,LHASH_OF(CONF_VALUE) *hash);
123LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf,const char *file,
124 long *eline);
125#ifndef OPENSSL_NO_FP_API
126LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
127 long *eline);
128#endif
129LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,long *eline);
130STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
131 const char *section);
132char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group,
133 const char *name);
134long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group,
135 const char *name);
136void CONF_free(LHASH_OF(CONF_VALUE) *conf);
137int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
138int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
139
140void OPENSSL_config(const char *config_name);
141void 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
146struct conf_st
147 {
148 CONF_METHOD *meth;
149 void *meth_data;
150 LHASH_OF(CONF_VALUE) *data;
151 };
152
153CONF *NCONF_new(CONF_METHOD *meth);
154CONF_METHOD *NCONF_default(void);
155CONF_METHOD *NCONF_WIN32(void);
156#if 0 /* Just to give you an idea of what I have in mind */
157CONF_METHOD *NCONF_XML(void);
158#endif
159void NCONF_free(CONF *conf);
160void NCONF_free_data(CONF *conf);
161
162int NCONF_load(CONF *conf,const char *file,long *eline);
163#ifndef OPENSSL_NO_FP_API
164int NCONF_load_fp(CONF *conf, FILE *fp,long *eline);
165#endif
166int NCONF_load_bio(CONF *conf, BIO *bp,long *eline);
167STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section);
168char *NCONF_get_string(const CONF *conf,const char *group,const char *name);
169int NCONF_get_number_e(const CONF *conf,const char *group,const char *name,
170 long *result);
171int NCONF_dump_fp(const CONF *conf, FILE *out);
172int 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 */
176long 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
183int CONF_modules_load(const CONF *cnf, const char *appname,
184 unsigned long flags);
185int CONF_modules_load_file(const char *filename, const char *appname,
186 unsigned long flags);
187void CONF_modules_unload(int all);
188void CONF_modules_finish(void);
189void CONF_modules_free(void);
190int CONF_module_add(const char *name, conf_init_func *ifunc,
191 conf_finish_func *ffunc);
192
193const char *CONF_imodule_get_name(const CONF_IMODULE *md);
194const char *CONF_imodule_get_value(const CONF_IMODULE *md);
195void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
196void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
197CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
198unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
199void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
200void *CONF_module_get_usr_data(CONF_MODULE *pmod);
201void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
202
203char *CONF_get1_default_config_file(void);
204
205int CONF_parse_list(const char *list, int sep, int nospc,
206 int (*list_cb)(const char *elem, int len, void *usr), void *arg);
207
208void 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 */
214void 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 22617e5fa1..0000000000
--- a/src/lib/libcrypto/conf/conf_api.c
+++ /dev/null
@@ -1,300 +0,0 @@
1/* conf_api.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* Part of the code in here was originally in conf.c, which is now removed */
60
61#ifndef CONF_DEBUG
62# undef NDEBUG /* avoid conflicting definitions */
63# define NDEBUG
64#endif
65
66#include <assert.h>
67#include <string.h>
68#include <openssl/conf.h>
69#include <openssl/conf_api.h>
70#include "e_os.h"
71
72static void value_free_hash_doall_arg(CONF_VALUE *a,
73 LHASH_OF(CONF_VALUE) *conf);
74static void value_free_stack_doall(CONF_VALUE *a);
75static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE,
76 LHASH_OF(CONF_VALUE))
77static IMPLEMENT_LHASH_DOALL_FN(value_free_stack, CONF_VALUE)
78
79/* Up until OpenSSL 0.9.5a, this was get_section */
80CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section)
81 {
82 CONF_VALUE *v,vv;
83
84 if ((conf == NULL) || (section == NULL)) return(NULL);
85 vv.name=NULL;
86 vv.section=(char *)section;
87 v=lh_CONF_VALUE_retrieve(conf->data,&vv);
88 return(v);
89 }
90
91/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
92STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
93 const char *section)
94 {
95 CONF_VALUE *v;
96
97 v=_CONF_get_section(conf,section);
98 if (v != NULL)
99 return((STACK_OF(CONF_VALUE) *)v->value);
100 else
101 return(NULL);
102 }
103
104int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)
105 {
106 CONF_VALUE *v = NULL;
107 STACK_OF(CONF_VALUE) *ts;
108
109 ts = (STACK_OF(CONF_VALUE) *)section->value;
110
111 value->section=section->section;
112 if (!sk_CONF_VALUE_push(ts,value))
113 {
114 return 0;
115 }
116
117 v = lh_CONF_VALUE_insert(conf->data, value);
118 if (v != NULL)
119 {
120 (void)sk_CONF_VALUE_delete_ptr(ts,v);
121 OPENSSL_free(v->name);
122 OPENSSL_free(v->value);
123 OPENSSL_free(v);
124 }
125 return 1;
126 }
127
128char *_CONF_get_string(const CONF *conf, const char *section, const char *name)
129 {
130 CONF_VALUE *v,vv;
131 char *p;
132
133 if (name == NULL) return(NULL);
134 if (conf != NULL)
135 {
136 if (section != NULL)
137 {
138 vv.name=(char *)name;
139 vv.section=(char *)section;
140 v=lh_CONF_VALUE_retrieve(conf->data,&vv);
141 if (v != NULL) return(v->value);
142 if (strcmp(section,"ENV") == 0)
143 {
144 p=getenv(name);
145 if (p != NULL) return(p);
146 }
147 }
148 vv.section="default";
149 vv.name=(char *)name;
150 v=lh_CONF_VALUE_retrieve(conf->data,&vv);
151 if (v != NULL)
152 return(v->value);
153 else
154 return(NULL);
155 }
156 else
157 return(getenv(name));
158 }
159
160#if 0 /* There's no way to provide error checking with this function, so
161 force implementors of the higher levels to get a string and read
162 the number themselves. */
163long _CONF_get_number(CONF *conf, char *section, char *name)
164 {
165 char *str;
166 long ret=0;
167
168 str=_CONF_get_string(conf,section,name);
169 if (str == NULL) return(0);
170 for (;;)
171 {
172 if (conf->meth->is_number(conf, *str))
173 ret=ret*10+conf->meth->to_int(conf, *str);
174 else
175 return(ret);
176 str++;
177 }
178 }
179#endif
180
181static unsigned long conf_value_hash(const CONF_VALUE *v)
182 {
183 return (lh_strhash(v->section)<<2)^lh_strhash(v->name);
184 }
185static IMPLEMENT_LHASH_HASH_FN(conf_value, CONF_VALUE)
186
187static int conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b)
188 {
189 int i;
190
191 if (a->section != b->section)
192 {
193 i=strcmp(a->section,b->section);
194 if (i) return(i);
195 }
196
197 if ((a->name != NULL) && (b->name != NULL))
198 {
199 i=strcmp(a->name,b->name);
200 return(i);
201 }
202 else if (a->name == b->name)
203 return(0);
204 else
205 return((a->name == NULL)?-1:1);
206 }
207static IMPLEMENT_LHASH_COMP_FN(conf_value, CONF_VALUE)
208
209int _CONF_new_data(CONF *conf)
210 {
211 if (conf == NULL)
212 {
213 return 0;
214 }
215 if (conf->data == NULL)
216 if ((conf->data = lh_CONF_VALUE_new()) == NULL)
217 {
218 return 0;
219 }
220 return 1;
221 }
222
223void _CONF_free_data(CONF *conf)
224 {
225 if (conf == NULL || conf->data == NULL) return;
226
227 lh_CONF_VALUE_down_load(conf->data)=0; /* evil thing to make
228 * sure the 'OPENSSL_free()' works as
229 * expected */
230 lh_CONF_VALUE_doall_arg(conf->data,
231 LHASH_DOALL_ARG_FN(value_free_hash),
232 LHASH_OF(CONF_VALUE), conf->data);
233
234 /* We now have only 'section' entries in the hash table.
235 * Due to problems with */
236
237 lh_CONF_VALUE_doall(conf->data, LHASH_DOALL_FN(value_free_stack));
238 lh_CONF_VALUE_free(conf->data);
239 }
240
241static void value_free_hash_doall_arg(CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf)
242 {
243 if (a->name != NULL)
244 (void)lh_CONF_VALUE_delete(conf,a);
245 }
246
247static void value_free_stack_doall(CONF_VALUE *a)
248 {
249 CONF_VALUE *vv;
250 STACK_OF(CONF_VALUE) *sk;
251 int i;
252
253 if (a->name != NULL) return;
254
255 sk=(STACK_OF(CONF_VALUE) *)a->value;
256 for (i=sk_CONF_VALUE_num(sk)-1; i>=0; i--)
257 {
258 vv=sk_CONF_VALUE_value(sk,i);
259 OPENSSL_free(vv->value);
260 OPENSSL_free(vv->name);
261 OPENSSL_free(vv);
262 }
263 if (sk != NULL) sk_CONF_VALUE_free(sk);
264 OPENSSL_free(a->section);
265 OPENSSL_free(a);
266 }
267
268/* Up until OpenSSL 0.9.5a, this was new_section */
269CONF_VALUE *_CONF_new_section(CONF *conf, const char *section)
270 {
271 STACK_OF(CONF_VALUE) *sk=NULL;
272 int ok=0,i;
273 CONF_VALUE *v=NULL,*vv;
274
275 if ((sk=sk_CONF_VALUE_new_null()) == NULL)
276 goto err;
277 if ((v=OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL)
278 goto err;
279 i=strlen(section)+1;
280 if ((v->section=OPENSSL_malloc(i)) == NULL)
281 goto err;
282
283 memcpy(v->section,section,i);
284 v->name=NULL;
285 v->value=(char *)sk;
286
287 vv=lh_CONF_VALUE_insert(conf->data,v);
288 assert(vv == NULL);
289 ok=1;
290err:
291 if (!ok)
292 {
293 if (sk != NULL) sk_CONF_VALUE_free(sk);
294 if (v != NULL) OPENSSL_free(v);
295 v=NULL;
296 }
297 return(v);
298 }
299
300IMPLEMENT_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
66extern "C" {
67#endif
68
69/* Up until OpenSSL 0.9.5a, this was new_section */
70CONF_VALUE *_CONF_new_section(CONF *conf, const char *section);
71/* Up until OpenSSL 0.9.5a, this was get_section */
72CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);
73/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
74STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
75 const char *section);
76
77int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);
78char *_CONF_get_string(const CONF *conf, const char *section,
79 const char *name);
80long _CONF_get_number(const CONF *conf, const char *section, const char *name);
81
82int _CONF_new_data(CONF *conf);
83void _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 0b571b0394..0000000000
--- a/src/lib/libcrypto/conf/conf_def.c
+++ /dev/null
@@ -1,751 +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
72static char *eat_ws(CONF *conf, char *p);
73static char *eat_alpha_numeric(CONF *conf, char *p);
74static void clear_comments(CONF *conf, char *p);
75static int str_copy(CONF *conf,char *section,char **to, char *from);
76static char *scan_quote(CONF *conf, char *p);
77static char *scan_dquote(CONF *conf, char *p);
78#define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2)))
79
80static CONF *def_create(CONF_METHOD *meth);
81static int def_init_default(CONF *conf);
82static int def_init_WIN32(CONF *conf);
83static int def_destroy(CONF *conf);
84static int def_destroy_data(CONF *conf);
85static int def_load(CONF *conf, const char *name, long *eline);
86static int def_load_bio(CONF *conf, BIO *bp, long *eline);
87static int def_dump(const CONF *conf, BIO *bp);
88static int def_is_number(const CONF *conf, char c);
89static int def_to_int(const CONF *conf, char c);
90
91const char CONF_def_version[]="CONF_def" OPENSSL_VERSION_PTEXT;
92
93static 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
106static 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
119CONF_METHOD *NCONF_default()
120 {
121 return &default_method;
122 }
123CONF_METHOD *NCONF_WIN32()
124 {
125 return &WIN32_method;
126 }
127
128static 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
142static 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
154static 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
166static 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
176static int def_destroy_data(CONF *conf)
177 {
178 if (conf == NULL)
179 return 0;
180 _CONF_free_data(conf);
181 return 1;
182 }
183
184static 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
209static int def_load_bio(CONF *conf, BIO *in, long *line)
210 {
211/* The macro BUFSIZE conflicts with a system macro in VxWorks */
212#define CONFBUFSIZE 512
213 int bufnum=0,i,ii;
214 BUF_MEM *buff=NULL;
215 char *s,*p,*end;
216 int again,n;
217 long eline=0;
218 char btmp[DECIMAL_SIZE(eline)+1];
219 CONF_VALUE *v=NULL,*tv;
220 CONF_VALUE *sv=NULL;
221 char *section=NULL,*buf;
222 STACK_OF(CONF_VALUE) *section_sk=NULL,*ts;
223 char *start,*psection,*pname;
224 void *h = (void *)(conf->data);
225
226 if ((buff=BUF_MEM_new()) == NULL)
227 {
228 CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_BUF_LIB);
229 goto err;
230 }
231
232 section=(char *)OPENSSL_malloc(10);
233 if (section == NULL)
234 {
235 CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE);
236 goto err;
237 }
238 BUF_strlcpy(section,"default",10);
239
240 if (_CONF_new_data(conf) == 0)
241 {
242 CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE);
243 goto err;
244 }
245
246 sv=_CONF_new_section(conf,section);
247 if (sv == NULL)
248 {
249 CONFerr(CONF_F_DEF_LOAD_BIO,
250 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
251 goto err;
252 }
253 section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
254
255 bufnum=0;
256 again=0;
257 for (;;)
258 {
259 if (!BUF_MEM_grow(buff,bufnum+CONFBUFSIZE))
260 {
261 CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_BUF_LIB);
262 goto err;
263 }
264 p= &(buff->data[bufnum]);
265 *p='\0';
266 BIO_gets(in, p, CONFBUFSIZE-1);
267 p[CONFBUFSIZE-1]='\0';
268 ii=i=strlen(p);
269 if (i == 0 && !again) break;
270 again=0;
271 while (i > 0)
272 {
273 if ((p[i-1] != '\r') && (p[i-1] != '\n'))
274 break;
275 else
276 i--;
277 }
278 /* we removed some trailing stuff so there is a new
279 * line on the end. */
280 if (ii && i == ii)
281 again=1; /* long line */
282 else
283 {
284 p[i]='\0';
285 eline++; /* another input line */
286 }
287
288 /* we now have a line with trailing \r\n removed */
289
290 /* i is the number of bytes */
291 bufnum+=i;
292
293 v=NULL;
294 /* check for line continuation */
295 if (bufnum >= 1)
296 {
297 /* If we have bytes and the last char '\\' and
298 * second last char is not '\\' */
299 p= &(buff->data[bufnum-1]);
300 if (IS_ESC(conf,p[0]) &&
301 ((bufnum <= 1) || !IS_ESC(conf,p[-1])))
302 {
303 bufnum--;
304 again=1;
305 }
306 }
307 if (again) continue;
308 bufnum=0;
309 buf=buff->data;
310
311 clear_comments(conf, buf);
312 n=strlen(buf);
313 s=eat_ws(conf, buf);
314 if (IS_EOF(conf,*s)) continue; /* blank line */
315 if (*s == '[')
316 {
317 char *ss;
318
319 s++;
320 start=eat_ws(conf, s);
321 ss=start;
322again:
323 end=eat_alpha_numeric(conf, ss);
324 p=eat_ws(conf, end);
325 if (*p != ']')
326 {
327 if (*p != '\0')
328 {
329 ss=p;
330 goto again;
331 }
332 CONFerr(CONF_F_DEF_LOAD_BIO,
333 CONF_R_MISSING_CLOSE_SQUARE_BRACKET);
334 goto err;
335 }
336 *end='\0';
337 if (!str_copy(conf,NULL,&section,start)) goto err;
338 if ((sv=_CONF_get_section(conf,section)) == NULL)
339 sv=_CONF_new_section(conf,section);
340 if (sv == NULL)
341 {
342 CONFerr(CONF_F_DEF_LOAD_BIO,
343 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
344 goto err;
345 }
346 section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
347 continue;
348 }
349 else
350 {
351 pname=s;
352 psection=NULL;
353 end=eat_alpha_numeric(conf, s);
354 if ((end[0] == ':') && (end[1] == ':'))
355 {
356 *end='\0';
357 end+=2;
358 psection=pname;
359 pname=end;
360 end=eat_alpha_numeric(conf, end);
361 }
362 p=eat_ws(conf, end);
363 if (*p != '=')
364 {
365 CONFerr(CONF_F_DEF_LOAD_BIO,
366 CONF_R_MISSING_EQUAL_SIGN);
367 goto err;
368 }
369 *end='\0';
370 p++;
371 start=eat_ws(conf, p);
372 while (!IS_EOF(conf,*p))
373 p++;
374 p--;
375 while ((p != start) && (IS_WS(conf,*p)))
376 p--;
377 p++;
378 *p='\0';
379
380 if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))))
381 {
382 CONFerr(CONF_F_DEF_LOAD_BIO,
383 ERR_R_MALLOC_FAILURE);
384 goto err;
385 }
386 if (psection == NULL) psection=section;
387 v->name=(char *)OPENSSL_malloc(strlen(pname)+1);
388 v->value=NULL;
389 if (v->name == NULL)
390 {
391 CONFerr(CONF_F_DEF_LOAD_BIO,
392 ERR_R_MALLOC_FAILURE);
393 goto err;
394 }
395 BUF_strlcpy(v->name,pname,strlen(pname)+1);
396 if (!str_copy(conf,psection,&(v->value),start)) goto err;
397
398 if (strcmp(psection,section) != 0)
399 {
400 if ((tv=_CONF_get_section(conf,psection))
401 == NULL)
402 tv=_CONF_new_section(conf,psection);
403 if (tv == NULL)
404 {
405 CONFerr(CONF_F_DEF_LOAD_BIO,
406 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
407 goto err;
408 }
409 ts=(STACK_OF(CONF_VALUE) *)tv->value;
410 }
411 else
412 {
413 tv=sv;
414 ts=section_sk;
415 }
416#if 1
417 if (_CONF_add_string(conf, tv, v) == 0)
418 {
419 CONFerr(CONF_F_DEF_LOAD_BIO,
420 ERR_R_MALLOC_FAILURE);
421 goto err;
422 }
423#else
424 v->section=tv->section;
425 if (!sk_CONF_VALUE_push(ts,v))
426 {
427 CONFerr(CONF_F_DEF_LOAD_BIO,
428 ERR_R_MALLOC_FAILURE);
429 goto err;
430 }
431 vv=(CONF_VALUE *)lh_insert(conf->data,v);
432 if (vv != NULL)
433 {
434 sk_CONF_VALUE_delete_ptr(ts,vv);
435 OPENSSL_free(vv->name);
436 OPENSSL_free(vv->value);
437 OPENSSL_free(vv);
438 }
439#endif
440 v=NULL;
441 }
442 }
443 if (buff != NULL) BUF_MEM_free(buff);
444 if (section != NULL) OPENSSL_free(section);
445 return(1);
446err:
447 if (buff != NULL) BUF_MEM_free(buff);
448 if (section != NULL) OPENSSL_free(section);
449 if (line != NULL) *line=eline;
450 BIO_snprintf(btmp,sizeof btmp,"%ld",eline);
451 ERR_add_error_data(2,"line ",btmp);
452 if ((h != conf->data) && (conf->data != NULL))
453 {
454 CONF_free(conf->data);
455 conf->data=NULL;
456 }
457 if (v != NULL)
458 {
459 if (v->name != NULL) OPENSSL_free(v->name);
460 if (v->value != NULL) OPENSSL_free(v->value);
461 if (v != NULL) OPENSSL_free(v);
462 }
463 return(0);
464 }
465
466static void clear_comments(CONF *conf, char *p)
467 {
468 char *to;
469
470 to=p;
471 for (;;)
472 {
473 if (IS_FCOMMENT(conf,*p))
474 {
475 *p='\0';
476 return;
477 }
478 if (!IS_WS(conf,*p))
479 {
480 break;
481 }
482 p++;
483 }
484
485 for (;;)
486 {
487 if (IS_COMMENT(conf,*p))
488 {
489 *p='\0';
490 return;
491 }
492 if (IS_DQUOTE(conf,*p))
493 {
494 p=scan_dquote(conf, p);
495 continue;
496 }
497 if (IS_QUOTE(conf,*p))
498 {
499 p=scan_quote(conf, p);
500 continue;
501 }
502 if (IS_ESC(conf,*p))
503 {
504 p=scan_esc(conf,p);
505 continue;
506 }
507 if (IS_EOF(conf,*p))
508 return;
509 else
510 p++;
511 }
512 }
513
514static int str_copy(CONF *conf, char *section, char **pto, char *from)
515 {
516 int q,r,rr=0,to=0,len=0;
517 char *s,*e,*rp,*p,*rrp,*np,*cp,v;
518 BUF_MEM *buf;
519
520 if ((buf=BUF_MEM_new()) == NULL) return(0);
521
522 len=strlen(from)+1;
523 if (!BUF_MEM_grow(buf,len)) goto err;
524
525 for (;;)
526 {
527 if (IS_QUOTE(conf,*from))
528 {
529 q= *from;
530 from++;
531 while (!IS_EOF(conf,*from) && (*from != q))
532 {
533 if (IS_ESC(conf,*from))
534 {
535 from++;
536 if (IS_EOF(conf,*from)) break;
537 }
538 buf->data[to++]= *(from++);
539 }
540 if (*from == q) from++;
541 }
542 else if (IS_DQUOTE(conf,*from))
543 {
544 q= *from;
545 from++;
546 while (!IS_EOF(conf,*from))
547 {
548 if (*from == q)
549 {
550 if (*(from+1) == q)
551 {
552 from++;
553 }
554 else
555 {
556 break;
557 }
558 }
559 buf->data[to++]= *(from++);
560 }
561 if (*from == q) from++;
562 }
563 else if (IS_ESC(conf,*from))
564 {
565 from++;
566 v= *(from++);
567 if (IS_EOF(conf,v)) break;
568 else if (v == 'r') v='\r';
569 else if (v == 'n') v='\n';
570 else if (v == 'b') v='\b';
571 else if (v == 't') v='\t';
572 buf->data[to++]= v;
573 }
574 else if (IS_EOF(conf,*from))
575 break;
576 else if (*from == '$')
577 {
578 /* try to expand it */
579 rrp=NULL;
580 s= &(from[1]);
581 if (*s == '{')
582 q='}';
583 else if (*s == '(')
584 q=')';
585 else q=0;
586
587 if (q) s++;
588 cp=section;
589 e=np=s;
590 while (IS_ALPHA_NUMERIC(conf,*e))
591 e++;
592 if ((e[0] == ':') && (e[1] == ':'))
593 {
594 cp=np;
595 rrp=e;
596 rr= *e;
597 *rrp='\0';
598 e+=2;
599 np=e;
600 while (IS_ALPHA_NUMERIC(conf,*e))
601 e++;
602 }
603 r= *e;
604 *e='\0';
605 rp=e;
606 if (q)
607 {
608 if (r != q)
609 {
610 CONFerr(CONF_F_STR_COPY,CONF_R_NO_CLOSE_BRACE);
611 goto err;
612 }
613 e++;
614 }
615 /* So at this point we have
616 * np which is the start of the name string which is
617 * '\0' terminated.
618 * cp which is the start of the section string which is
619 * '\0' terminated.
620 * e is the 'next point after'.
621 * r and rr are the chars replaced by the '\0'
622 * rp and rrp is where 'r' and 'rr' came from.
623 */
624 p=_CONF_get_string(conf,cp,np);
625 if (rrp != NULL) *rrp=rr;
626 *rp=r;
627 if (p == NULL)
628 {
629 CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE);
630 goto err;
631 }
632 BUF_MEM_grow_clean(buf,(strlen(p)+buf->length-(e-from)));
633 while (*p)
634 buf->data[to++]= *(p++);
635
636 /* Since we change the pointer 'from', we also have
637 to change the perceived length of the string it
638 points at. /RL */
639 len -= e-from;
640 from=e;
641
642 /* In case there were no braces or parenthesis around
643 the variable reference, we have to put back the
644 character that was replaced with a '\0'. /RL */
645 *rp = r;
646 }
647 else
648 buf->data[to++]= *(from++);
649 }
650 buf->data[to]='\0';
651 if (*pto != NULL) OPENSSL_free(*pto);
652 *pto=buf->data;
653 OPENSSL_free(buf);
654 return(1);
655err:
656 if (buf != NULL) BUF_MEM_free(buf);
657 return(0);
658 }
659
660static char *eat_ws(CONF *conf, char *p)
661 {
662 while (IS_WS(conf,*p) && (!IS_EOF(conf,*p)))
663 p++;
664 return(p);
665 }
666
667static char *eat_alpha_numeric(CONF *conf, char *p)
668 {
669 for (;;)
670 {
671 if (IS_ESC(conf,*p))
672 {
673 p=scan_esc(conf,p);
674 continue;
675 }
676 if (!IS_ALPHA_NUMERIC_PUNCT(conf,*p))
677 return(p);
678 p++;
679 }
680 }
681
682static char *scan_quote(CONF *conf, char *p)
683 {
684 int q= *p;
685
686 p++;
687 while (!(IS_EOF(conf,*p)) && (*p != q))
688 {
689 if (IS_ESC(conf,*p))
690 {
691 p++;
692 if (IS_EOF(conf,*p)) return(p);
693 }
694 p++;
695 }
696 if (*p == q) p++;
697 return(p);
698 }
699
700
701static char *scan_dquote(CONF *conf, char *p)
702 {
703 int q= *p;
704
705 p++;
706 while (!(IS_EOF(conf,*p)))
707 {
708 if (*p == q)
709 {
710 if (*(p+1) == q)
711 {
712 p++;
713 }
714 else
715 {
716 break;
717 }
718 }
719 p++;
720 }
721 if (*p == q) p++;
722 return(p);
723 }
724
725static void dump_value_doall_arg(CONF_VALUE *a, BIO *out)
726 {
727 if (a->name)
728 BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value);
729 else
730 BIO_printf(out, "[[%s]]\n", a->section);
731 }
732
733static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE, BIO)
734
735static int def_dump(const CONF *conf, BIO *out)
736 {
737 lh_CONF_VALUE_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value),
738 BIO, out);
739 return 1;
740 }
741
742static int def_is_number(const CONF *conf, char c)
743 {
744 return IS_NUMBER(conf,c);
745 }
746
747static int def_to_int(const CONF *conf, char c)
748 {
749 return c - '0';
750 }
751
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
111static 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
146static 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
71static 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
98static 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
121void 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
66const char CONF_version[]="CONF" OPENSSL_VERSION_PTEXT;
67
68static CONF_METHOD *default_CONF_method=NULL;
69
70/* Init a 'CONF' structure from an old LHASH */
71
72void 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
84int CONF_set_default_method(CONF_METHOD *meth)
85 {
86 default_CONF_method = meth;
87 return 1;
88 }
89
90LHASH_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
114LHASH_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
129LHASH_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
143STACK_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
158char *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
173long 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
198void 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
206int 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
221int 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
234CONF *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
251void NCONF_free(CONF *conf)
252 {
253 if (conf == NULL)
254 return;
255 conf->meth->destroy(conf);
256 }
257
258void NCONF_free_data(CONF *conf)
259 {
260 if (conf == NULL)
261 return;
262 conf->meth->destroy_data(conf);
263 }
264
265int 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
277int 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
292int 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
303STACK_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
320char *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
340int 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
366int 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
380int 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
394long 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
72void 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
77struct 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
98struct conf_imodule_st
99 {
100 CONF_MODULE *pmod;
101 char *name;
102 char *value;
103 unsigned long flags;
104 void *usr_data;
105 };
106
107static STACK_OF(CONF_MODULE) *supported_modules = NULL;
108static STACK_OF(CONF_IMODULE) *initialized_modules = NULL;
109
110static void module_free(CONF_MODULE *md);
111static void module_finish(CONF_IMODULE *imod);
112static int module_run(const CONF *cnf, char *name, char *value,
113 unsigned long flags);
114static CONF_MODULE *module_add(DSO *dso, const char *name,
115 conf_init_func *ifunc, conf_finish_func *ffunc);
116static CONF_MODULE *module_find(char *name);
117static int module_init(CONF_MODULE *pmod, char *name, char *value,
118 const CONF *cnf);
119static 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
124int 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
166int 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
206static 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 */
245static 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 */
291static 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
323static 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 */
347static 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
422void 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 */
446static 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
456void 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
470static 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
482int 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
491void CONF_modules_free(void)
492 {
493 CONF_modules_finish();
494 CONF_modules_unload(1);
495 }
496
497/* Utility functions */
498
499const char *CONF_imodule_get_name(const CONF_IMODULE *md)
500 {
501 return md->name;
502 }
503
504const char *CONF_imodule_get_value(const CONF_IMODULE *md)
505 {
506 return md->value;
507 }
508
509void *CONF_imodule_get_usr_data(const CONF_IMODULE *md)
510 {
511 return md->usr_data;
512 }
513
514void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data)
515 {
516 md->usr_data = usr_data;
517 }
518
519CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md)
520 {
521 return md->pmod;
522 }
523
524unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md)
525 {
526 return md->flags;
527 }
528
529void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags)
530 {
531 md->flags = flags;
532 }
533
534void *CONF_module_get_usr_data(CONF_MODULE *pmod)
535 {
536 return pmod->usr_data;
537 }
538
539void 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
546char *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
580int 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
75static int openssl_configured = 0;
76
77void 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
108void 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
17foreach (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
36foreach (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
54print <<"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
165EOF
166
167print "static unsigned short CONF_type_default[256]={";
168
169for ($i=0; $i<256; $i++)
170 {
171 print "\n\t" if ($i % 8) == 0;
172 printf "0x%04X,",$V_def[$i];
173 }
174
175print "\n\t};\n\n";
176
177print "static unsigned short CONF_type_win32[256]={";
178
179for ($i=0; $i<256; $i++)
180 {
181 print "\n\t" if ($i % 8) == 0;
182 printf "0x%04X,",$V_w32[$i];
183 }
184
185print "\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
5init = 5
6in\#it1 =10
7init2='10'
8init3='10\''
9init4="10'"
10init5='='10\'' again'
11
12SSLeay::version = 0.5.0
13
14[genrsa]
15default_bits = 512
16SSLEAY::version = 0.5.0
17
18[gendh]
19default_bits = 512
20def_generator = 2
21
22[s_client]
23cipher1 = DES_CBC_MD5:DES_CBC_SHA:DES_EDE_SHA:RC4_MD5\
24cipher2 = 'DES_CBC_MD5 DES_CBC_SHA DES_EDE_SHA RC4_MD5'
25cipher3 = "DES_CBC_MD5 DES_CBC_SHA DES_EDE_SHA RC4_MD5"
26cipher4 = DES_CBC_MD5 DES_CBC_SHA DES_EDE_SHA RC4_MD5
27
28[ default ]
29cert_dir = $ENV::HOME/.ca_certs
30
31HOME = /tmp/eay
32
33tmp_cert_dir = $HOME/.ca_certs
34tmp2_cert_dir = thisis$(HOME)stuff
35
36LOGNAME = Eric Young (home=$HOME)
37
38[ special ]
39
40H=$HOME
41H=$default::HOME
42H=$ENV::HOME
43#
44# SSLeay example configuration file.
45# This is mostly being used for generation of certificate requests.
46#
47
48RANDFILE = $HOME/.rand
49
50[ req ]
51default_bits = 512
52default_keyfile = privkey.pem
53
54Attribute_type_1 = countryName
55Attribute_text_1 = Country Name (2 letter code)
56Attribute_default_1 = AU
57
58Attribute_type_2 = stateOrProvinceName
59Attribute_text_2 = State or Province Name (full name)
60Attribute_default_2 = Queensland
61
62Attribute_type_3 = localityName
63Attribute_text_3 = Locality Name (eg, city)
64
65Attribute_type_4 = organizationName
66Attribute_text_4 = Organization Name (eg, company)
67Attribute_default_4 = Mincom Pty Ltd
68
69Attribute_type_5 = organizationalUnitName
70Attribute_text_5 = Organizational Unit Name (eg, section)
71Attribute_default_5 = TR
72
73Attribute_type_6 = commonName
74Attribute_text_6 = Common Name (eg, YOUR name)
75
76Attribute_type_7 = emailAddress
77Attribute_text_7 = Email Address
78