Commit e759b095 authored by Richard Levitte's avatar Richard Levitte
Browse files

Add code and changes to implement the ENGINE mechanism. These are the

patches that Geoff had in a patch file in his play directory.

NOTE for openssl-cvs:  THIS IS A CVS BRANCH (BRANCH_engine).  IT IS
NOT FOR THE FAINTHEARTED TO PLAY WITH.  The code works as it is, but
it's not at all sure it ends up in the OpenSSL distributio in this
form, so do not get dependent on it!

Those rsyncing the repository are considered warned!
parent afa0598f
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ use strict;

# see INSTALL for instructions.

my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [rsaref] [no-threads] [no-asm] [no-dso] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] os/compiler[:flags]\n";
my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [hw-xxx] [rsaref] [no-threads] [no-asm] [no-dso] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] os/compiler[:flags]\n";

# Options:
#
@@ -23,6 +23,11 @@ my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-
#               default).  This needn't be set in advance, you can
#               just as well use "make INSTALL_PREFIX=/whatever install".
#
# hw-xxx        compile support for specific crypto hardware. Generic
#               OpenSSL-style methods relating to this support are
#               always compiled but return NULL if the hardware support
#               isn't compiled. Currently, hw-cswift is the only support
#               of this form.
# rsaref        use RSAref
# [no-]threads  [don't] try to create a library that is suitable for
#               multithreaded applications (default is "threads" if we
@@ -459,6 +464,13 @@ foreach (@ARGV)
			$openssl_algorithm_defines .= "#define NO_MDC2\n";
			}
		}
	elsif (/^hw-(.+)$/)
		{
		my $hw=$1;
		$hw =~ tr/[a-z]/[A-Z]/;
		$flags .= "-DHW_$hw ";
		$openssl_other_defines .= "#define HW_$hw\n";
		}
	elsif (/^386$/)
		{ $processor=386; }
	elsif (/^rsaref$/)
+1 −1
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ SHLIBDIRS= crypto ssl
SDIRS=  \
	md2 md5 sha mdc2 hmac ripemd \
	des rc2 rc4 rc5 idea bf cast \
	bn rsa dsa dh dso \
	bn rsa dsa dh dso engine \
	buffer bio stack lhash rand err objects \
	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp

+12 −12
Original line number Diff line number Diff line
@@ -733,18 +733,18 @@ speed.o: ../include/openssl/buffer.h ../include/openssl/cast.h
speed.o: ../include/openssl/crypto.h ../include/openssl/des.h
speed.o: ../include/openssl/dh.h ../include/openssl/dsa.h
speed.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
speed.o: ../include/openssl/err.h ../include/openssl/evp.h
speed.o: ../include/openssl/hmac.h ../include/openssl/idea.h
speed.o: ../include/openssl/md2.h ../include/openssl/md5.h
speed.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
speed.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
speed.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
speed.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
speed.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
speed.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
speed.o: ../include/openssl/sha.h ../include/openssl/stack.h
speed.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ./testdsa.h
speed.o: ./testrsa.h apps.h
speed.o: ../include/openssl/engine.h ../include/openssl/err.h
speed.o: ../include/openssl/evp.h ../include/openssl/hmac.h
speed.o: ../include/openssl/idea.h ../include/openssl/md2.h
speed.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
speed.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
speed.o: ../include/openssl/opensslv.h ../include/openssl/pkcs7.h
speed.o: ../include/openssl/rand.h ../include/openssl/rc2.h
speed.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
speed.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
speed.o: ../include/openssl/safestack.h ../include/openssl/sha.h
speed.o: ../include/openssl/stack.h ../include/openssl/x509.h
speed.o: ../include/openssl/x509_vfy.h ./testdsa.h ./testrsa.h apps.h
spkac.o: ../include/openssl/asn1.h ../include/openssl/bio.h
spkac.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
spkac.o: ../include/openssl/buffer.h ../include/openssl/cast.h
+25 −2
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@
#include <openssl/crypto.h>
#include <openssl/rand.h>
#include <openssl/err.h>
#include <openssl/engine.h>

#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC))
#define TIMES
@@ -242,6 +243,7 @@ int MAIN(int, char **);

int MAIN(int argc, char **argv)
	{
	ENGINE *e;
	unsigned char *buf=NULL,*buf2=NULL;
	int mret=1;
#define ALGOR_NUM	14
@@ -391,6 +393,26 @@ int MAIN(int argc, char **argv)
	argv++;
	while (argc)
		{
		if	((strcmp(*argv,"-engine") == 0) && (argc > 0))
			{
			argc--;
			argv++;
			if((e = ENGINE_by_id(*argv)) == NULL)
				{
				BIO_printf(bio_err,"invalid engine \"%s\"\n",
					*argv);
				goto end;
				}
			if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
				{
				BIO_printf(bio_err,"can't use that engine\n");
				goto end;
				}
			BIO_printf(bio_err,"engine \"%s\" set.\n", *argv);
			/* Free our "structural" reference. */
			ENGINE_free(e);
			}
		else
#ifndef NO_MD2
		if	(strcmp(*argv,"md2") == 0) doit[D_MD2]=1;
		else
@@ -434,7 +456,7 @@ int MAIN(int argc, char **argv)
#ifdef RSAref
			if (strcmp(*argv,"rsaref") == 0) 
			{
			RSA_set_default_method(RSA_PKCS1_RSAref());
			RSA_set_default_openssl_method(RSA_PKCS1_RSAref());
			j--;
			}
		else
@@ -442,7 +464,7 @@ int MAIN(int argc, char **argv)
#ifndef RSA_NULL
			if (strcmp(*argv,"openssl") == 0) 
			{
			RSA_set_default_method(RSA_PKCS1_SSLeay());
			RSA_set_default_openssl_method(RSA_PKCS1_SSLeay());
			j--;
			}
		else
@@ -1173,6 +1195,7 @@ int MAIN(int argc, char **argv)
#endif
	mret=0;
end:
	ERR_print_errors(bio_err);
	if (buf != NULL) Free(buf);
	if (buf2 != NULL) Free(buf2);
#ifndef NO_RSA
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ LIBS=

SDIRS=	md2 md5 sha mdc2 hmac ripemd \
	des rc2 rc4 rc5 idea bf cast \
	bn rsa dsa dh dso \
	bn rsa dsa dh dso engine \
	buffer bio stack lhash rand err objects \
	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp

Loading