From dcdd2b67a83feac9d24e0827db69eb1e837cbecf Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 28 Jul 2023 09:22:26 +0000 Subject: [PATCH] Excise ECDH_METHOD Unlike ECDSA_METHOD, this has been unused forever but kind of needed to stay for symmetry with ECDSA_METHOD. Now we can finally take it behind the barn and remove its tendrils into ENGINE. ok jsing --- lib/libcrypto/Makefile | 4 +- lib/libcrypto/Symbols.list | 14 --- lib/libcrypto/Symbols.namespace | 7 -- lib/libcrypto/ecdh/ecdh.h | 13 +-- lib/libcrypto/ecdh/ech_lib.c | 147 ---------------------------- lib/libcrypto/engine/eng_fat.c | 11 +-- lib/libcrypto/engine/eng_int.h | 3 +- lib/libcrypto/engine/eng_list.c | 5 +- lib/libcrypto/engine/eng_openssl.c | 5 +- lib/libcrypto/engine/engine.h | 14 +-- lib/libcrypto/engine/tb_ecdh.c | 141 -------------------------- lib/libcrypto/hidden/openssl/ecdh.h | 10 +- lib/libcrypto/ossl_typ.h | 4 +- 13 files changed, 9 insertions(+), 369 deletions(-) delete mode 100644 lib/libcrypto/ecdh/ech_lib.c delete mode 100644 lib/libcrypto/engine/tb_ecdh.c diff --git a/lib/libcrypto/Makefile b/lib/libcrypto/Makefile index 030efb14c1e..50181579345 100644 --- a/lib/libcrypto/Makefile +++ b/lib/libcrypto/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.142 2023/07/28 09:19:58 tb Exp $ +# $OpenBSD: Makefile,v 1.143 2023/07/28 09:22:26 tb Exp $ LIB= crypto LIBREBUILD=y @@ -353,7 +353,6 @@ SRCS+= ecx_methods.c # ecdh/ SRCS+= ecdh.c -SRCS+= ech_lib.c # ecdsa/ SRCS+= ecdsa.c @@ -377,7 +376,6 @@ SRCS+= tb_cipher.c SRCS+= tb_dh.c SRCS+= tb_digest.c SRCS+= tb_dsa.c -SRCS+= tb_ecdh.c SRCS+= tb_eckey.c SRCS+= tb_pkmeth.c SRCS+= tb_rand.c diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index b9338fee67e..c16a178cf7f 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -1010,14 +1010,7 @@ DSO_set_filename DSO_set_method DSO_set_name_converter DSO_up_ref -ECDH_OpenSSL ECDH_compute_key -ECDH_get_default_method -ECDH_get_ex_data -ECDH_get_ex_new_index -ECDH_set_default_method -ECDH_set_ex_data -ECDH_set_method ECDH_size ECDSA_SIG_free ECDSA_SIG_get0 @@ -1180,7 +1173,6 @@ ENGINE_free ENGINE_get_DH ENGINE_get_DSA ENGINE_get_EC -ENGINE_get_ECDH ENGINE_get_RAND ENGINE_get_RSA ENGINE_get_STORE @@ -1192,7 +1184,6 @@ ENGINE_get_ctrl_function ENGINE_get_default_DH ENGINE_get_default_DSA ENGINE_get_default_EC -ENGINE_get_default_ECDH ENGINE_get_default_RAND ENGINE_get_default_RSA ENGINE_get_destroy_function @@ -1234,14 +1225,12 @@ ENGINE_pkey_asn1_find_str ENGINE_register_DH ENGINE_register_DSA ENGINE_register_EC -ENGINE_register_ECDH ENGINE_register_RAND ENGINE_register_RSA ENGINE_register_STORE ENGINE_register_all_DH ENGINE_register_all_DSA ENGINE_register_all_EC -ENGINE_register_all_ECDH ENGINE_register_all_RAND ENGINE_register_all_RSA ENGINE_register_all_STORE @@ -1259,7 +1248,6 @@ ENGINE_remove ENGINE_set_DH ENGINE_set_DSA ENGINE_set_EC -ENGINE_set_ECDH ENGINE_set_RAND ENGINE_set_RSA ENGINE_set_STORE @@ -1270,7 +1258,6 @@ ENGINE_set_default ENGINE_set_default_DH ENGINE_set_default_DSA ENGINE_set_default_EC -ENGINE_set_default_ECDH ENGINE_set_default_RAND ENGINE_set_default_RSA ENGINE_set_default_ciphers @@ -1295,7 +1282,6 @@ ENGINE_set_table_flags ENGINE_unregister_DH ENGINE_unregister_DSA ENGINE_unregister_EC -ENGINE_unregister_ECDH ENGINE_unregister_RAND ENGINE_unregister_RSA ENGINE_unregister_STORE diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index 9ad2aa2c218..9dd16a93f2a 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -1636,15 +1636,8 @@ _libre_SM4_encrypt _libre_CRYPTO_poly1305_init _libre_CRYPTO_poly1305_update _libre_CRYPTO_poly1305_finish -_libre_ECDH_OpenSSL -_libre_ECDH_set_default_method -_libre_ECDH_get_default_method -_libre_ECDH_set_method _libre_ECDH_size _libre_ECDH_compute_key -_libre_ECDH_get_ex_new_index -_libre_ECDH_set_ex_data -_libre_ECDH_get_ex_data _libre_PEM_get_EVP_CIPHER_INFO _libre_PEM_do_header _libre_PEM_read_bio diff --git a/lib/libcrypto/ecdh/ecdh.h b/lib/libcrypto/ecdh/ecdh.h index a5e32bea488..3163b9ea2e5 100644 --- a/lib/libcrypto/ecdh/ecdh.h +++ b/lib/libcrypto/ecdh/ecdh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ecdh.h,v 1.8 2023/07/28 09:19:59 tb Exp $ */ +/* $OpenBSD: ecdh.h,v 1.9 2023/07/28 09:22:26 tb Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -83,22 +83,11 @@ extern "C" { #endif -const ECDH_METHOD *ECDH_OpenSSL(void); - -void ECDH_set_default_method(const ECDH_METHOD *); -const ECDH_METHOD *ECDH_get_default_method(void); -int ECDH_set_method(EC_KEY *, const ECDH_METHOD *); - int ECDH_size(const EC_KEY *ecdh); int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh, void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)); -int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new -*new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); -int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg); -void *ECDH_get_ex_data(EC_KEY *d, int idx); - #ifdef __cplusplus } #endif diff --git a/lib/libcrypto/ecdh/ech_lib.c b/lib/libcrypto/ecdh/ech_lib.c deleted file mode 100644 index c8e5744c0ac..00000000000 --- a/lib/libcrypto/ecdh/ech_lib.c +++ /dev/null @@ -1,147 +0,0 @@ -/* $OpenBSD: ech_lib.c,v 1.24 2023/07/07 13:54:45 beck Exp $ */ -/* ==================================================================== - * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. - * - * The Elliptic Curve Public-Key Crypto Library (ECC Code) included - * herein is developed by SUN MICROSYSTEMS, INC., and is contributed - * to the OpenSSL project. - * - * The ECC Code is licensed pursuant to the OpenSSL open source - * license provided below. - * - * The ECDH software is originally written by Douglas Stebila of - * Sun Microsystems Laboratories. - * - */ -/* ==================================================================== - * Copyright (c) 1998-2003 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 - * openssl-core@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 - -#include - -#ifndef OPENSSL_NO_ENGINE -#include -#endif -#include - -#include "ec_local.h" - -struct ecdh_method { - const char *name; - int (*compute_key)(void *key, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh, - void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)); - int flags; - char *app_data; -}; - -static const ECDH_METHOD *default_ECDH_method = NULL; - -static const ECDH_METHOD openssl_ecdh_meth = { - .name = "OpenSSL ECDH method", - .compute_key = ecdh_compute_key, -}; - -const ECDH_METHOD * -ECDH_OpenSSL(void) -{ - return &openssl_ecdh_meth; -} -LCRYPTO_ALIAS(ECDH_OpenSSL); - -void -ECDH_set_default_method(const ECDH_METHOD *meth) -{ - default_ECDH_method = meth; -} -LCRYPTO_ALIAS(ECDH_set_default_method); - -const ECDH_METHOD * -ECDH_get_default_method(void) -{ - if (!default_ECDH_method) { - default_ECDH_method = ECDH_OpenSSL(); - } - return default_ECDH_method; -} -LCRYPTO_ALIAS(ECDH_get_default_method); - -int -ECDH_set_method(EC_KEY *eckey, const ECDH_METHOD *meth) -{ - return 0; -} -LCRYPTO_ALIAS(ECDH_set_method); - -int -ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, - CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) -{ - return -1; -} -LCRYPTO_ALIAS(ECDH_get_ex_new_index); - -int -ECDH_set_ex_data(EC_KEY *d, int idx, void *arg) -{ - return 0; -} -LCRYPTO_ALIAS(ECDH_set_ex_data); - -void * -ECDH_get_ex_data(EC_KEY *d, int idx) -{ - return NULL; -} -LCRYPTO_ALIAS(ECDH_get_ex_data); diff --git a/lib/libcrypto/engine/eng_fat.c b/lib/libcrypto/engine/eng_fat.c index cf49c99bb4c..f0b57722ffb 100644 --- a/lib/libcrypto/engine/eng_fat.c +++ b/lib/libcrypto/engine/eng_fat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eng_fat.c,v 1.18 2023/07/28 09:08:31 tb Exp $ */ +/* $OpenBSD: eng_fat.c,v 1.19 2023/07/28 09:22:26 tb Exp $ */ /* ==================================================================== * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. * @@ -85,10 +85,6 @@ ENGINE_set_default(ENGINE *e, unsigned int flags) if ((flags & ENGINE_METHOD_DH) && !ENGINE_set_default_DH(e)) return 0; #endif -#ifndef OPENSSL_NO_ECDH - if ((flags & ENGINE_METHOD_ECDH) && !ENGINE_set_default_ECDH(e)) - return 0; -#endif #ifndef OPENSSL_NO_EC if ((flags & ENGINE_METHOD_EC) && !ENGINE_set_default_EC(e)) return 0; @@ -117,8 +113,6 @@ int_def_cb(const char *alg, int len, void *arg) *pflags |= ENGINE_METHOD_RSA; else if (!strncmp(alg, "DSA", len)) *pflags |= ENGINE_METHOD_DSA; - else if (!strncmp(alg, "ECDH", len)) - *pflags |= ENGINE_METHOD_ECDH; else if (!strncmp(alg, "DH", len)) *pflags |= ENGINE_METHOD_DH; else if (strncmp(alg, "EC", len) == 0) @@ -168,9 +162,6 @@ ENGINE_register_complete(ENGINE *e) #ifndef OPENSSL_NO_DH ENGINE_register_DH(e); #endif -#ifndef OPENSSL_NO_ECDH - ENGINE_register_ECDH(e); -#endif #ifndef OPENSSL_NO_EC ENGINE_register_EC(e); #endif diff --git a/lib/libcrypto/engine/eng_int.h b/lib/libcrypto/engine/eng_int.h index ad504a5a2b4..2b0ba22aafa 100644 --- a/lib/libcrypto/engine/eng_int.h +++ b/lib/libcrypto/engine/eng_int.h @@ -1,4 +1,4 @@ -/* $OpenBSD: eng_int.h,v 1.11 2023/07/28 09:08:31 tb Exp $ */ +/* $OpenBSD: eng_int.h,v 1.12 2023/07/28 09:22:26 tb Exp $ */ /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL * project 2000. */ @@ -157,7 +157,6 @@ struct engine_st { const RSA_METHOD *rsa_meth; const DSA_METHOD *dsa_meth; const DH_METHOD *dh_meth; - const ECDH_METHOD *ecdh_meth; const EC_KEY_METHOD *ec_meth; const RAND_METHOD *rand_meth; const STORE_METHOD *store_meth; diff --git a/lib/libcrypto/engine/eng_list.c b/lib/libcrypto/engine/eng_list.c index e460e71136c..eaa0d228f9d 100644 --- a/lib/libcrypto/engine/eng_list.c +++ b/lib/libcrypto/engine/eng_list.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eng_list.c,v 1.26 2023/07/28 09:08:31 tb Exp $ */ +/* $OpenBSD: eng_list.c,v 1.27 2023/07/28 09:22:26 tb Exp $ */ /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL * project 2000. */ @@ -310,9 +310,6 @@ engine_cpy(ENGINE *dest, const ENGINE *src) #ifndef OPENSSL_NO_DH dest->dh_meth = src->dh_meth; #endif -#ifndef OPENSSL_NO_ECDH - dest->ecdh_meth = src->ecdh_meth; -#endif #ifndef OPENSSL_NO_EC dest->ec_meth = src->ec_meth; #endif diff --git a/lib/libcrypto/engine/eng_openssl.c b/lib/libcrypto/engine/eng_openssl.c index 7abb6114bc7..6162b715f0d 100644 --- a/lib/libcrypto/engine/eng_openssl.c +++ b/lib/libcrypto/engine/eng_openssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eng_openssl.c,v 1.18 2023/07/28 09:08:31 tb Exp $ */ +/* $OpenBSD: eng_openssl.c,v 1.19 2023/07/28 09:22:26 tb Exp $ */ /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL * project 2000. */ @@ -146,9 +146,6 @@ bind_helper(ENGINE *e) #ifndef OPENSSL_NO_DSA || !ENGINE_set_DSA(e, DSA_get_default_method()) #endif -#ifndef OPENSSL_NO_ECDH - || !ENGINE_set_ECDH(e, ECDH_OpenSSL()) -#endif #ifndef OPENSSL_NO_DH || !ENGINE_set_DH(e, DH_get_default_method()) #endif diff --git a/lib/libcrypto/engine/engine.h b/lib/libcrypto/engine/engine.h index dbc3718dca1..ef5878a5d38 100644 --- a/lib/libcrypto/engine/engine.h +++ b/lib/libcrypto/engine/engine.h @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.h,v 1.40 2023/07/28 09:08:31 tb Exp $ */ +/* $OpenBSD: engine.h,v 1.41 2023/07/28 09:22:26 tb Exp $ */ /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL * project 2000. */ @@ -76,9 +76,6 @@ #ifndef OPENSSL_NO_EC #include #endif -#ifndef OPENSSL_NO_ECDH -#include -#endif #include #ifndef OPENSSL_NO_RSA #include @@ -98,7 +95,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_ECDH (unsigned int)0x0010 #define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 #define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 #define ENGINE_METHOD_STORE (unsigned int)0x0100 @@ -375,10 +371,6 @@ int ENGINE_register_DSA(ENGINE *e); void ENGINE_unregister_DSA(ENGINE *e); void ENGINE_register_all_DSA(void); -int ENGINE_register_ECDH(ENGINE *e); -void ENGINE_unregister_ECDH(ENGINE *e); -void ENGINE_register_all_ECDH(void); - int ENGINE_register_EC(ENGINE *e); void ENGINE_unregister_EC(ENGINE *e); void ENGINE_register_all_EC(void); @@ -475,7 +467,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_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth); int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ec_meth); int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); @@ -514,7 +505,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 ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e); const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e); const DH_METHOD *ENGINE_get_DH(const ENGINE *e); const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); @@ -581,7 +571,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_ECDH(void); ENGINE *ENGINE_get_default_EC(void); ENGINE *ENGINE_get_default_DH(void); ENGINE *ENGINE_get_default_RAND(void); @@ -600,7 +589,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_ECDH(ENGINE *e); int ENGINE_set_default_EC(ENGINE *e); int ENGINE_set_default_DH(ENGINE *e); int ENGINE_set_default_RAND(ENGINE *e); diff --git a/lib/libcrypto/engine/tb_ecdh.c b/lib/libcrypto/engine/tb_ecdh.c deleted file mode 100644 index a67877addde..00000000000 --- a/lib/libcrypto/engine/tb_ecdh.c +++ /dev/null @@ -1,141 +0,0 @@ -/* $OpenBSD: tb_ecdh.c,v 1.4 2014/06/12 15:49:29 deraadt Exp $ */ -/* ==================================================================== - * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. - * - * The Elliptic Curve Public-Key Crypto Library (ECC Code) included - * herein is developed by SUN MICROSYSTEMS, INC., and is contributed - * to the OpenSSL project. - * - * The ECC Code is licensed pursuant to the OpenSSL open source - * license provided below. - * - * The ECDH engine software is originally written by Nils Gura and - * Douglas Stebila of Sun Microsystems Laboratories. - * - */ -/* ==================================================================== - * 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_ECDH(), the function that is - * used by ECDH to hook in implementation code and cache defaults (etc), will - * display brief debugging summaries to stderr with the 'nid'. */ -/* #define ENGINE_ECDH_DEBUG */ - -static ENGINE_TABLE *ecdh_table = NULL; -static const int dummy_nid = 1; - -void -ENGINE_unregister_ECDH(ENGINE *e) -{ - engine_table_unregister(&ecdh_table, e); -} - -static void -engine_unregister_all_ECDH(void) -{ - engine_table_cleanup(&ecdh_table); -} - -int -ENGINE_register_ECDH(ENGINE *e) -{ - if (e->ecdh_meth) - return engine_table_register(&ecdh_table, - engine_unregister_all_ECDH, e, &dummy_nid, 1, 0); - return 1; -} - -void -ENGINE_register_all_ECDH(void) -{ - ENGINE *e; - - for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) - ENGINE_register_ECDH(e); -} - -int -ENGINE_set_default_ECDH(ENGINE *e) -{ - if (e->ecdh_meth) - return engine_table_register(&ecdh_table, - engine_unregister_all_ECDH, 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_ECDH(void) -{ - return engine_table_select(&ecdh_table, dummy_nid); -} - -/* Obtains an ECDH implementation from an ENGINE functional reference */ -const ECDH_METHOD * -ENGINE_get_ECDH(const ENGINE *e) -{ - return e->ecdh_meth; -} - -/* Sets an ECDH implementation in an ENGINE structure */ -int -ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth) -{ - e->ecdh_meth = ecdh_meth; - return 1; -} diff --git a/lib/libcrypto/hidden/openssl/ecdh.h b/lib/libcrypto/hidden/openssl/ecdh.h index db56f8a5883..aff95893f07 100644 --- a/lib/libcrypto/hidden/openssl/ecdh.h +++ b/lib/libcrypto/hidden/openssl/ecdh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ecdh.h,v 1.1 2023/07/08 06:04:33 beck Exp $ */ +/* $OpenBSD: ecdh.h,v 1.2 2023/07/28 09:22:26 tb Exp $ */ /* * Copyright (c) 2023 Bob Beck * @@ -25,15 +25,7 @@ #endif #include "crypto_namespace.h" -LCRYPTO_USED(ECDH_OpenSSL); -LCRYPTO_USED(ECDH_set_default_method); -LCRYPTO_USED(ECDH_get_default_method); -LCRYPTO_USED(ECDH_set_method); LCRYPTO_USED(ECDH_size); LCRYPTO_USED(ECDH_compute_key); -LCRYPTO_USED(ECDH_get_ex_new_index); -LCRYPTO_USED(ECDH_set_ex_data); -LCRYPTO_USED(ECDH_get_ex_data); -LCRYPTO_USED(ERR_load_ECDH_strings); #endif /* _LIBCRYPTO_ECDH_H */ diff --git a/lib/libcrypto/ossl_typ.h b/lib/libcrypto/ossl_typ.h index 8ff37796360..b58888de3b7 100644 --- a/lib/libcrypto/ossl_typ.h +++ b/lib/libcrypto/ossl_typ.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ossl_typ.h,v 1.26 2023/07/28 09:08:31 tb Exp $ */ +/* $OpenBSD: ossl_typ.h,v 1.27 2023/07/28 09:22:26 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. * @@ -124,8 +124,6 @@ typedef struct rsa_pss_params_st RSA_PSS_PARAMS; typedef struct rand_meth_st RAND_METHOD; -typedef struct ecdh_method ECDH_METHOD; - typedef struct x509_st X509; typedef struct X509_algor_st X509_ALGOR; typedef struct X509_crl_st X509_CRL; -- 2.20.1