THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

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)
pull/9890/head
Richard Levitte 2 months ago
parent
commit
e5d4233fbd
16 changed files with 35 additions and 25 deletions
  1. 17
    9
      crypto/err/err.c
  2. 3
    3
      crypto/err/err_blocks.c
  3. 2
    0
      crypto/err/err_locl.h
  4. 1
    1
      fuzz/asn1.c
  5. 1
    1
      fuzz/asn1parse.c
  6. 1
    1
      fuzz/bignum.c
  7. 1
    1
      fuzz/bndiv.c
  8. 1
    1
      fuzz/client.c
  9. 1
    1
      fuzz/cms.c
  10. 1
    1
      fuzz/conf.c
  11. 1
    1
      fuzz/crl.c
  12. 1
    1
      fuzz/ct.c
  13. 1
    1
      fuzz/server.c
  14. 1
    1
      fuzz/x509.c
  15. 1
    1
      include/openssl/err.h
  16. 1
    1
      util/libcrypto.num

+ 17
- 9
crypto/err/err.c 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;


+ 3
- 3
crypto/err/err_blocks.c 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;

+ 2
- 0
crypto/err/err_locl.h 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);

+ 1
- 1
fuzz/asn1.c 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();


+ 1
- 1
fuzz/asn1parse.c 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;
}

+ 1
- 1
fuzz/bignum.c 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;
}

+ 1
- 1
fuzz/bndiv.c 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;
}

+ 1
- 1
fuzz/client.c 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();

+ 1
- 1
fuzz/cms.c 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;
}

+ 1
- 1
fuzz/conf.c 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;
}


+ 1
- 1
fuzz/crl.c 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;
}

+ 1
- 1
fuzz/ct.c 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;
}


+ 1
- 1
fuzz/server.c 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();

+ 1
- 1
fuzz/x509.c 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;

+ 1
- 1
include/openssl/err.h 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);


+ 1
- 1
util/libcrypto.num 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

Loading…
Cancel
Save