summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/conf
diff options
context:
space:
mode:
authordjm <>2008-09-06 12:17:54 +0000
committerdjm <>2008-09-06 12:17:54 +0000
commit38ce604e3cc97706b876b0525ddff0121115456d (patch)
tree7ccc28afe1789ea3dbedf72365f955d5b8e105b5 /src/lib/libcrypto/conf
parent12867252827c8efaa8ddd1fa3b3d6e321e2bcdef (diff)
downloadopenbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.gz
openbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.bz2
openbsd-38ce604e3cc97706b876b0525ddff0121115456d.zip
resolve conflicts
Diffstat (limited to 'src/lib/libcrypto/conf')
-rw-r--r--src/lib/libcrypto/conf/conf.h6
-rw-r--r--src/lib/libcrypto/conf/conf_api.c2
-rw-r--r--src/lib/libcrypto/conf/conf_def.c36
-rw-r--r--src/lib/libcrypto/conf/conf_err.c11
-rw-r--r--src/lib/libcrypto/conf/conf_lib.c4
-rw-r--r--src/lib/libcrypto/conf/conf_mod.c15
-rw-r--r--src/lib/libcrypto/conf/conf_sap.c4
7 files changed, 41 insertions, 37 deletions
diff --git a/src/lib/libcrypto/conf/conf.h b/src/lib/libcrypto/conf/conf.h
index f4671442ab..8aa06bc5ec 100644
--- a/src/lib/libcrypto/conf/conf.h
+++ b/src/lib/libcrypto/conf/conf.h
@@ -65,6 +65,8 @@
65#include <openssl/safestack.h> 65#include <openssl/safestack.h>
66#include <openssl/e_os2.h> 66#include <openssl/e_os2.h>
67 67
68#include <openssl/ossl_typ.h>
69
68#ifdef __cplusplus 70#ifdef __cplusplus
69extern "C" { 71extern "C" {
70#endif 72#endif
@@ -81,7 +83,6 @@ DECLARE_STACK_OF(CONF_MODULE)
81DECLARE_STACK_OF(CONF_IMODULE) 83DECLARE_STACK_OF(CONF_IMODULE)
82 84
83struct conf_st; 85struct conf_st;
84typedef struct conf_st CONF;
85struct conf_method_st; 86struct conf_method_st;
86typedef struct conf_method_st CONF_METHOD; 87typedef struct conf_method_st CONF_METHOD;
87 88
@@ -113,6 +114,7 @@ typedef void conf_finish_func(CONF_IMODULE *md);
113#define CONF_MFLAGS_SILENT 0x4 114#define CONF_MFLAGS_SILENT 0x4
114#define CONF_MFLAGS_NO_DSO 0x8 115#define CONF_MFLAGS_NO_DSO 0x8
115#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 116#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
117#define CONF_MFLAGS_DEFAULT_SECTION 0x20
116 118
117int CONF_set_default_method(CONF_METHOD *meth); 119int CONF_set_default_method(CONF_METHOD *meth);
118void CONF_set_nconf(CONF *conf,LHASH *hash); 120void CONF_set_nconf(CONF *conf,LHASH *hash);
@@ -212,6 +214,8 @@ void ERR_load_CONF_strings(void);
212#define CONF_F_CONF_LOAD_BIO 102 214#define CONF_F_CONF_LOAD_BIO 102
213#define CONF_F_CONF_LOAD_FP 103 215#define CONF_F_CONF_LOAD_FP 103
214#define CONF_F_CONF_MODULES_LOAD 116 216#define CONF_F_CONF_MODULES_LOAD 116
217#define CONF_F_DEF_LOAD 120
218#define CONF_F_DEF_LOAD_BIO 121
215#define CONF_F_MODULE_INIT 115 219#define CONF_F_MODULE_INIT 115
216#define CONF_F_MODULE_LOAD_DSO 117 220#define CONF_F_MODULE_LOAD_DSO 117
217#define CONF_F_MODULE_RUN 118 221#define CONF_F_MODULE_RUN 118
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c
index 0032baa711..909d72b4b8 100644
--- a/src/lib/libcrypto/conf/conf_api.c
+++ b/src/lib/libcrypto/conf/conf_api.c
@@ -121,7 +121,7 @@ int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)
121 v = (CONF_VALUE *)lh_insert(conf->data, value); 121 v = (CONF_VALUE *)lh_insert(conf->data, value);
122 if (v != NULL) 122 if (v != NULL)
123 { 123 {
124 sk_CONF_VALUE_delete_ptr(ts,v); 124 (void)sk_CONF_VALUE_delete_ptr(ts,v);
125 OPENSSL_free(v->name); 125 OPENSSL_free(v->name);
126 OPENSSL_free(v->value); 126 OPENSSL_free(v->value);
127 OPENSSL_free(v); 127 OPENSSL_free(v);
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c
index 2464f8ed90..d8bce8732a 100644
--- a/src/lib/libcrypto/conf/conf_def.c
+++ b/src/lib/libcrypto/conf/conf_def.c
@@ -60,6 +60,7 @@
60 60
61#include <stdio.h> 61#include <stdio.h>
62#include <string.h> 62#include <string.h>
63#include "cryptlib.h"
63#include <openssl/stack.h> 64#include <openssl/stack.h>
64#include <openssl/lhash.h> 65#include <openssl/lhash.h>
65#include <openssl/conf.h> 66#include <openssl/conf.h>
@@ -67,7 +68,6 @@
67#include "conf_def.h" 68#include "conf_def.h"
68#include <openssl/buffer.h> 69#include <openssl/buffer.h>
69#include <openssl/err.h> 70#include <openssl/err.h>
70#include "cryptlib.h"
71 71
72static char *eat_ws(CONF *conf, char *p); 72static char *eat_ws(CONF *conf, char *p);
73static char *eat_alpha_numeric(CONF *conf, char *p); 73static char *eat_alpha_numeric(CONF *conf, char *p);
@@ -88,7 +88,7 @@ static int def_dump(const CONF *conf, BIO *bp);
88static int def_is_number(const CONF *conf, char c); 88static int def_is_number(const CONF *conf, char c);
89static int def_to_int(const CONF *conf, char c); 89static int def_to_int(const CONF *conf, char c);
90 90
91const char *CONF_def_version="CONF_def" OPENSSL_VERSION_PTEXT; 91const char CONF_def_version[]="CONF_def" OPENSSL_VERSION_PTEXT;
92 92
93static CONF_METHOD default_method = { 93static CONF_METHOD default_method = {
94 "OpenSSL default", 94 "OpenSSL default",
@@ -194,9 +194,9 @@ static int def_load(CONF *conf, const char *name, long *line)
194 if (in == NULL) 194 if (in == NULL)
195 { 195 {
196 if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE) 196 if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE)
197 CONFerr(CONF_F_CONF_LOAD,CONF_R_NO_SUCH_FILE); 197 CONFerr(CONF_F_DEF_LOAD,CONF_R_NO_SUCH_FILE);
198 else 198 else
199 CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); 199 CONFerr(CONF_F_DEF_LOAD,ERR_R_SYS_LIB);
200 return 0; 200 return 0;
201 } 201 }
202 202
@@ -225,28 +225,28 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
225 225
226 if ((buff=BUF_MEM_new()) == NULL) 226 if ((buff=BUF_MEM_new()) == NULL)
227 { 227 {
228 CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB); 228 CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_BUF_LIB);
229 goto err; 229 goto err;
230 } 230 }
231 231
232 section=(char *)OPENSSL_malloc(10); 232 section=(char *)OPENSSL_malloc(10);
233 if (section == NULL) 233 if (section == NULL)
234 { 234 {
235 CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE); 235 CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE);
236 goto err; 236 goto err;
237 } 237 }
238 BUF_strlcpy(section,"default",10); 238 BUF_strlcpy(section,"default",10);
239 239
240 if (_CONF_new_data(conf) == 0) 240 if (_CONF_new_data(conf) == 0)
241 { 241 {
242 CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE); 242 CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE);
243 goto err; 243 goto err;
244 } 244 }
245 245
246 sv=_CONF_new_section(conf,section); 246 sv=_CONF_new_section(conf,section);
247 if (sv == NULL) 247 if (sv == NULL)
248 { 248 {
249 CONFerr(CONF_F_CONF_LOAD_BIO, 249 CONFerr(CONF_F_DEF_LOAD_BIO,
250 CONF_R_UNABLE_TO_CREATE_NEW_SECTION); 250 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
251 goto err; 251 goto err;
252 } 252 }
@@ -258,7 +258,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
258 { 258 {
259 if (!BUF_MEM_grow(buff,bufnum+CONFBUFSIZE)) 259 if (!BUF_MEM_grow(buff,bufnum+CONFBUFSIZE))
260 { 260 {
261 CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB); 261 CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_BUF_LIB);
262 goto err; 262 goto err;
263 } 263 }
264 p= &(buff->data[bufnum]); 264 p= &(buff->data[bufnum]);
@@ -329,7 +329,7 @@ again:
329 ss=p; 329 ss=p;
330 goto again; 330 goto again;
331 } 331 }
332 CONFerr(CONF_F_CONF_LOAD_BIO, 332 CONFerr(CONF_F_DEF_LOAD_BIO,
333 CONF_R_MISSING_CLOSE_SQUARE_BRACKET); 333 CONF_R_MISSING_CLOSE_SQUARE_BRACKET);
334 goto err; 334 goto err;
335 } 335 }
@@ -339,7 +339,7 @@ again:
339 sv=_CONF_new_section(conf,section); 339 sv=_CONF_new_section(conf,section);
340 if (sv == NULL) 340 if (sv == NULL)
341 { 341 {
342 CONFerr(CONF_F_CONF_LOAD_BIO, 342 CONFerr(CONF_F_DEF_LOAD_BIO,
343 CONF_R_UNABLE_TO_CREATE_NEW_SECTION); 343 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
344 goto err; 344 goto err;
345 } 345 }
@@ -362,7 +362,7 @@ again:
362 p=eat_ws(conf, end); 362 p=eat_ws(conf, end);
363 if (*p != '=') 363 if (*p != '=')
364 { 364 {
365 CONFerr(CONF_F_CONF_LOAD_BIO, 365 CONFerr(CONF_F_DEF_LOAD_BIO,
366 CONF_R_MISSING_EQUAL_SIGN); 366 CONF_R_MISSING_EQUAL_SIGN);
367 goto err; 367 goto err;
368 } 368 }
@@ -379,7 +379,7 @@ again:
379 379
380 if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) 380 if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))))
381 { 381 {
382 CONFerr(CONF_F_CONF_LOAD_BIO, 382 CONFerr(CONF_F_DEF_LOAD_BIO,
383 ERR_R_MALLOC_FAILURE); 383 ERR_R_MALLOC_FAILURE);
384 goto err; 384 goto err;
385 } 385 }
@@ -388,7 +388,7 @@ again:
388 v->value=NULL; 388 v->value=NULL;
389 if (v->name == NULL) 389 if (v->name == NULL)
390 { 390 {
391 CONFerr(CONF_F_CONF_LOAD_BIO, 391 CONFerr(CONF_F_DEF_LOAD_BIO,
392 ERR_R_MALLOC_FAILURE); 392 ERR_R_MALLOC_FAILURE);
393 goto err; 393 goto err;
394 } 394 }
@@ -402,7 +402,7 @@ again:
402 tv=_CONF_new_section(conf,psection); 402 tv=_CONF_new_section(conf,psection);
403 if (tv == NULL) 403 if (tv == NULL)
404 { 404 {
405 CONFerr(CONF_F_CONF_LOAD_BIO, 405 CONFerr(CONF_F_DEF_LOAD_BIO,
406 CONF_R_UNABLE_TO_CREATE_NEW_SECTION); 406 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
407 goto err; 407 goto err;
408 } 408 }
@@ -416,7 +416,7 @@ again:
416#if 1 416#if 1
417 if (_CONF_add_string(conf, tv, v) == 0) 417 if (_CONF_add_string(conf, tv, v) == 0)
418 { 418 {
419 CONFerr(CONF_F_CONF_LOAD_BIO, 419 CONFerr(CONF_F_DEF_LOAD_BIO,
420 ERR_R_MALLOC_FAILURE); 420 ERR_R_MALLOC_FAILURE);
421 goto err; 421 goto err;
422 } 422 }
@@ -424,7 +424,7 @@ again:
424 v->section=tv->section; 424 v->section=tv->section;
425 if (!sk_CONF_VALUE_push(ts,v)) 425 if (!sk_CONF_VALUE_push(ts,v))
426 { 426 {
427 CONFerr(CONF_F_CONF_LOAD_BIO, 427 CONFerr(CONF_F_DEF_LOAD_BIO,
428 ERR_R_MALLOC_FAILURE); 428 ERR_R_MALLOC_FAILURE);
429 goto err; 429 goto err;
430 } 430 }
@@ -629,7 +629,7 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
629 CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE); 629 CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE);
630 goto err; 630 goto err;
631 } 631 }
632 BUF_MEM_grow_clean(buf,(strlen(p)+len-(e-from))); 632 BUF_MEM_grow_clean(buf,(strlen(p)+buf->length-(e-from)));
633 while (*p) 633 while (*p)
634 buf->data[to++]= *(p++); 634 buf->data[to++]= *(p++);
635 635
diff --git a/src/lib/libcrypto/conf/conf_err.c b/src/lib/libcrypto/conf/conf_err.c
index f5e2ca4bf0..a16a5e0bd4 100644
--- a/src/lib/libcrypto/conf/conf_err.c
+++ b/src/lib/libcrypto/conf/conf_err.c
@@ -75,6 +75,8 @@ static ERR_STRING_DATA CONF_str_functs[]=
75{ERR_FUNC(CONF_F_CONF_LOAD_BIO), "CONF_load_bio"}, 75{ERR_FUNC(CONF_F_CONF_LOAD_BIO), "CONF_load_bio"},
76{ERR_FUNC(CONF_F_CONF_LOAD_FP), "CONF_load_fp"}, 76{ERR_FUNC(CONF_F_CONF_LOAD_FP), "CONF_load_fp"},
77{ERR_FUNC(CONF_F_CONF_MODULES_LOAD), "CONF_modules_load"}, 77{ERR_FUNC(CONF_F_CONF_MODULES_LOAD), "CONF_modules_load"},
78{ERR_FUNC(CONF_F_DEF_LOAD), "DEF_LOAD"},
79{ERR_FUNC(CONF_F_DEF_LOAD_BIO), "DEF_LOAD_BIO"},
78{ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"}, 80{ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"},
79{ERR_FUNC(CONF_F_MODULE_LOAD_DSO), "MODULE_LOAD_DSO"}, 81{ERR_FUNC(CONF_F_MODULE_LOAD_DSO), "MODULE_LOAD_DSO"},
80{ERR_FUNC(CONF_F_MODULE_RUN), "MODULE_RUN"}, 82{ERR_FUNC(CONF_F_MODULE_RUN), "MODULE_RUN"},
@@ -116,15 +118,12 @@ static ERR_STRING_DATA CONF_str_reasons[]=
116 118
117void ERR_load_CONF_strings(void) 119void ERR_load_CONF_strings(void)
118 { 120 {
119 static int init=1; 121#ifndef OPENSSL_NO_ERR
120 122
121 if (init) 123 if (ERR_func_error_string(CONF_str_functs[0].error) == NULL)
122 { 124 {
123 init=0;
124#ifndef OPENSSL_NO_ERR
125 ERR_load_strings(0,CONF_str_functs); 125 ERR_load_strings(0,CONF_str_functs);
126 ERR_load_strings(0,CONF_str_reasons); 126 ERR_load_strings(0,CONF_str_reasons);
127#endif
128
129 } 127 }
128#endif
130 } 129 }
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c
index 6a3cf109dd..2a3399d269 100644
--- a/src/lib/libcrypto/conf/conf_lib.c
+++ b/src/lib/libcrypto/conf/conf_lib.c
@@ -63,7 +63,7 @@
63#include <openssl/conf_api.h> 63#include <openssl/conf_api.h>
64#include <openssl/lhash.h> 64#include <openssl/lhash.h>
65 65
66const char *CONF_version="CONF" OPENSSL_VERSION_PTEXT; 66const 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
@@ -184,7 +184,7 @@ long CONF_get_number(LHASH *conf,const char *group,const char *name)
184 if (status == 0) 184 if (status == 0)
185 { 185 {
186 /* This function does not believe in errors... */ 186 /* This function does not believe in errors... */
187 ERR_get_error(); 187 ERR_clear_error();
188 } 188 }
189 return result; 189 return result;
190 } 190 }
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c
index 812e60dc70..58b23ba992 100644
--- a/src/lib/libcrypto/conf/conf_mod.c
+++ b/src/lib/libcrypto/conf/conf_mod.c
@@ -126,17 +126,18 @@ int CONF_modules_load(const CONF *cnf, const char *appname,
126 { 126 {
127 STACK_OF(CONF_VALUE) *values; 127 STACK_OF(CONF_VALUE) *values;
128 CONF_VALUE *vl; 128 CONF_VALUE *vl;
129 char *vsection; 129 char *vsection = NULL;
130 130
131 int ret, i; 131 int ret, i;
132 132
133 if (!cnf) 133 if (!cnf)
134 return 1; 134 return 1;
135 135
136 if (appname == NULL) 136 if (appname)
137 appname = "openssl_conf"; 137 vsection = NCONF_get_string(cnf, NULL, appname);
138 138
139 vsection = NCONF_get_string(cnf, NULL, appname); 139 if (!appname || (!vsection && (flags & CONF_MFLAGS_DEFAULT_SECTION)))
140 vsection = NCONF_get_string(cnf, NULL, "openssl_conf");
140 141
141 if (!vsection) 142 if (!vsection)
142 { 143 {
@@ -231,7 +232,7 @@ static int module_run(const CONF *cnf, char *name, char *value,
231 if (!(flags & CONF_MFLAGS_SILENT)) 232 if (!(flags & CONF_MFLAGS_SILENT))
232 { 233 {
233 char rcode[DECIMAL_SIZE(ret)+1]; 234 char rcode[DECIMAL_SIZE(ret)+1];
234 CONFerr(CONF_F_CONF_MODULES_LOAD, CONF_R_MODULE_INITIALIZATION_ERROR); 235 CONFerr(CONF_F_MODULE_RUN, CONF_R_MODULE_INITIALIZATION_ERROR);
235 BIO_snprintf(rcode, sizeof rcode, "%-8d", ret); 236 BIO_snprintf(rcode, sizeof rcode, "%-8d", ret);
236 ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); 237 ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode);
237 } 238 }
@@ -254,7 +255,7 @@ static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value,
254 path = NCONF_get_string(cnf, value, "path"); 255 path = NCONF_get_string(cnf, value, "path");
255 if (!path) 256 if (!path)
256 { 257 {
257 ERR_get_error(); 258 ERR_clear_error();
258 path = name; 259 path = name;
259 } 260 }
260 dso = DSO_load(NULL, path, NULL, 0); 261 dso = DSO_load(NULL, path, NULL, 0);
@@ -431,7 +432,7 @@ void CONF_modules_unload(int all)
431 if (((md->links > 0) || !md->dso) && !all) 432 if (((md->links > 0) || !md->dso) && !all)
432 continue; 433 continue;
433 /* Since we're working in reverse this is OK */ 434 /* Since we're working in reverse this is OK */
434 sk_CONF_MODULE_delete(supported_modules, i); 435 (void)sk_CONF_MODULE_delete(supported_modules, i);
435 module_free(md); 436 module_free(md);
436 } 437 }
437 if (sk_CONF_MODULE_num(supported_modules) == 0) 438 if (sk_CONF_MODULE_num(supported_modules) == 0)
diff --git a/src/lib/libcrypto/conf/conf_sap.c b/src/lib/libcrypto/conf/conf_sap.c
index e15c2e5546..9c53bac1a8 100644
--- a/src/lib/libcrypto/conf/conf_sap.c
+++ b/src/lib/libcrypto/conf/conf_sap.c
@@ -88,8 +88,8 @@ void OPENSSL_config(const char *config_name)
88 88
89 89
90 ERR_clear_error(); 90 ERR_clear_error();
91 if (CONF_modules_load_file(NULL, NULL, 91 if (CONF_modules_load_file(NULL, config_name,
92 CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) 92 CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0)
93 { 93 {
94 BIO *bio_err; 94 BIO *bio_err;
95 ERR_load_crypto_strings(); 95 ERR_load_crypto_strings();