(_hx509_private_key_assign_ptr): new function, exposes EVP_PKEY

(_hx509_private_key_assign_key_file): remember to free private key if
there is one.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16450 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-01-03 16:32:46 +00:00
parent 6791e8dbf7
commit 5d2485dd68

View File

@@ -871,6 +871,11 @@ _hx509_private_key_assign_key_file(hx509_private_key key,
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
ERR_load_crypto_strings(); ERR_load_crypto_strings();
if (key->private_key) {
EVP_PKEY_free(key->private_key);
key->private_key = NULL;
}
pw = _hx509_lock_get_passwords(lock); pw = _hx509_lock_get_passwords(lock);
for (i = 0; i < pw->len; i++) { for (i = 0; i < pw->len; i++) {
@@ -892,6 +897,15 @@ _hx509_private_key_assign_key_file(hx509_private_key key,
return 0; return 0;
} }
void
_hx509_private_key_assign_ptr(hx509_private_key key, void *ptr)
{
if (key->private_key)
EVP_PKEY_free(key->private_key);
key->private_key = ptr;
}
struct hx509_crypto_data { struct hx509_crypto_data {
char *name; char *name;
const EVP_CIPHER *c; const EVP_CIPHER *c;