Commit 0b13e9f0 authored by Richard Levitte's avatar Richard Levitte
Browse files

Add the possibility to build without the ENGINE framework.

PR: 287
parent 96f7065f
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -406,6 +406,9 @@ TODO: bug: pad x with leading zeros if necessary


 Changes between 0.9.7 and 0.9.7a  [XX xxx 2003]
 Changes between 0.9.7 and 0.9.7a  [XX xxx 2003]


  *) Add the possibility to build without the ENGINE framework.
     [Steven Reddie <smr@essemer.com.au> via Richard Levitte]

  *) Under Win32 gmtime() can return NULL: check return value in
  *) Under Win32 gmtime() can return NULL: check return value in
     OPENSSL_gmtime(). Add error code for case where gmtime() fails.
     OPENSSL_gmtime(). Add error code for case where gmtime() fails.
     [Steve Henson]
     [Steve Henson]
+2 −1
Original line number Original line Diff line number Diff line
@@ -10,7 +10,7 @@ use strict;


# see INSTALL for instructions.
# see INSTALL for instructions.


my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-engine] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";


# Options:
# Options:
#
#
@@ -38,6 +38,7 @@ my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-
# --test-sanity Make a number of sanity checks on the data in this file.
# --test-sanity Make a number of sanity checks on the data in this file.
#               This is a debugging tool for OpenSSL developers.
#               This is a debugging tool for OpenSSL developers.
#
#
# no-engine     do not compile in any engine code.
# no-hw-xxx     do not compile support for specific crypto hardware.
# no-hw-xxx     do not compile support for specific crypto hardware.
#               Generic OpenSSL-style methods relating to this support
#               Generic OpenSSL-style methods relating to this support
#               are always compiled but return NULL if the hardware
#               are always compiled but return NULL if the hardware
+8 −0
Original line number Original line Diff line number Diff line
@@ -122,7 +122,9 @@
#include <openssl/pkcs12.h>
#include <openssl/pkcs12.h>
#include <openssl/ui.h>
#include <openssl/ui.h>
#include <openssl/safestack.h>
#include <openssl/safestack.h>
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#include <openssl/engine.h>
#endif


#ifdef OPENSSL_SYS_WINDOWS
#ifdef OPENSSL_SYS_WINDOWS
#define strcasecmp _stricmp
#define strcasecmp _stricmp
@@ -859,6 +861,7 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
		BIO_printf(err,"no keyfile specified\n");
		BIO_printf(err,"no keyfile specified\n");
		goto end;
		goto end;
		}
		}
#ifndef OPENSSL_NO_ENGINE
	if (format == FORMAT_ENGINE)
	if (format == FORMAT_ENGINE)
		{
		{
		if (!e)
		if (!e)
@@ -868,6 +871,7 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
				ui_method, &cb_data);
				ui_method, &cb_data);
		goto end;
		goto end;
		}
		}
#endif
	key=BIO_new(BIO_s_file());
	key=BIO_new(BIO_s_file());
	if (key == NULL)
	if (key == NULL)
		{
		{
@@ -935,6 +939,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
		BIO_printf(err,"no keyfile specified\n");
		BIO_printf(err,"no keyfile specified\n");
		goto end;
		goto end;
		}
		}
#ifndef OPENSSL_NO_ENGINE
	if (format == FORMAT_ENGINE)
	if (format == FORMAT_ENGINE)
		{
		{
		if (!e)
		if (!e)
@@ -944,6 +949,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
				ui_method, &cb_data);
				ui_method, &cb_data);
		goto end;
		goto end;
		}
		}
#endif
	key=BIO_new(BIO_s_file());
	key=BIO_new(BIO_s_file());
	if (key == NULL)
	if (key == NULL)
		{
		{
@@ -1329,6 +1335,7 @@ X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath)
	return NULL;
	return NULL;
}
}


#ifndef OPENSSL_NO_ENGINE
/* Try to load an engine in a shareable library */
/* Try to load an engine in a shareable library */
static ENGINE *try_load_engine(BIO *err, const char *engine, int debug)
static ENGINE *try_load_engine(BIO *err, const char *engine, int debug)
	{
	{
@@ -1385,6 +1392,7 @@ ENGINE *setup_engine(BIO *err, const char *engine, int debug)
		}
		}
        return e;
        return e;
        }
        }
#endif


int load_config(BIO *err, CONF *cnf)
int load_config(BIO *err, CONF *cnf)
	{
	{
+50 −19
Original line number Original line Diff line number Diff line
@@ -121,7 +121,9 @@
#include <openssl/lhash.h>
#include <openssl/lhash.h>
#include <openssl/conf.h>
#include <openssl/conf.h>
#include <openssl/txt_db.h>
#include <openssl/txt_db.h>
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#include <openssl/engine.h>
#endif
#include <openssl/ossl_typ.h>
#include <openssl/ossl_typ.h>


int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn);
int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn);
@@ -179,6 +181,7 @@ extern BIO *bio_err;
		do_pipe_sig()
		do_pipe_sig()
#  define apps_shutdown()
#  define apps_shutdown()
#else
#else
#  ifndef OPENSSL_NO_ENGINE
#    if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
#    if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
     defined(OPENSSL_SYS_WIN32)
     defined(OPENSSL_SYS_WIN32)
#      ifdef _O_BINARY
#      ifdef _O_BINARY
@@ -203,6 +206,32 @@ extern BIO *bio_err;
			EVP_cleanup(); ENGINE_cleanup(); \
			EVP_cleanup(); ENGINE_cleanup(); \
			CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
			CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
			ERR_free_strings(); } while(0)
			ERR_free_strings(); } while(0)
#  else
#    if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
     defined(OPENSSL_SYS_WIN32)
#      ifdef _O_BINARY
#        define apps_startup() \
			do { _fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
			ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
			setup_ui_method(); } while(0)
#      else
#        define apps_startup() \
			do { _fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
			ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
			setup_ui_method(); } while(0)
#      endif
#    else
#      define apps_startup() \
			do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
			ERR_load_crypto_strings(); \
			setup_ui_method(); } while(0)
#    endif
#    define apps_shutdown() \
			do { CONF_modules_unload(1); destroy_ui_method(); \
			EVP_cleanup(); \
			CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
			ERR_free_strings(); } while(0)
#  endif
#endif
#endif


typedef struct args_st
typedef struct args_st
@@ -248,7 +277,9 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
	const char *pass, ENGINE *e, const char *cert_descrip);
	const char *pass, ENGINE *e, const char *cert_descrip);
X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
#ifndef OPENSSL_NO_ENGINE
ENGINE *setup_engine(BIO *err, const char *engine, int debug);
ENGINE *setup_engine(BIO *err, const char *engine, int debug);
#endif


int load_config(BIO *err, CONF *cnf);
int load_config(BIO *err, CONF *cnf);
char *make_config_name(void);
char *make_config_name(void);
+8 −0
Original line number Original line Diff line number Diff line
@@ -196,7 +196,9 @@ static char *ca_usage[]={
" -extensions ..  - Extension section (override value in config file)\n",
" -extensions ..  - Extension section (override value in config file)\n",
" -extfile file   - Configuration file with X509v3 extentions to add\n",
" -extfile file   - Configuration file with X509v3 extentions to add\n",
" -crlexts ..     - CRL extension section (override value in config file)\n",
" -crlexts ..     - CRL extension section (override value in config file)\n",
#ifndef OPENSSL_NO_ENGINE
" -engine e       - use engine e, possibly a hardware device.\n",
" -engine e       - use engine e, possibly a hardware device.\n",
#endif
" -status serial  - Shows certificate status given the serial number\n",
" -status serial  - Shows certificate status given the serial number\n",
" -updatedb       - Updates db for expired certificates\n",
" -updatedb       - Updates db for expired certificates\n",
NULL
NULL
@@ -333,7 +335,9 @@ int MAIN(int argc, char **argv)
#define BSIZE 256
#define BSIZE 256
	MS_STATIC char buf[3][BSIZE];
	MS_STATIC char buf[3][BSIZE];
	char *randfile=NULL;
	char *randfile=NULL;
#ifndef OPENSSL_NO_ENGINE
	char *engine = NULL;
	char *engine = NULL;
#endif
	char *tofree=NULL;
	char *tofree=NULL;


#ifdef EFENCE
#ifdef EFENCE
@@ -537,11 +541,13 @@ EF_ALIGNMENT=0;
			rev_arg = *(++argv);
			rev_arg = *(++argv);
			rev_type = REV_CA_COMPROMISE;
			rev_type = REV_CA_COMPROMISE;
			}
			}
#ifndef OPENSSL_NO_ENGINE
		else if (strcmp(*argv,"-engine") == 0)
		else if (strcmp(*argv,"-engine") == 0)
			{
			{
			if (--argc < 1) goto bad;
			if (--argc < 1) goto bad;
			engine= *(++argv);
			engine= *(++argv);
			}
			}
#endif
		else
		else
			{
			{
bad:
bad:
@@ -562,7 +568,9 @@ bad:


	ERR_load_crypto_strings();
	ERR_load_crypto_strings();


#ifndef OPENSSL_NO_ENGINE
	e = setup_engine(bio_err, engine, 0);
	e = setup_engine(bio_err, engine, 0);
#endif


	/*****************************************************************/
	/*****************************************************************/
	tofree=NULL;
	tofree=NULL;
Loading