summaryrefslogtreecommitdiffstats
path: root/crypto/store
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2023-06-22 09:36:37 +1000
committerPauli <pauli@openssl.org>2023-07-01 21:18:25 +1000
commit2a1f467cb9e00d7b6c437443d6414370f3e6ff40 (patch)
treed0b8e7d5ae6d6e52965249c8acabbdbd798b285a /crypto/store
parent97937cfcd8b5a011dd54e74eb2cc3cc26a533b10 (diff)
store: 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/store')
-rw-r--r--crypto/store/store_local.h1
-rw-r--r--crypto/store/store_meth.c9
2 files changed, 4 insertions, 6 deletions
diff --git a/crypto/store/store_local.h b/crypto/store/store_local.h
index bca6516b04..6526a7260a 100644
--- a/crypto/store/store_local.h
+++ b/crypto/store/store_local.h
@@ -103,7 +103,6 @@ struct ossl_store_loader_st {
const char *description;
CRYPTO_REF_COUNT refcnt;
- CRYPTO_RWLOCK *lock;
OSSL_FUNC_store_open_fn *p_open;
OSSL_FUNC_store_attach_fn *p_attach;
diff --git a/crypto/store/store_meth.c b/crypto/store/store_meth.c
index ab1016853e..e9f5a0eb8a 100644
--- a/crypto/store/store_meth.c
+++ b/crypto/store/store_meth.c
@@ -21,7 +21,7 @@ int OSSL_STORE_LOADER_up_ref(OSSL_STORE_LOADER *loader)
int ref = 0;
if (loader->prov != NULL)
- CRYPTO_UP_REF(&loader->refcnt, &ref, loader->lock);
+ CRYPTO_UP_REF(&loader->refcnt, &ref);
return 1;
}
@@ -30,11 +30,11 @@ void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader)
if (loader != NULL && loader->prov != NULL) {
int i;
- CRYPTO_DOWN_REF(&loader->refcnt, &i, loader->lock);
+ CRYPTO_DOWN_REF(&loader->refcnt, &i);
if (i > 0)
return;
ossl_provider_free(loader->prov);
- CRYPTO_THREAD_lock_free(loader->lock);
+ CRYPTO_FREE_REF(&loader->refcnt);
}
OPENSSL_free(loader);
}
@@ -48,13 +48,12 @@ static OSSL_STORE_LOADER *new_loader(OSSL_PROVIDER *prov)
OSSL_STORE_LOADER *loader;
if ((loader = OPENSSL_zalloc(sizeof(*loader))) == NULL
- || (loader->lock = CRYPTO_THREAD_lock_new()) == NULL) {
+ || !CRYPTO_NEW_REF(&loader->refcnt, 1)) {
OPENSSL_free(loader);
return NULL;
}
loader->prov = prov;
ossl_provider_up_ref(prov);
- loader->refcnt = 1;
return loader;
}