summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine
diff options
context:
space:
mode:
authortb <>2023-07-28 09:22:26 +0000
committertb <>2023-07-28 09:22:26 +0000
commitf15cd04d37436407bfd863b507fcd73ca66e3976 (patch)
tree4eb57ae2fdd0f6dff20d00655e0d117dcf61415d /src/lib/libcrypto/engine
parente5c3cb1fc9513740908e7dc235cee9871623b942 (diff)
downloadopenbsd-f15cd04d37436407bfd863b507fcd73ca66e3976.tar.gz
openbsd-f15cd04d37436407bfd863b507fcd73ca66e3976.tar.bz2
openbsd-f15cd04d37436407bfd863b507fcd73ca66e3976.zip
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
Diffstat (limited to 'src/lib/libcrypto/engine')
-rw-r--r--src/lib/libcrypto/engine/eng_fat.c11
-rw-r--r--src/lib/libcrypto/engine/eng_int.h3
-rw-r--r--src/lib/libcrypto/engine/eng_list.c5
-rw-r--r--src/lib/libcrypto/engine/eng_openssl.c5
-rw-r--r--src/lib/libcrypto/engine/engine.h14
-rw-r--r--src/lib/libcrypto/engine/tb_ecdh.c141
6 files changed, 5 insertions, 174 deletions
diff --git a/src/lib/libcrypto/engine/eng_fat.c b/src/lib/libcrypto/engine/eng_fat.c
index cf49c99bb4..f0b57722ff 100644
--- a/src/lib/libcrypto/engine/eng_fat.c
+++ b/src/lib/libcrypto/engine/eng_fat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_fat.c,v 1.18 2023/07/28 09:08:31 tb Exp $ */ 1/* $OpenBSD: eng_fat.c,v 1.19 2023/07/28 09:22:26 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -85,10 +85,6 @@ ENGINE_set_default(ENGINE *e, unsigned int flags)
85 if ((flags & ENGINE_METHOD_DH) && !ENGINE_set_default_DH(e)) 85 if ((flags & ENGINE_METHOD_DH) && !ENGINE_set_default_DH(e))
86 return 0; 86 return 0;
87#endif 87#endif
88#ifndef OPENSSL_NO_ECDH
89 if ((flags & ENGINE_METHOD_ECDH) && !ENGINE_set_default_ECDH(e))
90 return 0;
91#endif
92#ifndef OPENSSL_NO_EC 88#ifndef OPENSSL_NO_EC
93 if ((flags & ENGINE_METHOD_EC) && !ENGINE_set_default_EC(e)) 89 if ((flags & ENGINE_METHOD_EC) && !ENGINE_set_default_EC(e))
94 return 0; 90 return 0;
@@ -117,8 +113,6 @@ int_def_cb(const char *alg, int len, void *arg)
117 *pflags |= ENGINE_METHOD_RSA; 113 *pflags |= ENGINE_METHOD_RSA;
118 else if (!strncmp(alg, "DSA", len)) 114 else if (!strncmp(alg, "DSA", len))
119 *pflags |= ENGINE_METHOD_DSA; 115 *pflags |= ENGINE_METHOD_DSA;
120 else if (!strncmp(alg, "ECDH", len))
121 *pflags |= ENGINE_METHOD_ECDH;
122 else if (!strncmp(alg, "DH", len)) 116 else if (!strncmp(alg, "DH", len))
123 *pflags |= ENGINE_METHOD_DH; 117 *pflags |= ENGINE_METHOD_DH;
124 else if (strncmp(alg, "EC", len) == 0) 118 else if (strncmp(alg, "EC", len) == 0)
@@ -168,9 +162,6 @@ ENGINE_register_complete(ENGINE *e)
168#ifndef OPENSSL_NO_DH 162#ifndef OPENSSL_NO_DH
169 ENGINE_register_DH(e); 163 ENGINE_register_DH(e);
170#endif 164#endif
171#ifndef OPENSSL_NO_ECDH
172 ENGINE_register_ECDH(e);
173#endif
174#ifndef OPENSSL_NO_EC 165#ifndef OPENSSL_NO_EC
175 ENGINE_register_EC(e); 166 ENGINE_register_EC(e);
176#endif 167#endif
diff --git a/src/lib/libcrypto/engine/eng_int.h b/src/lib/libcrypto/engine/eng_int.h
index ad504a5a2b..2b0ba22aaf 100644
--- a/src/lib/libcrypto/engine/eng_int.h
+++ b/src/lib/libcrypto/engine/eng_int.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_int.h,v 1.11 2023/07/28 09:08:31 tb Exp $ */ 1/* $OpenBSD: eng_int.h,v 1.12 2023/07/28 09:22:26 tb Exp $ */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -157,7 +157,6 @@ struct engine_st {
157 const RSA_METHOD *rsa_meth; 157 const RSA_METHOD *rsa_meth;
158 const DSA_METHOD *dsa_meth; 158 const DSA_METHOD *dsa_meth;
159 const DH_METHOD *dh_meth; 159 const DH_METHOD *dh_meth;
160 const ECDH_METHOD *ecdh_meth;
161 const EC_KEY_METHOD *ec_meth; 160 const EC_KEY_METHOD *ec_meth;
162 const RAND_METHOD *rand_meth; 161 const RAND_METHOD *rand_meth;
163 const STORE_METHOD *store_meth; 162 const STORE_METHOD *store_meth;
diff --git a/src/lib/libcrypto/engine/eng_list.c b/src/lib/libcrypto/engine/eng_list.c
index e460e71136..eaa0d228f9 100644
--- a/src/lib/libcrypto/engine/eng_list.c
+++ b/src/lib/libcrypto/engine/eng_list.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_list.c,v 1.26 2023/07/28 09:08:31 tb Exp $ */ 1/* $OpenBSD: eng_list.c,v 1.27 2023/07/28 09:22:26 tb Exp $ */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -310,9 +310,6 @@ engine_cpy(ENGINE *dest, const ENGINE *src)
310#ifndef OPENSSL_NO_DH 310#ifndef OPENSSL_NO_DH
311 dest->dh_meth = src->dh_meth; 311 dest->dh_meth = src->dh_meth;
312#endif 312#endif
313#ifndef OPENSSL_NO_ECDH
314 dest->ecdh_meth = src->ecdh_meth;
315#endif
316#ifndef OPENSSL_NO_EC 313#ifndef OPENSSL_NO_EC
317 dest->ec_meth = src->ec_meth; 314 dest->ec_meth = src->ec_meth;
318#endif 315#endif
diff --git a/src/lib/libcrypto/engine/eng_openssl.c b/src/lib/libcrypto/engine/eng_openssl.c
index 7abb6114bc..6162b715f0 100644
--- a/src/lib/libcrypto/engine/eng_openssl.c
+++ b/src/lib/libcrypto/engine/eng_openssl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_openssl.c,v 1.18 2023/07/28 09:08:31 tb Exp $ */ 1/* $OpenBSD: eng_openssl.c,v 1.19 2023/07/28 09:22:26 tb Exp $ */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -146,9 +146,6 @@ bind_helper(ENGINE *e)
146#ifndef OPENSSL_NO_DSA 146#ifndef OPENSSL_NO_DSA
147 || !ENGINE_set_DSA(e, DSA_get_default_method()) 147 || !ENGINE_set_DSA(e, DSA_get_default_method())
148#endif 148#endif
149#ifndef OPENSSL_NO_ECDH
150 || !ENGINE_set_ECDH(e, ECDH_OpenSSL())
151#endif
152#ifndef OPENSSL_NO_DH 149#ifndef OPENSSL_NO_DH
153 || !ENGINE_set_DH(e, DH_get_default_method()) 150 || !ENGINE_set_DH(e, DH_get_default_method())
154#endif 151#endif
diff --git a/src/lib/libcrypto/engine/engine.h b/src/lib/libcrypto/engine/engine.h
index dbc3718dca..ef5878a5d3 100644
--- a/src/lib/libcrypto/engine/engine.h
+++ b/src/lib/libcrypto/engine/engine.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: engine.h,v 1.40 2023/07/28 09:08:31 tb Exp $ */ 1/* $OpenBSD: engine.h,v 1.41 2023/07/28 09:22:26 tb Exp $ */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -76,9 +76,6 @@
76#ifndef OPENSSL_NO_EC 76#ifndef OPENSSL_NO_EC
77#include <openssl/ec.h> 77#include <openssl/ec.h>
78#endif 78#endif
79#ifndef OPENSSL_NO_ECDH
80#include <openssl/ecdh.h>
81#endif
82#include <openssl/err.h> 79#include <openssl/err.h>
83#ifndef OPENSSL_NO_RSA 80#ifndef OPENSSL_NO_RSA
84#include <openssl/rsa.h> 81#include <openssl/rsa.h>
@@ -98,7 +95,6 @@ extern "C" {
98#define ENGINE_METHOD_DSA (unsigned int)0x0002 95#define ENGINE_METHOD_DSA (unsigned int)0x0002
99#define ENGINE_METHOD_DH (unsigned int)0x0004 96#define ENGINE_METHOD_DH (unsigned int)0x0004
100#define ENGINE_METHOD_RAND (unsigned int)0x0008 97#define ENGINE_METHOD_RAND (unsigned int)0x0008
101#define ENGINE_METHOD_ECDH (unsigned int)0x0010
102#define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 98#define ENGINE_METHOD_CIPHERS (unsigned int)0x0040
103#define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 99#define ENGINE_METHOD_DIGESTS (unsigned int)0x0080
104#define ENGINE_METHOD_STORE (unsigned int)0x0100 100#define ENGINE_METHOD_STORE (unsigned int)0x0100
@@ -375,10 +371,6 @@ int ENGINE_register_DSA(ENGINE *e);
375void ENGINE_unregister_DSA(ENGINE *e); 371void ENGINE_unregister_DSA(ENGINE *e);
376void ENGINE_register_all_DSA(void); 372void ENGINE_register_all_DSA(void);
377 373
378int ENGINE_register_ECDH(ENGINE *e);
379void ENGINE_unregister_ECDH(ENGINE *e);
380void ENGINE_register_all_ECDH(void);
381
382int ENGINE_register_EC(ENGINE *e); 374int ENGINE_register_EC(ENGINE *e);
383void ENGINE_unregister_EC(ENGINE *e); 375void ENGINE_unregister_EC(ENGINE *e);
384void ENGINE_register_all_EC(void); 376void ENGINE_register_all_EC(void);
@@ -475,7 +467,6 @@ int ENGINE_set_id(ENGINE *e, const char *id);
475int ENGINE_set_name(ENGINE *e, const char *name); 467int ENGINE_set_name(ENGINE *e, const char *name);
476int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); 468int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);
477int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); 469int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);
478int ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth);
479int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ec_meth); 470int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ec_meth);
480int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); 471int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);
481int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); 472int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);
@@ -514,7 +505,6 @@ const char *ENGINE_get_id(const ENGINE *e);
514const char *ENGINE_get_name(const ENGINE *e); 505const char *ENGINE_get_name(const ENGINE *e);
515const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); 506const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
516const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); 507const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
517const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e);
518const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e); 508const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e);
519const DH_METHOD *ENGINE_get_DH(const ENGINE *e); 509const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
520const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); 510const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
@@ -581,7 +571,6 @@ int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s,
581ENGINE *ENGINE_get_default_RSA(void); 571ENGINE *ENGINE_get_default_RSA(void);
582/* Same for the other "methods" */ 572/* Same for the other "methods" */
583ENGINE *ENGINE_get_default_DSA(void); 573ENGINE *ENGINE_get_default_DSA(void);
584ENGINE *ENGINE_get_default_ECDH(void);
585ENGINE *ENGINE_get_default_EC(void); 574ENGINE *ENGINE_get_default_EC(void);
586ENGINE *ENGINE_get_default_DH(void); 575ENGINE *ENGINE_get_default_DH(void);
587ENGINE *ENGINE_get_default_RAND(void); 576ENGINE *ENGINE_get_default_RAND(void);
@@ -600,7 +589,6 @@ int ENGINE_set_default_RSA(ENGINE *e);
600int ENGINE_set_default_string(ENGINE *e, const char *def_list); 589int ENGINE_set_default_string(ENGINE *e, const char *def_list);
601/* Same for the other "methods" */ 590/* Same for the other "methods" */
602int ENGINE_set_default_DSA(ENGINE *e); 591int ENGINE_set_default_DSA(ENGINE *e);
603int ENGINE_set_default_ECDH(ENGINE *e);
604int ENGINE_set_default_EC(ENGINE *e); 592int ENGINE_set_default_EC(ENGINE *e);
605int ENGINE_set_default_DH(ENGINE *e); 593int ENGINE_set_default_DH(ENGINE *e);
606int ENGINE_set_default_RAND(ENGINE *e); 594int ENGINE_set_default_RAND(ENGINE *e);
diff --git a/src/lib/libcrypto/engine/tb_ecdh.c b/src/lib/libcrypto/engine/tb_ecdh.c
deleted file mode 100644
index a67877addd..0000000000
--- a/src/lib/libcrypto/engine/tb_ecdh.c
+++ /dev/null
@@ -1,141 +0,0 @@
1/* $OpenBSD: tb_ecdh.c,v 1.4 2014/06/12 15:49:29 deraadt Exp $ */
2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 *
5 * The Elliptic Curve Public-Key Crypto Library (ECC Code) included
6 * herein is developed by SUN MICROSYSTEMS, INC., and is contributed
7 * to the OpenSSL project.
8 *
9 * The ECC Code is licensed pursuant to the OpenSSL open source
10 * license provided below.
11 *
12 * The ECDH engine software is originally written by Nils Gura and
13 * Douglas Stebila of Sun Microsystems Laboratories.
14 *
15 */
16/* ====================================================================
17 * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved.
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 *
23 * 1. Redistributions of source code must retain the above copyright
24 * notice, this list of conditions and the following disclaimer.
25 *
26 * 2. Redistributions in binary form must reproduce the above copyright
27 * notice, this list of conditions and the following disclaimer in
28 * the documentation and/or other materials provided with the
29 * distribution.
30 *
31 * 3. All advertising materials mentioning features or use of this
32 * software must display the following acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
35 *
36 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
37 * endorse or promote products derived from this software without
38 * prior written permission. For written permission, please contact
39 * licensing@OpenSSL.org.
40 *
41 * 5. Products derived from this software may not be called "OpenSSL"
42 * nor may "OpenSSL" appear in their names without prior written
43 * permission of the OpenSSL Project.
44 *
45 * 6. Redistributions of any form whatsoever must retain the following
46 * acknowledgment:
47 * "This product includes software developed by the OpenSSL Project
48 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
51 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
53 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
54 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
57 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
59 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
60 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
61 * OF THE POSSIBILITY OF SUCH DAMAGE.
62 * ====================================================================
63 *
64 * This product includes cryptographic software written by Eric Young
65 * (eay@cryptsoft.com). This product includes software written by Tim
66 * Hudson (tjh@cryptsoft.com).
67 *
68 */
69
70#include "eng_int.h"
71
72/* If this symbol is defined then ENGINE_get_default_ECDH(), the function that is
73 * used by ECDH to hook in implementation code and cache defaults (etc), will
74 * display brief debugging summaries to stderr with the 'nid'. */
75/* #define ENGINE_ECDH_DEBUG */
76
77static ENGINE_TABLE *ecdh_table = NULL;
78static const int dummy_nid = 1;
79
80void
81ENGINE_unregister_ECDH(ENGINE *e)
82{
83 engine_table_unregister(&ecdh_table, e);
84}
85
86static void
87engine_unregister_all_ECDH(void)
88{
89 engine_table_cleanup(&ecdh_table);
90}
91
92int
93ENGINE_register_ECDH(ENGINE *e)
94{
95 if (e->ecdh_meth)
96 return engine_table_register(&ecdh_table,
97 engine_unregister_all_ECDH, e, &dummy_nid, 1, 0);
98 return 1;
99}
100
101void
102ENGINE_register_all_ECDH(void)
103{
104 ENGINE *e;
105
106 for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e))
107 ENGINE_register_ECDH(e);
108}
109
110int
111ENGINE_set_default_ECDH(ENGINE *e)
112{
113 if (e->ecdh_meth)
114 return engine_table_register(&ecdh_table,
115 engine_unregister_all_ECDH, e, &dummy_nid, 1, 1);
116 return 1;
117}
118
119/* Exposed API function to get a functional reference from the implementation
120 * table (ie. try to get a functional reference from the tabled structural
121 * references). */
122ENGINE *
123ENGINE_get_default_ECDH(void)
124{
125 return engine_table_select(&ecdh_table, dummy_nid);
126}
127
128/* Obtains an ECDH implementation from an ENGINE functional reference */
129const ECDH_METHOD *
130ENGINE_get_ECDH(const ENGINE *e)
131{
132 return e->ecdh_meth;
133}
134
135/* Sets an ECDH implementation in an ENGINE structure */
136int
137ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth)
138{
139 e->ecdh_meth = ecdh_meth;
140 return 1;
141}