aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-10-26 16:11:24 +0200
committerTobias Brunner <tobias@strongswan.org>2011-10-31 18:45:36 +0100
commit4e346b1f97e17f08dc71b876a6ac3b041bcc7220 (patch)
treec2c8da706335e369dde7f805cfe1a559d406b649 /src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c
parent612e431305e53b5949636d95bb224acc61433d57 (diff)
downloadstrongswan-4e346b1f97e17f08dc71b876a6ac3b041bcc7220.tar.bz2
strongswan-4e346b1f97e17f08dc71b876a6ac3b041bcc7220.tar.xz
pkcs11: Added support for ECDH.
Diffstat (limited to 'src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c')
-rw-r--r--src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c b/src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c
index 1abb464a1..79b347783 100644
--- a/src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c
+++ b/src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c
@@ -30,6 +30,7 @@
#include "pkcs11_hasher.h"
#include "pkcs11_rng.h"
#include "pkcs11_dh.h"
+#include "pkcs11_ec_dh.h"
typedef struct private_pkcs11_plugin_t private_pkcs11_plugin_t;
@@ -163,12 +164,23 @@ METHOD(plugin_t, get_features, int,
PLUGIN_REGISTER(PUBKEY, pkcs11_public_key_load, TRUE),
PLUGIN_PROVIDE(PUBKEY, KEY_RSA),
};
+ static plugin_feature_t f_ecdh[] = {
+ PLUGIN_REGISTER(DH, pkcs11_ec_dh_create),
+ PLUGIN_PROVIDE(DH, ECP_192_BIT),
+ PLUGIN_PROVIDE(DH, ECP_224_BIT),
+ PLUGIN_PROVIDE(DH, ECP_256_BIT),
+ PLUGIN_PROVIDE(DH, ECP_384_BIT),
+ PLUGIN_PROVIDE(DH, ECP_521_BIT),
+ };
static plugin_feature_t f[countof(f_hash) + countof(f_dh) + countof(f_rng) +
- countof(f_key)] = {};
+ countof(f_key) + countof(f_ecdh)] = {};
static int count = 0;
if (!count)
{ /* initialize only once */
+ bool use_ecc = lib->settings->get_bool(lib->settings,
+ "libstrongswan.plugins.pkcs11.use_ecc", FALSE);
+
add_features(f, f_key, countof(f_key), &count);
if (lib->settings->get_bool(lib->settings,
"libstrongswan.plugins.pkcs11.use_hasher", FALSE))
@@ -184,6 +196,10 @@ METHOD(plugin_t, get_features, int,
"libstrongswan.plugins.pkcs11.use_dh", FALSE))
{
add_features(f, f_dh, countof(f_dh), &count);
+ if (use_ecc)
+ {
+ add_features(f, f_ecdh, countof(f_ecdh), &count);
+ }
}
}
*features = f;