Skip to content

Commit

Permalink
dso: update to structure based atomics
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #21260)
  • Loading branch information
paulidale committed Jul 1, 2023
1 parent 495e6d3 commit aaab365
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
11 changes: 4 additions & 7 deletions crypto/dso/dso_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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;
}
Expand All @@ -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);
Expand Down
1 change: 0 additions & 1 deletion crypto/dso/dso_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ struct dso_st {
* loaded.
*/
char *loaded_filename;
CRYPTO_RWLOCK *lock;
};

struct dso_meth_st {
Expand Down

0 comments on commit aaab365

Please sign in to comment.