aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2016-09-22 16:21:22 +0200
committerTobias Brunner <tobias@strongswan.org>2016-10-05 11:32:52 +0200
commit4a6f97d00bb5ed022ec8e06360e4cdc53ea536f6 (patch)
tree151423a140ca30c3a23387c8a024b5cb7e28b8ac /src/libstrongswan/plugins/openssl/openssl_ec_private_key.c
parent437610ace528ec8f51c356bdca49cb5dc71f88ba (diff)
downloadstrongswan-4a6f97d00bb5ed022ec8e06360e4cdc53ea536f6.tar.bz2
strongswan-4a6f97d00bb5ed022ec8e06360e4cdc53ea536f6.tar.xz
openssl: Add a generic private key loader
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_ec_private_key.c')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_ec_private_key.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c b/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c
index 24fe623eb..22bbf6dc7 100644
--- a/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c
+++ b/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2008-2012 Tobias Brunner
+ * Copyright (C) 2008-2016 Tobias Brunner
* Copyright (C) 2009 Martin Willi
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -304,7 +304,26 @@ static private_openssl_ec_private_key_t *create_empty(void)
return this;
}
-/**
+/*
+ * See header.
+ */
+private_key_t *openssl_ec_private_key_create(EVP_PKEY *key)
+{
+ private_openssl_ec_private_key_t *this;
+ EC_KEY *ec;
+
+ ec = EVP_PKEY_get1_EC_KEY(key);
+ EVP_PKEY_free(key);
+ if (!ec)
+ {
+ return NULL;
+ }
+ this = create_empty();
+ this->ec = ec;
+ return &this->public.key;
+}
+
+/*
* See header.
*/
openssl_ec_private_key_t *openssl_ec_private_key_gen(key_type_t type,