Commit b370230b authored by Geoff Thorpe's avatar Geoff Thorpe
Browse files

This change adds cipher and digest support into ENGINE using the

ENGING_TABLE mechanism. The necessary hooks from crypto/evp/ to use this
will be committed shortly.
parent 50a381b7
Loading
Loading
Loading
Loading
+32 −4
Original line number Diff line number Diff line
@@ -25,13 +25,13 @@ APPS=
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_rsa.c tb_dsa.c tb_dh.c tb_rand.c tb_cipher.c tb_digest.c \
	eng_openssl.c eng_dyn.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_rsa.o tb_dsa.o tb_dh.o tb_rand.o tb_cipher.o tb_digest.o \
	eng_openssl.o eng_dyn.o \
	hw_atalla.o hw_cswift.o hw_ncipher.o hw_nuron.o hw_ubsec.o \
	hw_openbsd_dev_crypto.o
@@ -185,10 +185,12 @@ eng_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
eng_openssl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
eng_openssl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
eng_openssl.o: ../../include/openssl/engine.h ../../include/openssl/err.h
eng_openssl.o: ../../include/openssl/lhash.h
eng_openssl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
eng_openssl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
eng_openssl.o: ../../include/openssl/opensslconf.h
eng_openssl.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
eng_openssl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
eng_openssl.o: ../../include/openssl/rc4.h ../../include/openssl/rsa.h
eng_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
eng_openssl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
eng_openssl.o: ../../include/openssl/types.h ../../include/openssl/ui.h
eng_openssl.o: ../cryptlib.h eng_openssl.c
@@ -283,6 +285,19 @@ hw_ubsec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
hw_ubsec.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
hw_ubsec.o: ../../include/openssl/types.h ../../include/openssl/ui.h
hw_ubsec.o: ../cryptlib.h hw_ubsec.c vendor_defns/hw_ubsec.h
tb_cipher.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
tb_cipher.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
tb_cipher.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
tb_cipher.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
tb_cipher.o: ../../include/openssl/err.h ../../include/openssl/evp.h
tb_cipher.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
tb_cipher.o: ../../include/openssl/objects.h
tb_cipher.o: ../../include/openssl/opensslconf.h
tb_cipher.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
tb_cipher.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
tb_cipher.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
tb_cipher.o: ../../include/openssl/types.h ../../include/openssl/ui.h eng_int.h
tb_cipher.o: tb_cipher.c
tb_dh.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
tb_dh.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
tb_dh.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
@@ -295,6 +310,19 @@ tb_dh.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
tb_dh.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
tb_dh.o: ../../include/openssl/types.h ../../include/openssl/ui.h eng_int.h
tb_dh.o: tb_dh.c
tb_digest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
tb_digest.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
tb_digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
tb_digest.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
tb_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
tb_digest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
tb_digest.o: ../../include/openssl/objects.h
tb_digest.o: ../../include/openssl/opensslconf.h
tb_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
tb_digest.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
tb_digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
tb_digest.o: ../../include/openssl/types.h ../../include/openssl/ui.h eng_int.h
tb_digest.o: tb_digest.c
tb_dsa.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
tb_dsa.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
tb_dsa.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+4 −0
Original line number Diff line number Diff line
@@ -77,7 +77,9 @@ static ERR_STRING_DATA ENGINE_str_functs[]=
{ERR_PACK(0,ENGINE_F_ENGINE_CTRL_CMD_STRING,0),	"ENGINE_ctrl_cmd_string"},
{ERR_PACK(0,ENGINE_F_ENGINE_FINISH,0),	"ENGINE_finish"},
{ERR_PACK(0,ENGINE_F_ENGINE_FREE,0),	"ENGINE_free"},
{ERR_PACK(0,ENGINE_F_ENGINE_GET_CIPHER,0),	"ENGINE_get_cipher"},
{ERR_PACK(0,ENGINE_F_ENGINE_GET_DEFAULT_TYPE,0),	"ENGINE_GET_DEFAULT_TYPE"},
{ERR_PACK(0,ENGINE_F_ENGINE_GET_DIGEST,0),	"ENGINE_get_digest"},
{ERR_PACK(0,ENGINE_F_ENGINE_GET_NEXT,0),	"ENGINE_get_next"},
{ERR_PACK(0,ENGINE_F_ENGINE_GET_PREV,0),	"ENGINE_get_prev"},
{ERR_PACK(0,ENGINE_F_ENGINE_INIT,0),	"ENGINE_init"},
@@ -144,6 +146,8 @@ static ERR_STRING_DATA ENGINE_str_reasons[]=
{ENGINE_R_REQUEST_FALLBACK               ,"request fallback"},
{ENGINE_R_RSA_NOT_IMPLEMENTED            ,"rsa not implemented"},
{ENGINE_R_SIZE_TOO_LARGE_OR_TOO_SMALL    ,"size too large or too small"},
{ENGINE_R_UNIMPLEMENTED_CIPHER           ,"unimplemented cipher"},
{ENGINE_R_UNIMPLEMENTED_DIGEST           ,"unimplemented digest"},
{ENGINE_R_UNIT_FAILURE                   ,"unit failure"},
{ENGINE_R_VERSION_INCOMPATIBILITY        ,"version incompatibility"},
{0,NULL}
+6 −0
Original line number Diff line number Diff line
@@ -60,6 +60,10 @@

int ENGINE_set_default(ENGINE *e, unsigned int flags)
	{
	if((flags & ENGINE_METHOD_CIPHERS) && !ENGINE_set_default_ciphers(e))
		return 0;
	if((flags & ENGINE_METHOD_DIGESTS) && !ENGINE_set_default_digests(e))
		return 0;
#ifndef OPENSSL_NO_RSA
	if((flags & ENGINE_METHOD_RSA) & !ENGINE_set_default_RSA(e))
		return 0;
@@ -79,6 +83,8 @@ int ENGINE_set_default(ENGINE *e, unsigned int flags)

int ENGINE_register_complete(ENGINE *e)
	{
	ENGINE_register_ciphers(e);
	ENGINE_register_digests(e);
#ifndef OPENSSL_NO_RSA
	ENGINE_register_RSA(e);
#endif
+6 −1
Original line number Diff line number Diff line
@@ -138,6 +138,11 @@ struct engine_st
	const DSA_METHOD *dsa_meth;
	const DH_METHOD *dh_meth;
	const RAND_METHOD *rand_meth;
	/* Cipher handling is via this callback */
	ENGINE_CIPHERS_PTR ciphers;
	/* Digest handling is via this callback */
	ENGINE_DIGESTS_PTR digests;


	ENGINE_GEN_INT_FUNC_PTR	destroy;

@@ -157,7 +162,7 @@ struct engine_st
	 * simply to cope with (de)allocation of this structure. Hence,
	 * running_ref <= struct_ref at all times. */
	int funct_ref;
	/* A place to store per-key data */
	/* A place to store per-ENGINE data */
	CRYPTO_EX_DATA ex_data;
	/* Used to maintain the linked-list of engines. */
	struct engine_st *prev;
+2 −0
Original line number Diff line number Diff line
@@ -325,6 +325,8 @@ static void engine_cpy(ENGINE *dest, const ENGINE *src)
	dest->dh_meth = src->dh_meth;
#endif
	dest->rand_meth = src->rand_meth;
	dest->ciphers = src->ciphers;
	dest->digests = src->digests;
	dest->destroy = src->destroy;
	dest->init = src->init;
	dest->finish = src->finish;
Loading