aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/dso/dso_lib.c
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2023-06-22 09:29:24 +1000
committerPauli <pauli@openssl.org>2023-07-01 21:18:25 +1000
commitaaab365c5afb950b9ffaa2916635a18e0d34fa98 (patch)
tree2ba491e5855378d44a7ac7ceeb9f4b12f30bfbe6 /crypto/dso/dso_lib.c
parent495e6d3b6266176b92ea20dbc6541ca724fa07ff (diff)
downloadopenssl-aaab365c5afb950b9ffaa2916635a18e0d34fa98.tar.gz
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/dso_lib.c')
-rw-r--r--crypto/dso/dso_lib.c11
1 files changed, 4 insertions, 7 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);