diff options
author | Pauli <pauli@openssl.org> | 2023-06-22 09:29:24 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-07-01 21:18:25 +1000 |
commit | aaab365c5afb950b9ffaa2916635a18e0d34fa98 (patch) | |
tree | 2ba491e5855378d44a7ac7ceeb9f4b12f30bfbe6 /crypto/dso | |
parent | 495e6d3b6266176b92ea20dbc6541ca724fa07ff (diff) |
dso: update to structure based atomics
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21260)
Diffstat (limited to 'crypto/dso')
-rw-r--r-- | crypto/dso/dso_lib.c | 11 | ||||
-rw-r--r-- | crypto/dso/dso_local.h | 1 |
2 files changed, 4 insertions, 8 deletions
diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c index a73d91e839..7680c40547 100644 --- a/crypto/dso/dso_lib.c +++ b/crypto/dso/dso_lib.c @@ -25,10 +25,7 @@ static DSO *DSO_new_method(DSO_METHOD *meth) return NULL; } ret->meth = DSO_METHOD_openssl(); - ret->references = 1; - ret->lock = CRYPTO_THREAD_lock_new(); - if (ret->lock == NULL) { - ERR_raise(ERR_LIB_DSO, ERR_R_CRYPTO_LIB); + if (!CRYPTO_NEW_REF(&ret->references, 1)) { sk_void_free(ret->meth_data); OPENSSL_free(ret); return NULL; @@ -54,7 +51,7 @@ int DSO_free(DSO *dso) if (dso == NULL) return 1; - if (CRYPTO_DOWN_REF(&dso->references, &i, dso->lock) <= 0) + if (CRYPTO_DOWN_REF(&dso->references, &i) <= 0) return 0; REF_PRINT_COUNT("DSO", dso); @@ -77,7 +74,7 @@ int DSO_free(DSO *dso) sk_void_free(dso->meth_data); OPENSSL_free(dso->filename); OPENSSL_free(dso->loaded_filename); - CRYPTO_THREAD_lock_free(dso->lock); + CRYPTO_FREE_REF(&dso->references); OPENSSL_free(dso); return 1; } @@ -96,7 +93,7 @@ int DSO_up_ref(DSO *dso) return 0; } - if (CRYPTO_UP_REF(&dso->references, &i, dso->lock) <= 0) + if (CRYPTO_UP_REF(&dso->references, &i) <= 0) return 0; REF_PRINT_COUNT("DSO", dso); diff --git a/crypto/dso/dso_local.h b/crypto/dso/dso_local.h index 8aa29c1826..3100ba0844 100644 --- a/crypto/dso/dso_local.h +++ b/crypto/dso/dso_local.h @@ -61,7 +61,6 @@ struct dso_st { * loaded. */ char *loaded_filename; - CRYPTO_RWLOCK *lock; }; struct dso_meth_st { |