summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_mult.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_mult.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_mult.c')
-rw-r--r--crypto/ec/ec_mult.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/crypto/ec/ec_mult.c b/crypto/ec/ec_mult.c
index a913c1e786..2317fc0ab5 100644
--- a/crypto/ec/ec_mult.c
+++ b/crypto/ec/ec_mult.c
@@ -45,7 +45,6 @@ struct ec_pre_comp_st {
* objects followed by a NULL */
size_t num; /* numblocks * 2^(w-1) */
CRYPTO_REF_COUNT references;
- CRYPTO_RWLOCK *lock;
};
static EC_PRE_COMP *ec_pre_comp_new(const EC_GROUP *group)
@@ -62,11 +61,8 @@ static EC_PRE_COMP *ec_pre_comp_new(const EC_GROUP *group)
ret->group = group;
ret->blocksize = 8; /* default */
ret->w = 4; /* default */
- 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)) {
OPENSSL_free(ret);
return NULL;
}
@@ -77,7 +73,7 @@ EC_PRE_COMP *EC_ec_pre_comp_dup(EC_PRE_COMP *pre)
{
int i;
if (pre != NULL)
- CRYPTO_UP_REF(&pre->references, &i, pre->lock);
+ CRYPTO_UP_REF(&pre->references, &i);
return pre;
}
@@ -88,7 +84,7 @@ void EC_ec_pre_comp_free(EC_PRE_COMP *pre)
if (pre == NULL)
return;
- CRYPTO_DOWN_REF(&pre->references, &i, pre->lock);
+ CRYPTO_DOWN_REF(&pre->references, &i);
REF_PRINT_COUNT("EC_ec", pre);
if (i > 0)
return;
@@ -101,7 +97,7 @@ void EC_ec_pre_comp_free(EC_PRE_COMP *pre)
EC_POINT_free(*pts);
OPENSSL_free(pre->points);
}
- CRYPTO_THREAD_lock_free(pre->lock);
+ CRYPTO_FREE_REF(&pre->references);
OPENSSL_free(pre);
}