diff options
| author | tb <> | 2023-07-21 09:04:23 +0000 |
|---|---|---|
| committer | tb <> | 2023-07-21 09:04:23 +0000 |
| commit | 6fcc6301cbb6ea5d47209442358f4af309d05661 (patch) | |
| tree | a06a9f51ed23a061b5e6a00600a42d86ad37ce11 /src | |
| parent | 500c0a920f08fe601ee280579eec5b7b8b093dfb (diff) | |
| download | openbsd-6fcc6301cbb6ea5d47209442358f4af309d05661.tar.gz openbsd-6fcc6301cbb6ea5d47209442358f4af309d05661.tar.bz2 openbsd-6fcc6301cbb6ea5d47209442358f4af309d05661.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
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/Makefile | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/engine.h | 44 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/engine_stubs.c | 125 |
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 | ||
| 3 | LIB= crypto | 3 | LIB= crypto |
| 4 | LIBREBUILD=y | 4 | LIBREBUILD=y |
| @@ -362,6 +362,7 @@ SRCS+= ecs_lib.c | |||
| 362 | SRCS+= ecdsa.c | 362 | SRCS+= ecdsa.c |
| 363 | 363 | ||
| 364 | # engine/ | 364 | # engine/ |
| 365 | SRCS+= engine_stubs.c | ||
| 365 | SRCS+= eng_all.c | 366 | SRCS+= eng_all.c |
| 366 | SRCS+= eng_cnf.c | 367 | SRCS+= eng_cnf.c |
| 367 | SRCS+= eng_ctrl.c | 368 | SRCS+= 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 | ||
| 251 | void ENGINE_load_builtin_engines(void); | ||
| 252 | void ENGINE_load_dynamic(void); | ||
| 253 | void ENGINE_load_openssl(void); | ||
| 254 | int ENGINE_register_all_complete(void); | ||
| 255 | |||
| 256 | void ENGINE_cleanup(void); | ||
| 257 | ENGINE *ENGINE_new(void); | ||
| 258 | |||
| 259 | int ENGINE_free(ENGINE *engine); | ||
| 260 | int ENGINE_init(ENGINE *engine); | ||
| 261 | int ENGINE_finish(ENGINE *engine); | ||
| 262 | |||
| 263 | ENGINE *ENGINE_by_id(const char *id); | ||
| 264 | const char *ENGINE_get_id(const ENGINE *engine); | ||
| 265 | const char *ENGINE_get_name(const ENGINE *engine); | ||
| 266 | |||
| 267 | int ENGINE_set_default(ENGINE *engine, unsigned int flags); | ||
| 268 | |||
| 269 | ENGINE *ENGINE_get_default_RSA(void); | ||
| 270 | int ENGINE_set_default_RSA(ENGINE *engine); | ||
| 271 | |||
| 272 | int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, long i, void *p, | ||
| 273 | void (*f)(void), int cmd_optional); | ||
| 274 | int ENGINE_ctrl_cmd_string(ENGINE *engine, const char *cmd, const char *arg, | ||
| 275 | int cmd_optional); | ||
| 276 | |||
| 277 | EVP_PKEY *ENGINE_load_private_key(ENGINE *engine, const char *key_id, | ||
| 278 | UI_METHOD *ui_method, void *callback_data); | ||
| 279 | EVP_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 | ||
| 716 | void ERR_load_ENGINE_strings(void); | 749 | void 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 | |||
| 11 | void | ||
| 12 | ENGINE_load_builtin_engines(void) | ||
| 13 | { | ||
| 14 | } | ||
| 15 | |||
| 16 | void | ||
| 17 | ENGINE_load_dynamic(void) | ||
| 18 | { | ||
| 19 | } | ||
| 20 | |||
| 21 | void | ||
| 22 | ENGINE_load_openssl(void) | ||
| 23 | { | ||
| 24 | } | ||
| 25 | |||
| 26 | int | ||
| 27 | ENGINE_register_all_complete(void) | ||
| 28 | { | ||
| 29 | return 0; | ||
| 30 | } | ||
| 31 | |||
| 32 | void | ||
| 33 | ENGINE_cleanup(void) | ||
| 34 | { | ||
| 35 | } | ||
| 36 | |||
| 37 | ENGINE * | ||
| 38 | ENGINE_new(void) | ||
| 39 | { | ||
| 40 | return NULL; | ||
| 41 | } | ||
| 42 | |||
| 43 | int | ||
| 44 | ENGINE_free(ENGINE *engine) | ||
| 45 | { | ||
| 46 | return 0; | ||
| 47 | } | ||
| 48 | |||
| 49 | int | ||
| 50 | ENGINE_init(ENGINE *engine) | ||
| 51 | { | ||
| 52 | return 0; | ||
| 53 | } | ||
| 54 | |||
| 55 | int | ||
| 56 | ENGINE_finish(ENGINE *engine) | ||
| 57 | { | ||
| 58 | return 0; | ||
| 59 | } | ||
| 60 | |||
| 61 | ENGINE * | ||
| 62 | ENGINE_by_id(const char *id) | ||
| 63 | { | ||
| 64 | return NULL; | ||
| 65 | } | ||
| 66 | |||
| 67 | const char * | ||
| 68 | ENGINE_get_id(const ENGINE *engine) | ||
| 69 | { | ||
| 70 | return ""; | ||
| 71 | } | ||
| 72 | |||
| 73 | const char * | ||
| 74 | ENGINE_get_name(const ENGINE *engine) | ||
| 75 | { | ||
| 76 | return ""; | ||
| 77 | } | ||
| 78 | |||
| 79 | int | ||
| 80 | ENGINE_set_default(ENGINE *engine, unsigned int flags) | ||
| 81 | { | ||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | |||
| 85 | ENGINE * | ||
| 86 | ENGINE_get_default_RSA(void) | ||
| 87 | { | ||
| 88 | return NULL; | ||
| 89 | } | ||
| 90 | |||
| 91 | int | ||
| 92 | ENGINE_set_default_RSA(ENGINE *engine) | ||
| 93 | { | ||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | |||
| 97 | int | ||
| 98 | ENGINE_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 | |||
| 104 | int | ||
| 105 | ENGINE_ctrl_cmd_string(ENGINE *engine, const char *cmd, const char *arg, | ||
| 106 | int cmd_optional) | ||
| 107 | { | ||
| 108 | return 0; | ||
| 109 | } | ||
| 110 | |||
| 111 | EVP_PKEY * | ||
| 112 | ENGINE_load_private_key(ENGINE *engine, const char *key_id, | ||
| 113 | UI_METHOD *ui_method, void *callback_data) | ||
| 114 | { | ||
| 115 | return NULL; | ||
| 116 | } | ||
| 117 | |||
| 118 | EVP_PKEY * | ||
| 119 | ENGINE_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 | ||
