Loading apps/apps.c +46 −7 Original line number Diff line number Diff line Loading @@ -496,20 +496,14 @@ static char *app_get_pass(char *arg, int keepbio) return BUF_strdup(tpass); } CONF *app_load_config(const char *filename) static CONF *app_load_config_(BIO *in, const char *filename) { long errorline = -1; CONF *conf; int i; BIO *in; in = bio_open_default(filename, "r"); if (in == NULL) return NULL; conf = NCONF_new(NULL); i = NCONF_load_bio(conf, in, &errorline); BIO_free(in); if (i > 0) return conf; Loading @@ -522,6 +516,51 @@ CONF *app_load_config(const char *filename) NCONF_free(conf); return NULL; } CONF *app_load_config(const char *filename) { BIO *in; CONF *conf; in = bio_open_default(filename, "r"); if (in == NULL) return NULL; conf = app_load_config_(in, filename); BIO_free(in); return conf; } CONF *app_load_config_quiet(const char *filename) { BIO *in; CONF *conf; in = bio_open_default_quiet(filename, "r"); if (in == NULL) return NULL; conf = app_load_config_(in, filename); BIO_free(in); return conf; } int app_load_modules(const CONF *config) { CONF *to_free = NULL; if (config == NULL) config = to_free = app_load_config_quiet(default_config_file); if (config == NULL) return 1; if (CONF_modules_load(config, NULL, 0) <= 0) { BIO_printf(bio_err, "Error configuring OpenSSL modules\n"); ERR_print_errors(bio_err); NCONF_free(to_free); return 0; } NCONF_free(to_free); return 1; } int add_oid_section(CONF *conf) { Loading apps/apps.h +4 −1 Original line number Diff line number Diff line Loading @@ -154,7 +154,10 @@ extern BIO *bio_err; BIO *dup_bio_in(void); BIO *dup_bio_out(void); BIO *bio_open_default(const char *filename, const char *mode); BIO *bio_open_default_quiet(const char *filename, const char *mode); CONF *app_load_config(const char *filename); CONF *app_load_config_quiet(const char *filename); int app_load_modules(const CONF *config); void unbuffer(FILE *fp); /* Often used in calls to bio_open_default. */ Loading apps/asn1pars.c +4 −1 Original line number Diff line number Diff line Loading @@ -186,6 +186,9 @@ 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"); if (in == NULL) Loading apps/ca.c +2 −0 Original line number Diff line number Diff line Loading @@ -485,6 +485,8 @@ end_of_options: BIO_printf(bio_err, "Using configuration from %s\n", configfile); 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) { Loading apps/ciphers.c +3 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,9 @@ 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; Loading Loading
apps/apps.c +46 −7 Original line number Diff line number Diff line Loading @@ -496,20 +496,14 @@ static char *app_get_pass(char *arg, int keepbio) return BUF_strdup(tpass); } CONF *app_load_config(const char *filename) static CONF *app_load_config_(BIO *in, const char *filename) { long errorline = -1; CONF *conf; int i; BIO *in; in = bio_open_default(filename, "r"); if (in == NULL) return NULL; conf = NCONF_new(NULL); i = NCONF_load_bio(conf, in, &errorline); BIO_free(in); if (i > 0) return conf; Loading @@ -522,6 +516,51 @@ CONF *app_load_config(const char *filename) NCONF_free(conf); return NULL; } CONF *app_load_config(const char *filename) { BIO *in; CONF *conf; in = bio_open_default(filename, "r"); if (in == NULL) return NULL; conf = app_load_config_(in, filename); BIO_free(in); return conf; } CONF *app_load_config_quiet(const char *filename) { BIO *in; CONF *conf; in = bio_open_default_quiet(filename, "r"); if (in == NULL) return NULL; conf = app_load_config_(in, filename); BIO_free(in); return conf; } int app_load_modules(const CONF *config) { CONF *to_free = NULL; if (config == NULL) config = to_free = app_load_config_quiet(default_config_file); if (config == NULL) return 1; if (CONF_modules_load(config, NULL, 0) <= 0) { BIO_printf(bio_err, "Error configuring OpenSSL modules\n"); ERR_print_errors(bio_err); NCONF_free(to_free); return 0; } NCONF_free(to_free); return 1; } int add_oid_section(CONF *conf) { Loading
apps/apps.h +4 −1 Original line number Diff line number Diff line Loading @@ -154,7 +154,10 @@ extern BIO *bio_err; BIO *dup_bio_in(void); BIO *dup_bio_out(void); BIO *bio_open_default(const char *filename, const char *mode); BIO *bio_open_default_quiet(const char *filename, const char *mode); CONF *app_load_config(const char *filename); CONF *app_load_config_quiet(const char *filename); int app_load_modules(const CONF *config); void unbuffer(FILE *fp); /* Often used in calls to bio_open_default. */ Loading
apps/asn1pars.c +4 −1 Original line number Diff line number Diff line Loading @@ -186,6 +186,9 @@ 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"); if (in == NULL) Loading
apps/ca.c +2 −0 Original line number Diff line number Diff line Loading @@ -485,6 +485,8 @@ end_of_options: BIO_printf(bio_err, "Using configuration from %s\n", configfile); 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) { Loading
apps/ciphers.c +3 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,9 @@ 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; Loading