From 3001f29e8e1ee3d723ebd2ae74056d6a1427d81c Mon Sep 17 00:00:00 2001 From: tb Date: Wed, 27 Mar 2024 06:08:45 +0000 Subject: [PATCH] Hide symbols in engine ok jsing --- lib/libcrypto/Symbols.namespace | 19 +++++++++++ lib/libcrypto/engine/engine_stubs.c | 21 +++++++++++- lib/libcrypto/hidden/openssl/engine.h | 48 +++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 lib/libcrypto/hidden/openssl/engine.h diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index 95b2a33720b..adb4330f093 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -2523,3 +2523,22 @@ _libre_OPENSSL_gmtime _libre_OPENSSL_timegm _libre_OPENSSL_posix_to_tm _libre_OPENSSL_tm_to_posix +_libre_ENGINE_load_builtin_engines +_libre_ENGINE_load_dynamic +_libre_ENGINE_load_openssl +_libre_ENGINE_register_all_complete +_libre_ENGINE_cleanup +_libre_ENGINE_new +_libre_ENGINE_free +_libre_ENGINE_init +_libre_ENGINE_finish +_libre_ENGINE_by_id +_libre_ENGINE_get_id +_libre_ENGINE_get_name +_libre_ENGINE_set_default +_libre_ENGINE_get_default_RSA +_libre_ENGINE_set_default_RSA +_libre_ENGINE_ctrl_cmd +_libre_ENGINE_ctrl_cmd_string +_libre_ENGINE_load_private_key +_libre_ENGINE_load_public_key diff --git a/lib/libcrypto/engine/engine_stubs.c b/lib/libcrypto/engine/engine_stubs.c index bd031e49f07..055396fba06 100644 --- a/lib/libcrypto/engine/engine_stubs.c +++ b/lib/libcrypto/engine/engine_stubs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine_stubs.c,v 1.3 2023/11/19 15:47:40 tb Exp $ */ +/* $OpenBSD: engine_stubs.c,v 1.4 2024/03/27 06:08:45 tb Exp $ */ /* * Written by Theo Buehler. Public domain. @@ -10,87 +10,102 @@ void ENGINE_load_builtin_engines(void) { } +LCRYPTO_ALIAS(ENGINE_load_builtin_engines); void ENGINE_load_dynamic(void) { } +LCRYPTO_ALIAS(ENGINE_load_dynamic); void ENGINE_load_openssl(void) { } +LCRYPTO_ALIAS(ENGINE_load_openssl); int ENGINE_register_all_complete(void) { return 0; } +LCRYPTO_ALIAS(ENGINE_register_all_complete); void ENGINE_cleanup(void) { } +LCRYPTO_ALIAS(ENGINE_cleanup); ENGINE * ENGINE_new(void) { return NULL; } +LCRYPTO_ALIAS(ENGINE_new); int ENGINE_free(ENGINE *engine) { return 0; } +LCRYPTO_ALIAS(ENGINE_free); int ENGINE_init(ENGINE *engine) { return 0; } +LCRYPTO_ALIAS(ENGINE_init); int ENGINE_finish(ENGINE *engine) { return 0; } +LCRYPTO_ALIAS(ENGINE_finish); ENGINE * ENGINE_by_id(const char *id) { return NULL; } +LCRYPTO_ALIAS(ENGINE_by_id); const char * ENGINE_get_id(const ENGINE *engine) { return ""; } +LCRYPTO_ALIAS(ENGINE_get_id); const char * ENGINE_get_name(const ENGINE *engine) { return ""; } +LCRYPTO_ALIAS(ENGINE_get_name); int ENGINE_set_default(ENGINE *engine, unsigned int flags) { return 0; } +LCRYPTO_ALIAS(ENGINE_set_default); ENGINE * ENGINE_get_default_RSA(void) { return NULL; } +LCRYPTO_ALIAS(ENGINE_get_default_RSA); int ENGINE_set_default_RSA(ENGINE *engine) { return 0; } +LCRYPTO_ALIAS(ENGINE_set_default_RSA); int ENGINE_ctrl_cmd(ENGINE *engine, const char *cmd_name, long i, void *p, @@ -98,6 +113,7 @@ ENGINE_ctrl_cmd(ENGINE *engine, const char *cmd_name, long i, void *p, { return 0; } +LCRYPTO_ALIAS(ENGINE_ctrl_cmd); int ENGINE_ctrl_cmd_string(ENGINE *engine, const char *cmd, const char *arg, @@ -105,6 +121,7 @@ ENGINE_ctrl_cmd_string(ENGINE *engine, const char *cmd, const char *arg, { return 0; } +LCRYPTO_ALIAS(ENGINE_ctrl_cmd_string); EVP_PKEY * ENGINE_load_private_key(ENGINE *engine, const char *key_id, @@ -112,6 +129,7 @@ ENGINE_load_private_key(ENGINE *engine, const char *key_id, { return NULL; } +LCRYPTO_ALIAS(ENGINE_load_private_key); EVP_PKEY * ENGINE_load_public_key(ENGINE *engine, const char *key_id, @@ -119,3 +137,4 @@ ENGINE_load_public_key(ENGINE *engine, const char *key_id, { return NULL; } +LCRYPTO_ALIAS(ENGINE_load_public_key); diff --git a/lib/libcrypto/hidden/openssl/engine.h b/lib/libcrypto/hidden/openssl/engine.h new file mode 100644 index 00000000000..78334779b12 --- /dev/null +++ b/lib/libcrypto/hidden/openssl/engine.h @@ -0,0 +1,48 @@ +/* $OpenBSD: engine.h,v 1.1 2024/03/27 06:08:45 tb Exp $ */ +/* + * Copyright (c) 2024 Theo Buehler + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_ENGINE_H +#define _LIBCRYPTO_ENGINE_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/engine.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(ENGINE_load_builtin_engines); +LCRYPTO_USED(ENGINE_load_dynamic); +LCRYPTO_USED(ENGINE_load_openssl); +LCRYPTO_USED(ENGINE_register_all_complete); +LCRYPTO_USED(ENGINE_cleanup); +LCRYPTO_USED(ENGINE_new); +LCRYPTO_USED(ENGINE_free); +LCRYPTO_USED(ENGINE_init); +LCRYPTO_USED(ENGINE_finish); +LCRYPTO_USED(ENGINE_by_id); +LCRYPTO_USED(ENGINE_get_id); +LCRYPTO_USED(ENGINE_get_name); +LCRYPTO_USED(ENGINE_set_default); +LCRYPTO_USED(ENGINE_get_default_RSA); +LCRYPTO_USED(ENGINE_set_default_RSA); +LCRYPTO_USED(ENGINE_ctrl_cmd); +LCRYPTO_USED(ENGINE_ctrl_cmd_string); +LCRYPTO_USED(ENGINE_load_private_key); +LCRYPTO_USED(ENGINE_load_public_key); + +#endif /* _LIBCRYPTO_ENGINE_H */ -- 2.20.1