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.h249
-rw-r--r--src/lib/libcrypto/conf/conf_api.c291
-rw-r--r--src/lib/libcrypto/conf/conf_api.h88
-rw-r--r--src/lib/libcrypto/conf/conf_def.c699
-rw-r--r--src/lib/libcrypto/conf/conf_def.h162
-rw-r--r--src/lib/libcrypto/conf/conf_err.c131
-rw-r--r--src/lib/libcrypto/conf/conf_lib.c375
-rw-r--r--src/lib/libcrypto/conf/conf_mall.c82
-rw-r--r--src/lib/libcrypto/conf/conf_mod.c603
-rw-r--r--src/lib/libcrypto/conf/conf_sap.c113
-rw-r--r--src/lib/libcrypto/conf/keysets.pl169
-rw-r--r--src/lib/libcrypto/conf/ssleay.cnf78
13 files changed, 0 insertions, 3113 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 095066d31b..0000000000
--- a/src/lib/libcrypto/conf/conf.h
+++ /dev/null
@@ -1,249 +0,0 @@
1/* $OpenBSD: conf.h,v 1.14 2015/02/07 13:19:15 doug Exp $ */
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/opensslconf.h>
63
64#include <openssl/bio.h>
65#include <openssl/lhash.h>
66#include <openssl/stack.h>
67#include <openssl/safestack.h>
68
69#include <openssl/ossl_typ.h>
70
71#ifdef __cplusplus
72extern "C" {
73#endif
74
75typedef struct {
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 const char *name;
90 CONF *(*create)(CONF_METHOD *meth);
91 int (*init)(CONF *conf);
92 int (*destroy)(CONF *conf);
93 int (*destroy_data)(CONF *conf);
94 int (*load_bio)(CONF *conf, BIO *bp, long *eline);
95 int (*dump)(const CONF *conf, BIO *bp);
96 int (*is_number)(const CONF *conf, char c);
97 int (*to_int)(const CONF *conf, char c);
98 int (*load)(CONF *conf, const char *name, long *eline);
99};
100
101/* Module definitions */
102
103typedef struct conf_imodule_st CONF_IMODULE;
104typedef struct conf_module_st CONF_MODULE;
105
106DECLARE_STACK_OF(CONF_MODULE)
107DECLARE_STACK_OF(CONF_IMODULE)
108
109/* DSO module function typedefs */
110typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);
111typedef void conf_finish_func(CONF_IMODULE *md);
112
113#define CONF_MFLAGS_IGNORE_ERRORS 0x1
114#define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
115#define CONF_MFLAGS_SILENT 0x4
116#define CONF_MFLAGS_NO_DSO 0x8
117#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
118#define CONF_MFLAGS_DEFAULT_SECTION 0x20
119
120int CONF_set_default_method(CONF_METHOD *meth);
121void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
122LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
123 long *eline);
124LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
125 long *eline);
126LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, long *eline);
127STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
128 const char *section);
129char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
130 const char *name);
131long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
132 const char *name);
133void CONF_free(LHASH_OF(CONF_VALUE) *conf);
134int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
135int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
136
137void OPENSSL_config(const char *config_name);
138void OPENSSL_no_config(void);
139
140/* New conf code. The semantics are different from the functions above.
141 If that wasn't the case, the above functions would have been replaced */
142
143struct conf_st {
144 CONF_METHOD *meth;
145 void *meth_data;
146 LHASH_OF(CONF_VALUE) *data;
147};
148
149CONF *NCONF_new(CONF_METHOD *meth);
150CONF_METHOD *NCONF_default(void);
151CONF_METHOD *NCONF_WIN32(void);
152void NCONF_free(CONF *conf);
153void NCONF_free_data(CONF *conf);
154
155int NCONF_load(CONF *conf, const char *file, long *eline);
156int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
157int NCONF_load_bio(CONF *conf, BIO *bp, long *eline);
158STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section);
159char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
160int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
161 long *result);
162int NCONF_dump_fp(const CONF *conf, FILE *out);
163int NCONF_dump_bio(const CONF *conf, BIO *out);
164
165#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
166
167/* Module functions */
168
169int CONF_modules_load(const CONF *cnf, const char *appname,
170 unsigned long flags);
171int CONF_modules_load_file(const char *filename, const char *appname,
172 unsigned long flags);
173void CONF_modules_unload(int all);
174void CONF_modules_finish(void);
175void CONF_modules_free(void);
176int CONF_module_add(const char *name, conf_init_func *ifunc,
177 conf_finish_func *ffunc);
178
179const char *CONF_imodule_get_name(const CONF_IMODULE *md);
180const char *CONF_imodule_get_value(const CONF_IMODULE *md);
181void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
182void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
183CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
184unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
185void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
186void *CONF_module_get_usr_data(CONF_MODULE *pmod);
187void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
188
189char *CONF_get1_default_config_file(void);
190
191int CONF_parse_list(const char *list, int sep, int nospc,
192 int (*list_cb)(const char *elem, int len, void *usr), void *arg);
193
194void OPENSSL_load_builtin_modules(void);
195
196/* BEGIN ERROR CODES */
197/* The following lines are auto generated by the script mkerr.pl. Any changes
198 * made after this point may be overwritten when the script is next run.
199 */
200void ERR_load_CONF_strings(void);
201
202/* Error codes for the CONF functions. */
203
204/* Function codes. */
205#define CONF_F_CONF_DUMP_FP 104
206#define CONF_F_CONF_LOAD 100
207#define CONF_F_CONF_LOAD_BIO 102
208#define CONF_F_CONF_LOAD_FP 103
209#define CONF_F_CONF_MODULES_LOAD 116
210#define CONF_F_CONF_PARSE_LIST 119
211#define CONF_F_DEF_LOAD 120
212#define CONF_F_DEF_LOAD_BIO 121
213#define CONF_F_MODULE_INIT 115
214#define CONF_F_MODULE_LOAD_DSO 117
215#define CONF_F_MODULE_RUN 118
216#define CONF_F_NCONF_DUMP_BIO 105
217#define CONF_F_NCONF_DUMP_FP 106
218#define CONF_F_NCONF_GET_NUMBER 107
219#define CONF_F_NCONF_GET_NUMBER_E 112
220#define CONF_F_NCONF_GET_SECTION 108
221#define CONF_F_NCONF_GET_STRING 109
222#define CONF_F_NCONF_LOAD 113
223#define CONF_F_NCONF_LOAD_BIO 110
224#define CONF_F_NCONF_LOAD_FP 114
225#define CONF_F_NCONF_NEW 111
226#define CONF_F_STR_COPY 101
227
228/* Reason codes. */
229#define CONF_R_ERROR_LOADING_DSO 110
230#define CONF_R_LIST_CANNOT_BE_NULL 115
231#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
232#define CONF_R_MISSING_EQUAL_SIGN 101
233#define CONF_R_MISSING_FINISH_FUNCTION 111
234#define CONF_R_MISSING_INIT_FUNCTION 112
235#define CONF_R_MODULE_INITIALIZATION_ERROR 109
236#define CONF_R_NO_CLOSE_BRACE 102
237#define CONF_R_NO_CONF 105
238#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
239#define CONF_R_NO_SECTION 107
240#define CONF_R_NO_SUCH_FILE 114
241#define CONF_R_NO_VALUE 108
242#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
243#define CONF_R_UNKNOWN_MODULE_NAME 113
244#define CONF_R_VARIABLE_HAS_NO_VALUE 104
245
246#ifdef __cplusplus
247}
248#endif
249#endif
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c
deleted file mode 100644
index efa4be9f6b..0000000000
--- a/src/lib/libcrypto/conf/conf_api.c
+++ /dev/null
@@ -1,291 +0,0 @@
1/* $OpenBSD: conf_api.c,v 1.14 2015/02/10 11:22:21 jsing Exp $ */
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 <stdlib.h>
67#include <string.h>
68#include <unistd.h>
69#include <openssl/conf.h>
70#include <openssl/conf_api.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 *
81_CONF_get_section(const CONF *conf, const char *section)
82{
83 CONF_VALUE *v, vv;
84
85 if ((conf == NULL) || (section == NULL))
86 return (NULL);
87 vv.name = NULL;
88 vv.section = (char *)section;
89 v = lh_CONF_VALUE_retrieve(conf->data, &vv);
90 return (v);
91}
92
93/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
94STACK_OF(CONF_VALUE) *
95_CONF_get_section_values(const CONF *conf, const char *section)
96{
97 CONF_VALUE *v;
98
99 v = _CONF_get_section(conf, section);
100 if (v != NULL)
101 return ((STACK_OF(CONF_VALUE) *)v->value);
102 else
103 return (NULL);
104}
105
106int
107_CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)
108{
109 CONF_VALUE *v = NULL;
110 STACK_OF(CONF_VALUE) *ts;
111
112 ts = (STACK_OF(CONF_VALUE) *)section->value;
113
114 value->section = section->section;
115 if (!sk_CONF_VALUE_push(ts, value)) {
116 return 0;
117 }
118
119 v = lh_CONF_VALUE_insert(conf->data, value);
120 if (v != NULL) {
121 (void)sk_CONF_VALUE_delete_ptr(ts, v);
122 free(v->name);
123 free(v->value);
124 free(v);
125 }
126 return 1;
127}
128
129char *
130_CONF_get_string(const CONF *conf, const char *section, const char *name)
131{
132 CONF_VALUE *v, vv;
133 char *p;
134
135 if (name == NULL)
136 return (NULL);
137 if (conf != NULL) {
138 if (section != NULL) {
139 vv.name = (char *)name;
140 vv.section = (char *)section;
141 v = lh_CONF_VALUE_retrieve(conf->data, &vv);
142 if (v != NULL)
143 return (v->value);
144 if (strcmp(section, "ENV") == 0) {
145 if (issetugid() == 0)
146 p = getenv(name);
147 else
148 p = NULL;
149 if (p != NULL)
150 return (p);
151 }
152 }
153 vv.section = "default";
154 vv.name = (char *)name;
155 v = lh_CONF_VALUE_retrieve(conf->data, &vv);
156 if (v != NULL)
157 return (v->value);
158 else
159 return (NULL);
160 } else {
161 if (issetugid())
162 return (NULL);
163 return (getenv(name));
164 }
165}
166
167static unsigned long
168conf_value_hash(const CONF_VALUE *v)
169{
170 return (lh_strhash(v->section) << 2) ^ lh_strhash(v->name);
171}
172
173static IMPLEMENT_LHASH_HASH_FN(conf_value, CONF_VALUE)
174
175static int
176conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b)
177{
178 int i;
179
180 if (a->section != b->section) {
181 i = strcmp(a->section, b->section);
182 if (i)
183 return (i);
184 }
185 if ((a->name != NULL) && (b->name != NULL)) {
186 i = strcmp(a->name, b->name);
187 return (i);
188 } else if (a->name == b->name)
189 return (0);
190 else
191 return ((a->name == NULL)?-1 : 1);
192}
193
194static IMPLEMENT_LHASH_COMP_FN(conf_value, CONF_VALUE)
195
196int
197_CONF_new_data(CONF *conf)
198{
199 if (conf == NULL) {
200 return 0;
201 }
202 if (conf->data == NULL)
203 if ((conf->data = lh_CONF_VALUE_new()) == NULL) {
204 return 0;
205 }
206 return 1;
207}
208
209void
210_CONF_free_data(CONF *conf)
211{
212 if (conf == NULL || conf->data == NULL)
213 return;
214
215 lh_CONF_VALUE_down_load(conf->data) = 0; /* evil thing to make
216 * sure the 'free()' works as
217 * expected */
218 lh_CONF_VALUE_doall_arg(conf->data,
219 LHASH_DOALL_ARG_FN(value_free_hash),
220 LHASH_OF(CONF_VALUE), conf->data);
221
222 /* We now have only 'section' entries in the hash table.
223 * Due to problems with */
224
225 lh_CONF_VALUE_doall(conf->data, LHASH_DOALL_FN(value_free_stack));
226 lh_CONF_VALUE_free(conf->data);
227}
228
229static void
230value_free_hash_doall_arg(CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf)
231{
232 if (a->name != NULL)
233 (void)lh_CONF_VALUE_delete(conf, a);
234}
235
236static void
237value_free_stack_doall(CONF_VALUE *a)
238{
239 CONF_VALUE *vv;
240 STACK_OF(CONF_VALUE) *sk;
241 int i;
242
243 if (a->name != NULL)
244 return;
245
246 sk = (STACK_OF(CONF_VALUE) *)a->value;
247 for (i = sk_CONF_VALUE_num(sk) - 1; i >= 0; i--) {
248 vv = sk_CONF_VALUE_value(sk, i);
249 free(vv->value);
250 free(vv->name);
251 free(vv);
252 }
253 if (sk != NULL)
254 sk_CONF_VALUE_free(sk);
255 free(a->section);
256 free(a);
257}
258
259/* Up until OpenSSL 0.9.5a, this was new_section */
260CONF_VALUE *
261_CONF_new_section(CONF *conf, const char *section)
262{
263 STACK_OF(CONF_VALUE) *sk = NULL;
264 int ok = 0, i;
265 CONF_VALUE *v = NULL, *vv;
266
267 if ((sk = sk_CONF_VALUE_new_null()) == NULL)
268 goto err;
269 if ((v = malloc(sizeof(CONF_VALUE))) == NULL)
270 goto err;
271 i = strlen(section) + 1;
272 if ((v->section = malloc(i)) == NULL)
273 goto err;
274
275 memcpy(v->section, section, i);
276 v->name = NULL;
277 v->value = (char *)sk;
278
279 vv = lh_CONF_VALUE_insert(conf->data, v);
280 OPENSSL_assert(vv == NULL);
281 ok = 1;
282
283err:
284 if (!ok) {
285 if (sk != NULL)
286 sk_CONF_VALUE_free(sk);
287 free(v);
288 v = NULL;
289 }
290 return (v);
291}
diff --git a/src/lib/libcrypto/conf/conf_api.h b/src/lib/libcrypto/conf/conf_api.h
deleted file mode 100644
index 95f9386226..0000000000
--- a/src/lib/libcrypto/conf/conf_api.h
+++ /dev/null
@@ -1,88 +0,0 @@
1/* $OpenBSD: conf_api.h,v 1.4 2014/06/12 15:49:28 deraadt Exp $ */
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
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c
deleted file mode 100644
index e608e5fe9d..0000000000
--- a/src/lib/libcrypto/conf/conf_def.c
+++ /dev/null
@@ -1,699 +0,0 @@
1/* $OpenBSD: conf_def.c,v 1.29 2015/02/07 13:19:15 doug Exp $ */
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
64#include <openssl/buffer.h>
65#include <openssl/conf.h>
66#include <openssl/conf_api.h>
67#include <openssl/err.h>
68#include <openssl/lhash.h>
69#include <openssl/stack.h>
70
71#include "conf_def.h"
72
73static char *eat_ws(CONF *conf, char *p);
74static char *eat_alpha_numeric(CONF *conf, char *p);
75static void clear_comments(CONF *conf, char *p);
76static int str_copy(CONF *conf, char *section, char **to, char *from);
77static char *scan_quote(CONF *conf, char *p);
78static char *scan_dquote(CONF *conf, char *p);
79#define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2)))
80
81static CONF *def_create(CONF_METHOD *meth);
82static int def_init_default(CONF *conf);
83static int def_init_WIN32(CONF *conf);
84static int def_destroy(CONF *conf);
85static int def_destroy_data(CONF *conf);
86static int def_load(CONF *conf, const char *name, long *eline);
87static int def_load_bio(CONF *conf, BIO *bp, long *eline);
88static int def_dump(const CONF *conf, BIO *bp);
89static int def_is_number(const CONF *conf, char c);
90static int def_to_int(const CONF *conf, char c);
91
92static CONF_METHOD default_method = {
93 .name = "OpenSSL default",
94 .create = def_create,
95 .init = def_init_default,
96 .destroy = def_destroy,
97 .destroy_data = def_destroy_data,
98 .load_bio = def_load_bio,
99 .dump = def_dump,
100 .is_number = def_is_number,
101 .to_int = def_to_int,
102 .load = def_load
103};
104
105static CONF_METHOD WIN32_method = {
106 "WIN32",
107 def_create,
108 def_init_WIN32,
109 def_destroy,
110 def_destroy_data,
111 def_load_bio,
112 def_dump,
113 def_is_number,
114 def_to_int,
115 def_load
116};
117
118CONF_METHOD *
119NCONF_default(void)
120{
121 return &default_method;
122}
123
124CONF_METHOD *
125NCONF_WIN32(void)
126{
127 return &WIN32_method;
128}
129
130static CONF *
131def_create(CONF_METHOD *meth)
132{
133 CONF *ret;
134
135 ret = malloc(sizeof(CONF) + sizeof(unsigned short *));
136 if (ret)
137 if (meth->init(ret) == 0) {
138 free(ret);
139 ret = NULL;
140 }
141 return ret;
142}
143
144static int
145def_init_default(CONF *conf)
146{
147 if (conf == NULL)
148 return 0;
149
150 conf->meth = &default_method;
151 conf->meth_data = CONF_type_default;
152 conf->data = NULL;
153
154 return 1;
155}
156
157static int
158def_init_WIN32(CONF *conf)
159{
160 if (conf == NULL)
161 return 0;
162
163 conf->meth = &WIN32_method;
164 conf->meth_data = (void *)CONF_type_win32;
165 conf->data = NULL;
166
167 return 1;
168}
169
170static int
171def_destroy(CONF *conf)
172{
173 if (def_destroy_data(conf)) {
174 free(conf);
175 return 1;
176 }
177 return 0;
178}
179
180static int
181def_destroy_data(CONF *conf)
182{
183 if (conf == NULL)
184 return 0;
185 _CONF_free_data(conf);
186 return 1;
187}
188
189static int
190def_load(CONF *conf, const char *name, long *line)
191{
192 int ret;
193 BIO *in = NULL;
194
195 in = BIO_new_file(name, "rb");
196 if (in == NULL) {
197 if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE)
198 CONFerr(CONF_F_DEF_LOAD, CONF_R_NO_SUCH_FILE);
199 else
200 CONFerr(CONF_F_DEF_LOAD, ERR_R_SYS_LIB);
201 return 0;
202 }
203
204 ret = def_load_bio(conf, in, line);
205 BIO_free(in);
206
207 return ret;
208}
209
210static int
211def_load_bio(CONF *conf, BIO *in, long *line)
212{
213/* The macro BUFSIZE conflicts with a system macro in VxWorks */
214#define CONFBUFSIZE 512
215 int bufnum = 0, i, ii;
216 BUF_MEM *buff = NULL;
217 char *s, *p, *end;
218 int again;
219 long eline = 0;
220 CONF_VALUE *v = NULL, *tv;
221 CONF_VALUE *sv = NULL;
222 char *section = NULL, *buf;
223 char *start, *psection, *pname;
224 void *h = (void *)(conf->data);
225
226 if ((buff = BUF_MEM_new()) == NULL) {
227 CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB);
228 goto err;
229 }
230
231 section = malloc(10);
232 if (section == NULL) {
233 CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
234 goto err;
235 }
236 strlcpy(section, "default",10);
237
238 if (_CONF_new_data(conf) == 0) {
239 CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
240 goto err;
241 }
242
243 sv = _CONF_new_section(conf, section);
244 if (sv == NULL) {
245 CONFerr(CONF_F_DEF_LOAD_BIO,
246 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
247 goto err;
248 }
249
250 bufnum = 0;
251 again = 0;
252 for (;;) {
253 if (!BUF_MEM_grow(buff, bufnum + CONFBUFSIZE)) {
254 CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB);
255 goto err;
256 }
257 p = &(buff->data[bufnum]);
258 *p = '\0';
259 BIO_gets(in, p, CONFBUFSIZE - 1);
260 p[CONFBUFSIZE - 1] = '\0';
261 ii = i = strlen(p);
262 if (i == 0 && !again)
263 break;
264 again = 0;
265 while (i > 0) {
266 if ((p[i - 1] != '\r') && (p[i - 1] != '\n'))
267 break;
268 else
269 i--;
270 }
271 /* we removed some trailing stuff so there is a new
272 * line on the end. */
273 if (ii && i == ii)
274 again = 1; /* long line */
275 else {
276 p[i] = '\0';
277 eline++; /* another input line */
278 }
279
280 /* we now have a line with trailing \r\n removed */
281
282 /* i is the number of bytes */
283 bufnum += i;
284
285 v = NULL;
286 /* check for line continuation */
287 if (bufnum >= 1) {
288 /* If we have bytes and the last char '\\' and
289 * second last char is not '\\' */
290 p = &(buff->data[bufnum - 1]);
291 if (IS_ESC(conf, p[0]) &&
292 ((bufnum <= 1) || !IS_ESC(conf, p[-1]))) {
293 bufnum--;
294 again = 1;
295 }
296 }
297 if (again)
298 continue;
299 bufnum = 0;
300 buf = buff->data;
301
302 clear_comments(conf, buf);
303 s = eat_ws(conf, buf);
304 if (IS_EOF(conf, *s))
305 continue; /* blank line */
306 if (*s == '[') {
307 char *ss;
308
309 s++;
310 start = eat_ws(conf, s);
311 ss = start;
312again:
313 end = eat_alpha_numeric(conf, ss);
314 p = eat_ws(conf, end);
315 if (*p != ']') {
316 if (*p != '\0' && ss != p) {
317 ss = p;
318 goto again;
319 }
320 CONFerr(CONF_F_DEF_LOAD_BIO,
321 CONF_R_MISSING_CLOSE_SQUARE_BRACKET);
322 goto err;
323 }
324 *end = '\0';
325 if (!str_copy(conf, NULL, &section, start))
326 goto err;
327 if ((sv = _CONF_get_section(conf, section)) == NULL)
328 sv = _CONF_new_section(conf, section);
329 if (sv == NULL) {
330 CONFerr(CONF_F_DEF_LOAD_BIO,
331 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
332 goto err;
333 }
334 continue;
335 } else {
336 pname = s;
337 psection = NULL;
338 end = eat_alpha_numeric(conf, s);
339 if ((end[0] == ':') && (end[1] == ':')) {
340 *end = '\0';
341 end += 2;
342 psection = pname;
343 pname = end;
344 end = eat_alpha_numeric(conf, end);
345 }
346 p = eat_ws(conf, end);
347 if (*p != '=') {
348 CONFerr(CONF_F_DEF_LOAD_BIO,
349 CONF_R_MISSING_EQUAL_SIGN);
350 goto err;
351 }
352 *end = '\0';
353 p++;
354 start = eat_ws(conf, p);
355 while (!IS_EOF(conf, *p))
356 p++;
357 p--;
358 while ((p != start) && (IS_WS(conf, *p)))
359 p--;
360 p++;
361 *p = '\0';
362
363 if (!(v = malloc(sizeof(CONF_VALUE)))) {
364 CONFerr(CONF_F_DEF_LOAD_BIO,
365 ERR_R_MALLOC_FAILURE);
366 goto err;
367 }
368 if (psection == NULL)
369 psection = section;
370 v->name = strdup(pname);
371 v->value = NULL;
372 if (v->name == NULL) {
373 CONFerr(CONF_F_DEF_LOAD_BIO,
374 ERR_R_MALLOC_FAILURE);
375 goto err;
376 }
377 if (!str_copy(conf, psection, &(v->value), start))
378 goto err;
379
380 if (strcmp(psection, section) != 0) {
381 if ((tv = _CONF_get_section(conf, psection))
382 == NULL)
383 tv = _CONF_new_section(conf, psection);
384 if (tv == NULL) {
385 CONFerr(CONF_F_DEF_LOAD_BIO,
386 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
387 goto err;
388 }
389 } else
390 tv = sv;
391
392 if (_CONF_add_string(conf, tv, v) == 0) {
393 CONFerr(CONF_F_DEF_LOAD_BIO,
394 ERR_R_MALLOC_FAILURE);
395 goto err;
396 }
397 v = NULL;
398 }
399 }
400 if (buff != NULL)
401 BUF_MEM_free(buff);
402 free(section);
403 return (1);
404
405err:
406 if (buff != NULL)
407 BUF_MEM_free(buff);
408 free(section);
409 if (line != NULL)
410 *line = eline;
411 ERR_asprintf_error_data("line %ld", eline);
412 if ((h != conf->data) && (conf->data != NULL)) {
413 CONF_free(conf->data);
414 conf->data = NULL;
415 }
416 if (v != NULL) {
417 free(v->name);
418 free(v->value);
419 free(v);
420 }
421 return (0);
422}
423
424static void
425clear_comments(CONF *conf, char *p)
426{
427 for (;;) {
428 if (IS_FCOMMENT(conf, *p)) {
429 *p = '\0';
430 return;
431 }
432 if (!IS_WS(conf, *p)) {
433 break;
434 }
435 p++;
436 }
437
438 for (;;) {
439 if (IS_COMMENT(conf, *p)) {
440 *p = '\0';
441 return;
442 }
443 if (IS_DQUOTE(conf, *p)) {
444 p = scan_dquote(conf, p);
445 continue;
446 }
447 if (IS_QUOTE(conf, *p)) {
448 p = scan_quote(conf, p);
449 continue;
450 }
451 if (IS_ESC(conf, *p)) {
452 p = scan_esc(conf, p);
453 continue;
454 }
455 if (IS_EOF(conf, *p))
456 return;
457 else
458 p++;
459 }
460}
461
462static int
463str_copy(CONF *conf, char *section, char **pto, char *from)
464{
465 int q, r,rr = 0, to = 0, len = 0;
466 char *s, *e, *rp, *p, *rrp, *np, *cp, v;
467 BUF_MEM *buf;
468
469 if ((buf = BUF_MEM_new()) == NULL)
470 return (0);
471
472 len = strlen(from) + 1;
473 if (!BUF_MEM_grow(buf, len))
474 goto err;
475
476 for (;;) {
477 if (IS_QUOTE(conf, *from)) {
478 q = *from;
479 from++;
480 while (!IS_EOF(conf, *from) && (*from != q)) {
481 if (IS_ESC(conf, *from)) {
482 from++;
483 if (IS_EOF(conf, *from))
484 break;
485 }
486 buf->data[to++] = *(from++);
487 }
488 if (*from == q)
489 from++;
490 } else if (IS_DQUOTE(conf, *from)) {
491 q = *from;
492 from++;
493 while (!IS_EOF(conf, *from)) {
494 if (*from == q) {
495 if (*(from + 1) == q) {
496 from++;
497 } else {
498 break;
499 }
500 }
501 buf->data[to++] = *(from++);
502 }
503 if (*from == q)
504 from++;
505 } else if (IS_ESC(conf, *from)) {
506 from++;
507 v = *(from++);
508 if (IS_EOF(conf, v))
509 break;
510 else if (v == 'r')
511 v = '\r';
512 else if (v == 'n')
513 v = '\n';
514 else if (v == 'b')
515 v = '\b';
516 else if (v == 't')
517 v = '\t';
518 buf->data[to++] = v;
519 } else if (IS_EOF(conf, *from))
520 break;
521 else if (*from == '$') {
522 /* try to expand it */
523 rrp = NULL;
524 s = &(from[1]);
525 if (*s == '{')
526 q = '}';
527 else if (*s == '(')
528 q = ')';
529 else
530 q = 0;
531
532 if (q)
533 s++;
534 cp = section;
535 e = np = s;
536 while (IS_ALPHA_NUMERIC(conf, *e))
537 e++;
538 if ((e[0] == ':') && (e[1] == ':')) {
539 cp = np;
540 rrp = e;
541 rr = *e;
542 *rrp = '\0';
543 e += 2;
544 np = e;
545 while (IS_ALPHA_NUMERIC(conf, *e))
546 e++;
547 }
548 r = *e;
549 *e = '\0';
550 rp = e;
551 if (q) {
552 if (r != q) {
553 CONFerr(CONF_F_STR_COPY,
554 CONF_R_NO_CLOSE_BRACE);
555 goto err;
556 }
557 e++;
558 }
559 /* So at this point we have
560 * np which is the start of the name string which is
561 * '\0' terminated.
562 * cp which is the start of the section string which is
563 * '\0' terminated.
564 * e is the 'next point after'.
565 * r and rr are the chars replaced by the '\0'
566 * rp and rrp is where 'r' and 'rr' came from.
567 */
568 p = _CONF_get_string(conf, cp, np);
569 if (rrp != NULL)
570 *rrp = rr;
571 *rp = r;
572 if (p == NULL) {
573 CONFerr(CONF_F_STR_COPY,
574 CONF_R_VARIABLE_HAS_NO_VALUE);
575 goto err;
576 }
577 BUF_MEM_grow_clean(buf,
578 (strlen(p) + buf->length - (e - from)));
579 while (*p)
580 buf->data[to++] = *(p++);
581
582 /* Since we change the pointer 'from', we also have
583 to change the perceived length of the string it
584 points at. /RL */
585 len -= e - from;
586 from = e;
587
588 /* In case there were no braces or parenthesis around
589 the variable reference, we have to put back the
590 character that was replaced with a '\0'. /RL */
591 *rp = r;
592 } else
593 buf->data[to++] = *(from++);
594 }
595 buf->data[to]='\0';
596 free(*pto);
597 *pto = buf->data;
598 free(buf);
599 return (1);
600
601err:
602 if (buf != NULL)
603 BUF_MEM_free(buf);
604 return (0);
605}
606
607static char *
608eat_ws(CONF *conf, char *p)
609{
610 while (IS_WS(conf, *p) && (!IS_EOF(conf, *p)))
611 p++;
612 return (p);
613}
614
615static char *
616eat_alpha_numeric(CONF *conf, char *p)
617{
618 for (;;) {
619 if (IS_ESC(conf, *p)) {
620 p = scan_esc(conf, p);
621 continue;
622 }
623 if (!IS_ALPHA_NUMERIC_PUNCT(conf, *p))
624 return (p);
625 p++;
626 }
627}
628
629static char *
630scan_quote(CONF *conf, char *p)
631{
632 int q = *p;
633
634 p++;
635 while (!(IS_EOF(conf, *p)) && (*p != q)) {
636 if (IS_ESC(conf, *p)) {
637 p++;
638 if (IS_EOF(conf, *p))
639 return (p);
640 }
641 p++;
642 }
643 if (*p == q)
644 p++;
645 return (p);
646}
647
648
649static char *
650scan_dquote(CONF *conf, char *p)
651{
652 int q = *p;
653
654 p++;
655 while (!(IS_EOF(conf, *p))) {
656 if (*p == q) {
657 if (*(p + 1) == q) {
658 p++;
659 } else {
660 break;
661 }
662 }
663 p++;
664 }
665 if (*p == q)
666 p++;
667 return (p);
668}
669
670static void
671dump_value_doall_arg(CONF_VALUE *a, BIO *out)
672{
673 if (a->name)
674 BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value);
675 else
676 BIO_printf(out, "[[%s]]\n", a->section);
677}
678
679static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE, BIO)
680
681static int
682def_dump(const CONF *conf, BIO *out)
683{
684 lh_CONF_VALUE_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value),
685 BIO, out);
686 return 1;
687}
688
689static int
690def_is_number(const CONF *conf, char c)
691{
692 return IS_NUMBER(conf, c);
693}
694
695static int
696def_to_int(const CONF *conf, char c)
697{
698 return c - '0';
699}
diff --git a/src/lib/libcrypto/conf/conf_def.h b/src/lib/libcrypto/conf/conf_def.h
deleted file mode 100644
index 8f8c1fd961..0000000000
--- a/src/lib/libcrypto/conf/conf_def.h
+++ /dev/null
@@ -1,162 +0,0 @@
1/* $OpenBSD: conf_def.h,v 1.5 2014/06/12 15:49:28 deraadt Exp $ */
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#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
82#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
83#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
84#define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
85#define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
86#define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS)
87#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
88#define IS_ALPHA_NUMERIC_PUNCT(c,a) \
89 (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
90#define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
91#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
92#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
93
94static unsigned short CONF_type_default[256] = {
95 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
96 0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000,
97 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
98 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
99 0x0010, 0x0200, 0x0040, 0x0080, 0x0000, 0x0200, 0x0200, 0x0040,
100 0x0000, 0x0000, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
101 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
102 0x0001, 0x0001, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000, 0x0200,
103 0x0200, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
104 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
105 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
106 0x0002, 0x0002, 0x0002, 0x0000, 0x0020, 0x0000, 0x0200, 0x0100,
107 0x0040, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
108 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
109 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
110 0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000,
111 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
112 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
113 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
114 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
115 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
116 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
117 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
118 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
119 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
120 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
121 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
122 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
123 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
124 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
125 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
126 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
127};
128
129static unsigned short CONF_type_win32[256] = {
130 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
131 0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000,
132 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
133 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
134 0x0010, 0x0200, 0x0400, 0x0000, 0x0000, 0x0200, 0x0200, 0x0000,
135 0x0000, 0x0000, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
136 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
137 0x0001, 0x0001, 0x0000, 0x0A00, 0x0000, 0x0000, 0x0000, 0x0200,
138 0x0200, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
139 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
140 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
141 0x0002, 0x0002, 0x0002, 0x0000, 0x0000, 0x0000, 0x0200, 0x0100,
142 0x0000, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
143 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
144 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
145 0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000,
146 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
147 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
148 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
149 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
150 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
151 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
152 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
153 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
154 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
155 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
156 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
157 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
158 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
159 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
160 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
161 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
162};
diff --git a/src/lib/libcrypto/conf/conf_err.c b/src/lib/libcrypto/conf/conf_err.c
deleted file mode 100644
index a1a7cbe42e..0000000000
--- a/src/lib/libcrypto/conf/conf_err.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/* $OpenBSD: conf_err.c,v 1.12 2014/07/10 22:45:56 jsing Exp $ */
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
63#include <openssl/opensslconf.h>
64
65#include <openssl/conf.h>
66#include <openssl/err.h>
67
68/* BEGIN ERROR CODES */
69#ifndef OPENSSL_NO_ERR
70
71#define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0)
72#define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason)
73
74static ERR_STRING_DATA CONF_str_functs[]= {
75 {ERR_FUNC(CONF_F_CONF_DUMP_FP), "CONF_dump_fp"},
76 {ERR_FUNC(CONF_F_CONF_LOAD), "CONF_load"},
77 {ERR_FUNC(CONF_F_CONF_LOAD_BIO), "CONF_load_bio"},
78 {ERR_FUNC(CONF_F_CONF_LOAD_FP), "CONF_load_fp"},
79 {ERR_FUNC(CONF_F_CONF_MODULES_LOAD), "CONF_modules_load"},
80 {ERR_FUNC(CONF_F_CONF_PARSE_LIST), "CONF_parse_list"},
81 {ERR_FUNC(CONF_F_DEF_LOAD), "DEF_LOAD"},
82 {ERR_FUNC(CONF_F_DEF_LOAD_BIO), "DEF_LOAD_BIO"},
83 {ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"},
84 {ERR_FUNC(CONF_F_MODULE_LOAD_DSO), "MODULE_LOAD_DSO"},
85 {ERR_FUNC(CONF_F_MODULE_RUN), "MODULE_RUN"},
86 {ERR_FUNC(CONF_F_NCONF_DUMP_BIO), "NCONF_dump_bio"},
87 {ERR_FUNC(CONF_F_NCONF_DUMP_FP), "NCONF_dump_fp"},
88 {ERR_FUNC(CONF_F_NCONF_GET_NUMBER), "NCONF_get_number"},
89 {ERR_FUNC(CONF_F_NCONF_GET_NUMBER_E), "NCONF_get_number_e"},
90 {ERR_FUNC(CONF_F_NCONF_GET_SECTION), "NCONF_get_section"},
91 {ERR_FUNC(CONF_F_NCONF_GET_STRING), "NCONF_get_string"},
92 {ERR_FUNC(CONF_F_NCONF_LOAD), "NCONF_load"},
93 {ERR_FUNC(CONF_F_NCONF_LOAD_BIO), "NCONF_load_bio"},
94 {ERR_FUNC(CONF_F_NCONF_LOAD_FP), "NCONF_load_fp"},
95 {ERR_FUNC(CONF_F_NCONF_NEW), "NCONF_new"},
96 {ERR_FUNC(CONF_F_STR_COPY), "STR_COPY"},
97 {0, NULL}
98};
99
100static ERR_STRING_DATA CONF_str_reasons[]= {
101 {ERR_REASON(CONF_R_ERROR_LOADING_DSO) , "error loading dso"},
102 {ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL) , "list cannot be null"},
103 {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET), "missing close square bracket"},
104 {ERR_REASON(CONF_R_MISSING_EQUAL_SIGN) , "missing equal sign"},
105 {ERR_REASON(CONF_R_MISSING_FINISH_FUNCTION), "missing finish function"},
106 {ERR_REASON(CONF_R_MISSING_INIT_FUNCTION), "missing init function"},
107 {ERR_REASON(CONF_R_MODULE_INITIALIZATION_ERROR), "module initialization error"},
108 {ERR_REASON(CONF_R_NO_CLOSE_BRACE) , "no close brace"},
109 {ERR_REASON(CONF_R_NO_CONF) , "no conf"},
110 {ERR_REASON(CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE), "no conf or environment variable"},
111 {ERR_REASON(CONF_R_NO_SECTION) , "no section"},
112 {ERR_REASON(CONF_R_NO_SUCH_FILE) , "no such file"},
113 {ERR_REASON(CONF_R_NO_VALUE) , "no value"},
114 {ERR_REASON(CONF_R_UNABLE_TO_CREATE_NEW_SECTION), "unable to create new section"},
115 {ERR_REASON(CONF_R_UNKNOWN_MODULE_NAME) , "unknown module name"},
116 {ERR_REASON(CONF_R_VARIABLE_HAS_NO_VALUE), "variable has no value"},
117 {0, NULL}
118};
119
120#endif
121
122void
123ERR_load_CONF_strings(void)
124{
125#ifndef OPENSSL_NO_ERR
126 if (ERR_func_error_string(CONF_str_functs[0].error) == NULL) {
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 a7c8be7c0d..0000000000
--- a/src/lib/libcrypto/conf/conf_lib.c
+++ /dev/null
@@ -1,375 +0,0 @@
1/* $OpenBSD: conf_lib.c,v 1.13 2015/02/07 13:19:15 doug Exp $ */
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
66static CONF_METHOD *default_CONF_method = NULL;
67
68/* Init a 'CONF' structure from an old LHASH */
69
70void
71CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash)
72{
73 if (default_CONF_method == NULL)
74 default_CONF_method = NCONF_default();
75 default_CONF_method->init(conf);
76 conf->data = hash;
77}
78
79/* The following section contains the "CONF classic" functions,
80 rewritten in terms of the new CONF interface. */
81
82int
83CONF_set_default_method(CONF_METHOD *meth)
84{
85 default_CONF_method = meth;
86 return 1;
87}
88
89LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
90 long *eline)
91{
92 LHASH_OF(CONF_VALUE) *ltmp;
93 BIO *in = NULL;
94
95 in = BIO_new_file(file, "rb");
96 if (in == NULL) {
97 CONFerr(CONF_F_CONF_LOAD, ERR_R_SYS_LIB);
98 return NULL;
99 }
100
101 ltmp = CONF_load_bio(conf, in, eline);
102 BIO_free(in);
103
104 return ltmp;
105}
106
107LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
108 long *eline)
109{
110 BIO *btmp;
111 LHASH_OF(CONF_VALUE) *ltmp;
112
113 if (!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) {
114 CONFerr(CONF_F_CONF_LOAD_FP, ERR_R_BUF_LIB);
115 return NULL;
116 }
117 ltmp = CONF_load_bio(conf, btmp, eline);
118 BIO_free(btmp);
119 return ltmp;
120}
121
122LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
123 long *eline)
124{
125 CONF ctmp;
126 int ret;
127
128 CONF_set_nconf(&ctmp, conf);
129
130 ret = NCONF_load_bio(&ctmp, bp, eline);
131 if (ret)
132 return ctmp.data;
133 return NULL;
134}
135
136STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
137 const char *section)
138{
139 if (conf == NULL) {
140 return NULL;
141 } else {
142 CONF ctmp;
143 CONF_set_nconf(&ctmp, conf);
144 return NCONF_get_section(&ctmp, section);
145 }
146}
147
148char *
149CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
150 const char *name)
151{
152 if (conf == NULL) {
153 return NCONF_get_string(NULL, group, name);
154 } else {
155 CONF ctmp;
156 CONF_set_nconf(&ctmp, conf);
157 return NCONF_get_string(&ctmp, group, name);
158 }
159}
160
161long
162CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
163 const char *name)
164{
165 int status;
166 long result = 0;
167
168 if (conf == NULL) {
169 status = NCONF_get_number_e(NULL, group, name, &result);
170 } else {
171 CONF ctmp;
172 CONF_set_nconf(&ctmp, conf);
173 status = NCONF_get_number_e(&ctmp, group, name, &result);
174 }
175
176 if (status == 0) {
177 /* This function does not believe in errors... */
178 ERR_clear_error();
179 }
180 return result;
181}
182
183void
184CONF_free(LHASH_OF(CONF_VALUE) *conf)
185{
186 CONF ctmp;
187
188 CONF_set_nconf(&ctmp, conf);
189 NCONF_free_data(&ctmp);
190}
191
192int
193CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out)
194{
195 BIO *btmp;
196 int ret;
197
198 if (!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) {
199 CONFerr(CONF_F_CONF_DUMP_FP, ERR_R_BUF_LIB);
200 return 0;
201 }
202 ret = CONF_dump_bio(conf, btmp);
203 BIO_free(btmp);
204 return ret;
205}
206
207int
208CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out)
209{
210 CONF ctmp;
211
212 CONF_set_nconf(&ctmp, conf);
213 return NCONF_dump_bio(&ctmp, out);
214}
215
216/* The following section contains the "New CONF" functions. They are
217 completely centralised around a new CONF structure that may contain
218 basically anything, but at least a method pointer and a table of data.
219 These functions are also written in terms of the bridge functions used
220 by the "CONF classic" functions, for consistency. */
221
222CONF *
223NCONF_new(CONF_METHOD *meth)
224{
225 CONF *ret;
226
227 if (meth == NULL)
228 meth = NCONF_default();
229
230 ret = meth->create(meth);
231 if (ret == NULL) {
232 CONFerr(CONF_F_NCONF_NEW, ERR_R_MALLOC_FAILURE);
233 return (NULL);
234 }
235
236 return ret;
237}
238
239void
240NCONF_free(CONF *conf)
241{
242 if (conf == NULL)
243 return;
244 conf->meth->destroy(conf);
245}
246
247void
248NCONF_free_data(CONF *conf)
249{
250 if (conf == NULL)
251 return;
252 conf->meth->destroy_data(conf);
253}
254
255int
256NCONF_load(CONF *conf, const char *file, long *eline)
257{
258 if (conf == NULL) {
259 CONFerr(CONF_F_NCONF_LOAD, CONF_R_NO_CONF);
260 return 0;
261 }
262
263 return conf->meth->load(conf, file, eline);
264}
265
266int
267NCONF_load_fp(CONF *conf, FILE *fp, long *eline)
268{
269 BIO *btmp;
270 int ret;
271
272 if (!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) {
273 CONFerr(CONF_F_NCONF_LOAD_FP, ERR_R_BUF_LIB);
274 return 0;
275 }
276 ret = NCONF_load_bio(conf, btmp, eline);
277 BIO_free(btmp);
278 return ret;
279}
280
281int
282NCONF_load_bio(CONF *conf, BIO *bp, long *eline)
283{
284 if (conf == NULL) {
285 CONFerr(CONF_F_NCONF_LOAD_BIO, CONF_R_NO_CONF);
286 return 0;
287 }
288
289 return conf->meth->load_bio(conf, bp, eline);
290}
291
292STACK_OF(CONF_VALUE) *
293NCONF_get_section(const CONF *conf, const char *section)
294{
295 if (conf == NULL) {
296 CONFerr(CONF_F_NCONF_GET_SECTION, CONF_R_NO_CONF);
297 return NULL;
298 }
299
300 if (section == NULL) {
301 CONFerr(CONF_F_NCONF_GET_SECTION, CONF_R_NO_SECTION);
302 return NULL;
303 }
304
305 return _CONF_get_section_values(conf, section);
306}
307
308char *
309NCONF_get_string(const CONF *conf, const char *group, const char *name)
310{
311 char *s = _CONF_get_string(conf, group, name);
312
313 /* Since we may get a value from an environment variable even
314 if conf is NULL, let's check the value first */
315 if (s)
316 return s;
317
318 if (conf == NULL) {
319 CONFerr(CONF_F_NCONF_GET_STRING,
320 CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE);
321 return NULL;
322 }
323 CONFerr(CONF_F_NCONF_GET_STRING, CONF_R_NO_VALUE);
324 ERR_asprintf_error_data("group=%s name=%s", group, name);
325 return NULL;
326}
327
328int
329NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
330 long *result)
331{
332 char *str;
333
334 if (result == NULL) {
335 CONFerr(CONF_F_NCONF_GET_NUMBER_E, ERR_R_PASSED_NULL_PARAMETER);
336 return 0;
337 }
338
339 str = NCONF_get_string(conf, group, name);
340
341 if (str == NULL)
342 return 0;
343
344 for (*result = 0; conf->meth->is_number(conf, *str); ) {
345 *result = (*result) * 10 + conf->meth->to_int(conf, *str);
346 str++;
347 }
348
349 return 1;
350}
351
352int
353NCONF_dump_fp(const CONF *conf, FILE *out)
354{
355 BIO *btmp;
356 int ret;
357 if (!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) {
358 CONFerr(CONF_F_NCONF_DUMP_FP, ERR_R_BUF_LIB);
359 return 0;
360 }
361 ret = NCONF_dump_bio(conf, btmp);
362 BIO_free(btmp);
363 return ret;
364}
365
366int
367NCONF_dump_bio(const CONF *conf, BIO *out)
368{
369 if (conf == NULL) {
370 CONFerr(CONF_F_NCONF_DUMP_BIO, CONF_R_NO_CONF);
371 return 0;
372 }
373
374 return conf->meth->dump(conf, out);
375}
diff --git a/src/lib/libcrypto/conf/conf_mall.c b/src/lib/libcrypto/conf/conf_mall.c
deleted file mode 100644
index 18631b3ba8..0000000000
--- a/src/lib/libcrypto/conf/conf_mall.c
+++ /dev/null
@@ -1,82 +0,0 @@
1/* $OpenBSD: conf_mall.c,v 1.9 2014/07/11 08:44:48 jsing Exp $ */
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
61#include <openssl/opensslconf.h>
62
63#include <openssl/asn1.h>
64#include <openssl/conf.h>
65#include <openssl/crypto.h>
66#include <openssl/x509.h>
67
68#ifndef OPENSSL_NO_ENGINE
69#include <openssl/engine.h>
70#endif
71
72/* Load all OpenSSL builtin modules */
73
74void
75OPENSSL_load_builtin_modules(void)
76{
77 /* Add builtin modules here */
78 ASN1_add_oid_module();
79#ifndef OPENSSL_NO_ENGINE
80 ENGINE_add_conf_module();
81#endif
82}
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c
deleted file mode 100644
index 4363f297c7..0000000000
--- a/src/lib/libcrypto/conf/conf_mod.c
+++ /dev/null
@@ -1,603 +0,0 @@
1/* $OpenBSD: conf_mod.c,v 1.25 2014/07/22 02:21:20 beck Exp $ */
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 <ctype.h>
60#include <stdio.h>
61#include <string.h>
62#include <unistd.h>
63
64#include <openssl/conf.h>
65#include <openssl/crypto.h>
66#include <openssl/dso.h>
67#include <openssl/err.h>
68#include <openssl/x509.h>
69
70#define DSO_mod_init_name "OPENSSL_init"
71#define DSO_mod_finish_name "OPENSSL_finish"
72
73/* This structure contains a data about supported modules.
74 * entries in this table correspond to either dynamic or
75 * static modules.
76 */
77
78struct conf_module_st {
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 CONF_MODULE *pmod;
100 char *name;
101 char *value;
102 unsigned long flags;
103 void *usr_data;
104};
105
106static STACK_OF(CONF_MODULE) *supported_modules = NULL;
107static STACK_OF(CONF_IMODULE) *initialized_modules = NULL;
108
109static void module_free(CONF_MODULE *md);
110static void module_finish(CONF_IMODULE *imod);
111static int module_run(const CONF *cnf, char *name, char *value,
112 unsigned long flags);
113static CONF_MODULE *module_add(DSO *dso, const char *name,
114 conf_init_func *ifunc, conf_finish_func *ffunc);
115static CONF_MODULE *module_find(char *name);
116static int module_init(CONF_MODULE *pmod, char *name, char *value,
117 const CONF *cnf);
118static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value,
119 unsigned long flags);
120
121/* Main function: load modules from a CONF structure */
122
123int
124CONF_modules_load(const CONF *cnf, const char *appname, unsigned long flags)
125{
126 STACK_OF(CONF_VALUE) *values;
127 CONF_VALUE *vl;
128 char *vsection = NULL;
129
130 int ret, i;
131
132 if (!cnf)
133 return 1;
134
135 if (appname)
136 vsection = NCONF_get_string(cnf, NULL, appname);
137
138 if (!appname || (!vsection && (flags & CONF_MFLAGS_DEFAULT_SECTION)))
139 vsection = NCONF_get_string(cnf, NULL, "openssl_conf");
140
141 if (!vsection) {
142 ERR_clear_error();
143 return 1;
144 }
145
146 values = NCONF_get_section(cnf, vsection);
147
148 if (!values)
149 return 0;
150
151 for (i = 0; i < sk_CONF_VALUE_num(values); i++) {
152 vl = sk_CONF_VALUE_value(values, i);
153 ret = module_run(cnf, vl->name, vl->value, flags);
154 if (ret <= 0)
155 if (!(flags & CONF_MFLAGS_IGNORE_ERRORS))
156 return ret;
157 }
158
159 return 1;
160}
161
162int
163CONF_modules_load_file(const char *filename, const char *appname,
164 unsigned long flags)
165{
166 char *file = NULL;
167 CONF *conf = NULL;
168 int ret = 0;
169 conf = NCONF_new(NULL);
170 if (!conf)
171 goto err;
172
173 if (filename == NULL) {
174 file = CONF_get1_default_config_file();
175 if (!file)
176 goto err;
177 } else
178 file = (char *)filename;
179
180 if (NCONF_load(conf, file, NULL) <= 0) {
181 if ((flags & CONF_MFLAGS_IGNORE_MISSING_FILE) &&
182 (ERR_GET_REASON(ERR_peek_last_error()) ==
183 CONF_R_NO_SUCH_FILE)) {
184 ERR_clear_error();
185 ret = 1;
186 }
187 goto err;
188 }
189
190 ret = CONF_modules_load(conf, appname, flags);
191
192err:
193 if (filename == NULL)
194 free(file);
195 NCONF_free(conf);
196
197 return ret;
198}
199
200static int
201module_run(const CONF *cnf, char *name, char *value, unsigned long flags)
202{
203 CONF_MODULE *md;
204 int ret;
205
206 md = module_find(name);
207
208 /* Module not found: try to load DSO */
209 if (!md && !(flags & CONF_MFLAGS_NO_DSO))
210 md = module_load_dso(cnf, name, value, flags);
211
212 if (!md) {
213 if (!(flags & CONF_MFLAGS_SILENT)) {
214 CONFerr(CONF_F_MODULE_RUN, CONF_R_UNKNOWN_MODULE_NAME);
215 ERR_asprintf_error_data("module=%s", name);
216 }
217 return -1;
218 }
219
220 ret = module_init(md, name, value, cnf);
221
222 if (ret <= 0) {
223 if (!(flags & CONF_MFLAGS_SILENT)) {
224 CONFerr(CONF_F_MODULE_RUN,
225 CONF_R_MODULE_INITIALIZATION_ERROR);
226 ERR_asprintf_error_data
227 ("module=%s, value=%s, retcode=%-8d",
228 name, value, ret);
229 }
230 }
231
232 return ret;
233}
234
235/* Load a module from a DSO */
236static CONF_MODULE *
237module_load_dso(const CONF *cnf, char *name, char *value, unsigned long flags)
238{
239 DSO *dso = NULL;
240 conf_init_func *ifunc;
241 conf_finish_func *ffunc;
242 char *path = NULL;
243 int errcode = 0;
244 CONF_MODULE *md;
245
246 /* Look for alternative path in module section */
247 path = NCONF_get_string(cnf, value, "path");
248 if (!path) {
249 ERR_clear_error();
250 path = name;
251 }
252 dso = DSO_load(NULL, path, NULL, 0);
253 if (!dso) {
254 errcode = CONF_R_ERROR_LOADING_DSO;
255 goto err;
256 }
257 ifunc = (conf_init_func *)DSO_bind_func(dso, DSO_mod_init_name);
258 if (!ifunc) {
259 errcode = CONF_R_MISSING_INIT_FUNCTION;
260 goto err;
261 }
262 ffunc = (conf_finish_func *)DSO_bind_func(dso, DSO_mod_finish_name);
263 /* All OK, add module */
264 md = module_add(dso, name, ifunc, ffunc);
265
266 if (!md)
267 goto err;
268
269 return md;
270
271err:
272 if (dso)
273 DSO_free(dso);
274 CONFerr(CONF_F_MODULE_LOAD_DSO, errcode);
275 ERR_asprintf_error_data("module=%s, path=%s", name, path);
276 return NULL;
277}
278
279/* add module to list */
280static CONF_MODULE *
281module_add(DSO *dso, const char *name, conf_init_func *ifunc,
282 conf_finish_func *ffunc)
283{
284 CONF_MODULE *tmod = NULL;
285
286 if (name == NULL)
287 return NULL;
288 if (supported_modules == NULL)
289 supported_modules = sk_CONF_MODULE_new_null();
290 if (supported_modules == NULL)
291 return NULL;
292 tmod = malloc(sizeof(CONF_MODULE));
293 if (tmod == NULL)
294 return NULL;
295
296 tmod->dso = dso;
297 tmod->name = strdup(name);
298 tmod->init = ifunc;
299 tmod->finish = ffunc;
300 tmod->links = 0;
301
302 if (!sk_CONF_MODULE_push(supported_modules, tmod)) {
303 free(tmod);
304 return NULL;
305 }
306
307 return tmod;
308}
309
310/* Find a module from the list. We allow module names of the
311 * form modname.XXXX to just search for modname to allow the
312 * same module to be initialized more than once.
313 */
314
315static CONF_MODULE *
316module_find(char *name)
317{
318 CONF_MODULE *tmod;
319 int i, nchar;
320 char *p;
321
322 p = strrchr(name, '.');
323
324 if (p)
325 nchar = p - name;
326 else
327 nchar = strlen(name);
328
329 for (i = 0; i < sk_CONF_MODULE_num(supported_modules); i++) {
330 tmod = sk_CONF_MODULE_value(supported_modules, i);
331 if (!strncmp(tmod->name, name, nchar))
332 return tmod;
333 }
334
335 return NULL;
336}
337
338/* initialize a module */
339static int
340module_init(CONF_MODULE *pmod, char *name, char *value, const CONF *cnf)
341{
342 int ret = 1;
343 int init_called = 0;
344 CONF_IMODULE *imod = NULL;
345
346 /* Otherwise add initialized module to list */
347 imod = malloc(sizeof(CONF_IMODULE));
348 if (!imod)
349 goto err;
350
351 imod->pmod = pmod;
352 imod->name = name ? strdup(name) : NULL;
353 imod->value = value ? strdup(value) : NULL;
354 imod->usr_data = NULL;
355
356 if (!imod->name || !imod->value)
357 goto memerr;
358
359 /* Try to initialize module */
360 if (pmod->init) {
361 ret = pmod->init(imod, cnf);
362 init_called = 1;
363 /* Error occurred, exit */
364 if (ret <= 0)
365 goto err;
366 }
367
368 if (initialized_modules == NULL) {
369 initialized_modules = sk_CONF_IMODULE_new_null();
370 if (!initialized_modules) {
371 CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE);
372 goto err;
373 }
374 }
375
376 if (!sk_CONF_IMODULE_push(initialized_modules, imod)) {
377 CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE);
378 goto err;
379 }
380
381 pmod->links++;
382
383 return ret;
384
385err:
386 /* We've started the module so we'd better finish it */
387 if (pmod->finish && init_called)
388 pmod->finish(imod);
389
390memerr:
391 if (imod) {
392 free(imod->name);
393 free(imod->value);
394 free(imod);
395 }
396
397 return -1;
398}
399
400/* Unload any dynamic modules that have a link count of zero:
401 * i.e. have no active initialized modules. If 'all' is set
402 * then all modules are unloaded including static ones.
403 */
404
405void
406CONF_modules_unload(int all)
407{
408 int i;
409 CONF_MODULE *md;
410
411 CONF_modules_finish();
412
413 /* unload modules in reverse order */
414 for (i = sk_CONF_MODULE_num(supported_modules) - 1; i >= 0; i--) {
415 md = sk_CONF_MODULE_value(supported_modules, i);
416 /* If static or in use and 'all' not set ignore it */
417 if (((md->links > 0) || !md->dso) && !all)
418 continue;
419 /* Since we're working in reverse this is OK */
420 (void)sk_CONF_MODULE_delete(supported_modules, i);
421 module_free(md);
422 }
423 if (sk_CONF_MODULE_num(supported_modules) == 0) {
424 sk_CONF_MODULE_free(supported_modules);
425 supported_modules = NULL;
426 }
427}
428
429/* unload a single module */
430static void
431module_free(CONF_MODULE *md)
432{
433 if (md->dso)
434 DSO_free(md->dso);
435 free(md->name);
436 free(md);
437}
438
439/* finish and free up all modules instances */
440
441void
442CONF_modules_finish(void)
443{
444 CONF_IMODULE *imod;
445
446 while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
447 imod = sk_CONF_IMODULE_pop(initialized_modules);
448 module_finish(imod);
449 }
450 sk_CONF_IMODULE_free(initialized_modules);
451 initialized_modules = NULL;
452}
453
454/* finish a module instance */
455
456static void
457module_finish(CONF_IMODULE *imod)
458{
459 if (imod->pmod->finish)
460 imod->pmod->finish(imod);
461 imod->pmod->links--;
462 free(imod->name);
463 free(imod->value);
464 free(imod);
465}
466
467/* Add a static module to OpenSSL */
468
469int
470CONF_module_add(const char *name, conf_init_func *ifunc,
471 conf_finish_func *ffunc)
472{
473 if (module_add(NULL, name, ifunc, ffunc))
474 return 1;
475 else
476 return 0;
477}
478
479void
480CONF_modules_free(void)
481{
482 CONF_modules_finish();
483 CONF_modules_unload(1);
484}
485
486/* Utility functions */
487
488const char *
489CONF_imodule_get_name(const CONF_IMODULE *md)
490{
491 return md->name;
492}
493
494const char *
495CONF_imodule_get_value(const CONF_IMODULE *md)
496{
497 return md->value;
498}
499
500void *
501CONF_imodule_get_usr_data(const CONF_IMODULE *md)
502{
503 return md->usr_data;
504}
505
506void
507CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data)
508{
509 md->usr_data = usr_data;
510}
511
512CONF_MODULE *
513CONF_imodule_get_module(const CONF_IMODULE *md)
514{
515 return md->pmod;
516}
517
518unsigned long
519CONF_imodule_get_flags(const CONF_IMODULE *md)
520{
521 return md->flags;
522}
523
524void
525CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags)
526{
527 md->flags = flags;
528}
529
530void *
531CONF_module_get_usr_data(CONF_MODULE *pmod)
532{
533 return pmod->usr_data;
534}
535
536void
537CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data)
538{
539 pmod->usr_data = usr_data;
540}
541
542/* Return default config file name */
543
544char *
545CONF_get1_default_config_file(void)
546{
547 char *file = NULL;
548
549 if (issetugid() == 0)
550 file = getenv("OPENSSL_CONF");
551 if (file)
552 return strdup(file);
553 if (asprintf(&file, "%s/openssl.cnf",
554 X509_get_default_cert_area()) == -1)
555 return (NULL);
556 return file;
557}
558
559/* This function takes a list separated by 'sep' and calls the
560 * callback function giving the start and length of each member
561 * optionally stripping leading and trailing whitespace. This can
562 * be used to parse comma separated lists for example.
563 */
564
565int
566CONF_parse_list(const char *list_, int sep, int nospc,
567 int (*list_cb)(const char *elem, int len, void *usr), void *arg)
568{
569 int ret;
570 const char *lstart, *tmpend, *p;
571
572 if (list_ == NULL) {
573 CONFerr(CONF_F_CONF_PARSE_LIST, CONF_R_LIST_CANNOT_BE_NULL);
574 return 0;
575 }
576
577 lstart = list_;
578 for (;;) {
579 if (nospc) {
580 while (*lstart && isspace((unsigned char)*lstart))
581 lstart++;
582 }
583 p = strchr(lstart, sep);
584 if (p == lstart || !*lstart)
585 ret = list_cb(NULL, 0, arg);
586 else {
587 if (p)
588 tmpend = p - 1;
589 else
590 tmpend = lstart + strlen(lstart) - 1;
591 if (nospc) {
592 while (isspace((unsigned char)*tmpend))
593 tmpend--;
594 }
595 ret = list_cb(lstart, tmpend - lstart + 1, arg);
596 }
597 if (ret <= 0)
598 return ret;
599 if (p == NULL)
600 return 1;
601 lstart = p + 1;
602 }
603}
diff --git a/src/lib/libcrypto/conf/conf_sap.c b/src/lib/libcrypto/conf/conf_sap.c
deleted file mode 100644
index a29acea7c1..0000000000
--- a/src/lib/libcrypto/conf/conf_sap.c
+++ /dev/null
@@ -1,113 +0,0 @@
1/* $OpenBSD: conf_sap.c,v 1.11 2015/02/11 03:19:37 doug Exp $ */
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
61#include <openssl/opensslconf.h>
62
63#include <openssl/asn1.h>
64#include <openssl/conf.h>
65#include <openssl/crypto.h>
66#include <openssl/err.h>
67#include <openssl/x509.h>
68
69#ifndef OPENSSL_NO_ENGINE
70#include <openssl/engine.h>
71#endif
72
73/* This is the automatic configuration loader: it is called automatically by
74 * OpenSSL when any of a number of standard initialisation functions are called,
75 * unless this is overridden by calling OPENSSL_no_config()
76 */
77
78static int openssl_configured = 0;
79
80void
81OPENSSL_config(const char *config_name)
82{
83 if (openssl_configured)
84 return;
85
86 OPENSSL_load_builtin_modules();
87#ifndef OPENSSL_NO_ENGINE
88 /* Need to load ENGINEs */
89 ENGINE_load_builtin_engines();
90#endif
91 /* Add others here? */
92
93 ERR_clear_error();
94 if (CONF_modules_load_file(NULL, config_name,
95 CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {
96 BIO *bio_err;
97 ERR_load_crypto_strings();
98 if ((bio_err = BIO_new_fp(stderr, BIO_NOCLOSE)) != NULL) {
99 BIO_printf(bio_err, "Auto configuration failed\n");
100 ERR_print_errors(bio_err);
101 BIO_free(bio_err);
102 }
103 exit(1);
104 }
105
106 return;
107}
108
109void
110OPENSSL_no_config(void)
111{
112 openssl_configured = 1;
113}
diff --git a/src/lib/libcrypto/conf/keysets.pl b/src/lib/libcrypto/conf/keysets.pl
deleted file mode 100644
index fe17be57fe..0000000000
--- a/src/lib/libcrypto/conf/keysets.pl
+++ /dev/null
@@ -1,169 +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#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
136#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
137#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
138#define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
139#define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
140#define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS)
141#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
142#define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
143 (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
144#define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
145#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
146#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
147
148
149EOF
150
151print "static unsigned short CONF_type_default[256]={";
152
153for ($i=0; $i<256; $i++)
154 {
155 print "\n\t" if ($i % 8) == 0;
156 printf "0x%04X,",$V_def[$i];
157 }
158
159print "\n\t};\n\n";
160
161print "static unsigned short CONF_type_win32[256]={";
162
163for ($i=0; $i<256; $i++)
164 {
165 print "\n\t" if ($i % 8) == 0;
166 printf "0x%04X,",$V_w32[$i];
167 }
168
169print "\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