summaryrefslogtreecommitdiffstats
path: root/crypto/engine
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2001-04-02 17:47:16 +0000
committerGeoff Thorpe <geoff@openssl.org>2001-04-02 17:47:16 +0000
commit69443d0da007cf49bc343eb1b9549acb7da46165 (patch)
tree44b42992190dcc0eeed02011b96556e527f1a8a8 /crypto/engine
parente4dc18d7e5bc46cb8909e4b12e87cda0b262892f (diff)
ENGINE_load_[private|public]_key had error handling that could return
without releasing a lock. This is the same fix as applied to OpenSSL-engine-0_9_6-stable, minus the ENGINE_ctrl() change - the HEAD already had that fixed.
Diffstat (limited to 'crypto/engine')
-rw-r--r--crypto/engine/engine_lib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/engine/engine_lib.c b/crypto/engine/engine_lib.c
index 99b031fe96..cefaec36f2 100644
--- a/crypto/engine/engine_lib.c
+++ b/crypto/engine/engine_lib.c
@@ -230,17 +230,18 @@ EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
if(e->funct_ref == 0)
{
+ CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
ENGINEerr(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY,
ENGINE_R_NOT_INITIALISED);
return 0;
}
+ CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
if (!e->load_privkey)
{
ENGINEerr(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY,
ENGINE_R_NO_LOAD_FUNCTION);
return 0;
}
- CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
pkey = e->load_privkey(key_id, passphrase);
if (!pkey)
{
@@ -265,17 +266,18 @@ EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
if(e->funct_ref == 0)
{
+ CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
ENGINEerr(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY,
ENGINE_R_NOT_INITIALISED);
return 0;
}
+ CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
if (!e->load_pubkey)
{
ENGINEerr(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY,
ENGINE_R_NO_LOAD_FUNCTION);
return 0;
}
- CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
pkey = e->load_pubkey(key_id, passphrase);
if (!pkey)
{