aboutsummaryrefslogtreecommitdiff
path: root/apps/ts.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-05-28 13:52:55 -0400
committerRich Salz <rsalz@openssl.org>2015-05-28 17:28:33 -0400
commitcc01d21756cc9c79231ef21039782c5fe42008a2 (patch)
treecb92584cc79d9994f9859b15c04a645d0b020389 /apps/ts.c
parentf097f81c891bb1f479426d8ac9c9541390334983 (diff)
downloadopenssl-cc01d21756cc9c79231ef21039782c5fe42008a2.zip
openssl-cc01d21756cc9c79231ef21039782c5fe42008a2.tar.gz
openssl-cc01d21756cc9c79231ef21039782c5fe42008a2.tar.bz2
RT3876: Only load config when needed
Create app_load_config(), a routine to load config file. Remove the "always load config" from the main app. Change the places that used to load config to call the new common routine. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/ts.c')
-rw-r--r--apps/ts.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/apps/ts.c b/apps/ts.c
index 5c42ff5..be2482c 100644
--- a/apps/ts.c
+++ b/apps/ts.c
@@ -188,7 +188,8 @@ int ts_main(int argc, char **argv)
{
CONF *conf = NULL;
char *CAfile = NULL, *untrusted = NULL, *engine = NULL, *prog, **helpp;
- char *configfile = NULL, *section = NULL, *password = NULL;
+ char *configfile = default_config_file;
+ char *section = NULL, *password = NULL;
char *data = NULL, *digest = NULL, *rnd = NULL, *policy = NULL;
char *in = NULL, *out = NULL, *queryfile = NULL, *passin = NULL;
char *inkey = NULL, *signer = NULL, *chain = NULL, *CApath = NULL;
@@ -389,24 +390,7 @@ static ASN1_OBJECT *txt2obj(const char *oid)
static CONF *load_config_file(const char *configfile)
{
- CONF *conf = NULL;
- long errorline = -1;
-
- if (!configfile)
- configfile = getenv("OPENSSL_CONF");
- if (!configfile)
- configfile = getenv("SSLEAY_CONF");
-
- if (configfile &&
- ((conf = NCONF_new(NULL)) == NULL
- || NCONF_load(conf, configfile, &errorline) <= 0)) {
- if (errorline <= 0)
- BIO_printf(bio_err, "error loading the config file "
- "'%s'\n", configfile);
- else
- BIO_printf(bio_err, "error on line %ld of config file "
- "'%s'\n", errorline, configfile);
- }
+ CONF *conf = app_load_config(configfile);
if (conf != NULL) {
const char *p;