summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-07-21 09:04:23 +0000
committertb <>2023-07-21 09:04:23 +0000
commitf3f431c8f6134c5d325ede30963e2f1edd9a0718 (patch)
treea06a9f51ed23a061b5e6a00600a42d86ad37ce11
parent0fa0e5b768255277d5110ebe72faab0818b80b86 (diff)
downloadopenbsd-f3f431c8f6134c5d325ede30963e2f1edd9a0718.tar.gz
openbsd-f3f431c8f6134c5d325ede30963e2f1edd9a0718.tar.bz2
openbsd-f3f431c8f6134c5d325ede30963e2f1edd9a0718.zip
Provide a bunch of always failing ENGINE API
This commit adds a few symbols under OPENSSL_NO_ENGINE. They will be used after the main ENGINE code is disabled in the next bump. The ecosystem is mostly prepared for dealing with a libcrypto compiled with OPENSSL_NO_ENGINE. There are a few stragglers like M2Crypto, dovecot and the latest apr-util release (fixed in their development branch). To avoid intrusive patching in these ports, we need to keep a bunch of ENGINE symbols around despite adding OPENSSL_NO_ENGINE. This of course meant patching some other ports, but that was way easier. ok jsing
-rw-r--r--src/lib/libcrypto/Makefile3
-rw-r--r--src/lib/libcrypto/engine/engine.h44
-rw-r--r--src/lib/libcrypto/engine/engine_stubs.c125
3 files changed, 166 insertions, 6 deletions
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile
index 8ec9b1b3d8..b9cb2eddce 100644
--- a/src/lib/libcrypto/Makefile
+++ b/src/lib/libcrypto/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.138 2023/07/20 16:36:06 tb Exp $ 1# $OpenBSD: Makefile,v 1.139 2023/07/21 09:04:23 tb Exp $
2 2
3LIB= crypto 3LIB= crypto
4LIBREBUILD=y 4LIBREBUILD=y
@@ -362,6 +362,7 @@ SRCS+= ecs_lib.c
362SRCS+= ecdsa.c 362SRCS+= ecdsa.c
363 363
364# engine/ 364# engine/
365SRCS+= engine_stubs.c
365SRCS+= eng_all.c 366SRCS+= eng_all.c
366SRCS+= eng_cnf.c 367SRCS+= eng_cnf.c
367SRCS+= eng_ctrl.c 368SRCS+= eng_ctrl.c
diff --git a/src/lib/libcrypto/engine/engine.h b/src/lib/libcrypto/engine/engine.h
index 0c620ba7f8..156c2f856c 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.38 2023/04/18 09:10:44 tb Exp $ */ 1/* $OpenBSD: engine.h,v 1.39 2023/07/21 09:04:23 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 */
@@ -66,10 +66,6 @@
66 66
67#include <openssl/opensslconf.h> 67#include <openssl/opensslconf.h>
68 68
69#ifdef OPENSSL_NO_ENGINE
70#error ENGINE is disabled.
71#endif
72
73#include <openssl/bn.h> 69#include <openssl/bn.h>
74#ifndef OPENSSL_NO_DH 70#ifndef OPENSSL_NO_DH
75#include <openssl/dh.h> 71#include <openssl/dh.h>
@@ -246,6 +242,43 @@ extern "C" {
246 * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */ 242 * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */
247#define ENGINE_CMD_BASE 200 243#define ENGINE_CMD_BASE 200
248 244
245/*
246 * Prototypes for the stub functions in engine_stubs.c. They are provided to
247 * build M2Crypto, Dovecot, apr-utils without patching. All the other garbage
248 * can hopefully go away soon.
249 */
250#ifdef OPENSSL_NO_ENGINE
251void ENGINE_load_builtin_engines(void);
252void ENGINE_load_dynamic(void);
253void ENGINE_load_openssl(void);
254int ENGINE_register_all_complete(void);
255
256void ENGINE_cleanup(void);
257ENGINE *ENGINE_new(void);
258
259int ENGINE_free(ENGINE *engine);
260int ENGINE_init(ENGINE *engine);
261int ENGINE_finish(ENGINE *engine);
262
263ENGINE *ENGINE_by_id(const char *id);
264const char *ENGINE_get_id(const ENGINE *engine);
265const char *ENGINE_get_name(const ENGINE *engine);
266
267int ENGINE_set_default(ENGINE *engine, unsigned int flags);
268
269ENGINE *ENGINE_get_default_RSA(void);
270int ENGINE_set_default_RSA(ENGINE *engine);
271
272int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, long i, void *p,
273 void (*f)(void), int cmd_optional);
274int ENGINE_ctrl_cmd_string(ENGINE *engine, const char *cmd, const char *arg,
275 int cmd_optional);
276
277EVP_PKEY *ENGINE_load_private_key(ENGINE *engine, const char *key_id,
278 UI_METHOD *ui_method, void *callback_data);
279EVP_PKEY *ENGINE_load_public_key(ENGINE *engine, const char *key_id,
280 UI_METHOD *ui_method, void *callback_data);
281#else
249/* If an ENGINE supports its own specific control commands and wishes the 282/* If an ENGINE supports its own specific control commands and wishes the
250 * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on its 283 * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on its
251 * behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN entries 284 * behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN entries
@@ -714,6 +747,7 @@ typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id,
714 void *ENGINE_get_static_state(void); 747 void *ENGINE_get_static_state(void);
715 748
716void ERR_load_ENGINE_strings(void); 749void ERR_load_ENGINE_strings(void);
750#endif
717 751
718/* Error codes for the ENGINE functions. */ 752/* Error codes for the ENGINE functions. */
719 753
diff --git a/src/lib/libcrypto/engine/engine_stubs.c b/src/lib/libcrypto/engine/engine_stubs.c
new file mode 100644
index 0000000000..3621da80ef
--- /dev/null
+++ b/src/lib/libcrypto/engine/engine_stubs.c
@@ -0,0 +1,125 @@
1/* $OpenBSD: engine_stubs.c,v 1.1 2023/07/21 09:04:23 tb Exp $ */
2
3/*
4 * Written by Theo Buehler. Public domain.
5 */
6
7#include <openssl/engine.h>
8
9#ifdef OPENSSL_NO_ENGINE
10
11void
12ENGINE_load_builtin_engines(void)
13{
14}
15
16void
17ENGINE_load_dynamic(void)
18{
19}
20
21void
22ENGINE_load_openssl(void)
23{
24}
25
26int
27ENGINE_register_all_complete(void)
28{
29 return 0;
30}
31
32void
33ENGINE_cleanup(void)
34{
35}
36
37ENGINE *
38ENGINE_new(void)
39{
40 return NULL;
41}
42
43int
44ENGINE_free(ENGINE *engine)
45{
46 return 0;
47}
48
49int
50ENGINE_init(ENGINE *engine)
51{
52 return 0;
53}
54
55int
56ENGINE_finish(ENGINE *engine)
57{
58 return 0;
59}
60
61ENGINE *
62ENGINE_by_id(const char *id)
63{
64 return NULL;
65}
66
67const char *
68ENGINE_get_id(const ENGINE *engine)
69{
70 return "";
71}
72
73const char *
74ENGINE_get_name(const ENGINE *engine)
75{
76 return "";
77}
78
79int
80ENGINE_set_default(ENGINE *engine, unsigned int flags)
81{
82 return 0;
83}
84
85ENGINE *
86ENGINE_get_default_RSA(void)
87{
88 return NULL;
89}
90
91int
92ENGINE_set_default_RSA(ENGINE *engine)
93{
94 return 0;
95}
96
97int
98ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, long i, void *p,
99 void (*f)(void), int cmd_optional)
100{
101 return 0;
102}
103
104int
105ENGINE_ctrl_cmd_string(ENGINE *engine, const char *cmd, const char *arg,
106 int cmd_optional)
107{
108 return 0;
109}
110
111EVP_PKEY *
112ENGINE_load_private_key(ENGINE *engine, const char *key_id,
113 UI_METHOD *ui_method, void *callback_data)
114{
115 return NULL;
116}
117
118EVP_PKEY *
119ENGINE_load_public_key(ENGINE *engine, const char *key_id,
120 UI_METHOD *ui_method, void *callback_data)
121{
122 return NULL;
123}
124
125#endif