From: tb Date: Sat, 2 Mar 2024 10:30:48 +0000 (+0000) Subject: Remove ERR_get_state X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=86b918c0f1d8aba4b6e44fa7ed5ea972f8ec6c1d;p=openbsd Remove ERR_get_state The ERR_STATE struct is an unused implementation detail of the horrific error stack code. It is the last public consumer of CRYPTO_THREAD internals. Make this and its accessor internal so we can make the CRYPTO_THREAD struct opaque. ok jsing --- diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index de97306613d..715999858e7 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -1086,7 +1086,6 @@ ERR_get_error ERR_get_error_line ERR_get_error_line_data ERR_get_next_error_library -ERR_get_state ERR_lib_error_string ERR_load_ASN1_strings ERR_load_BIO_strings diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index a540b310489..6aa4468fae1 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -1328,7 +1328,6 @@ _libre_ERR_load_crypto_strings _libre_ERR_free_strings _libre_ERR_remove_thread_state _libre_ERR_remove_state -_libre_ERR_get_state _libre_ERR_get_next_error_library _libre_ERR_set_mark _libre_ERR_pop_to_mark diff --git a/lib/libcrypto/err/err.c b/lib/libcrypto/err/err.c index 036396bc1a9..acbcda76cc9 100644 --- a/lib/libcrypto/err/err.c +++ b/lib/libcrypto/err/err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err.c,v 1.58 2024/02/24 07:53:01 tb Exp $ */ +/* $OpenBSD: err.c,v 1.59 2024/03/02 10:30:48 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -127,9 +127,22 @@ DECLARE_LHASH_OF(ERR_STATE); typedef struct st_ERR_FNS ERR_FNS; +typedef struct err_state_st { + CRYPTO_THREADID tid; + int err_flags[ERR_NUM_ERRORS]; + unsigned long err_buffer[ERR_NUM_ERRORS]; + char *err_data[ERR_NUM_ERRORS]; + int err_data_flags[ERR_NUM_ERRORS]; + const char *err_file[ERR_NUM_ERRORS]; + int err_line[ERR_NUM_ERRORS]; + int top, bottom; +} ERR_STATE; + static void err_load_strings(int lib, ERR_STRING_DATA *str); +static ERR_STATE *ERR_get_state(void); static void ERR_STATE_free(ERR_STATE *s); + #ifndef OPENSSL_NO_ERR static ERR_STRING_DATA ERR_str_libraries[] = { {ERR_PACK(ERR_LIB_NONE,0,0), "unknown library"}, @@ -1020,7 +1033,7 @@ ERR_remove_state(unsigned long pid) } LCRYPTO_ALIAS(ERR_remove_state); -ERR_STATE * +static ERR_STATE * ERR_get_state(void) { static ERR_STATE fallback; @@ -1058,7 +1071,6 @@ ERR_get_state(void) } return ret; } -LCRYPTO_ALIAS(ERR_get_state); int ERR_get_next_error_library(void) diff --git a/lib/libcrypto/err/err.h b/lib/libcrypto/err/err.h index d85de24cb11..e0b4354e49b 100644 --- a/lib/libcrypto/err/err.h +++ b/lib/libcrypto/err/err.h @@ -1,4 +1,4 @@ -/* $OpenBSD: err.h,v 1.31 2023/07/28 10:23:19 tb Exp $ */ +/* $OpenBSD: err.h,v 1.32 2024/03/02 10:30:48 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -143,16 +143,6 @@ extern "C" { #define ERR_FLAG_MARK 0x01 #define ERR_NUM_ERRORS 16 -typedef struct err_state_st { - CRYPTO_THREADID tid; - int err_flags[ERR_NUM_ERRORS]; - unsigned long err_buffer[ERR_NUM_ERRORS]; - char *err_data[ERR_NUM_ERRORS]; - int err_data_flags[ERR_NUM_ERRORS]; - const char *err_file[ERR_NUM_ERRORS]; - int err_line[ERR_NUM_ERRORS]; - int top, bottom; -} ERR_STATE; /* library */ #define ERR_LIB_NONE 1 @@ -397,7 +387,6 @@ void ERR_free_strings(void); void ERR_remove_thread_state(const CRYPTO_THREADID *tid); /* Wrapped in OPENSSL_NO_DEPRECATED in 0.9.8. Still used in 2023. */ void ERR_remove_state(unsigned long pid); -ERR_STATE *ERR_get_state(void); int ERR_get_next_error_library(void); diff --git a/lib/libcrypto/hidden/openssl/err.h b/lib/libcrypto/hidden/openssl/err.h index 036ead8c089..08f97e1c5db 100644 --- a/lib/libcrypto/hidden/openssl/err.h +++ b/lib/libcrypto/hidden/openssl/err.h @@ -1,4 +1,4 @@ -/* $OpenBSD: err.h,v 1.4 2023/07/28 10:23:19 tb Exp $ */ +/* $OpenBSD: err.h,v 1.5 2024/03/02 10:30:48 tb Exp $ */ /* * Copyright (c) 2023 Bob Beck * @@ -53,7 +53,6 @@ LCRYPTO_USED(ERR_load_crypto_strings); LCRYPTO_USED(ERR_free_strings); LCRYPTO_USED(ERR_remove_thread_state); LCRYPTO_USED(ERR_remove_state); -LCRYPTO_USED(ERR_get_state); LCRYPTO_USED(ERR_get_next_error_library); LCRYPTO_USED(ERR_set_mark); LCRYPTO_USED(ERR_pop_to_mark);