diff options
author | Tomas Mraz <tomas@openssl.org> | 2023-05-30 22:14:58 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-07-07 15:13:29 +0200 |
commit | 9c3ea4e1d7580fc061dfb754b620adb3439e683f (patch) | |
tree | e87832dee0de7a0e5a1f0da4a71e59ac89f3345d /crypto/err/err.c | |
parent | 5c3474ea563ed95bb7c86c08867139613655276b (diff) |
QUIC err handling: Save and restore error state
We save the error state from the thread that encountered
a permanent error condition caused by system or internal
error to the QUIC_CHANNEL.
Then we restore it whenever we are returning to a user
call when protocol is shutdown.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21087)
Diffstat (limited to 'crypto/err/err.c')
-rw-r--r-- | crypto/err/err.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/crypto/err/err.c b/crypto/err/err.c index a6c5ff6132..972856ad23 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -33,7 +33,6 @@ ERR_STATE *ERR_get_state(void); static int err_load_strings(const ERR_STRING_DATA *str); #endif -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"}, @@ -199,7 +198,7 @@ static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d) } #endif -static void ERR_STATE_free(ERR_STATE *state) +void OSSL_ERR_STATE_free(ERR_STATE *state) { int i; @@ -649,7 +648,7 @@ static void err_delete_thread_state(void *unused) return; CRYPTO_THREAD_set_local(&err_thread_local, NULL); - ERR_STATE_free(state); + OSSL_ERR_STATE_free(state); } #ifndef OPENSSL_NO_DEPRECATED_1_1_0 @@ -689,8 +688,7 @@ ERR_STATE *ossl_err_get_state_int(void) if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1)) return NULL; - /* calling CRYPTO_zalloc(.., NULL, 0) prevents mem alloc error loop */ - state = CRYPTO_zalloc(sizeof(*state), NULL, 0); + state = OSSL_ERR_STATE_new(); if (state == NULL) { CRYPTO_THREAD_set_local(&err_thread_local, NULL); return NULL; @@ -698,7 +696,7 @@ ERR_STATE *ossl_err_get_state_int(void) if (!ossl_init_thread_start(NULL, NULL, err_delete_thread_state) || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { - ERR_STATE_free(state); + OSSL_ERR_STATE_free(state); CRYPTO_THREAD_set_local(&err_thread_local, NULL); return NULL; } |