summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/conf
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/conf')
-rw-r--r--src/lib/libcrypto/conf/conf.h170
-rw-r--r--src/lib/libcrypto/conf/conf_api.c49
-rw-r--r--src/lib/libcrypto/conf/conf_api.h12
-rw-r--r--src/lib/libcrypto/conf/conf_def.c62
-rw-r--r--src/lib/libcrypto/conf/conf_def.h143
-rw-r--r--src/lib/libcrypto/conf/conf_err.c150
-rw-r--r--src/lib/libcrypto/conf/conf_lib.c196
-rw-r--r--src/lib/libcrypto/conf/keysets.pl164
8 files changed, 686 insertions, 260 deletions
diff --git a/src/lib/libcrypto/conf/conf.h b/src/lib/libcrypto/conf/conf.h
index 1446226a16..3c03fb19c0 100644
--- a/src/lib/libcrypto/conf/conf.h
+++ b/src/lib/libcrypto/conf/conf.h
@@ -59,13 +59,16 @@
59#ifndef HEADER_CONF_H 59#ifndef HEADER_CONF_H
60#define HEADER_CONF_H 60#define HEADER_CONF_H
61 61
62#include <openssl/bio.h>
63#include <openssl/lhash.h>
64#include <openssl/stack.h>
65#include <openssl/safestack.h>
66#include <openssl/e_os2.h>
67
62#ifdef __cplusplus 68#ifdef __cplusplus
63extern "C" { 69extern "C" {
64#endif 70#endif
65 71
66#include "stack.h"
67#include "lhash.h"
68
69typedef struct 72typedef struct
70 { 73 {
71 char *section; 74 char *section;
@@ -73,42 +76,173 @@ typedef struct
73 char *value; 76 char *value;
74 } CONF_VALUE; 77 } CONF_VALUE;
75 78
76#ifndef NOPROTO 79DECLARE_STACK_OF(CONF_VALUE)
80DECLARE_STACK_OF(CONF_MODULE)
81DECLARE_STACK_OF(CONF_IMODULE)
82
83struct conf_st;
84typedef struct conf_st CONF;
85struct conf_method_st;
86typedef struct conf_method_st CONF_METHOD;
87
88struct conf_method_st
89 {
90 const char *name;
91 CONF *(*create)(CONF_METHOD *meth);
92 int (*init)(CONF *conf);
93 int (*destroy)(CONF *conf);
94 int (*destroy_data)(CONF *conf);
95 int (*load_bio)(CONF *conf, BIO *bp, long *eline);
96 int (*dump)(const CONF *conf, BIO *bp);
97 int (*is_number)(const CONF *conf, char c);
98 int (*to_int)(const CONF *conf, char c);
99 int (*load)(CONF *conf, const char *name, long *eline);
100 };
101
102/* Module definitions */
103
104typedef struct conf_imodule_st CONF_IMODULE;
105typedef struct conf_module_st CONF_MODULE;
77 106
78LHASH *CONF_load(LHASH *conf,char *file,long *eline); 107/* DSO module function typedefs */
79STACK *CONF_get_section(LHASH *conf,char *section); 108typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);
80char *CONF_get_string(LHASH *conf,char *group,char *name); 109typedef void conf_finish_func(CONF_IMODULE *md);
81long CONF_get_number(LHASH *conf,char *group,char *name); 110
111#define CONF_MFLAGS_IGNORE_ERRORS 0x1
112#define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
113#define CONF_MFLAGS_SILENT 0x4
114#define CONF_MFLAGS_NO_DSO 0x8
115#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
116
117int CONF_set_default_method(CONF_METHOD *meth);
118void CONF_set_nconf(CONF *conf,LHASH *hash);
119LHASH *CONF_load(LHASH *conf,const char *file,long *eline);
120#ifndef OPENSSL_NO_FP_API
121LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline);
122#endif
123LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline);
124STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section);
125char *CONF_get_string(LHASH *conf,const char *group,const char *name);
126long CONF_get_number(LHASH *conf,const char *group,const char *name);
82void CONF_free(LHASH *conf); 127void CONF_free(LHASH *conf);
83void ERR_load_CONF_strings(void ); 128int CONF_dump_fp(LHASH *conf, FILE *out);
129int CONF_dump_bio(LHASH *conf, BIO *out);
84 130
85#else 131void OPENSSL_config(const char *config_name);
86 132
87LHASH *CONF_load(); 133/* New conf code. The semantics are different from the functions above.
88STACK *CONF_get_section(); 134 If that wasn't the case, the above functions would have been replaced */
89char *CONF_get_string();
90long CONF_get_number();
91void CONF_free();
92void ERR_load_CONF_strings();
93 135
136struct conf_st
137 {
138 CONF_METHOD *meth;
139 void *meth_data;
140 LHASH *data;
141 };
142
143CONF *NCONF_new(CONF_METHOD *meth);
144CONF_METHOD *NCONF_default();
145CONF_METHOD *NCONF_WIN32();
146#if 0 /* Just to give you an idea of what I have in mind */
147CONF_METHOD *NCONF_XML();
94#endif 148#endif
149void NCONF_free(CONF *conf);
150void NCONF_free_data(CONF *conf);
151
152int NCONF_load(CONF *conf,const char *file,long *eline);
153#ifndef OPENSSL_NO_FP_API
154int NCONF_load_fp(CONF *conf, FILE *fp,long *eline);
155#endif
156int NCONF_load_bio(CONF *conf, BIO *bp,long *eline);
157STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section);
158char *NCONF_get_string(const CONF *conf,const char *group,const char *name);
159int NCONF_get_number_e(const CONF *conf,const char *group,const char *name,
160 long *result);
161int NCONF_dump_fp(const CONF *conf, FILE *out);
162int NCONF_dump_bio(const CONF *conf, BIO *out);
163
164#if 0 /* The following function has no error checking,
165 and should therefore be avoided */
166long NCONF_get_number(CONF *conf,char *group,char *name);
167#else
168#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
169#endif
170
171/* Module functions */
172
173int CONF_modules_load(const CONF *cnf, const char *appname,
174 unsigned long flags);
175int CONF_modules_load_file(const char *filename, const char *appname,
176 unsigned long flags);
177void CONF_modules_unload(int all);
178void CONF_modules_finish(void);
179int CONF_module_add(const char *name, conf_init_func *ifunc,
180 conf_finish_func *ffunc);
181
182const char *CONF_imodule_get_name(const CONF_IMODULE *md);
183const char *CONF_imodule_get_value(const CONF_IMODULE *md);
184void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
185void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
186CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
187unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
188void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
189void *CONF_module_get_usr_data(CONF_MODULE *pmod);
190void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
191
192char *CONF_get1_default_config_file(void);
193
194int CONF_parse_list(const char *list, int sep, int nospc,
195 int (*list_cb)(const char *elem, int len, void *usr), void *arg);
196
197void OPENSSL_load_builtin_modules(void);
95 198
96/* BEGIN ERROR CODES */ 199/* BEGIN ERROR CODES */
200/* The following lines are auto generated by the script mkerr.pl. Any changes
201 * made after this point may be overwritten when the script is next run.
202 */
203void ERR_load_CONF_strings(void);
204
97/* Error codes for the CONF functions. */ 205/* Error codes for the CONF functions. */
98 206
99/* Function codes. */ 207/* Function codes. */
208#define CONF_F_CONF_DUMP_FP 104
100#define CONF_F_CONF_LOAD 100 209#define CONF_F_CONF_LOAD 100
210#define CONF_F_CONF_LOAD_BIO 102
211#define CONF_F_CONF_LOAD_FP 103
212#define CONF_F_CONF_MODULES_LOAD 116
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
101#define CONF_F_STR_COPY 101 226#define CONF_F_STR_COPY 101
102 227
103/* Reason codes. */ 228/* Reason codes. */
229#define CONF_R_ERROR_LOADING_DSO 110
104#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 230#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
105#define CONF_R_MISSING_EQUAL_SIGN 101 231#define CONF_R_MISSING_EQUAL_SIGN 101
232#define CONF_R_MISSING_FINISH_FUNCTION 111
233#define CONF_R_MISSING_INIT_FUNCTION 112
234#define CONF_R_MODULE_INITIALIZATION_ERROR 109
106#define CONF_R_NO_CLOSE_BRACE 102 235#define CONF_R_NO_CLOSE_BRACE 102
236#define CONF_R_NO_CONF 105
237#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
238#define CONF_R_NO_SECTION 107
239#define CONF_R_NO_SUCH_FILE 114
240#define CONF_R_NO_VALUE 108
107#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 241#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
242#define CONF_R_UNKNOWN_MODULE_NAME 113
108#define CONF_R_VARIABLE_HAS_NO_VALUE 104 243#define CONF_R_VARIABLE_HAS_NO_VALUE 104
109 244
110#ifdef __cplusplus 245#ifdef __cplusplus
111} 246}
112#endif 247#endif
113#endif 248#endif
114
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c
index d05a778ff6..0032baa711 100644
--- a/src/lib/libcrypto/conf/conf_api.c
+++ b/src/lib/libcrypto/conf/conf_api.c
@@ -67,26 +67,34 @@
67#include <string.h> 67#include <string.h>
68#include <openssl/conf.h> 68#include <openssl/conf.h>
69#include <openssl/conf_api.h> 69#include <openssl/conf_api.h>
70#include "e_os.h"
70 71
71static void value_free_hash(CONF_VALUE *a, LHASH *conf); 72static void value_free_hash(CONF_VALUE *a, LHASH *conf);
72static void value_free_stack(CONF_VALUE *a,LHASH *conf); 73static void value_free_stack(CONF_VALUE *a,LHASH *conf);
73static unsigned long hash(CONF_VALUE *v); 74static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE *, LHASH *)
74static int cmp_conf(CONF_VALUE *a,CONF_VALUE *b); 75static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_stack, CONF_VALUE *, LHASH *)
76/* We don't use function pointer casting or wrapper functions - but cast each
77 * callback parameter inside the callback functions. */
78/* static unsigned long hash(CONF_VALUE *v); */
79static unsigned long hash(const void *v_void);
80/* static int cmp_conf(CONF_VALUE *a,CONF_VALUE *b); */
81static int cmp_conf(const void *a_void,const void *b_void);
75 82
76/* Up until OpenSSL 0.9.5a, this was get_section */ 83/* Up until OpenSSL 0.9.5a, this was get_section */
77CONF_VALUE *_CONF_get_section(CONF *conf, char *section) 84CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section)
78 { 85 {
79 CONF_VALUE *v,vv; 86 CONF_VALUE *v,vv;
80 87
81 if ((conf == NULL) || (section == NULL)) return(NULL); 88 if ((conf == NULL) || (section == NULL)) return(NULL);
82 vv.name=NULL; 89 vv.name=NULL;
83 vv.section=section; 90 vv.section=(char *)section;
84 v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); 91 v=(CONF_VALUE *)lh_retrieve(conf->data,&vv);
85 return(v); 92 return(v);
86 } 93 }
87 94
88/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ 95/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
89STACK_OF(CONF_VALUE) *_CONF_get_section_values(CONF *conf, char *section) 96STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
97 const char *section)
90 { 98 {
91 CONF_VALUE *v; 99 CONF_VALUE *v;
92 100
@@ -121,7 +129,7 @@ int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)
121 return 1; 129 return 1;
122 } 130 }
123 131
124char *_CONF_get_string(CONF *conf, char *section, char *name) 132char *_CONF_get_string(const CONF *conf, const char *section, const char *name)
125 { 133 {
126 CONF_VALUE *v,vv; 134 CONF_VALUE *v,vv;
127 char *p; 135 char *p;
@@ -131,8 +139,8 @@ char *_CONF_get_string(CONF *conf, char *section, char *name)
131 { 139 {
132 if (section != NULL) 140 if (section != NULL)
133 { 141 {
134 vv.name=name; 142 vv.name=(char *)name;
135 vv.section=section; 143 vv.section=(char *)section;
136 v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); 144 v=(CONF_VALUE *)lh_retrieve(conf->data,&vv);
137 if (v != NULL) return(v->value); 145 if (v != NULL) return(v->value);
138 if (strcmp(section,"ENV") == 0) 146 if (strcmp(section,"ENV") == 0)
@@ -142,7 +150,7 @@ char *_CONF_get_string(CONF *conf, char *section, char *name)
142 } 150 }
143 } 151 }
144 vv.section="default"; 152 vv.section="default";
145 vv.name=name; 153 vv.name=(char *)name;
146 v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); 154 v=(CONF_VALUE *)lh_retrieve(conf->data,&vv);
147 if (v != NULL) 155 if (v != NULL)
148 return(v->value); 156 return(v->value);
@@ -153,6 +161,9 @@ char *_CONF_get_string(CONF *conf, char *section, char *name)
153 return(Getenv(name)); 161 return(Getenv(name));
154 } 162 }
155 163
164#if 0 /* There's no way to provide error checking with this function, so
165 force implementors of the higher levels to get a string and read
166 the number themselves. */
156long _CONF_get_number(CONF *conf, char *section, char *name) 167long _CONF_get_number(CONF *conf, char *section, char *name)
157 { 168 {
158 char *str; 169 char *str;
@@ -169,6 +180,7 @@ long _CONF_get_number(CONF *conf, char *section, char *name)
169 str++; 180 str++;
170 } 181 }
171 } 182 }
183#endif
172 184
173int _CONF_new_data(CONF *conf) 185int _CONF_new_data(CONF *conf)
174 { 186 {
@@ -177,7 +189,7 @@ int _CONF_new_data(CONF *conf)
177 return 0; 189 return 0;
178 } 190 }
179 if (conf->data == NULL) 191 if (conf->data == NULL)
180 if ((conf->data = lh_new(hash,cmp_conf)) == NULL) 192 if ((conf->data = lh_new(hash, cmp_conf)) == NULL)
181 { 193 {
182 return 0; 194 return 0;
183 } 195 }
@@ -190,12 +202,14 @@ void _CONF_free_data(CONF *conf)
190 202
191 conf->data->down_load=0; /* evil thing to make sure the 'OPENSSL_free()' 203 conf->data->down_load=0; /* evil thing to make sure the 'OPENSSL_free()'
192 * works as expected */ 204 * works as expected */
193 lh_doall_arg(conf->data,(void (*)())value_free_hash,conf->data); 205 lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(value_free_hash),
206 conf->data);
194 207
195 /* We now have only 'section' entries in the hash table. 208 /* We now have only 'section' entries in the hash table.
196 * Due to problems with */ 209 * Due to problems with */
197 210
198 lh_doall_arg(conf->data,(void (*)())value_free_stack,conf->data); 211 lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(value_free_stack),
212 conf->data);
199 lh_free(conf->data); 213 lh_free(conf->data);
200 } 214 }
201 215
@@ -228,14 +242,19 @@ static void value_free_stack(CONF_VALUE *a, LHASH *conf)
228 OPENSSL_free(a); 242 OPENSSL_free(a);
229 } 243 }
230 244
231static unsigned long hash(CONF_VALUE *v) 245/* static unsigned long hash(CONF_VALUE *v) */
246static unsigned long hash(const void *v_void)
232 { 247 {
248 CONF_VALUE *v = (CONF_VALUE *)v_void;
233 return((lh_strhash(v->section)<<2)^lh_strhash(v->name)); 249 return((lh_strhash(v->section)<<2)^lh_strhash(v->name));
234 } 250 }
235 251
236static int cmp_conf(CONF_VALUE *a, CONF_VALUE *b) 252/* static int cmp_conf(CONF_VALUE *a, CONF_VALUE *b) */
253static int cmp_conf(const void *a_void,const void *b_void)
237 { 254 {
238 int i; 255 int i;
256 CONF_VALUE *a = (CONF_VALUE *)a_void;
257 CONF_VALUE *b = (CONF_VALUE *)b_void;
239 258
240 if (a->section != b->section) 259 if (a->section != b->section)
241 { 260 {
@@ -255,7 +274,7 @@ static int cmp_conf(CONF_VALUE *a, CONF_VALUE *b)
255 } 274 }
256 275
257/* Up until OpenSSL 0.9.5a, this was new_section */ 276/* Up until OpenSSL 0.9.5a, this was new_section */
258CONF_VALUE *_CONF_new_section(CONF *conf, char *section) 277CONF_VALUE *_CONF_new_section(CONF *conf, const char *section)
259 { 278 {
260 STACK *sk=NULL; 279 STACK *sk=NULL;
261 int ok=0,i; 280 int ok=0,i;
diff --git a/src/lib/libcrypto/conf/conf_api.h b/src/lib/libcrypto/conf/conf_api.h
index a5cc17b233..87a954aff6 100644
--- a/src/lib/libcrypto/conf/conf_api.h
+++ b/src/lib/libcrypto/conf/conf_api.h
@@ -67,15 +67,17 @@ extern "C" {
67#endif 67#endif
68 68
69/* Up until OpenSSL 0.9.5a, this was new_section */ 69/* Up until OpenSSL 0.9.5a, this was new_section */
70CONF_VALUE *_CONF_new_section(CONF *conf, char *section); 70CONF_VALUE *_CONF_new_section(CONF *conf, const char *section);
71/* Up until OpenSSL 0.9.5a, this was get_section */ 71/* Up until OpenSSL 0.9.5a, this was get_section */
72CONF_VALUE *_CONF_get_section(CONF *conf, char *section); 72CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);
73/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ 73/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
74STACK_OF(CONF_VALUE) *_CONF_get_section_values(CONF *conf, char *section); 74STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
75 const char *section);
75 76
76int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); 77int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);
77char *_CONF_get_string(CONF *conf, char *section, char *name); 78char *_CONF_get_string(const CONF *conf, const char *section,
78long _CONF_get_number(CONF *conf, char *section, char *name); 79 const char *name);
80long _CONF_get_number(const CONF *conf, const char *section, const char *name);
79 81
80int _CONF_new_data(CONF *conf); 82int _CONF_new_data(CONF *conf);
81void _CONF_free_data(CONF *conf); 83void _CONF_free_data(CONF *conf);
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c
index 773df32c68..31f2766246 100644
--- a/src/lib/libcrypto/conf/conf_def.c
+++ b/src/lib/libcrypto/conf/conf_def.c
@@ -81,10 +81,11 @@ static int def_init_default(CONF *conf);
81static int def_init_WIN32(CONF *conf); 81static int def_init_WIN32(CONF *conf);
82static int def_destroy(CONF *conf); 82static int def_destroy(CONF *conf);
83static int def_destroy_data(CONF *conf); 83static int def_destroy_data(CONF *conf);
84static int def_load(CONF *conf, BIO *bp, long *eline); 84static int def_load(CONF *conf, const char *name, long *eline);
85static int def_dump(CONF *conf, BIO *bp); 85static int def_load_bio(CONF *conf, BIO *bp, long *eline);
86static int def_is_number(CONF *conf, char c); 86static int def_dump(const CONF *conf, BIO *bp);
87static int def_to_int(CONF *conf, char c); 87static int def_is_number(const CONF *conf, char c);
88static int def_to_int(const CONF *conf, char c);
88 89
89const char *CONF_def_version="CONF_def" OPENSSL_VERSION_PTEXT; 90const char *CONF_def_version="CONF_def" OPENSSL_VERSION_PTEXT;
90 91
@@ -94,10 +95,11 @@ static CONF_METHOD default_method = {
94 def_init_default, 95 def_init_default,
95 def_destroy, 96 def_destroy,
96 def_destroy_data, 97 def_destroy_data,
97 def_load, 98 def_load_bio,
98 def_dump, 99 def_dump,
99 def_is_number, 100 def_is_number,
100 def_to_int 101 def_to_int,
102 def_load
101 }; 103 };
102 104
103static CONF_METHOD WIN32_method = { 105static CONF_METHOD WIN32_method = {
@@ -106,10 +108,11 @@ static CONF_METHOD WIN32_method = {
106 def_init_WIN32, 108 def_init_WIN32,
107 def_destroy, 109 def_destroy,
108 def_destroy_data, 110 def_destroy_data,
109 def_load, 111 def_load_bio,
110 def_dump, 112 def_dump,
111 def_is_number, 113 def_is_number,
112 def_to_int 114 def_to_int,
115 def_load
113 }; 116 };
114 117
115CONF_METHOD *NCONF_default() 118CONF_METHOD *NCONF_default()
@@ -177,7 +180,32 @@ static int def_destroy_data(CONF *conf)
177 return 1; 180 return 1;
178 } 181 }
179 182
180static int def_load(CONF *conf, BIO *in, long *line) 183static int def_load(CONF *conf, const char *name, long *line)
184 {
185 int ret;
186 BIO *in=NULL;
187
188#ifdef OPENSSL_SYS_VMS
189 in=BIO_new_file(name, "r");
190#else
191 in=BIO_new_file(name, "rb");
192#endif
193 if (in == NULL)
194 {
195 if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE)
196 CONFerr(CONF_F_CONF_LOAD,CONF_R_NO_SUCH_FILE);
197 else
198 CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB);
199 return 0;
200 }
201
202 ret = def_load_bio(conf, in, line);
203 BIO_free(in);
204
205 return ret;
206 }
207
208static int def_load_bio(CONF *conf, BIO *in, long *line)
181 { 209 {
182#define BUFSIZE 512 210#define BUFSIZE 512
183 char btmp[16]; 211 char btmp[16];
@@ -418,7 +446,11 @@ err:
418 if (line != NULL) *line=eline; 446 if (line != NULL) *line=eline;
419 sprintf(btmp,"%ld",eline); 447 sprintf(btmp,"%ld",eline);
420 ERR_add_error_data(2,"line ",btmp); 448 ERR_add_error_data(2,"line ",btmp);
421 if ((h != conf->data) && (conf->data != NULL)) CONF_free(conf->data); 449 if ((h != conf->data) && (conf->data != NULL))
450 {
451 CONF_free(conf->data);
452 conf->data=NULL;
453 }
422 if (v != NULL) 454 if (v != NULL)
423 { 455 {
424 if (v->name != NULL) OPENSSL_free(v->name); 456 if (v->name != NULL) OPENSSL_free(v->name);
@@ -685,18 +717,20 @@ static void dump_value(CONF_VALUE *a, BIO *out)
685 BIO_printf(out, "[[%s]]\n", a->section); 717 BIO_printf(out, "[[%s]]\n", a->section);
686 } 718 }
687 719
688static int def_dump(CONF *conf, BIO *out) 720static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE *, BIO *)
721
722static int def_dump(const CONF *conf, BIO *out)
689 { 723 {
690 lh_doall_arg(conf->data, (void (*)())dump_value, out); 724 lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), out);
691 return 1; 725 return 1;
692 } 726 }
693 727
694static int def_is_number(CONF *conf, char c) 728static int def_is_number(const CONF *conf, char c)
695 { 729 {
696 return IS_NUMBER(conf,c); 730 return IS_NUMBER(conf,c);
697 } 731 }
698 732
699static int def_to_int(CONF *conf, char c) 733static int def_to_int(const CONF *conf, char c)
700 { 734 {
701 return c - '0'; 735 return c - '0';
702 } 736 }
diff --git a/src/lib/libcrypto/conf/conf_def.h b/src/lib/libcrypto/conf/conf_def.h
index 3244d9a331..92a7d8ad77 100644
--- a/src/lib/libcrypto/conf/conf_def.h
+++ b/src/lib/libcrypto/conf/conf_def.h
@@ -71,6 +71,7 @@
71#define CONF_COMMENT 128 71#define CONF_COMMENT 128
72#define CONF_FCOMMENT 2048 72#define CONF_FCOMMENT 2048
73#define CONF_EOF 8 73#define CONF_EOF 8
74#define CONF_HIGHBIT 4096
74#define CONF_ALPHA (CONF_UPPER|CONF_LOWER) 75#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
75#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) 76#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
76#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \ 77#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \
@@ -78,68 +79,102 @@
78 79
79#define KEYTYPES(c) ((unsigned short *)((c)->meth_data)) 80#define KEYTYPES(c) ((unsigned short *)((c)->meth_data))
80#ifndef CHARSET_EBCDIC 81#ifndef CHARSET_EBCDIC
81#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_COMMENT) 82#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
82#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_FCOMMENT) 83#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
83#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_EOF) 84#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
84#define IS_ESC(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_ESC) 85#define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
85#define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_NUMBER) 86#define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
86#define IS_WS(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_WS) 87#define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS)
87#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_ALPHA_NUMERIC) 88#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
88#define IS_ALPHA_NUMERIC_PUNCT(c,a) \ 89#define IS_ALPHA_NUMERIC_PUNCT(c,a) \
89 (KEYTYPES(c)[(a)&0x7f]&CONF_ALPHA_NUMERIC_PUNCT) 90 (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
90#define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_QUOTE) 91#define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
91#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_DQUOTE) 92#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
93#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
92 94
93#else /*CHARSET_EBCDIC*/ 95#else /*CHARSET_EBCDIC*/
94 96
95#define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_COMMENT) 97#define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_COMMENT)
96#define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_FCOMMENT) 98#define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_FCOMMENT)
97#define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_EOF) 99#define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_EOF)
98#define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_ESC) 100#define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ESC)
99#define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_NUMBER) 101#define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_NUMBER)
100#define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_WS) 102#define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_WS)
101#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_ALPHA_NUMERIC) 103#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC)
102#define IS_ALPHA_NUMERIC_PUNCT(c,a) \ 104#define IS_ALPHA_NUMERIC_PUNCT(c,a) \
103 (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_ALPHA_NUMERIC_PUNCT) 105 (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
104#define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_QUOTE) 106#define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_QUOTE)
105#define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_DQUOTE) 107#define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_DQUOTE)
108#define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_HIGHBIT)
106#endif /*CHARSET_EBCDIC*/ 109#endif /*CHARSET_EBCDIC*/
107 110
108static unsigned short CONF_type_default[128]={ 111static unsigned short CONF_type_default[256]={
109 0x008,0x000,0x000,0x000,0x000,0x000,0x000,0x000, 112 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
110 0x000,0x010,0x010,0x000,0x000,0x010,0x000,0x000, 113 0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000,
111 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, 114 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
112 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, 115 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
113 0x010,0x200,0x040,0x080,0x000,0x200,0x200,0x040, 116 0x0010,0x0200,0x0040,0x0080,0x0000,0x0200,0x0200,0x0040,
114 0x000,0x000,0x200,0x200,0x200,0x200,0x200,0x200, 117 0x0000,0x0000,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
115 0x001,0x001,0x001,0x001,0x001,0x001,0x001,0x001, 118 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
116 0x001,0x001,0x000,0x200,0x000,0x000,0x000,0x200, 119 0x0001,0x0001,0x0000,0x0200,0x0000,0x0000,0x0000,0x0200,
117 0x200,0x002,0x002,0x002,0x002,0x002,0x002,0x002, 120 0x0200,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
118 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, 121 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
119 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, 122 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
120 0x002,0x002,0x002,0x000,0x020,0x000,0x200,0x100, 123 0x0002,0x0002,0x0002,0x0000,0x0020,0x0000,0x0200,0x0100,
121 0x040,0x004,0x004,0x004,0x004,0x004,0x004,0x004, 124 0x0040,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,
122 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, 125 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,
123 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, 126 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,
124 0x004,0x004,0x004,0x000,0x200,0x000,0x200,0x000, 127 0x0004,0x0004,0x0004,0x0000,0x0200,0x0000,0x0200,0x0000,
128 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
129 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
130 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
131 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
132 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
133 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
134 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
135 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
136 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
137 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
138 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
139 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
140 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
141 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
142 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
143 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
125 }; 144 };
126 145
127static unsigned short CONF_type_win32[128]={ 146static unsigned short CONF_type_win32[256]={
128 0x008,0x000,0x000,0x000,0x000,0x000,0x000,0x000, 147 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
129 0x000,0x010,0x010,0x000,0x000,0x010,0x000,0x000, 148 0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000,
130 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, 149 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
131 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, 150 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
132 0x010,0x200,0x400,0x000,0x000,0x200,0x200,0x000, 151 0x0010,0x0200,0x0400,0x0000,0x0000,0x0200,0x0200,0x0000,
133 0x000,0x000,0x200,0x200,0x200,0x200,0x200,0x200, 152 0x0000,0x0000,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
134 0x001,0x001,0x001,0x001,0x001,0x001,0x001,0x001, 153 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
135 0x001,0x001,0x000,0xA00,0x000,0x000,0x000,0x200, 154 0x0001,0x0001,0x0000,0x0A00,0x0000,0x0000,0x0000,0x0200,
136 0x200,0x002,0x002,0x002,0x002,0x002,0x002,0x002, 155 0x0200,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
137 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, 156 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
138 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, 157 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
139 0x002,0x002,0x002,0x000,0x000,0x000,0x200,0x100, 158 0x0002,0x0002,0x0002,0x0000,0x0000,0x0000,0x0200,0x0100,
140 0x000,0x004,0x004,0x004,0x004,0x004,0x004,0x004, 159 0x0000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,
141 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, 160 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,
142 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, 161 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,
143 0x004,0x004,0x004,0x000,0x200,0x000,0x200,0x000, 162 0x0004,0x0004,0x0004,0x0000,0x0200,0x0000,0x0200,0x0000,
163 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
164 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
165 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
166 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
167 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
168 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
169 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
170 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
171 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
172 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
173 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
174 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
175 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
176 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
177 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
178 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
144 }; 179 };
145 180
diff --git a/src/lib/libcrypto/conf/conf_err.c b/src/lib/libcrypto/conf/conf_err.c
index a8db8f266f..ee07bfe9d9 100644
--- a/src/lib/libcrypto/conf/conf_err.c
+++ b/src/lib/libcrypto/conf/conf_err.c
@@ -1,93 +1,123 @@
1/* lib/conf/conf_err.c */ 1/* crypto/conf/conf_err.c */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* ====================================================================
3 * All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 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 5 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
25 * are met: 7 * are met:
26 * 1. Redistributions of source code must retain the copyright 8 *
27 * notice, this list of conditions and the following disclaimer. 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
28 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in
30 * documentation and/or other materials provided with the distribution. 14 * the documentation and/or other materials provided with the
31 * 3. All advertising materials mentioning features or use of this software 15 * distribution.
32 * must display the following acknowledgement: 16 *
33 * "This product includes cryptographic software written by 17 * 3. All advertising materials mentioning features or use of this
34 * Eric Young (eay@cryptsoft.com)" 18 * software must display the following acknowledgment:
35 * The word 'cryptographic' can be left out if the rouines from the library 19 * "This product includes software developed by the OpenSSL Project
36 * being used are not cryptographic related :-). 20 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
37 * 4. If you include any Windows specific code (or a derivative thereof) from 21 *
38 * the apps directory (application code) you must include an acknowledgement: 22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 23 * endorse or promote products derived from this software without
40 * 24 * prior written permission. For written permission, please contact
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 25 * openssl-core@OpenSSL.org.
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 *
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * 5. Products derived from this software may not be called "OpenSSL"
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 28 * nor may "OpenSSL" appear in their names without prior written
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * permission of the OpenSSL Project.
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 *
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * 6. Redistributions of any form whatsoever must retain the following
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * acknowledgment:
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * "This product includes software developed by the OpenSSL Project
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
51 * SUCH DAMAGE. 35 *
52 * 36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
53 * The licence and distribution terms for any publically available version or 37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * derivative of this code cannot be changed. i.e. this code cannot simply be 38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
55 * copied and put under another distribution licence 39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
56 * [including the GNU Public Licence.] 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 *
57 */ 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
58#include <stdio.h> 61#include <stdio.h>
59#include "err.h" 62#include <openssl/err.h>
60#include "conf.h" 63#include <openssl/conf.h>
61 64
62/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
63#ifndef NO_ERR 66#ifndef OPENSSL_NO_ERR
64static ERR_STRING_DATA CONF_str_functs[]= 67static ERR_STRING_DATA CONF_str_functs[]=
65 { 68 {
69{ERR_PACK(0,CONF_F_CONF_DUMP_FP,0), "CONF_dump_fp"},
66{ERR_PACK(0,CONF_F_CONF_LOAD,0), "CONF_load"}, 70{ERR_PACK(0,CONF_F_CONF_LOAD,0), "CONF_load"},
71{ERR_PACK(0,CONF_F_CONF_LOAD_BIO,0), "CONF_load_bio"},
72{ERR_PACK(0,CONF_F_CONF_LOAD_FP,0), "CONF_load_fp"},
73{ERR_PACK(0,CONF_F_CONF_MODULES_LOAD,0), "CONF_modules_load"},
74{ERR_PACK(0,CONF_F_MODULE_INIT,0), "MODULE_INIT"},
75{ERR_PACK(0,CONF_F_MODULE_LOAD_DSO,0), "MODULE_LOAD_DSO"},
76{ERR_PACK(0,CONF_F_MODULE_RUN,0), "MODULE_RUN"},
77{ERR_PACK(0,CONF_F_NCONF_DUMP_BIO,0), "NCONF_dump_bio"},
78{ERR_PACK(0,CONF_F_NCONF_DUMP_FP,0), "NCONF_dump_fp"},
79{ERR_PACK(0,CONF_F_NCONF_GET_NUMBER,0), "NCONF_get_number"},
80{ERR_PACK(0,CONF_F_NCONF_GET_NUMBER_E,0), "NCONF_get_number_e"},
81{ERR_PACK(0,CONF_F_NCONF_GET_SECTION,0), "NCONF_get_section"},
82{ERR_PACK(0,CONF_F_NCONF_GET_STRING,0), "NCONF_get_string"},
83{ERR_PACK(0,CONF_F_NCONF_LOAD,0), "NCONF_load"},
84{ERR_PACK(0,CONF_F_NCONF_LOAD_BIO,0), "NCONF_load_bio"},
85{ERR_PACK(0,CONF_F_NCONF_LOAD_FP,0), "NCONF_load_fp"},
86{ERR_PACK(0,CONF_F_NCONF_NEW,0), "NCONF_new"},
67{ERR_PACK(0,CONF_F_STR_COPY,0), "STR_COPY"}, 87{ERR_PACK(0,CONF_F_STR_COPY,0), "STR_COPY"},
68{0,NULL}, 88{0,NULL}
69 }; 89 };
70 90
71static ERR_STRING_DATA CONF_str_reasons[]= 91static ERR_STRING_DATA CONF_str_reasons[]=
72 { 92 {
93{CONF_R_ERROR_LOADING_DSO ,"error loading dso"},
73{CONF_R_MISSING_CLOSE_SQUARE_BRACKET ,"missing close square bracket"}, 94{CONF_R_MISSING_CLOSE_SQUARE_BRACKET ,"missing close square bracket"},
74{CONF_R_MISSING_EQUAL_SIGN ,"missing equal sign"}, 95{CONF_R_MISSING_EQUAL_SIGN ,"missing equal sign"},
96{CONF_R_MISSING_FINISH_FUNCTION ,"missing finish function"},
97{CONF_R_MISSING_INIT_FUNCTION ,"missing init function"},
98{CONF_R_MODULE_INITIALIZATION_ERROR ,"module initialization error"},
75{CONF_R_NO_CLOSE_BRACE ,"no close brace"}, 99{CONF_R_NO_CLOSE_BRACE ,"no close brace"},
100{CONF_R_NO_CONF ,"no conf"},
101{CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE ,"no conf or environment variable"},
102{CONF_R_NO_SECTION ,"no section"},
103{CONF_R_NO_SUCH_FILE ,"no such file"},
104{CONF_R_NO_VALUE ,"no value"},
76{CONF_R_UNABLE_TO_CREATE_NEW_SECTION ,"unable to create new section"}, 105{CONF_R_UNABLE_TO_CREATE_NEW_SECTION ,"unable to create new section"},
106{CONF_R_UNKNOWN_MODULE_NAME ,"unknown module name"},
77{CONF_R_VARIABLE_HAS_NO_VALUE ,"variable has no value"}, 107{CONF_R_VARIABLE_HAS_NO_VALUE ,"variable has no value"},
78{0,NULL}, 108{0,NULL}
79 }; 109 };
80 110
81#endif 111#endif
82 112
83void ERR_load_CONF_strings() 113void ERR_load_CONF_strings(void)
84 { 114 {
85 static int init=1; 115 static int init=1;
86 116
87 if (init); 117 if (init)
88 {; 118 {
89 init=0; 119 init=0;
90#ifndef NO_ERR 120#ifndef OPENSSL_NO_ERR
91 ERR_load_strings(ERR_LIB_CONF,CONF_str_functs); 121 ERR_load_strings(ERR_LIB_CONF,CONF_str_functs);
92 ERR_load_strings(ERR_LIB_CONF,CONF_str_reasons); 122 ERR_load_strings(ERR_LIB_CONF,CONF_str_reasons);
93#endif 123#endif
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c
index 4c8ca9e9ae..7998f34c7b 100644
--- a/src/lib/libcrypto/conf/conf_lib.c
+++ b/src/lib/libcrypto/conf/conf_lib.c
@@ -67,6 +67,17 @@ const char *CONF_version="CONF" OPENSSL_VERSION_PTEXT;
67 67
68static CONF_METHOD *default_CONF_method=NULL; 68static CONF_METHOD *default_CONF_method=NULL;
69 69
70/* Init a 'CONF' structure from an old LHASH */
71
72void CONF_set_nconf(CONF *conf, LHASH *hash)
73 {
74 if (default_CONF_method == NULL)
75 default_CONF_method = NCONF_default();
76
77 default_CONF_method->init(conf);
78 conf->data = hash;
79 }
80
70/* The following section contains the "CONF classic" functions, 81/* The following section contains the "CONF classic" functions,
71 rewritten in terms of the new CONF interface. */ 82 rewritten in terms of the new CONF interface. */
72 83
@@ -81,7 +92,7 @@ LHASH *CONF_load(LHASH *conf, const char *file, long *eline)
81 LHASH *ltmp; 92 LHASH *ltmp;
82 BIO *in=NULL; 93 BIO *in=NULL;
83 94
84#ifdef VMS 95#ifdef OPENSSL_SYS_VMS
85 in=BIO_new_file(file, "r"); 96 in=BIO_new_file(file, "r");
86#else 97#else
87 in=BIO_new_file(file, "rb"); 98 in=BIO_new_file(file, "rb");
@@ -98,7 +109,7 @@ LHASH *CONF_load(LHASH *conf, const char *file, long *eline)
98 return ltmp; 109 return ltmp;
99 } 110 }
100 111
101#ifndef NO_FP_API 112#ifndef OPENSSL_NO_FP_API
102LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline) 113LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline)
103 { 114 {
104 BIO *btmp; 115 BIO *btmp;
@@ -118,66 +129,74 @@ LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline)
118 CONF ctmp; 129 CONF ctmp;
119 int ret; 130 int ret;
120 131
121 if (default_CONF_method == NULL) 132 CONF_set_nconf(&ctmp, conf);
122 default_CONF_method = NCONF_default();
123 133
124 default_CONF_method->init(&ctmp);
125 ctmp.data = conf;
126 ret = NCONF_load_bio(&ctmp, bp, eline); 134 ret = NCONF_load_bio(&ctmp, bp, eline);
127 if (ret) 135 if (ret)
128 return ctmp.data; 136 return ctmp.data;
129 return NULL; 137 return NULL;
130 } 138 }
131 139
132STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section) 140STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section)
133 { 141 {
134 CONF ctmp; 142 if (conf == NULL)
135 143 {
136 if (default_CONF_method == NULL) 144 return NULL;
137 default_CONF_method = NCONF_default(); 145 }
138 146 else
139 default_CONF_method->init(&ctmp); 147 {
140 ctmp.data = conf; 148 CONF ctmp;
141 return NCONF_get_section(&ctmp, section); 149 CONF_set_nconf(&ctmp, conf);
150 return NCONF_get_section(&ctmp, section);
151 }
142 } 152 }
143 153
144char *CONF_get_string(LHASH *conf,char *group,char *name) 154char *CONF_get_string(LHASH *conf,const char *group,const char *name)
145 { 155 {
146 CONF ctmp; 156 if (conf == NULL)
147 157 {
148 if (default_CONF_method == NULL) 158 return NCONF_get_string(NULL, group, name);
149 default_CONF_method = NCONF_default(); 159 }
150 160 else
151 default_CONF_method->init(&ctmp); 161 {
152 ctmp.data = conf; 162 CONF ctmp;
153 return NCONF_get_string(&ctmp, group, name); 163 CONF_set_nconf(&ctmp, conf);
164 return NCONF_get_string(&ctmp, group, name);
165 }
154 } 166 }
155 167
156long CONF_get_number(LHASH *conf,char *group,char *name) 168long CONF_get_number(LHASH *conf,const char *group,const char *name)
157 { 169 {
158 CONF ctmp; 170 int status;
171 long result = 0;
159 172
160 if (default_CONF_method == NULL) 173 if (conf == NULL)
161 default_CONF_method = NCONF_default(); 174 {
175 status = NCONF_get_number_e(NULL, group, name, &result);
176 }
177 else
178 {
179 CONF ctmp;
180 CONF_set_nconf(&ctmp, conf);
181 status = NCONF_get_number_e(&ctmp, group, name, &result);
182 }
162 183
163 default_CONF_method->init(&ctmp); 184 if (status == 0)
164 ctmp.data = conf; 185 {
165 return NCONF_get_number(&ctmp, group, name); 186 /* This function does not believe in errors... */
187 ERR_get_error();
188 }
189 return result;
166 } 190 }
167 191
168void CONF_free(LHASH *conf) 192void CONF_free(LHASH *conf)
169 { 193 {
170 CONF ctmp; 194 CONF ctmp;
171 195 CONF_set_nconf(&ctmp, conf);
172 if (default_CONF_method == NULL)
173 default_CONF_method = NCONF_default();
174
175 default_CONF_method->init(&ctmp);
176 ctmp.data = conf;
177 NCONF_free_data(&ctmp); 196 NCONF_free_data(&ctmp);
178 } 197 }
179 198
180#ifndef NO_FP_API 199#ifndef OPENSSL_NO_FP_API
181int CONF_dump_fp(LHASH *conf, FILE *out) 200int CONF_dump_fp(LHASH *conf, FILE *out)
182 { 201 {
183 BIO *btmp; 202 BIO *btmp;
@@ -196,12 +215,7 @@ int CONF_dump_fp(LHASH *conf, FILE *out)
196int CONF_dump_bio(LHASH *conf, BIO *out) 215int CONF_dump_bio(LHASH *conf, BIO *out)
197 { 216 {
198 CONF ctmp; 217 CONF ctmp;
199 218 CONF_set_nconf(&ctmp, conf);
200 if (default_CONF_method == NULL)
201 default_CONF_method = NCONF_default();
202
203 default_CONF_method->init(&ctmp);
204 ctmp.data = conf;
205 return NCONF_dump_bio(&ctmp, out); 219 return NCONF_dump_bio(&ctmp, out);
206 } 220 }
207 221
@@ -244,34 +258,23 @@ void NCONF_free_data(CONF *conf)
244 258
245int NCONF_load(CONF *conf, const char *file, long *eline) 259int NCONF_load(CONF *conf, const char *file, long *eline)
246 { 260 {
247 int ret; 261 if (conf == NULL)
248 BIO *in=NULL;
249
250#ifdef VMS
251 in=BIO_new_file(file, "r");
252#else
253 in=BIO_new_file(file, "rb");
254#endif
255 if (in == NULL)
256 { 262 {
257 CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); 263 CONFerr(CONF_F_NCONF_LOAD,CONF_R_NO_CONF);
258 return 0; 264 return 0;
259 } 265 }
260 266
261 ret = NCONF_load_bio(conf, in, eline); 267 return conf->meth->load(conf, file, eline);
262 BIO_free(in);
263
264 return ret;
265 } 268 }
266 269
267#ifndef NO_FP_API 270#ifndef OPENSSL_NO_FP_API
268int NCONF_load_fp(CONF *conf, FILE *fp,long *eline) 271int NCONF_load_fp(CONF *conf, FILE *fp,long *eline)
269 { 272 {
270 BIO *btmp; 273 BIO *btmp;
271 int ret; 274 int ret;
272 if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) 275 if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE)))
273 { 276 {
274 CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB); 277 CONFerr(CONF_F_NCONF_LOAD_FP,ERR_R_BUF_LIB);
275 return 0; 278 return 0;
276 } 279 }
277 ret = NCONF_load_bio(conf, btmp, eline); 280 ret = NCONF_load_bio(conf, btmp, eline);
@@ -288,10 +291,10 @@ int NCONF_load_bio(CONF *conf, BIO *bp,long *eline)
288 return 0; 291 return 0;
289 } 292 }
290 293
291 return conf->meth->load(conf, bp, eline); 294 return conf->meth->load_bio(conf, bp, eline);
292 } 295 }
293 296
294STACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section) 297STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section)
295 { 298 {
296 if (conf == NULL) 299 if (conf == NULL)
297 { 300 {
@@ -299,33 +302,62 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section)
299 return NULL; 302 return NULL;
300 } 303 }
301 304
305 if (section == NULL)
306 {
307 CONFerr(CONF_F_NCONF_GET_SECTION,CONF_R_NO_SECTION);
308 return NULL;
309 }
310
302 return _CONF_get_section_values(conf, section); 311 return _CONF_get_section_values(conf, section);
303 } 312 }
304 313
305char *NCONF_get_string(CONF *conf,char *group,char *name) 314char *NCONF_get_string(const CONF *conf,const char *group,const char *name)
306 { 315 {
316 char *s = _CONF_get_string(conf, group, name);
317
318 /* Since we may get a value from an environment variable even
319 if conf is NULL, let's check the value first */
320 if (s) return s;
321
307 if (conf == NULL) 322 if (conf == NULL)
308 { 323 {
309 CONFerr(CONF_F_NCONF_GET_STRING,CONF_R_NO_CONF); 324 CONFerr(CONF_F_NCONF_GET_STRING,
325 CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE);
310 return NULL; 326 return NULL;
311 } 327 }
312 328 CONFerr(CONF_F_NCONF_GET_STRING,
313 return _CONF_get_string(conf, group, name); 329 CONF_R_NO_VALUE);
330 ERR_add_error_data(4,"group=",group," name=",name);
331 return NULL;
314 } 332 }
315 333
316long NCONF_get_number(CONF *conf,char *group,char *name) 334int NCONF_get_number_e(const CONF *conf,const char *group,const char *name,
335 long *result)
317 { 336 {
318 if (conf == NULL) 337 char *str;
338
339 if (result == NULL)
319 { 340 {
320 CONFerr(CONF_F_NCONF_GET_NUMBER,CONF_R_NO_CONF); 341 CONFerr(CONF_F_NCONF_GET_NUMBER_E,ERR_R_PASSED_NULL_PARAMETER);
321 return 0; 342 return 0;
322 } 343 }
323 344
324 return _CONF_get_number(conf, group, name); 345 str = NCONF_get_string(conf,group,name);
346
347 if (str == NULL)
348 return 0;
349
350 for (*result = 0;conf->meth->is_number(conf, *str);)
351 {
352 *result = (*result)*10 + conf->meth->to_int(conf, *str);
353 str++;
354 }
355
356 return 1;
325 } 357 }
326 358
327#ifndef NO_FP_API 359#ifndef OPENSSL_NO_FP_API
328int NCONF_dump_fp(CONF *conf, FILE *out) 360int NCONF_dump_fp(const CONF *conf, FILE *out)
329 { 361 {
330 BIO *btmp; 362 BIO *btmp;
331 int ret; 363 int ret;
@@ -339,7 +371,7 @@ int NCONF_dump_fp(CONF *conf, FILE *out)
339 } 371 }
340#endif 372#endif
341 373
342int NCONF_dump_bio(CONF *conf, BIO *out) 374int NCONF_dump_bio(const CONF *conf, BIO *out)
343 { 375 {
344 if (conf == NULL) 376 if (conf == NULL)
345 { 377 {
@@ -350,3 +382,19 @@ int NCONF_dump_bio(CONF *conf, BIO *out)
350 return conf->meth->dump(conf, out); 382 return conf->meth->dump(conf, out);
351 } 383 }
352 384
385/* This function should be avoided */
386#undef NCONF_get_number
387long NCONF_get_number(CONF *conf,char *group,char *name)
388 {
389 int status;
390 long ret=0;
391
392 status = NCONF_get_number_e(conf, group, name, &ret);
393 if (status == 0)
394 {
395 /* This function does not believe in errors... */
396 ERR_get_error();
397 }
398 return ret;
399 }
400
diff --git a/src/lib/libcrypto/conf/keysets.pl b/src/lib/libcrypto/conf/keysets.pl
index e40fed0ca1..50ed67fa52 100644
--- a/src/lib/libcrypto/conf/keysets.pl
+++ b/src/lib/libcrypto/conf/keysets.pl
@@ -1,16 +1,20 @@
1#!/usr/bin/perl 1#!/usr/local/bin/perl
2 2
3$NUMBER=0x01; 3$NUMBER=0x01;
4$UPPER=0x02; 4$UPPER=0x02;
5$LOWER=0x04; 5$LOWER=0x04;
6$EOF=0x08; 6$UNDER=0x100;
7$PUNCTUATION=0x200;
7$WS=0x10; 8$WS=0x10;
8$ESC=0x20; 9$ESC=0x20;
9$QUOTE=0x40; 10$QUOTE=0x40;
11$DQUOTE=0x400;
10$COMMENT=0x80; 12$COMMENT=0x80;
11$UNDER=0x100; 13$FCOMMENT=0x800;
14$EOF=0x08;
15$HIGHBIT=0x1000;
12 16
13foreach (0 .. 127) 17foreach (0 .. 255)
14 { 18 {
15 $v=0; 19 $v=0;
16 $c=sprintf("%c",$_); 20 $c=sprintf("%c",$_);
@@ -18,44 +22,164 @@ foreach (0 .. 127)
18 $v|=$UPPER if ($c =~ /[A-Z]/); 22 $v|=$UPPER if ($c =~ /[A-Z]/);
19 $v|=$LOWER if ($c =~ /[a-z]/); 23 $v|=$LOWER if ($c =~ /[a-z]/);
20 $v|=$UNDER if ($c =~ /_/); 24 $v|=$UNDER if ($c =~ /_/);
21 $v|=$WS if ($c =~ / \t\r\n/); 25 $v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/);
26 $v|=$WS if ($c =~ /[ \t\r\n]/);
22 $v|=$ESC if ($c =~ /\\/); 27 $v|=$ESC if ($c =~ /\\/);
23 $v|=$QUOTE if ($c =~ /['`"]/); 28 $v|=$QUOTE if ($c =~ /['`"]/); # for emacs: "`'}/)
24 $v|=$COMMENT if ($c =~ /\#/); 29 $v|=$COMMENT if ($c =~ /\#/);
25 $v|=$EOF if ($c =~ /\0/); 30 $v|=$EOF if ($c =~ /\0/);
31 $v|=$HIGHBIT if ($c =~/[\x80-\xff]/);
32
33 push(@V_def,$v);
34 }
35
36foreach (0 .. 255)
37 {
38 $v=0;
39 $c=sprintf("%c",$_);
40 $v|=$NUMBER if ($c =~ /[0-9]/);
41 $v|=$UPPER if ($c =~ /[A-Z]/);
42 $v|=$LOWER if ($c =~ /[a-z]/);
43 $v|=$UNDER if ($c =~ /_/);
44 $v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/);
45 $v|=$WS if ($c =~ /[ \t\r\n]/);
46 $v|=$DQUOTE if ($c =~ /["]/); # for emacs: "}/)
47 $v|=$FCOMMENT if ($c =~ /;/);
48 $v|=$EOF if ($c =~ /\0/);
49 $v|=$HIGHBIT if ($c =~/[\x80-\xff]/);
26 50
27 push(@V,$v); 51 push(@V_w32,$v);
28 } 52 }
29 53
30print <<"EOF"; 54print <<"EOF";
55/* crypto/conf/conf_def.h */
56/* Copyright (C) 1995-1998 Eric Young (eay\@cryptsoft.com)
57 * All rights reserved.
58 *
59 * This package is an SSL implementation written
60 * by Eric Young (eay\@cryptsoft.com).
61 * The implementation was written so as to conform with Netscapes SSL.
62 *
63 * This library is free for commercial and non-commercial use as long as
64 * the following conditions are aheared to. The following conditions
65 * apply to all code found in this distribution, be it the RC4, RSA,
66 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
67 * included with this distribution is covered by the same copyright terms
68 * except that the holder is Tim Hudson (tjh\@cryptsoft.com).
69 *
70 * Copyright remains Eric Young's, and as such any Copyright notices in
71 * the code are not to be removed.
72 * If this package is used in a product, Eric Young should be given attribution
73 * as the author of the parts of the library used.
74 * This can be in the form of a textual message at program startup or
75 * in documentation (online or textual) provided with the package.
76 *
77 * Redistribution and use in source and binary forms, with or without
78 * modification, are permitted provided that the following conditions
79 * are met:
80 * 1. Redistributions of source code must retain the copyright
81 * notice, this list of conditions and the following disclaimer.
82 * 2. Redistributions in binary form must reproduce the above copyright
83 * notice, this list of conditions and the following disclaimer in the
84 * documentation and/or other materials provided with the distribution.
85 * 3. All advertising materials mentioning features or use of this software
86 * must display the following acknowledgement:
87 * "This product includes cryptographic software written by
88 * Eric Young (eay\@cryptsoft.com)"
89 * The word 'cryptographic' can be left out if the rouines from the library
90 * being used are not cryptographic related :-).
91 * 4. If you include any Windows specific code (or a derivative thereof) from
92 * the apps directory (application code) you must include an acknowledgement:
93 * "This product includes software written by Tim Hudson (tjh\@cryptsoft.com)"
94 *
95 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
96 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
97 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
98 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
99 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
100 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
101 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
102 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
103 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
104 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
105 * SUCH DAMAGE.
106 *
107 * The licence and distribution terms for any publically available version or
108 * derivative of this code cannot be changed. i.e. this code cannot simply be
109 * copied and put under another distribution licence
110 * [including the GNU Public Licence.]
111 */
112
113/* THIS FILE WAS AUTOMAGICALLY GENERATED!
114 Please modify and use keysets.pl to regenerate it. */
115
31#define CONF_NUMBER $NUMBER 116#define CONF_NUMBER $NUMBER
32#define CONF_UPPER $UPPER 117#define CONF_UPPER $UPPER
33#define CONF_LOWER $LOWER 118#define CONF_LOWER $LOWER
34#define CONF_EOF $EOF 119#define CONF_UNDER $UNDER
120#define CONF_PUNCTUATION $PUNCTUATION
35#define CONF_WS $WS 121#define CONF_WS $WS
36#define CONF_ESC $ESC 122#define CONF_ESC $ESC
37#define CONF_QUOTE $QUOTE 123#define CONF_QUOTE $QUOTE
124#define CONF_DQUOTE $DQUOTE
38#define CONF_COMMENT $COMMENT 125#define CONF_COMMENT $COMMENT
126#define CONF_FCOMMENT $FCOMMENT
127#define CONF_EOF $EOF
128#define CONF_HIGHBIT $HIGHBIT
39#define CONF_ALPHA (CONF_UPPER|CONF_LOWER) 129#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
40#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) 130#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
41#define CONF_UNDER $UNDER 131#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \\
132 CONF_PUNCTUATION)
133
134#define KEYTYPES(c) ((unsigned short *)((c)->meth_data))
135#ifndef CHARSET_EBCDIC
136#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
137#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
138#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
139#define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
140#define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
141#define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS)
142#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
143#define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
144 (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
145#define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
146#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
147#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
42 148
43#define IS_COMMENT(a) (CONF_COMMENT&(CONF_type[(a)&0x7f])) 149#else /*CHARSET_EBCDIC*/
44#define IS_EOF(a) ((a) == '\\0') 150
45#define IS_ESC(a) ((a) == '\\\\') 151#define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_COMMENT)
46#define IS_NUMER(a) (CONF_type[(a)&0x7f]&CONF_NUMBER) 152#define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_FCOMMENT)
47#define IS_WS(a) (CONF_type[(a)&0x7f]&CONF_WS) 153#define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_EOF)
48#define IS_ALPHA_NUMERIC(a) (CONF_type[(a)&0x7f]&CONF_ALPHA_NUMERIC) 154#define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ESC)
49#define IS_QUOTE(a) (CONF_type[(a)&0x7f]&CONF_QUOTE) 155#define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_NUMBER)
156#define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_WS)
157#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC)
158#define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
159 (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
160#define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_QUOTE)
161#define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_DQUOTE)
162#define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_HIGHBIT)
163#endif /*CHARSET_EBCDIC*/
50 164
51EOF 165EOF
52 166
53print "static unsigned short CONF_type[128]={"; 167print "static unsigned short CONF_type_default[256]={";
168
169for ($i=0; $i<256; $i++)
170 {
171 print "\n\t" if ($i % 8) == 0;
172 printf "0x%04X,",$V_def[$i];
173 }
174
175print "\n\t};\n\n";
176
177print "static unsigned short CONF_type_win32[256]={";
54 178
55for ($i=0; $i<128; $i++) 179for ($i=0; $i<256; $i++)
56 { 180 {
57 print "\n\t" if ($i % 8) == 0; 181 print "\n\t" if ($i % 8) == 0;
58 printf "0x%03X,",$V[$i]; 182 printf "0x%04X,",$V_w32[$i];
59 } 183 }
60 184
61print "\n\t};\n"; 185print "\n\t};\n\n";