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.h189
-rw-r--r--src/lib/libcrypto/conf/conf_api.c261
-rw-r--r--src/lib/libcrypto/conf/conf_def.c657
-rw-r--r--src/lib/libcrypto/conf/conf_def.h133
-rw-r--r--src/lib/libcrypto/conf/conf_err.c108
-rw-r--r--src/lib/libcrypto/conf/conf_lib.c197
-rw-r--r--src/lib/libcrypto/conf/conf_local.h101
-rw-r--r--src/lib/libcrypto/conf/conf_mod.c480
-rw-r--r--src/lib/libcrypto/conf/conf_sap.c151
-rw-r--r--src/lib/libcrypto/conf/keysets.pl169
-rw-r--r--src/lib/libcrypto/conf/ssleay.cnf78
12 files changed, 0 insertions, 2597 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 58a90358b1..0000000000
--- a/src/lib/libcrypto/conf/conf.h
+++ /dev/null
@@ -1,189 +0,0 @@
1/* $OpenBSD: conf.h,v 1.28 2025/03/01 10:11:19 tb 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
88/* Module definitions */
89
90typedef struct conf_imodule_st CONF_IMODULE;
91typedef struct conf_module_st CONF_MODULE;
92
93DECLARE_STACK_OF(CONF_MODULE)
94DECLARE_STACK_OF(CONF_IMODULE)
95
96/* DSO module function typedefs */
97typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);
98typedef void conf_finish_func(CONF_IMODULE *md);
99
100#define CONF_MFLAGS_IGNORE_ERRORS 0x1
101#define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
102#define CONF_MFLAGS_SILENT 0x4
103#define CONF_MFLAGS_NO_DSO 0x8
104#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
105#define CONF_MFLAGS_DEFAULT_SECTION 0x20
106
107void OPENSSL_config(const char *config_name);
108void OPENSSL_no_config(void);
109
110struct conf_st {
111 const CONF_METHOD *meth;
112 LHASH_OF(CONF_VALUE) *data;
113};
114
115CONF *NCONF_new(const CONF_METHOD *meth);
116void NCONF_free(CONF *conf);
117
118int NCONF_load(CONF *conf, const char *file, long *eline);
119int NCONF_load_bio(CONF *conf, BIO *bp, long *eline);
120STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section);
121char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
122int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
123 long *result);
124
125#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
126
127/* Module functions */
128
129int CONF_modules_load(const CONF *cnf, const char *appname,
130 unsigned long flags);
131int CONF_modules_load_file(const char *filename, const char *appname,
132 unsigned long flags);
133void CONF_modules_unload(int all);
134void CONF_modules_finish(void);
135void CONF_modules_free(void);
136
137char *CONF_get1_default_config_file(void);
138
139void ERR_load_CONF_strings(void);
140
141/* Error codes for the CONF functions. */
142
143/* Function codes. */
144#define CONF_F_CONF_DUMP_FP 104
145#define CONF_F_CONF_LOAD 100
146#define CONF_F_CONF_LOAD_BIO 102
147#define CONF_F_CONF_LOAD_FP 103
148#define CONF_F_CONF_MODULES_LOAD 116
149#define CONF_F_CONF_PARSE_LIST 119
150#define CONF_F_DEF_LOAD 120
151#define CONF_F_DEF_LOAD_BIO 121
152#define CONF_F_MODULE_INIT 115
153#define CONF_F_MODULE_LOAD_DSO 117
154#define CONF_F_MODULE_RUN 118
155#define CONF_F_NCONF_DUMP_BIO 105
156#define CONF_F_NCONF_DUMP_FP 106
157#define CONF_F_NCONF_GET_NUMBER 107
158#define CONF_F_NCONF_GET_NUMBER_E 112
159#define CONF_F_NCONF_GET_SECTION 108
160#define CONF_F_NCONF_GET_STRING 109
161#define CONF_F_NCONF_LOAD 113
162#define CONF_F_NCONF_LOAD_BIO 110
163#define CONF_F_NCONF_LOAD_FP 114
164#define CONF_F_NCONF_NEW 111
165#define CONF_F_STR_COPY 101
166
167/* Reason codes. */
168#define CONF_R_ERROR_LOADING_DSO 110
169#define CONF_R_LIST_CANNOT_BE_NULL 115
170#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
171#define CONF_R_MISSING_EQUAL_SIGN 101
172#define CONF_R_MISSING_FINISH_FUNCTION 111
173#define CONF_R_MISSING_INIT_FUNCTION 112
174#define CONF_R_MODULE_INITIALIZATION_ERROR 109
175#define CONF_R_NO_CLOSE_BRACE 102
176#define CONF_R_NO_CONF 105
177#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
178#define CONF_R_NO_SECTION 107
179#define CONF_R_NO_SUCH_FILE 114
180#define CONF_R_NO_VALUE 108
181#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
182#define CONF_R_UNKNOWN_MODULE_NAME 113
183#define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116
184#define CONF_R_VARIABLE_HAS_NO_VALUE 104
185
186#ifdef __cplusplus
187}
188#endif
189#endif
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c
deleted file mode 100644
index f986243b65..0000000000
--- a/src/lib/libcrypto/conf/conf_api.c
+++ /dev/null
@@ -1,261 +0,0 @@
1/* $OpenBSD: conf_api.c,v 1.26 2025/03/08 09:35:53 tb 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
71#include "conf_local.h"
72
73static void value_free_hash_doall_arg(CONF_VALUE *a,
74 LHASH_OF(CONF_VALUE) *conf);
75static void value_free_stack_doall(CONF_VALUE *a);
76static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE,
77 LHASH_OF(CONF_VALUE))
78static IMPLEMENT_LHASH_DOALL_FN(value_free_stack, CONF_VALUE)
79
80/* Up until OpenSSL 0.9.5a, this was get_section */
81CONF_VALUE *
82_CONF_get_section(const CONF *conf, const char *section)
83{
84 CONF_VALUE *v, vv;
85
86 if ((conf == NULL) || (section == NULL))
87 return (NULL);
88 vv.name = NULL;
89 vv.section = (char *)section;
90 v = lh_CONF_VALUE_retrieve(conf->data, &vv);
91 return (v);
92}
93
94int
95_CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)
96{
97 CONF_VALUE *v = NULL;
98 STACK_OF(CONF_VALUE) *ts;
99
100 ts = (STACK_OF(CONF_VALUE) *)section->value;
101
102 value->section = section->section;
103 if (!sk_CONF_VALUE_push(ts, value)) {
104 return 0;
105 }
106
107 v = lh_CONF_VALUE_insert(conf->data, value);
108 if (v != NULL) {
109 (void)sk_CONF_VALUE_delete_ptr(ts, v);
110 free(v->name);
111 free(v->value);
112 free(v);
113 }
114 return 1;
115}
116
117char *
118_CONF_get_string(const CONF *conf, const char *section, const char *name)
119{
120 CONF_VALUE *v, vv;
121
122 if (name == NULL)
123 return (NULL);
124 if (conf != NULL) {
125 if (section != NULL) {
126 vv.name = (char *)name;
127 vv.section = (char *)section;
128 v = lh_CONF_VALUE_retrieve(conf->data, &vv);
129 if (v != NULL)
130 return (v->value);
131 }
132 vv.section = "default";
133 vv.name = (char *)name;
134 v = lh_CONF_VALUE_retrieve(conf->data, &vv);
135 if (v != NULL)
136 return (v->value);
137 else
138 return (NULL);
139 } else
140 return (NULL);
141}
142
143static unsigned long
144conf_value_hash(const CONF_VALUE *v)
145{
146 return (lh_strhash(v->section) << 2) ^ lh_strhash(v->name);
147}
148
149static IMPLEMENT_LHASH_HASH_FN(conf_value, CONF_VALUE)
150
151static int
152conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b)
153{
154 int i;
155
156 if (a->section != b->section) {
157 i = strcmp(a->section, b->section);
158 if (i)
159 return (i);
160 }
161 if ((a->name != NULL) && (b->name != NULL)) {
162 i = strcmp(a->name, b->name);
163 return (i);
164 } else if (a->name == b->name)
165 return (0);
166 else
167 return ((a->name == NULL)?-1 : 1);
168}
169
170static IMPLEMENT_LHASH_COMP_FN(conf_value, CONF_VALUE)
171
172int
173_CONF_new_data(CONF *conf)
174{
175 if (conf == NULL) {
176 return 0;
177 }
178 if (conf->data == NULL)
179 if ((conf->data = lh_CONF_VALUE_new()) == NULL) {
180 return 0;
181 }
182 return 1;
183}
184
185void
186_CONF_free_data(CONF *conf)
187{
188 if (conf == NULL || conf->data == NULL)
189 return;
190
191 lh_CONF_VALUE_doall_arg(conf->data,
192 LHASH_DOALL_ARG_FN(value_free_hash),
193 LHASH_OF(CONF_VALUE), conf->data);
194
195 /* We now have only 'section' entries in the hash table.
196 * Due to problems with */
197
198 lh_CONF_VALUE_doall(conf->data, LHASH_DOALL_FN(value_free_stack));
199 lh_CONF_VALUE_free(conf->data);
200}
201
202static void
203value_free_hash_doall_arg(CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf)
204{
205 if (a->name != NULL)
206 (void)lh_CONF_VALUE_delete(conf, a);
207}
208
209static void
210value_free_stack_doall(CONF_VALUE *a)
211{
212 CONF_VALUE *vv;
213 STACK_OF(CONF_VALUE) *sk;
214 int i;
215
216 if (a->name != NULL)
217 return;
218
219 sk = (STACK_OF(CONF_VALUE) *)a->value;
220 for (i = sk_CONF_VALUE_num(sk) - 1; i >= 0; i--) {
221 vv = sk_CONF_VALUE_value(sk, i);
222 free(vv->value);
223 free(vv->name);
224 free(vv);
225 }
226 if (sk != NULL)
227 sk_CONF_VALUE_free(sk);
228 free(a->section);
229 free(a);
230}
231
232/* Up until OpenSSL 0.9.5a, this was new_section */
233CONF_VALUE *
234_CONF_new_section(CONF *conf, const char *section)
235{
236 STACK_OF(CONF_VALUE) *sk = NULL;
237 CONF_VALUE *v = NULL, *vv;
238
239 if ((sk = sk_CONF_VALUE_new_null()) == NULL)
240 goto err;
241 if ((v = calloc(1, sizeof(*v))) == NULL)
242 goto err;
243 if ((v->section = strdup(section)) == NULL)
244 goto err;
245 v->value = (char *)sk;
246
247 vv = lh_CONF_VALUE_insert(conf->data, v);
248 OPENSSL_assert(vv == NULL);
249 if (lh_CONF_VALUE_error(conf->data))
250 goto err;
251
252 return v;
253
254 err:
255 sk_CONF_VALUE_free(sk);
256 if (v != NULL)
257 free(v->section);
258 free(v);
259
260 return NULL;
261}
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c
deleted file mode 100644
index 0173a7117c..0000000000
--- a/src/lib/libcrypto/conf/conf_def.c
+++ /dev/null
@@ -1,657 +0,0 @@
1/* $OpenBSD: conf_def.c,v 1.44 2024/08/31 09:46:17 tb 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/err.h>
67#include <openssl/lhash.h>
68#include <openssl/stack.h>
69
70#include "conf_def.h"
71#include "conf_local.h"
72
73#define MAX_CONF_VALUE_LENGTH 65536
74
75static char *eat_ws(CONF *conf, char *p);
76static char *eat_alpha_numeric(CONF *conf, char *p);
77static void clear_comments(CONF *conf, char *p);
78static int str_copy(CONF *conf, char *section, char **to, char *from);
79static char *scan_quote(CONF *conf, char *p);
80static char *scan_dquote(CONF *conf, char *p);
81#define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2)))
82
83static CONF *
84def_create(const CONF_METHOD *meth)
85{
86 CONF *ret;
87
88 ret = calloc(1, sizeof(CONF) + sizeof(unsigned short *));
89 if (ret)
90 if (meth->init(ret) == 0) {
91 free(ret);
92 ret = NULL;
93 }
94 return ret;
95}
96
97static int
98def_init_default(CONF *conf)
99{
100 if (conf == NULL)
101 return 0;
102
103 conf->meth = NCONF_default();
104 conf->data = NULL;
105
106 return 1;
107}
108
109static int
110def_destroy_data(CONF *conf)
111{
112 if (conf == NULL)
113 return 0;
114 _CONF_free_data(conf);
115 return 1;
116}
117
118static int
119def_destroy(CONF *conf)
120{
121 if (def_destroy_data(conf)) {
122 free(conf);
123 return 1;
124 }
125 return 0;
126}
127
128static int
129def_load_bio(CONF *conf, BIO *in, long *line)
130{
131/* The macro BUFSIZE conflicts with a system macro in VxWorks */
132#define CONFBUFSIZE 512
133 int bufnum = 0, i, ii;
134 BUF_MEM *buff = NULL;
135 char *s, *p, *end;
136 int again;
137 long eline = 0;
138 CONF_VALUE *v = NULL, *tv;
139 CONF_VALUE *sv = NULL;
140 char *section = NULL, *buf;
141 char *start, *psection, *pname;
142 void *h = (void *)(conf->data);
143
144 if ((buff = BUF_MEM_new()) == NULL) {
145 CONFerror(ERR_R_BUF_LIB);
146 goto err;
147 }
148
149 section = strdup("default");
150 if (section == NULL) {
151 CONFerror(ERR_R_MALLOC_FAILURE);
152 goto err;
153 }
154
155 if (_CONF_new_data(conf) == 0) {
156 CONFerror(ERR_R_MALLOC_FAILURE);
157 goto err;
158 }
159
160 sv = _CONF_new_section(conf, section);
161 if (sv == NULL) {
162 CONFerror(CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
163 goto err;
164 }
165
166 bufnum = 0;
167 again = 0;
168 for (;;) {
169 if (!BUF_MEM_grow(buff, bufnum + CONFBUFSIZE)) {
170 CONFerror(ERR_R_BUF_LIB);
171 goto err;
172 }
173 p = &(buff->data[bufnum]);
174 *p = '\0';
175 BIO_gets(in, p, CONFBUFSIZE - 1);
176 p[CONFBUFSIZE - 1] = '\0';
177 ii = i = strlen(p);
178 if (i == 0 && !again)
179 break;
180 again = 0;
181 while (i > 0) {
182 if ((p[i - 1] != '\r') && (p[i - 1] != '\n'))
183 break;
184 else
185 i--;
186 }
187 /* we removed some trailing stuff so there is a new
188 * line on the end. */
189 if (ii && i == ii)
190 again = 1; /* long line */
191 else {
192 p[i] = '\0';
193 eline++; /* another input line */
194 }
195
196 /* we now have a line with trailing \r\n removed */
197
198 /* i is the number of bytes */
199 bufnum += i;
200
201 v = NULL;
202 /* check for line continuation */
203 if (bufnum >= 1) {
204 /* If we have bytes and the last char '\\' and
205 * second last char is not '\\' */
206 p = &(buff->data[bufnum - 1]);
207 if (IS_ESC(conf, p[0]) &&
208 ((bufnum <= 1) || !IS_ESC(conf, p[-1]))) {
209 bufnum--;
210 again = 1;
211 }
212 }
213 if (again)
214 continue;
215 bufnum = 0;
216 buf = buff->data;
217
218 clear_comments(conf, buf);
219 s = eat_ws(conf, buf);
220 if (IS_EOF(conf, *s))
221 continue; /* blank line */
222 if (*s == '[') {
223 char *ss;
224
225 s++;
226 start = eat_ws(conf, s);
227 ss = start;
228again:
229 end = eat_alpha_numeric(conf, ss);
230 p = eat_ws(conf, end);
231 if (*p != ']') {
232 if (*p != '\0' && ss != p) {
233 ss = p;
234 goto again;
235 }
236 CONFerror(CONF_R_MISSING_CLOSE_SQUARE_BRACKET);
237 goto err;
238 }
239 *end = '\0';
240 if (!str_copy(conf, NULL, &section, start))
241 goto err;
242 if ((sv = _CONF_get_section(conf, section)) == NULL)
243 sv = _CONF_new_section(conf, section);
244 if (sv == NULL) {
245 CONFerror(CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
246 goto err;
247 }
248 continue;
249 } else {
250 pname = s;
251 psection = NULL;
252 end = eat_alpha_numeric(conf, s);
253 if ((end[0] == ':') && (end[1] == ':')) {
254 *end = '\0';
255 end += 2;
256 psection = pname;
257 pname = end;
258 end = eat_alpha_numeric(conf, end);
259 }
260 p = eat_ws(conf, end);
261 if (*p != '=') {
262 CONFerror(CONF_R_MISSING_EQUAL_SIGN);
263 goto err;
264 }
265 *end = '\0';
266 p++;
267 start = eat_ws(conf, p);
268 while (!IS_EOF(conf, *p))
269 p++;
270 p--;
271 while ((p != start) && (IS_WS(conf, *p)))
272 p--;
273 p++;
274 *p = '\0';
275
276 if (!(v = malloc(sizeof(CONF_VALUE)))) {
277 CONFerror(ERR_R_MALLOC_FAILURE);
278 goto err;
279 }
280 if (psection == NULL)
281 psection = section;
282 v->name = strdup(pname);
283 v->value = NULL;
284 if (v->name == NULL) {
285 CONFerror(ERR_R_MALLOC_FAILURE);
286 goto err;
287 }
288 if (!str_copy(conf, psection, &(v->value), start))
289 goto err;
290
291 if (strcmp(psection, section) != 0) {
292 if ((tv = _CONF_get_section(conf, psection))
293 == NULL)
294 tv = _CONF_new_section(conf, psection);
295 if (tv == NULL) {
296 CONFerror(CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
297 goto err;
298 }
299 } else
300 tv = sv;
301
302 if (_CONF_add_string(conf, tv, v) == 0) {
303 CONFerror(ERR_R_MALLOC_FAILURE);
304 goto err;
305 }
306 v = NULL;
307 }
308 }
309 if (buff != NULL)
310 BUF_MEM_free(buff);
311 free(section);
312 return (1);
313
314err:
315 if (buff != NULL)
316 BUF_MEM_free(buff);
317 free(section);
318 if (line != NULL)
319 *line = eline;
320 ERR_asprintf_error_data("line %ld", eline);
321 if ((h != conf->data) && (conf->data != NULL)) {
322 CONF ctmp;
323
324 CONF_set_nconf(&ctmp, conf->data);
325 ctmp.meth->destroy_data(&ctmp);
326 conf->data = NULL;
327 }
328 if (v != NULL) {
329 free(v->name);
330 free(v->value);
331 free(v);
332 }
333 return (0);
334}
335
336static int
337def_load(CONF *conf, const char *name, long *line)
338{
339 int ret;
340 BIO *in = NULL;
341
342 in = BIO_new_file(name, "rb");
343 if (in == NULL) {
344 if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE)
345 CONFerror(CONF_R_NO_SUCH_FILE);
346 else
347 CONFerror(ERR_R_SYS_LIB);
348 return 0;
349 }
350
351 ret = def_load_bio(conf, in, line);
352 BIO_free(in);
353
354 return ret;
355}
356
357static void
358clear_comments(CONF *conf, char *p)
359{
360 for (;;) {
361 if (IS_FCOMMENT(conf, *p)) {
362 *p = '\0';
363 return;
364 }
365 if (!IS_WS(conf, *p)) {
366 break;
367 }
368 p++;
369 }
370
371 for (;;) {
372 if (IS_COMMENT(conf, *p)) {
373 *p = '\0';
374 return;
375 }
376 if (IS_DQUOTE(conf, *p)) {
377 p = scan_dquote(conf, p);
378 continue;
379 }
380 if (IS_QUOTE(conf, *p)) {
381 p = scan_quote(conf, p);
382 continue;
383 }
384 if (IS_ESC(conf, *p)) {
385 p = scan_esc(conf, p);
386 continue;
387 }
388 if (IS_EOF(conf, *p))
389 return;
390 else
391 p++;
392 }
393}
394
395static int
396str_copy(CONF *conf, char *section, char **pto, char *from)
397{
398 int q, r,rr = 0, to = 0, len = 0;
399 char *s, *e, *rp, *p, *rrp, *np, *cp, v;
400 size_t newsize;
401 BUF_MEM *buf;
402
403 if ((buf = BUF_MEM_new()) == NULL)
404 return (0);
405
406 len = strlen(from) + 1;
407 if (!BUF_MEM_grow(buf, len))
408 goto err;
409
410 for (;;) {
411 if (IS_QUOTE(conf, *from)) {
412 q = *from;
413 from++;
414 while (!IS_EOF(conf, *from) && (*from != q)) {
415 if (IS_ESC(conf, *from)) {
416 from++;
417 if (IS_EOF(conf, *from))
418 break;
419 }
420 buf->data[to++] = *(from++);
421 }
422 if (*from == q)
423 from++;
424 } else if (IS_DQUOTE(conf, *from)) {
425 q = *from;
426 from++;
427 while (!IS_EOF(conf, *from)) {
428 if (*from == q) {
429 if (*(from + 1) == q) {
430 from++;
431 } else {
432 break;
433 }
434 }
435 buf->data[to++] = *(from++);
436 }
437 if (*from == q)
438 from++;
439 } else if (IS_ESC(conf, *from)) {
440 from++;
441 v = *(from++);
442 if (IS_EOF(conf, v))
443 break;
444 else if (v == 'r')
445 v = '\r';
446 else if (v == 'n')
447 v = '\n';
448 else if (v == 'b')
449 v = '\b';
450 else if (v == 't')
451 v = '\t';
452 buf->data[to++] = v;
453 } else if (IS_EOF(conf, *from))
454 break;
455 else if (*from == '$') {
456 /* try to expand it */
457 rrp = NULL;
458 s = &(from[1]);
459 if (*s == '{')
460 q = '}';
461 else if (*s == '(')
462 q = ')';
463 else
464 q = 0;
465
466 if (q)
467 s++;
468 cp = section;
469 e = np = s;
470 while (IS_ALPHA_NUMERIC(conf, *e))
471 e++;
472 if ((e[0] == ':') && (e[1] == ':')) {
473 cp = np;
474 rrp = e;
475 rr = *e;
476 *rrp = '\0';
477 e += 2;
478 np = e;
479 while (IS_ALPHA_NUMERIC(conf, *e))
480 e++;
481 }
482 r = *e;
483 *e = '\0';
484 rp = e;
485 if (q) {
486 if (r != q) {
487 CONFerror(CONF_R_NO_CLOSE_BRACE);
488 goto err;
489 }
490 e++;
491 }
492 /* So at this point we have
493 * np which is the start of the name string which is
494 * '\0' terminated.
495 * cp which is the start of the section string which is
496 * '\0' terminated.
497 * e is the 'next point after'.
498 * r and rr are the chars replaced by the '\0'
499 * rp and rrp is where 'r' and 'rr' came from.
500 */
501 p = _CONF_get_string(conf, cp, np);
502 if (rrp != NULL)
503 *rrp = rr;
504 *rp = r;
505 if (p == NULL) {
506 CONFerror(CONF_R_VARIABLE_HAS_NO_VALUE);
507 goto err;
508 }
509 newsize = strlen(p) + buf->length - (e - from);
510 if (newsize > MAX_CONF_VALUE_LENGTH) {
511 CONFerror(CONF_R_VARIABLE_EXPANSION_TOO_LONG);
512 goto err;
513 }
514 if (!BUF_MEM_grow_clean(buf, newsize)) {
515 CONFerror(CONF_R_MODULE_INITIALIZATION_ERROR);
516 goto err;
517 }
518 while (*p)
519 buf->data[to++] = *(p++);
520
521 /* Since we change the pointer 'from', we also have
522 to change the perceived length of the string it
523 points at. /RL */
524 len -= e - from;
525 from = e;
526
527 /* In case there were no braces or parenthesis around
528 the variable reference, we have to put back the
529 character that was replaced with a '\0'. /RL */
530 *rp = r;
531 } else
532 buf->data[to++] = *(from++);
533 }
534 buf->data[to]='\0';
535 free(*pto);
536 *pto = buf->data;
537 free(buf);
538 return (1);
539
540err:
541 if (buf != NULL)
542 BUF_MEM_free(buf);
543 return (0);
544}
545
546static char *
547eat_ws(CONF *conf, char *p)
548{
549 while (IS_WS(conf, *p) && (!IS_EOF(conf, *p)))
550 p++;
551 return (p);
552}
553
554static char *
555eat_alpha_numeric(CONF *conf, char *p)
556{
557 for (;;) {
558 if (IS_ESC(conf, *p)) {
559 p = scan_esc(conf, p);
560 continue;
561 }
562 if (!IS_ALPHA_NUMERIC_PUNCT(conf, *p))
563 return (p);
564 p++;
565 }
566}
567
568static char *
569scan_quote(CONF *conf, char *p)
570{
571 int q = *p;
572
573 p++;
574 while (!(IS_EOF(conf, *p)) && (*p != q)) {
575 if (IS_ESC(conf, *p)) {
576 p++;
577 if (IS_EOF(conf, *p))
578 return (p);
579 }
580 p++;
581 }
582 if (*p == q)
583 p++;
584 return (p);
585}
586
587
588static char *
589scan_dquote(CONF *conf, char *p)
590{
591 int q = *p;
592
593 p++;
594 while (!(IS_EOF(conf, *p))) {
595 if (*p == q) {
596 if (*(p + 1) == q) {
597 p++;
598 } else {
599 break;
600 }
601 }
602 p++;
603 }
604 if (*p == q)
605 p++;
606 return (p);
607}
608
609static void
610dump_value_doall_arg(CONF_VALUE *a, BIO *out)
611{
612 if (a->name)
613 BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value);
614 else
615 BIO_printf(out, "[[%s]]\n", a->section);
616}
617
618static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE, BIO)
619
620static int
621def_dump(const CONF *conf, BIO *out)
622{
623 lh_CONF_VALUE_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value),
624 BIO, out);
625 return 1;
626}
627
628static int
629def_is_number(const CONF *conf, char c)
630{
631 return IS_NUMBER(conf, c);
632}
633
634static int
635def_to_int(const CONF *conf, char c)
636{
637 return c - '0';
638}
639
640static const CONF_METHOD default_method = {
641 .name = "OpenSSL default",
642 .create = def_create,
643 .init = def_init_default,
644 .destroy = def_destroy,
645 .destroy_data = def_destroy_data,
646 .load_bio = def_load_bio,
647 .dump = def_dump,
648 .is_number = def_is_number,
649 .to_int = def_to_int,
650 .load = def_load,
651};
652
653const CONF_METHOD *
654NCONF_default(void)
655{
656 return &default_method;
657}
diff --git a/src/lib/libcrypto/conf/conf_def.h b/src/lib/libcrypto/conf/conf_def.h
deleted file mode 100644
index 36a8aac4de..0000000000
--- a/src/lib/libcrypto/conf/conf_def.h
+++ /dev/null
@@ -1,133 +0,0 @@
1/* $OpenBSD: conf_def.h,v 1.8 2024/08/31 09:36:38 tb 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__BEGIN_HIDDEN_DECLS
63
64#define CONF_NUMBER 1
65#define CONF_UPPER 2
66#define CONF_LOWER 4
67#define CONF_UNDER 256
68#define CONF_PUNCTUATION 512
69#define CONF_WS 16
70#define CONF_ESC 32
71#define CONF_QUOTE 64
72#define CONF_DQUOTE 1024
73#define CONF_COMMENT 128
74#define CONF_FCOMMENT 2048
75#define CONF_EOF 8
76#define CONF_HIGHBIT 4096
77#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
78#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
79#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \
80 CONF_PUNCTUATION)
81
82static const unsigned short CONF_type_default[256];
83
84#define KEYTYPES(c) (CONF_type_default)
85#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
86#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
87#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
88#define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
89#define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
90#define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS)
91#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
92#define IS_ALPHA_NUMERIC_PUNCT(c,a) \
93 (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
94#define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
95#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
96#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
97
98static const unsigned short CONF_type_default[256] = {
99 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
100 0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000,
101 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
102 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
103 0x0010, 0x0200, 0x0040, 0x0080, 0x0000, 0x0200, 0x0200, 0x0040,
104 0x0000, 0x0000, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
105 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
106 0x0001, 0x0001, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000, 0x0200,
107 0x0200, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
108 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
109 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
110 0x0002, 0x0002, 0x0002, 0x0000, 0x0020, 0x0000, 0x0200, 0x0100,
111 0x0040, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
112 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
113 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
114 0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000,
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 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
128 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
129 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
130 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
131};
132
133__END_HIDDEN_DECLS
diff --git a/src/lib/libcrypto/conf/conf_err.c b/src/lib/libcrypto/conf/conf_err.c
deleted file mode 100644
index 5100847d89..0000000000
--- a/src/lib/libcrypto/conf/conf_err.c
+++ /dev/null
@@ -1,108 +0,0 @@
1/* $OpenBSD: conf_err.c,v 1.17 2024/06/24 06:43:22 tb 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#include <stdio.h>
57
58#include <openssl/opensslconf.h>
59
60#include <openssl/conf.h>
61#include <openssl/err.h>
62
63#include "err_local.h"
64
65#ifndef OPENSSL_NO_ERR
66
67#define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0)
68#define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason)
69
70static const ERR_STRING_DATA CONF_str_functs[] = {
71 {ERR_FUNC(0xfff), "CRYPTO_internal"},
72 {0, NULL}
73};
74
75static const ERR_STRING_DATA CONF_str_reasons[] = {
76 {ERR_REASON(CONF_R_ERROR_LOADING_DSO) , "error loading dso"},
77 {ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL) , "list cannot be null"},
78 {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET), "missing close square bracket"},
79 {ERR_REASON(CONF_R_MISSING_EQUAL_SIGN) , "missing equal sign"},
80 {ERR_REASON(CONF_R_MISSING_FINISH_FUNCTION), "missing finish function"},
81 {ERR_REASON(CONF_R_MISSING_INIT_FUNCTION), "missing init function"},
82 {ERR_REASON(CONF_R_MODULE_INITIALIZATION_ERROR), "module initialization error"},
83 {ERR_REASON(CONF_R_NO_CLOSE_BRACE) , "no close brace"},
84 {ERR_REASON(CONF_R_NO_CONF) , "no conf"},
85 {ERR_REASON(CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE), "no conf or environment variable"},
86 {ERR_REASON(CONF_R_NO_SECTION) , "no section"},
87 {ERR_REASON(CONF_R_NO_SUCH_FILE) , "no such file"},
88 {ERR_REASON(CONF_R_NO_VALUE) , "no value"},
89 {ERR_REASON(CONF_R_UNABLE_TO_CREATE_NEW_SECTION), "unable to create new section"},
90 {ERR_REASON(CONF_R_UNKNOWN_MODULE_NAME) , "unknown module name"},
91 {ERR_REASON(CONF_R_VARIABLE_EXPANSION_TOO_LONG), "variable expansion too long"},
92 {ERR_REASON(CONF_R_VARIABLE_HAS_NO_VALUE), "variable has no value"},
93 {0, NULL}
94};
95
96#endif
97
98void
99ERR_load_CONF_strings(void)
100{
101#ifndef OPENSSL_NO_ERR
102 if (ERR_func_error_string(CONF_str_functs[0].error) == NULL) {
103 ERR_load_const_strings(CONF_str_functs);
104 ERR_load_const_strings(CONF_str_reasons);
105 }
106#endif
107}
108LCRYPTO_ALIAS(ERR_load_CONF_strings);
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c
deleted file mode 100644
index 863e1c9475..0000000000
--- a/src/lib/libcrypto/conf/conf_lib.c
+++ /dev/null
@@ -1,197 +0,0 @@
1/* $OpenBSD: conf_lib.c,v 1.25 2025/03/08 09:35:53 tb 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/lhash.h>
64
65#include "conf_local.h"
66
67static const CONF_METHOD *default_CONF_method = NULL;
68
69/* Init a 'CONF' structure from an old LHASH */
70
71void
72CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash)
73{
74 if (default_CONF_method == NULL)
75 default_CONF_method = NCONF_default();
76 default_CONF_method->init(conf);
77 conf->data = hash;
78}
79
80CONF *
81NCONF_new(const CONF_METHOD *meth)
82{
83 CONF *ret;
84
85 if (meth == NULL)
86 meth = NCONF_default();
87
88 ret = meth->create(meth);
89 if (ret == NULL) {
90 CONFerror(ERR_R_MALLOC_FAILURE);
91 return (NULL);
92 }
93
94 return ret;
95}
96LCRYPTO_ALIAS(NCONF_new);
97
98void
99NCONF_free(CONF *conf)
100{
101 if (conf == NULL)
102 return;
103 conf->meth->destroy(conf);
104}
105LCRYPTO_ALIAS(NCONF_free);
106
107int
108NCONF_load(CONF *conf, const char *file, long *eline)
109{
110 if (conf == NULL) {
111 CONFerror(CONF_R_NO_CONF);
112 return 0;
113 }
114
115 return conf->meth->load(conf, file, eline);
116}
117LCRYPTO_ALIAS(NCONF_load);
118
119int
120NCONF_load_bio(CONF *conf, BIO *bp, long *eline)
121{
122 if (conf == NULL) {
123 CONFerror(CONF_R_NO_CONF);
124 return 0;
125 }
126
127 return conf->meth->load_bio(conf, bp, eline);
128}
129LCRYPTO_ALIAS(NCONF_load_bio);
130
131STACK_OF(CONF_VALUE) *
132NCONF_get_section(const CONF *conf, const char *section)
133{
134 CONF_VALUE *v;
135
136 if (conf == NULL) {
137 CONFerror(CONF_R_NO_CONF);
138 return NULL;
139 }
140
141 if (section == NULL) {
142 CONFerror(CONF_R_NO_SECTION);
143 return NULL;
144 }
145
146 if ((v = _CONF_get_section(conf, section)) == NULL)
147 return NULL;
148
149 return (STACK_OF(CONF_VALUE) *)v->value;
150}
151LCRYPTO_ALIAS(NCONF_get_section);
152
153char *
154NCONF_get_string(const CONF *conf, const char *group, const char *name)
155{
156 char *s = _CONF_get_string(conf, group, name);
157
158 /* Since we may get a value from an environment variable even
159 if conf is NULL, let's check the value first */
160 if (s)
161 return s;
162
163 if (conf == NULL) {
164 CONFerror(CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE);
165 return NULL;
166 }
167 CONFerror(CONF_R_NO_VALUE);
168 ERR_asprintf_error_data("group=%s name=%s",
169 group ? group : "", name);
170 return NULL;
171}
172LCRYPTO_ALIAS(NCONF_get_string);
173
174int
175NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
176 long *result)
177{
178 char *str;
179
180 if (result == NULL) {
181 CONFerror(ERR_R_PASSED_NULL_PARAMETER);
182 return 0;
183 }
184
185 str = NCONF_get_string(conf, group, name);
186
187 if (str == NULL)
188 return 0;
189
190 for (*result = 0; conf->meth->is_number(conf, *str); ) {
191 *result = (*result) * 10 + conf->meth->to_int(conf, *str);
192 str++;
193 }
194
195 return 1;
196}
197LCRYPTO_ALIAS(NCONF_get_number_e);
diff --git a/src/lib/libcrypto/conf/conf_local.h b/src/lib/libcrypto/conf/conf_local.h
deleted file mode 100644
index 71cd22707b..0000000000
--- a/src/lib/libcrypto/conf/conf_local.h
+++ /dev/null
@@ -1,101 +0,0 @@
1/* $OpenBSD: conf_local.h,v 1.10 2025/03/08 09:35:53 tb 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_LOCAL_H
60#define HEADER_CONF_LOCAL_H
61
62__BEGIN_HIDDEN_DECLS
63
64const CONF_METHOD *NCONF_default(void);
65
66struct conf_method_st {
67 const char *name;
68 CONF *(*create)(const CONF_METHOD *meth);
69 int (*init)(CONF *conf);
70 int (*destroy)(CONF *conf);
71 int (*destroy_data)(CONF *conf);
72 int (*load_bio)(CONF *conf, BIO *bp, long *eline);
73 int (*dump)(const CONF *conf, BIO *bp);
74 int (*is_number)(const CONF *conf, char c);
75 int (*to_int)(const CONF *conf, char c);
76 int (*load)(CONF *conf, const char *name, long *eline);
77};
78
79int CONF_module_add(const char *name, conf_init_func *ifunc,
80 conf_finish_func *ffunc);
81
82const char *CONF_imodule_get_value(const CONF_IMODULE *md);
83
84int CONF_parse_list(const char *list, int sep, int nospc,
85 int (*list_cb)(const char *elem, int len, void *usr), void *arg);
86
87void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
88
89CONF_VALUE *_CONF_new_section(CONF *conf, const char *section);
90CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);
91
92int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);
93char *_CONF_get_string(const CONF *conf, const char *section,
94 const char *name);
95
96int _CONF_new_data(CONF *conf);
97void _CONF_free_data(CONF *conf);
98
99__END_HIDDEN_DECLS
100
101#endif /* HEADER_CONF_LOCAL_H */
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c
deleted file mode 100644
index 0e07bb3ea5..0000000000
--- a/src/lib/libcrypto/conf/conf_mod.c
+++ /dev/null
@@ -1,480 +0,0 @@
1/* $OpenBSD: conf_mod.c,v 1.40 2024/10/10 06:51:22 tb 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/err.h>
67#include <openssl/x509.h>
68
69/* This structure contains data about supported modules. */
70struct conf_module_st {
71 /* Name of the module */
72 char *name;
73 /* Init function */
74 conf_init_func *init;
75 /* Finish function */
76 conf_finish_func *finish;
77 /* Number of successfully initialized modules */
78 int links;
79};
80
81
82/* This structure contains information about modules that have been
83 * successfully initialized. There may be more than one entry for a
84 * given module.
85 */
86
87struct conf_imodule_st {
88 CONF_MODULE *mod;
89 char *value;
90};
91
92static STACK_OF(CONF_MODULE) *supported_modules = NULL;
93static STACK_OF(CONF_IMODULE) *initialized_modules = NULL;
94
95static void module_free(CONF_MODULE *mod);
96static void imodule_free(CONF_IMODULE *imod);
97static void module_finish(CONF_IMODULE *imod);
98static int module_run(const CONF *cnf, char *name, char *value,
99 unsigned long flags);
100static int module_add(const char *name, conf_init_func *ifunc,
101 conf_finish_func *ffunc);
102static CONF_MODULE *module_find(char *name);
103static int module_init(CONF_MODULE *mod, char *name, char *value,
104 const CONF *cnf);
105
106/* Main function: load modules from a CONF structure */
107
108int
109CONF_modules_load(const CONF *cnf, const char *appname, unsigned long flags)
110{
111 STACK_OF(CONF_VALUE) *values;
112 CONF_VALUE *vl;
113 char *vsection = NULL;
114
115 int ret, i;
116
117 if (!cnf)
118 return 1;
119
120 if (appname)
121 vsection = NCONF_get_string(cnf, NULL, appname);
122
123 if (!appname || (!vsection && (flags & CONF_MFLAGS_DEFAULT_SECTION)))
124 vsection = NCONF_get_string(cnf, NULL, "openssl_conf");
125
126 if (!vsection) {
127 ERR_clear_error();
128 return 1;
129 }
130
131 values = NCONF_get_section(cnf, vsection);
132
133 if (!values)
134 return 0;
135
136 for (i = 0; i < sk_CONF_VALUE_num(values); i++) {
137 vl = sk_CONF_VALUE_value(values, i);
138 ret = module_run(cnf, vl->name, vl->value, flags);
139 if (ret <= 0)
140 if (!(flags & CONF_MFLAGS_IGNORE_ERRORS))
141 return ret;
142 }
143
144 return 1;
145}
146LCRYPTO_ALIAS(CONF_modules_load);
147
148int
149CONF_modules_load_file(const char *filename, const char *appname,
150 unsigned long flags)
151{
152 char *file = NULL;
153 CONF *conf = NULL;
154 int ret = 0;
155 conf = NCONF_new(NULL);
156 if (!conf)
157 goto err;
158
159 if (filename == NULL) {
160 file = CONF_get1_default_config_file();
161 if (!file)
162 goto err;
163 } else
164 file = (char *)filename;
165
166 if (NCONF_load(conf, file, NULL) <= 0) {
167 if ((flags & CONF_MFLAGS_IGNORE_MISSING_FILE) &&
168 (ERR_GET_REASON(ERR_peek_last_error()) ==
169 CONF_R_NO_SUCH_FILE)) {
170 ERR_clear_error();
171 ret = 1;
172 }
173 goto err;
174 }
175
176 ret = CONF_modules_load(conf, appname, flags);
177
178err:
179 if (filename == NULL)
180 free(file);
181 NCONF_free(conf);
182
183 return ret;
184}
185LCRYPTO_ALIAS(CONF_modules_load_file);
186
187static int
188module_run(const CONF *cnf, char *name, char *value, unsigned long flags)
189{
190 CONF_MODULE *mod;
191 int ret;
192
193 if ((mod = module_find(name)) == NULL) {
194 if (!(flags & CONF_MFLAGS_SILENT)) {
195 CONFerror(CONF_R_UNKNOWN_MODULE_NAME);
196 ERR_asprintf_error_data("module=%s", name);
197 }
198 return -1;
199 }
200
201 ret = module_init(mod, name, value, cnf);
202
203 if (ret <= 0) {
204 if (!(flags & CONF_MFLAGS_SILENT)) {
205 CONFerror(CONF_R_MODULE_INITIALIZATION_ERROR);
206 ERR_asprintf_error_data
207 ("module=%s, value=%s, retcode=%-8d",
208 name, value, ret);
209 }
210 }
211
212 return ret;
213}
214
215static int
216module_add(const char *name, conf_init_func *ifunc, conf_finish_func *ffunc)
217{
218 CONF_MODULE *mod = NULL;
219 int ret = 0;
220
221 if (name == NULL)
222 goto err;
223
224 if (supported_modules == NULL)
225 supported_modules = sk_CONF_MODULE_new_null();
226 if (supported_modules == NULL)
227 goto err;
228
229 if ((mod = calloc(1, sizeof(*mod))) == NULL)
230 goto err;
231 if ((mod->name = strdup(name)) == NULL)
232 goto err;
233 mod->init = ifunc;
234 mod->finish = ffunc;
235
236 if (!sk_CONF_MODULE_push(supported_modules, mod))
237 goto err;
238 mod = NULL;
239
240 ret = 1;
241
242 err:
243 module_free(mod);
244
245 return ret;
246}
247
248/* Find a module from the list. We allow module names of the
249 * form modname.XXXX to just search for modname to allow the
250 * same module to be initialized more than once.
251 */
252
253static CONF_MODULE *
254module_find(char *name)
255{
256 CONF_MODULE *mod;
257 int i, nchar;
258 char *p;
259
260 p = strrchr(name, '.');
261
262 if (p)
263 nchar = p - name;
264 else
265 nchar = strlen(name);
266
267 for (i = 0; i < sk_CONF_MODULE_num(supported_modules); i++) {
268 mod = sk_CONF_MODULE_value(supported_modules, i);
269 if (!strncmp(mod->name, name, nchar))
270 return mod;
271 }
272
273 return NULL;
274}
275
276/* initialize a module */
277static int
278module_init(CONF_MODULE *mod, char *name, char *value, const CONF *cnf)
279{
280 CONF_IMODULE *imod = NULL;
281 int need_finish = 0;
282 int ret = -1;
283
284 if (name == NULL || value == NULL)
285 goto err;
286
287 if ((imod = calloc(1, sizeof(*imod))) == NULL)
288 goto err;
289
290 imod->mod = mod;
291
292 if ((imod->value = strdup(value)) == NULL)
293 goto err;
294
295 if (mod->init != NULL) {
296 need_finish = 1;
297 if (mod->init(imod, cnf) <= 0)
298 goto err;
299 }
300
301 if (initialized_modules == NULL)
302 initialized_modules = sk_CONF_IMODULE_new_null();
303 if (initialized_modules == NULL)
304 goto err;
305
306 if (!sk_CONF_IMODULE_push(initialized_modules, imod))
307 goto err;
308 imod = NULL;
309 need_finish = 0;
310
311 mod->links++;
312
313 ret = 1;
314
315 err:
316 if (need_finish && mod->finish != NULL)
317 mod->finish(imod);
318
319 imodule_free(imod);
320
321 return ret;
322}
323
324/* Unload any dynamic modules that have a link count of zero:
325 * i.e. have no active initialized modules. If 'all' is set
326 * then all modules are unloaded including static ones.
327 */
328
329void
330CONF_modules_unload(int all)
331{
332 int i;
333 CONF_MODULE *mod;
334
335 CONF_modules_finish();
336
337 /* unload modules in reverse order */
338 for (i = sk_CONF_MODULE_num(supported_modules) - 1; i >= 0; i--) {
339 mod = sk_CONF_MODULE_value(supported_modules, i);
340 if (!all)
341 continue;
342 /* Since we're working in reverse this is OK */
343 (void)sk_CONF_MODULE_delete(supported_modules, i);
344 module_free(mod);
345 }
346 if (sk_CONF_MODULE_num(supported_modules) == 0) {
347 sk_CONF_MODULE_free(supported_modules);
348 supported_modules = NULL;
349 }
350}
351LCRYPTO_ALIAS(CONF_modules_unload);
352
353/* unload a single module */
354static void
355module_free(CONF_MODULE *mod)
356{
357 if (mod == NULL)
358 return;
359
360 free(mod->name);
361 free(mod);
362}
363
364static void
365imodule_free(CONF_IMODULE *imod)
366{
367 if (imod == NULL)
368 return;
369
370 free(imod->value);
371 free(imod);
372}
373
374/* finish and free up all modules instances */
375
376void
377CONF_modules_finish(void)
378{
379 CONF_IMODULE *imod;
380
381 while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
382 imod = sk_CONF_IMODULE_pop(initialized_modules);
383 module_finish(imod);
384 }
385 sk_CONF_IMODULE_free(initialized_modules);
386 initialized_modules = NULL;
387}
388LCRYPTO_ALIAS(CONF_modules_finish);
389
390/* finish a module instance */
391
392static void
393module_finish(CONF_IMODULE *imod)
394{
395 if (imod->mod->finish)
396 imod->mod->finish(imod);
397 imod->mod->links--;
398
399 imodule_free(imod);
400}
401
402/* Add a static module to OpenSSL */
403
404int
405CONF_module_add(const char *name, conf_init_func *ifunc, conf_finish_func *ffunc)
406{
407 return module_add(name, ifunc, ffunc);
408}
409
410void
411CONF_modules_free(void)
412{
413 CONF_modules_finish();
414 CONF_modules_unload(1);
415}
416LCRYPTO_ALIAS(CONF_modules_free);
417
418const char *
419CONF_imodule_get_value(const CONF_IMODULE *imod)
420{
421 return imod->value;
422}
423
424char *
425CONF_get1_default_config_file(void)
426{
427 char *file = NULL;
428
429 if (asprintf(&file, "%s/openssl.cnf",
430 X509_get_default_cert_area()) == -1)
431 return (NULL);
432 return file;
433}
434LCRYPTO_ALIAS(CONF_get1_default_config_file);
435
436/* This function takes a list separated by 'sep' and calls the
437 * callback function giving the start and length of each member
438 * optionally stripping leading and trailing whitespace. This can
439 * be used to parse comma separated lists for example.
440 */
441
442int
443CONF_parse_list(const char *list_, int sep, int nospc,
444 int (*list_cb)(const char *elem, int len, void *usr), void *arg)
445{
446 int ret;
447 const char *lstart, *tmpend, *p;
448
449 if (list_ == NULL) {
450 CONFerror(CONF_R_LIST_CANNOT_BE_NULL);
451 return 0;
452 }
453
454 lstart = list_;
455 for (;;) {
456 if (nospc) {
457 while (*lstart && isspace((unsigned char)*lstart))
458 lstart++;
459 }
460 p = strchr(lstart, sep);
461 if (p == lstart || !*lstart)
462 ret = list_cb(NULL, 0, arg);
463 else {
464 if (p)
465 tmpend = p - 1;
466 else
467 tmpend = lstart + strlen(lstart) - 1;
468 if (nospc) {
469 while (isspace((unsigned char)*tmpend))
470 tmpend--;
471 }
472 ret = list_cb(lstart, tmpend - lstart + 1, arg);
473 }
474 if (ret <= 0)
475 return ret;
476 if (p == NULL)
477 return 1;
478 lstart = p + 1;
479 }
480}
diff --git a/src/lib/libcrypto/conf/conf_sap.c b/src/lib/libcrypto/conf/conf_sap.c
deleted file mode 100644
index 6951718765..0000000000
--- a/src/lib/libcrypto/conf/conf_sap.c
+++ /dev/null
@@ -1,151 +0,0 @@
1/* $OpenBSD: conf_sap.c,v 1.18 2024/10/18 11:12:10 tb 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 <pthread.h>
60#include <stdio.h>
61
62#include <openssl/opensslconf.h>
63
64#include <openssl/asn1.h>
65#include <openssl/conf.h>
66#include <openssl/crypto.h>
67#include <openssl/err.h>
68#include <openssl/x509.h>
69
70#include "conf_local.h"
71
72/* This is the automatic configuration loader: it is called automatically by
73 * OpenSSL when any of a number of standard initialisation functions are called,
74 * unless this is overridden by calling OPENSSL_no_config()
75 */
76
77static pthread_once_t openssl_configured = PTHREAD_ONCE_INIT;
78
79static const char *openssl_config_name;
80
81void ASN1_add_oid_module(void);
82
83static void
84OPENSSL_config_internal(void)
85{
86 ASN1_add_oid_module();
87
88 ERR_clear_error();
89 if (CONF_modules_load_file(NULL, openssl_config_name,
90 CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {
91 BIO *bio_err;
92 ERR_load_crypto_strings();
93 if ((bio_err = BIO_new_fp(stderr, BIO_NOCLOSE)) != NULL) {
94 BIO_printf(bio_err, "Auto configuration failed\n");
95 ERR_print_errors(bio_err);
96 BIO_free(bio_err);
97 }
98 exit(1);
99 }
100
101 return;
102}
103
104int
105OpenSSL_config(const char *config_name)
106{
107 /* Don't override if NULL */
108 /*
109 * Note - multiple threads calling this with *different* config names
110 * is probably not advisable. One thread will win, but you don't know
111 * if it will be the same thread as wins the pthread_once.
112 */
113 if (config_name != NULL)
114 openssl_config_name = config_name;
115
116 if (OPENSSL_init_crypto(0, NULL) == 0)
117 return 0;
118
119 if (pthread_once(&openssl_configured, OPENSSL_config_internal) != 0)
120 return 0;
121
122 return 1;
123}
124
125void
126OPENSSL_config(const char *config_name)
127{
128 (void) OpenSSL_config(config_name);
129}
130LCRYPTO_ALIAS(OPENSSL_config);
131
132static void
133OPENSSL_no_config_internal(void)
134{
135}
136
137int
138OpenSSL_no_config(void)
139{
140 if (pthread_once(&openssl_configured, OPENSSL_no_config_internal) != 0)
141 return 0;
142
143 return 1;
144}
145
146void
147OPENSSL_no_config(void)
148{
149 (void) OpenSSL_no_config();
150}
151LCRYPTO_ALIAS(OPENSSL_no_config);
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