Commit 3647bee2 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Config code updates.

CONF_modules_unload() now calls CONF_modules_finish()
automatically.

Default use of section openssl_conf moved to
CONF_modules_load()

Load config file in several openssl utilities.

Most utilities now load modules from the config file,
though in a few (such as version) this isn't done
because it couldn't be used for anything.

In the case of ca and req the config file used is
the same as the utility itself: that is the -config
command line option can be used to specify an
alternative file.
parent e2aebccb
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -43,7 +43,19 @@
         *) applies to 0.9.6a ... 0.9.6d and 0.9.7
         +) applies to 0.9.7 only

  +) Move default behaviour to CONF_modules_load_file(). Is appname is NULL
  +) Config modules support in openssl utility.

     Most commands now load modules from the config file,
     though in a few (such as version) this isn't done 
     because it couldn't be used for anything.

     In the case of ca and req the config file used is
     the same as the utility itself: that is the -config
     command line option can be used to specify an
     alternative file.
     [Steve Henson]

  +) Move default behaviour from OPENSSL_config(). If appname is NULL
     use "openssl_conf" if filename is NULL use default openssl config file.
     [Steve Henson]

+18 −0
Original line number Diff line number Diff line
@@ -1314,3 +1314,21 @@ ENGINE *setup_engine(BIO *err, const char *engine, int debug)
		}
        return e;
        }

int load_config(BIO *err, CONF *cnf)
	{
	if (!cnf)
		cnf = config;
	if (!cnf)
		return 1;

	OPENSSL_load_builtin_modules();

	if (CONF_modules_load(cnf, NULL, 0) <= 0)
		{
		BIO_printf(err, "Error configuring OpenSSL\n");
		ERR_print_errors(err);
		return 0;
		}
	return 1;
	}
+4 −1
Original line number Diff line number Diff line
@@ -196,7 +196,8 @@ extern BIO *bio_err;
#  define apps_shutdown() \
		do { destroy_ui_method(); EVP_cleanup(); \
		ENGINE_cleanup(); CRYPTO_cleanup_all_ex_data(); \
		ERR_remove_state(0); ERR_free_strings(); } while(0)
		ERR_remove_state(0); ERR_free_strings(); \
		CONF_modules_unload(1); } while(0)
#endif

typedef struct args_st
@@ -244,6 +245,8 @@ STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
ENGINE *setup_engine(BIO *err, const char *engine, int debug);

int load_config(BIO *err, CONF *cnf);

/* Functions defined in ca.c and also used in ocsp.c */
int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
			ASN1_GENERALIZEDTIME **pinvtm, char *str);
+3 −0
Original line number Diff line number Diff line
@@ -103,6 +103,9 @@ int MAIN(int argc, char **argv)
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);

	if (!load_config(bio_err, NULL))
		goto end;

	prog=argv[0];
	argc--;
	argv++;
+3 −0
Original line number Diff line number Diff line
@@ -590,6 +590,9 @@ bad:
		goto err;
		}

	if (!load_config(bio_err, conf))
		goto err;

	/* Lets get the config section we are using */
	if (section == NULL)
		{
Loading