From: Dr. Stephen Henson Date: Tue, 27 Oct 2015 20:02:13 +0000 (+0000) Subject: remove ECDSA_METHOD from ENGINE X-Git-Tag: OpenSSL_1_1_0-pre1~38 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=1eb97c3ecd5a9c7faa9436d506735be0bd7c3b4b remove ECDSA_METHOD from ENGINE Reviewed-by: Richard Levitte --- diff --git a/crypto/engine/Makefile b/crypto/engine/Makefile index d09235752d..6e7292e3a7 100644 --- a/crypto/engine/Makefile +++ b/crypto/engine/Makefile @@ -17,13 +17,13 @@ GENERAL=Makefile 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_ecdsa.c tb_dh.c tb_rand.c tb_store.c \ + tb_rsa.c tb_dsa.c tb_dh.c tb_rand.c tb_store.c \ tb_cipher.c tb_digest.c tb_pkmeth.c tb_asnmth.c tb_eckey.c \ eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c \ eng_rdrand.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_ecdsa.o tb_dh.o tb_rand.o tb_store.o \ + tb_rsa.o tb_dsa.o tb_dh.o tb_rand.o tb_store.o \ tb_cipher.o tb_digest.o tb_pkmeth.o tb_asnmth.o tb_eckey.o \ eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o \ eng_rdrand.o @@ -345,34 +345,19 @@ tb_dsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h tb_dsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h tb_dsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h tb_dsa.o: ../include/internal/cryptlib.h eng_int.h tb_dsa.c -tb_ecdh.o: ../../e_os.h ../../include/openssl/asn1.h -tb_ecdh.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h -tb_ecdh.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h -tb_ecdh.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h -tb_ecdh.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h -tb_ecdh.o: ../../include/openssl/err.h ../../include/openssl/evp.h -tb_ecdh.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h -tb_ecdh.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -tb_ecdh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h -tb_ecdh.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h -tb_ecdh.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -tb_ecdh.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h -tb_ecdh.o: ../../include/openssl/x509_vfy.h ../include/internal/cryptlib.h -tb_ecdh.o: eng_int.h tb_ecdh.c -tb_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h -tb_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h -tb_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h -tb_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h -tb_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h -tb_ecdsa.o: ../../include/openssl/err.h ../../include/openssl/evp.h -tb_ecdsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h -tb_ecdsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -tb_ecdsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h -tb_ecdsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h -tb_ecdsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -tb_ecdsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h -tb_ecdsa.o: ../../include/openssl/x509_vfy.h ../include/internal/cryptlib.h -tb_ecdsa.o: eng_int.h tb_ecdsa.c +tb_eckey.o: ../../e_os.h ../../include/openssl/asn1.h +tb_eckey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h +tb_eckey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h +tb_eckey.o: ../../include/openssl/ec.h ../../include/openssl/engine.h +tb_eckey.o: ../../include/openssl/err.h ../../include/openssl/evp.h +tb_eckey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h +tb_eckey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +tb_eckey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h +tb_eckey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h +tb_eckey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +tb_eckey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h +tb_eckey.o: ../../include/openssl/x509_vfy.h ../include/internal/cryptlib.h +tb_eckey.o: eng_int.h tb_eckey.c tb_pkmeth.o: ../../e_os.h ../../include/openssl/asn1.h tb_pkmeth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h tb_pkmeth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h diff --git a/crypto/engine/eng_fat.c b/crypto/engine/eng_fat.c index 60d62d882d..7984a5bf21 100644 --- a/crypto/engine/eng_fat.c +++ b/crypto/engine/eng_fat.c @@ -80,8 +80,6 @@ int ENGINE_set_default(ENGINE *e, unsigned int flags) return 0; #endif #ifndef OPENSSL_NO_EC - if ((flags & ENGINE_METHOD_ECDSA) && !ENGINE_set_default_ECDSA(e)) - return 0; #endif if ((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e)) return 0; @@ -107,8 +105,6 @@ static int int_def_cb(const char *alg, int len, void *arg) *pflags |= ENGINE_METHOD_RSA; else if (strncmp(alg, "DSA", len) == 0) *pflags |= ENGINE_METHOD_DSA; - else if (strncmp(alg, "ECDSA", len) == 0) - *pflags |= ENGINE_METHOD_ECDSA; else if (strncmp(alg, "DH", len) == 0) *pflags |= ENGINE_METHOD_DH; else if (strncmp(alg, "RAND", len) == 0) @@ -154,7 +150,6 @@ int ENGINE_register_complete(ENGINE *e) ENGINE_register_DH(e); #endif #ifndef OPENSSL_NO_EC - ENGINE_register_ECDSA(e); #endif ENGINE_register_RAND(e); ENGINE_register_pkey_meths(e); diff --git a/crypto/engine/eng_int.h b/crypto/engine/eng_int.h index 939e59da4e..eea5e3d298 100644 --- a/crypto/engine/eng_int.h +++ b/crypto/engine/eng_int.h @@ -179,7 +179,6 @@ struct engine_st { const RSA_METHOD *rsa_meth; const DSA_METHOD *dsa_meth; const DH_METHOD *dh_meth; - const ECDSA_METHOD *ecdsa_meth; const EC_KEY_METHOD *ec_key_meth; const RAND_METHOD *rand_meth; const STORE_METHOD *store_meth; diff --git a/crypto/engine/eng_list.c b/crypto/engine/eng_list.c index 997603363d..72d3a17f19 100644 --- a/crypto/engine/eng_list.c +++ b/crypto/engine/eng_list.c @@ -302,7 +302,7 @@ static void engine_cpy(ENGINE *dest, const ENGINE *src) dest->dh_meth = src->dh_meth; #endif #ifndef OPENSSL_NO_EC - dest->ecdsa_meth = src->ecdsa_meth; + #endif dest->rand_meth = src->rand_meth; dest->store_meth = src->store_meth; diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c index 9b2f459f14..90a95541ba 100644 --- a/crypto/engine/eng_openssl.c +++ b/crypto/engine/eng_openssl.c @@ -155,7 +155,6 @@ static int bind_helper(ENGINE *e) || !ENGINE_set_DSA(e, DSA_get_default_method()) # endif # ifndef OPENSSL_NO_EC - || !ENGINE_set_ECDSA(e, ECDSA_OpenSSL()) # endif # ifndef OPENSSL_NO_DH || !ENGINE_set_DH(e, DH_get_default_method()) diff --git a/crypto/engine/tb_ecdsa.c b/crypto/engine/tb_ecdsa.c deleted file mode 100644 index a8b9be60d7..0000000000 --- a/crypto/engine/tb_ecdsa.c +++ /dev/null @@ -1,124 +0,0 @@ -/* ==================================================================== - * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#include "eng_int.h" - -/* - * If this symbol is defined then ENGINE_get_default_ECDSA(), the function - * that is used by ECDSA to hook in implementation code and cache defaults - * (etc), will display brief debugging summaries to stderr with the 'nid'. - */ -/* #define ENGINE_ECDSA_DEBUG */ - -static ENGINE_TABLE *ecdsa_table = NULL; -static const int dummy_nid = 1; - -void ENGINE_unregister_ECDSA(ENGINE *e) -{ - engine_table_unregister(&ecdsa_table, e); -} - -static void engine_unregister_all_ECDSA(void) -{ - engine_table_cleanup(&ecdsa_table); -} - -int ENGINE_register_ECDSA(ENGINE *e) -{ - if (e->ecdsa_meth) - return engine_table_register(&ecdsa_table, - engine_unregister_all_ECDSA, e, - &dummy_nid, 1, 0); - return 1; -} - -void ENGINE_register_all_ECDSA() -{ - ENGINE *e; - - for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) - ENGINE_register_ECDSA(e); -} - -int ENGINE_set_default_ECDSA(ENGINE *e) -{ - if (e->ecdsa_meth) - return engine_table_register(&ecdsa_table, - engine_unregister_all_ECDSA, e, - &dummy_nid, 1, 1); - return 1; -} - -/* - * Exposed API function to get a functional reference from the implementation - * table (ie. try to get a functional reference from the tabled structural - * references). - */ -ENGINE *ENGINE_get_default_ECDSA(void) -{ - return engine_table_select(&ecdsa_table, dummy_nid); -} - -/* Obtains an ECDSA implementation from an ENGINE functional reference */ -const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e) -{ - return e->ecdsa_meth; -} - -/* Sets an ECDSA implementation in an ENGINE structure */ -int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth) -{ - e->ecdsa_meth = ecdsa_meth; - return 1; -} diff --git a/include/openssl/engine.h b/include/openssl/engine.h index d82535bb56..92a9753fe7 100644 --- a/include/openssl/engine.h +++ b/include/openssl/engine.h @@ -108,7 +108,6 @@ extern "C" { # define ENGINE_METHOD_DSA (unsigned int)0x0002 # define ENGINE_METHOD_DH (unsigned int)0x0004 # define ENGINE_METHOD_RAND (unsigned int)0x0008 -# define ENGINE_METHOD_ECDSA (unsigned int)0x0020 # define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 # define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 # define ENGINE_METHOD_STORE (unsigned int)0x0100 @@ -439,10 +438,6 @@ int ENGINE_register_DSA(ENGINE *e); void ENGINE_unregister_DSA(ENGINE *e); void ENGINE_register_all_DSA(void); -int ENGINE_register_ECDSA(ENGINE *e); -void ENGINE_unregister_ECDSA(ENGINE *e); -void ENGINE_register_all_ECDSA(void); - int ENGINE_register_EC_KEY(ENGINE *e); void ENGINE_unregister_EC_KEY(ENGINE *e); void ENGINE_register_all_EC_KEY(void); @@ -553,7 +548,6 @@ int ENGINE_set_id(ENGINE *e, const char *id); int ENGINE_set_name(ENGINE *e, const char *name); int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); -int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth); int ENGINE_set_EC_KEY(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth); int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); @@ -598,7 +592,6 @@ const char *ENGINE_get_id(const ENGINE *e); const char *ENGINE_get_name(const ENGINE *e); const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); -const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e); const EC_KEY_METHOD *ENGINE_get_EC_KEY(const ENGINE *e); const DH_METHOD *ENGINE_get_DH(const ENGINE *e); const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); @@ -677,7 +670,6 @@ int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, ENGINE *ENGINE_get_default_RSA(void); /* Same for the other "methods" */ ENGINE *ENGINE_get_default_DSA(void); -ENGINE *ENGINE_get_default_ECDSA(void); ENGINE *ENGINE_get_default_EC_KEY(void); ENGINE *ENGINE_get_default_DH(void); ENGINE *ENGINE_get_default_RAND(void); @@ -700,7 +692,6 @@ int ENGINE_set_default_RSA(ENGINE *e); int ENGINE_set_default_string(ENGINE *e, const char *def_list); /* Same for the other "methods" */ int ENGINE_set_default_DSA(ENGINE *e); -int ENGINE_set_default_ECDSA(ENGINE *e); int ENGINE_set_default_EC_KEY(ENGINE *e); int ENGINE_set_default_DH(ENGINE *e); int ENGINE_set_default_RAND(ENGINE *e);