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