Deprecate ERR_get_state()

Internally, we still need this function, so we make it internal and
then add a new ERR_get_state() that simply calls the internal variant,
unless it's "removed" by configuration.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9462)
This commit is contained in:
Richard Levitte 2019-07-26 18:11:55 +02:00
parent 14e275e8fb
commit e5d4233fbd
16 changed files with 35 additions and 25 deletions

View File

@ -365,7 +365,7 @@ void ERR_clear_error(void)
int i;
ERR_STATE *es;
es = ERR_get_state();
es = err_get_state_int();
if (es == NULL)
return;
@ -488,7 +488,7 @@ static unsigned long get_error_values(int inc, int top, const char **file,
ERR_STATE *es;
unsigned long ret;
es = ERR_get_state();
es = err_get_state_int();
if (es == NULL)
return 0;
@ -685,7 +685,7 @@ DEFINE_RUN_ONCE_STATIC(err_do_init)
return CRYPTO_THREAD_init_local(&err_thread_local, NULL);
}
ERR_STATE *ERR_get_state(void)
ERR_STATE *err_get_state_int(void)
{
ERR_STATE *state;
int saveerrno = get_last_sys_error();
@ -724,6 +724,14 @@ ERR_STATE *ERR_get_state(void)
return state;
}
#if !OPENSSL_API_3
ERR_STATE *ERR_get_state(void)
{
return err_get_state_int();
}
#endif
/*
* err_shelve_state returns the current thread local error state
* and freezes the error module until err_unshelve_state is called.
@ -786,7 +794,7 @@ static int err_set_error_data_int(char *data, size_t size, int flags,
{
ERR_STATE *es;
es = ERR_get_state();
es = err_get_state_int();
if (es == NULL)
return 0;
@ -831,7 +839,7 @@ void ERR_add_error_vdata(int num, va_list args)
ERR_STATE *es;
/* Get the current error data; if an allocated string get it. */
es = ERR_get_state();
es = err_get_state_int();
if (es == NULL)
return;
i = es->top;
@ -886,7 +894,7 @@ int ERR_set_mark(void)
{
ERR_STATE *es;
es = ERR_get_state();
es = err_get_state_int();
if (es == NULL)
return 0;
@ -900,7 +908,7 @@ int ERR_pop_to_mark(void)
{
ERR_STATE *es;
es = ERR_get_state();
es = err_get_state_int();
if (es == NULL)
return 0;
@ -921,7 +929,7 @@ int ERR_clear_last_mark(void)
ERR_STATE *es;
int top;
es = ERR_get_state();
es = err_get_state_int();
if (es == NULL)
return 0;
@ -942,7 +950,7 @@ void err_clear_last_constant_time(int clear)
ERR_STATE *es;
int top;
es = ERR_get_state();
es = err_get_state_int();
if (es == NULL)
return;

View File

@ -18,7 +18,7 @@ void ERR_new(void)
{
ERR_STATE *es;
es = ERR_get_state();
es = err_get_state_int();
if (es == NULL)
return;
@ -31,7 +31,7 @@ void ERR_set_debug(const char *file, int line, const char *func)
{
ERR_STATE *es;
es = ERR_get_state();
es = err_get_state_int();
if (es == NULL)
return;
@ -55,7 +55,7 @@ void ERR_vset_error(int lib, int reason, const char *fmt, va_list args)
unsigned long flags = 0;
size_t i;
es = ERR_get_state();
es = err_get_state_int();
if (es == NULL)
return;
i = es->top;

View File

@ -66,3 +66,5 @@ static ossl_inline void err_clear(ERR_STATE *es, size_t i, int deall)
es->err_file[i] = NULL;
es->err_line[i] = -1;
}
ERR_STATE *err_get_state_int(void);

View File

@ -283,7 +283,7 @@ int FuzzerInitialize(int *argc, char ***argv)
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
ERR_get_state();
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
FuzzerSetRand();

View File

@ -25,7 +25,7 @@ int FuzzerInitialize(int *argc, char ***argv)
{
bio_out = BIO_new_file("/dev/null", "w");
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_get_state();
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}

View File

@ -22,7 +22,7 @@
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_get_state();
ERR_clear_error();
return 1;
}

View File

@ -38,7 +38,7 @@ int FuzzerInitialize(int *argc, char ***argv)
ctx = BN_CTX_new();
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_get_state();
ERR_clear_error();
return 1;
}

View File

@ -44,7 +44,7 @@ int FuzzerInitialize(int *argc, char ***argv)
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ASYNC, NULL);
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
ERR_get_state();
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
idx = SSL_get_ex_data_X509_STORE_CTX_idx();
FuzzerSetRand();

View File

@ -20,7 +20,7 @@
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_get_state();
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}

View File

@ -19,7 +19,7 @@
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_get_state();
ERR_clear_error();
return 1;
}

View File

@ -16,7 +16,7 @@
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_get_state();
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}

View File

@ -21,7 +21,7 @@ int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
CRYPTO_free_ex_index(0, -1);
ERR_get_state();
ERR_clear_error();
return 1;
}

View File

@ -491,7 +491,7 @@ int FuzzerInitialize(int *argc, char ***argv)
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ASYNC, NULL);
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
ERR_get_state();
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
idx = SSL_get_ex_data_X509_STORE_CTX_idx();
FuzzerSetRand();

View File

@ -19,7 +19,7 @@
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_get_state();
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
FuzzerSetRand();
return 1;

View File

@ -333,7 +333,7 @@ int ERR_load_ERR_strings(void);
DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *))
DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid))
ERR_STATE *ERR_get_state(void);
DEPRECATEDIN_3(ERR_STATE *ERR_get_state(void))
int ERR_get_next_error_library(void);

View File

@ -2213,7 +2213,7 @@ EVP_PKEY_missing_parameters 2261 3_0_0 EXIST::FUNCTION:
X509_REQ_INFO_new 2262 3_0_0 EXIST::FUNCTION:
EVP_rc2_cfb64 2263 3_0_0 EXIST::FUNCTION:RC2
PKCS7_get_smimecap 2264 3_0_0 EXIST::FUNCTION:
ERR_get_state 2265 3_0_0 EXIST::FUNCTION:
ERR_get_state 2265 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3
d2i_DSAPrivateKey_bio 2266 3_0_0 EXIST::FUNCTION:DSA
X509_PURPOSE_get_trust 2267 3_0_0 EXIST::FUNCTION:
EC_GROUP_get_point_conversion_form 2268 3_0_0 EXIST::FUNCTION:EC