diff options
Diffstat (limited to 'crypto/engine/tb_asnmth.c')
-rw-r--r-- | crypto/engine/tb_asnmth.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/engine/tb_asnmth.c b/crypto/engine/tb_asnmth.c index b0d0d50974..28aa8e8cd4 100644 --- a/crypto/engine/tb_asnmth.c +++ b/crypto/engine/tb_asnmth.c @@ -233,7 +233,9 @@ const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, fstr.ameth = NULL; fstr.str = str; fstr.len = len; - CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); + + CRYPTO_THREAD_run_once(&engine_lock_init, do_engine_lock_init); + CRYPTO_THREAD_write_lock(global_engine_lock); engine_table_doall(pkey_asn1_meth_table, look_str_cb, &fstr); /* If found obtain a structural reference to engine */ if (fstr.e) { @@ -241,6 +243,6 @@ const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, engine_ref_debug(fstr.e, 0, 1); } *pe = fstr.e; - CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); + CRYPTO_THREAD_unlock(global_engine_lock); return fstr.ameth; } |