summaryrefslogtreecommitdiffstats
path: root/apps/openssl.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-10-12 12:40:15 +0100
committerMatt Caswell <matt@openssl.org>2015-10-12 22:31:00 +0100
commita0a82324f965bbcc4faed4e1ee3fcaf81ea52166 (patch)
treef7221e7b9d58b659c094aac39a6497c25938588e /apps/openssl.c
parentd175e8a6c23ca212bf57ff78fdbca6942f3e0ef7 (diff)
Centralise loading default apps config file
Loading the config file after processing command line options can cause problems, e.g. where an engine provides new ciphers/digests these are not then recoginised on the command line. Move the default config file loading to before the command line option processing. Whilst we're doing this we might as well centralise this instead of doing it individually for each application. Finally if we do it before the OpenSSL_add_ssl_algorithms() call then ciphersuites provided by an engine (e.g. GOST) can be available to the apps. RT#4085 RT#4086 Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/openssl.c')
-rw-r--r--apps/openssl.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/openssl.c b/apps/openssl.c
index 81a37629d1..565903f9f7 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -166,7 +166,7 @@ BIO *bio_in = NULL;
BIO *bio_out = NULL;
BIO *bio_err = NULL;
-static void apps_startup()
+static int apps_startup()
{
#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
@@ -174,6 +174,13 @@ static void apps_startup()
CRYPTO_malloc_init();
ERR_load_crypto_strings();
ERR_load_SSL_strings();
+
+ if (!app_load_modules(NULL)) {
+ ERR_print_errors(bio_err);
+ BIO_printf(bio_err, "Error loading default configuration\n");
+ return 0;
+ }
+
OpenSSL_add_all_algorithms();
OpenSSL_add_ssl_algorithms();
OPENSSL_load_builtin_modules();
@@ -182,6 +189,7 @@ static void apps_startup()
#ifndef OPENSSL_NO_ENGINE
ENGINE_load_builtin_engines();
#endif
+ return 1;
}
static void apps_shutdown()
@@ -328,7 +336,9 @@ int main(int argc, char *argv[])
#endif
}
- apps_startup();
+ if (!apps_startup())
+ goto end;
+
prog = prog_init();
pname = opt_progname(argv[0]);