From 7e749655f538adaee74d05fee754d1cb4126f073 Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 28 Jul 2023 10:21:01 +0000 Subject: [PATCH] Remove ERR_{get,set}_implementation() Much like ex_data, applications can make the library use their own error stack implementation. Well, except as of right now they no longer can. ok jsing --- lib/libcrypto/Symbols.list | 2 -- lib/libcrypto/Symbols.namespace | 2 -- lib/libcrypto/err/err.c | 31 +++--------------------------- lib/libcrypto/err/err.h | 11 +---------- lib/libcrypto/hidden/openssl/err.h | 4 +--- lib/libcrypto/ossl_typ.h | 4 +--- 6 files changed, 6 insertions(+), 48 deletions(-) diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index 8129d9f182c..6a739fa1931 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -1123,7 +1123,6 @@ ERR_get_err_state_table ERR_get_error ERR_get_error_line ERR_get_error_line_data -ERR_get_implementation ERR_get_next_error_library ERR_get_state ERR_get_string_table @@ -1170,7 +1169,6 @@ ERR_release_err_state_table ERR_remove_state ERR_remove_thread_state ERR_set_error_data -ERR_set_implementation ERR_set_mark ERR_unload_strings ESS_CERT_ID_dup diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index dcf70a63e6a..721c111ff4a 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -1396,8 +1396,6 @@ _libre_ERR_release_err_state_table _libre_ERR_get_next_error_library _libre_ERR_set_mark _libre_ERR_pop_to_mark -_libre_ERR_get_implementation -_libre_ERR_set_implementation _libre_RAND_set_rand_method _libre_RAND_get_rand_method _libre_RAND_SSLeay diff --git a/lib/libcrypto/err/err.c b/lib/libcrypto/err/err.c index 8fbeea715e3..8beb29543a5 100644 --- a/lib/libcrypto/err/err.c +++ b/lib/libcrypto/err/err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err.c,v 1.54 2023/07/07 19:37:53 beck Exp $ */ +/* $OpenBSD: err.c,v 1.55 2023/07/28 10:21:01 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -125,6 +125,8 @@ DECLARE_LHASH_OF(ERR_STRING_DATA); DECLARE_LHASH_OF(ERR_STATE); +typedef struct st_ERR_FNS ERR_FNS; + static void err_load_strings(int lib, ERR_STRING_DATA *str); static void ERR_STATE_free(ERR_STATE *s); @@ -300,33 +302,6 @@ err_fns_check(void) CRYPTO_w_unlock(CRYPTO_LOCK_ERR); } -/* API functions to get or set the underlying ERR functions. */ - -const ERR_FNS * -ERR_get_implementation(void) -{ - err_fns_check(); - return err_fns; -} -LCRYPTO_ALIAS(ERR_get_implementation); - -int -ERR_set_implementation(const ERR_FNS *fns) -{ - int ret = 0; - - CRYPTO_w_lock(CRYPTO_LOCK_ERR); - /* It's too late if 'err_fns' is non-NULL. BTW: not much point setting - * an error is there?! */ - if (!err_fns) { - err_fns = fns; - ret = 1; - } - CRYPTO_w_unlock(CRYPTO_LOCK_ERR); - return ret; -} -LCRYPTO_ALIAS(ERR_set_implementation); - /* These are the callbacks provided to "lh_new()" when creating the LHASH tables * internal to the "err_defaults" implementation. */ diff --git a/lib/libcrypto/err/err.h b/lib/libcrypto/err/err.h index b61599d508f..703817be332 100644 --- a/lib/libcrypto/err/err.h +++ b/lib/libcrypto/err/err.h @@ -1,4 +1,4 @@ -/* $OpenBSD: err.h,v 1.29 2023/04/09 19:10:23 tb Exp $ */ +/* $OpenBSD: err.h,v 1.30 2023/07/28 10:21:01 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -410,15 +410,6 @@ int ERR_get_next_error_library(void); int ERR_set_mark(void); int ERR_pop_to_mark(void); -/* Already defined in ossl_typ.h */ -/* typedef struct st_ERR_FNS ERR_FNS; */ -/* An application can use this function and provide the return value to loaded - * modules that should use the application's ERR state/functionality */ -const ERR_FNS *ERR_get_implementation(void); -/* A loaded module should call this function prior to any ERR operations using - * the application's "ERR_FNS". */ -int ERR_set_implementation(const ERR_FNS *fns); - #ifdef __cplusplus } #endif diff --git a/lib/libcrypto/hidden/openssl/err.h b/lib/libcrypto/hidden/openssl/err.h index bc2a96644cd..c53feb89f4c 100644 --- a/lib/libcrypto/hidden/openssl/err.h +++ b/lib/libcrypto/hidden/openssl/err.h @@ -1,4 +1,4 @@ -/* $OpenBSD: err.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ +/* $OpenBSD: err.h,v 1.3 2023/07/28 10:21:01 tb Exp $ */ /* * Copyright (c) 2023 Bob Beck * @@ -60,7 +60,5 @@ LCRYPTO_USED(ERR_release_err_state_table); LCRYPTO_USED(ERR_get_next_error_library); LCRYPTO_USED(ERR_set_mark); LCRYPTO_USED(ERR_pop_to_mark); -LCRYPTO_USED(ERR_get_implementation); -LCRYPTO_USED(ERR_set_implementation); #endif /* _LIBCRYPTO_ERR_H */ diff --git a/lib/libcrypto/ossl_typ.h b/lib/libcrypto/ossl_typ.h index b58888de3b7..5da4243f80c 100644 --- a/lib/libcrypto/ossl_typ.h +++ b/lib/libcrypto/ossl_typ.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ossl_typ.h,v 1.27 2023/07/28 09:22:26 tb Exp $ */ +/* $OpenBSD: ossl_typ.h,v 1.28 2023/07/28 10:21:01 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. * @@ -150,8 +150,6 @@ typedef struct store_method_st STORE_METHOD; typedef struct ui_st UI; typedef struct ui_method_st UI_METHOD; -typedef struct st_ERR_FNS ERR_FNS; - typedef struct engine_st ENGINE; typedef struct ssl_st SSL; typedef struct ssl_ctx_st SSL_CTX; -- 2.20.1