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

Initial ENGINE config module, docs to follow.

Fix buffer overrun errors in OPENSSL_conf().
parent 9dd5ae65
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -12,6 +12,9 @@
         *) applies to 0.9.6a/0.9.6b/0.9.6c and 0.9.7
         +) applies to 0.9.7 only

  +) Prelminary ENGINE config module.
     [Steve Henson]

  *) The earlier bugfix for the SSL3_ST_SW_HELLO_REQ_C case of
     ssl3_accept (ssl/s3_srvr.c) incorrectly used a local flag
     variable as an indication that a ClientHello message has been
+2 −0
Original line number Diff line number Diff line
@@ -188,6 +188,8 @@ void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
void *CONF_module_get_usr_data(CONF_MODULE *pmod);
void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);

char *CONF_get1_default_config_file(void);

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
+9 −16
Original line number Diff line number Diff line
@@ -63,11 +63,13 @@
#include <openssl/dso.h>
#include <openssl/x509.h>
#include <openssl/asn1.h>
#include <openssl/engine.h>

void OPENSSL_load_builtin_modules(void)
	{
	/* Add builtin modules here */
	ASN1_add_oid_module();
	ENGINE_add_conf_module();
	}

/* This is the automatic configuration loader: it is called automatically by
@@ -77,32 +79,24 @@ void OPENSSL_load_builtin_modules(void)

static int openssl_configured = 0;

#if 0 /* Disabled because of obvious buffer overflow.
       * This is not yet actually used anywhere -- but it shouldn't
       * unless it is fixed first. */
void OPENSSL_config(void)
	{
	char *file, config_name[256];
	int ret;
	char *file;
	if (openssl_configured)
		return;

	OPENSSL_load_builtin_modules();

	file = getenv("OPENSSL_CONF");
	file = CONF_get1_default_config_file();
	if (!file)
                {
		strcpy(config_name,X509_get_default_cert_area());
#ifndef OPENSSL_SYS_VMS
		strcat(config_name,"/");
#endif
		strcat(config_name,OPENSSL_CONF);
		file=config_name;
                }
		return;

	if(CONF_modules_load_file(file, "openssl_config", 0) <= 0)
	ret = CONF_modules_load_file(file, "openssl_config", 0);
	OPENSSL_free(file);
	if (ret <= 0)
		{
		BIO *bio_err;

		ERR_load_crypto_strings();
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
			{
@@ -116,7 +110,6 @@ void OPENSSL_config(void)
	return;

	}
#endif

void OPENSSL_no_config()
	{
+29 −0
Original line number Diff line number Diff line
@@ -520,3 +520,32 @@ void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data)
	pmod->usr_data = usr_data;
	}

/* Return default config file name */

char *CONF_get1_default_config_file(void)
	{
	char *file;
	int len;

	file = getenv("OPENSSL_CONF");
	if (file) 
		return BUF_strdup(file);

	len = strlen(X509_get_default_cert_area());
#ifndef OPENSSL_SYS_VMS
	len++;
#endif
	len += strlen(OPENSSL_CONF);

	file = OPENSSL_malloc(len + 1);

	if (!file)
		return NULL;
	strcpy(file,X509_get_default_cert_area());
#ifndef OPENSSL_SYS_VMS
	strcat(file,"/");
#endif
	strcat(file,OPENSSL_CONF);

	return file;
	}
+2 −2
Original line number Diff line number Diff line
@@ -26,13 +26,13 @@ LIB=$(TOP)/libcrypto.a
LIBSRC= eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c \
	eng_table.c eng_pkey.c eng_fat.c eng_all.c \
	tb_rsa.c tb_dsa.c tb_dh.c tb_rand.c tb_cipher.c tb_digest.c \
	eng_openssl.c eng_dyn.c \
	eng_openssl.c eng_dyn.c eng_cnf.c \
	hw_atalla.c hw_cswift.c hw_ncipher.c hw_nuron.c hw_ubsec.c \
	hw_openbsd_dev_crypto.c
LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \
	eng_table.o eng_pkey.o eng_fat.o eng_all.o \
	tb_rsa.o tb_dsa.o tb_dh.o tb_rand.o tb_cipher.o tb_digest.o \
	eng_openssl.o eng_dyn.o \
	eng_openssl.o eng_dyn.o eng_cnf.o \
	hw_atalla.o hw_cswift.o hw_ncipher.o hw_nuron.o hw_ubsec.o \
	hw_openbsd_dev_crypto.o

Loading