Commit a0a82324 authored by Matt Caswell's avatar Matt Caswell
Browse files

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: default avatarRichard Levitte <levitte@openssl.org>
parent d175e8a6
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -186,9 +186,6 @@ int asn1parse_main(int argc, char **argv)
    argc = opt_num_rest();
    argv = opt_rest();

    if (!app_load_modules(NULL))
        goto end;

    if (oidfile != NULL) {
        in = bio_open_default(oidfile, 'r', FORMAT_TEXT);
        if (in == NULL)
+7 −4
Original line number Diff line number Diff line
@@ -484,10 +484,13 @@ end_of_options:
    argv = opt_rest();

    BIO_printf(bio_err, "Using configuration from %s\n", configfile);
    /* We already loaded the default config file */
    if (configfile != default_config_file) {
        if ((conf = app_load_config(configfile)) == NULL)
            goto end;
        if (!app_load_modules(conf))
            goto end;
    }

    /* Lets get the config section we are using */
    if (section == NULL) {
+0 −3
Original line number Diff line number Diff line
@@ -144,9 +144,6 @@ int ciphers_main(int argc, char **argv)
    else if (argc != 0)
        goto opthelp;

    if (!app_load_modules(NULL))
        goto end;

    ctx = SSL_CTX_new(meth);
    if (ctx == NULL)
        goto err;
+0 −3
Original line number Diff line number Diff line
@@ -684,9 +684,6 @@ int cms_main(int argc, char **argv)
        goto end;
    }

    if (!app_load_modules(NULL))
        goto end;

    if (need_rand) {
        app_RAND_load_file(NULL, (inrand != NULL));
        if (inrand != NULL)
+0 −3
Original line number Diff line number Diff line
@@ -232,9 +232,6 @@ int crl_main(int argc, char **argv)
    if (!nmflag_set)
        nmflag = XN_FLAG_ONELINE;

    if (!app_load_modules(NULL))
        goto end;

    x = load_crl(infile, informat);
    if (x == NULL)
        goto end;
Loading