summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_kmeth.c
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2023-06-22 09:32:45 +1000
committerPauli <pauli@openssl.org>2023-07-01 21:18:25 +1000
commit1353736b3e6f33a9f6e47f837c5de05cc0dd3647 (patch)
tree686c7d45b4981bcc882c8ca856ae35bfc441be77 /crypto/ec/ec_kmeth.c
parent420ad86a0e35ddbd65dae7e9458e36223af5f140 (diff)
ec: 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/ec/ec_kmeth.c')
-rw-r--r--crypto/ec/ec_kmeth.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/crypto/ec/ec_kmeth.c b/crypto/ec/ec_kmeth.c
index eca531d2b3..ec68ab154e 100644
--- a/crypto/ec/ec_kmeth.c
+++ b/crypto/ec/ec_kmeth.c
@@ -93,12 +93,8 @@ EC_KEY *ossl_ec_key_new_method_int(OSSL_LIB_CTX *libctx, const char *propq,
goto err;
}
- ret->references = 1;
- ret->lock = CRYPTO_THREAD_lock_new();
- if (ret->lock == NULL) {
- ERR_raise(ERR_LIB_EC, ERR_R_CRYPTO_LIB);
+ if (!CRYPTO_NEW_REF(&ret->references, 1))
goto err;
- }
ret->meth = EC_KEY_get_default_method();
#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
@@ -137,6 +133,7 @@ EC_KEY *ossl_ec_key_new_method_int(OSSL_LIB_CTX *libctx, const char *propq,
return ret;
err:
+ CRYPTO_FREE_REF(&ret->references);
EC_KEY_free(ret);
return NULL;
}