diff options
Diffstat (limited to 'providers/implementations/keymgmt')
-rw-r--r-- | providers/implementations/keymgmt/kdf_legacy_kmgmt.c | 10 | ||||
-rw-r--r-- | providers/implementations/keymgmt/mac_legacy_kmgmt.c | 10 |
2 files changed, 8 insertions, 12 deletions
diff --git a/providers/implementations/keymgmt/kdf_legacy_kmgmt.c b/providers/implementations/keymgmt/kdf_legacy_kmgmt.c index 40885ee019..a2303f2e19 100644 --- a/providers/implementations/keymgmt/kdf_legacy_kmgmt.c +++ b/providers/implementations/keymgmt/kdf_legacy_kmgmt.c @@ -37,13 +37,11 @@ KDF_DATA *ossl_kdf_data_new(void *provctx) if (kdfdata == NULL) return NULL; - kdfdata->lock = CRYPTO_THREAD_lock_new(); - if (kdfdata->lock == NULL) { + if (!CRYPTO_NEW_REF(&kdfdata->refcnt, 1)) { OPENSSL_free(kdfdata); return NULL; } kdfdata->libctx = PROV_LIBCTX_OF(provctx); - kdfdata->refcnt = 1; return kdfdata; } @@ -55,11 +53,11 @@ void ossl_kdf_data_free(KDF_DATA *kdfdata) if (kdfdata == NULL) return; - CRYPTO_DOWN_REF(&kdfdata->refcnt, &ref, kdfdata->lock); + CRYPTO_DOWN_REF(&kdfdata->refcnt, &ref); if (ref > 0) return; - CRYPTO_THREAD_lock_free(kdfdata->lock); + CRYPTO_FREE_REF(&kdfdata->refcnt); OPENSSL_free(kdfdata); } @@ -77,7 +75,7 @@ int ossl_kdf_data_up_ref(KDF_DATA *kdfdata) if (!ossl_prov_is_running()) return 0; - CRYPTO_UP_REF(&kdfdata->refcnt, &ref, kdfdata->lock); + CRYPTO_UP_REF(&kdfdata->refcnt, &ref); return 1; } diff --git a/providers/implementations/keymgmt/mac_legacy_kmgmt.c b/providers/implementations/keymgmt/mac_legacy_kmgmt.c index 114d9e9fe9..babeba748d 100644 --- a/providers/implementations/keymgmt/mac_legacy_kmgmt.c +++ b/providers/implementations/keymgmt/mac_legacy_kmgmt.c @@ -72,13 +72,11 @@ MAC_KEY *ossl_mac_key_new(OSSL_LIB_CTX *libctx, int cmac) if (mackey == NULL) return NULL; - mackey->lock = CRYPTO_THREAD_lock_new(); - if (mackey->lock == NULL) { + if (!CRYPTO_NEW_REF(&mackey->refcnt, 1)) { OPENSSL_free(mackey); return NULL; } mackey->libctx = libctx; - mackey->refcnt = 1; mackey->cmac = cmac; return mackey; @@ -91,14 +89,14 @@ void ossl_mac_key_free(MAC_KEY *mackey) if (mackey == NULL) return; - CRYPTO_DOWN_REF(&mackey->refcnt, &ref, mackey->lock); + CRYPTO_DOWN_REF(&mackey->refcnt, &ref); if (ref > 0) return; OPENSSL_secure_clear_free(mackey->priv_key, mackey->priv_key_len); OPENSSL_free(mackey->properties); ossl_prov_cipher_reset(&mackey->cipher); - CRYPTO_THREAD_lock_free(mackey->lock); + CRYPTO_FREE_REF(&mackey->refcnt); OPENSSL_free(mackey); } @@ -116,7 +114,7 @@ int ossl_mac_key_up_ref(MAC_KEY *mackey) if (!ossl_prov_is_running()) return 0; - CRYPTO_UP_REF(&mackey->refcnt, &ref, mackey->lock); + CRYPTO_UP_REF(&mackey->refcnt, &ref); return 1; } |