aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2011-04-21 13:21:26 +0200
committerMartin Willi <martin@revosec.ch>2011-04-21 13:35:31 +0200
commit5b0bcfb1fc4aabb6535db91e70f7f262328e664f (patch)
tree000c5588b5da0e498f74e251cd0e1aeaa6d597a9 /src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
parentfdead26ffe1da8501a6ff5e0639a6f44c723e763 (diff)
downloadstrongswan-5b0bcfb1fc4aabb6535db91e70f7f262328e664f.tar.bz2
strongswan-5b0bcfb1fc4aabb6535db91e70f7f262328e664f.tar.xz
Revert alloc_str changes
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
index 39c28d3cd..0b607c386 100644
--- a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
+++ b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
@@ -550,34 +550,36 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type,
if (!engine_id)
{
- engine_id = lib->settings->alloc_str(lib->settings,
+ engine_id = lib->settings->get_str(lib->settings,
"libstrongswan.plugins.openssl.engine_id", "pkcs11");
}
engine = ENGINE_by_id(engine_id);
if (!engine)
{
DBG2(DBG_LIB, "engine '%s' is not available", engine_id);
- goto engine_failed;
+ return NULL;
}
if (!ENGINE_init(engine))
{
DBG1(DBG_LIB, "failed to initialize engine '%s'", engine_id);
- goto engine_failed;
+ ENGINE_free(engine);
+ return NULL;
}
if (!login(engine, keyid))
{
DBG1(DBG_LIB, "login to engine '%s' failed", engine_id);
- goto engine_failed;
+ ENGINE_free(engine);
+ return NULL;
}
key = ENGINE_load_private_key(engine, keyname, NULL, NULL);
if (!key)
{
DBG1(DBG_LIB, "failed to load private key with ID '%s' from "
"engine '%s'", keyname, engine_id);
- goto engine_failed;
+ ENGINE_free(engine);
+ return NULL;
}
ENGINE_free(engine);
- free(engine_id);
this = create_empty();
this->rsa = EVP_PKEY_get1_RSA(key);
@@ -592,12 +594,5 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type,
#else /* OPENSSL_NO_ENGINE */
return NULL;
#endif /* OPENSSL_NO_ENGINE */
-engine_failed:
- if (engine)
- {
- ENGINE_free(engine);
- }
- free(engine_id);
- return NULL;
}