aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2011-05-19 17:34:57 +0200
committerMartin Willi <martin@revosec.ch>2011-10-14 10:05:44 +0200
commitcec7dd14eb65429d971d88bbbf43660879488273 (patch)
treeeb7a7ed68fedaf6f19d38f4e3d2b4bd5c4787743 /src
parent2d2ffa58f6b0b34595e3e255795c4e732610f379 (diff)
downloadstrongswan-cec7dd14eb65429d971d88bbbf43660879488273.tar.bz2
strongswan-cec7dd14eb65429d971d88bbbf43660879488273.tar.xz
Add features support to sha1 plugin
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/plugins/sha1/sha1_plugin.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libstrongswan/plugins/sha1/sha1_plugin.c b/src/libstrongswan/plugins/sha1/sha1_plugin.c
index a9b84e790..66c80b292 100644
--- a/src/libstrongswan/plugins/sha1/sha1_plugin.c
+++ b/src/libstrongswan/plugins/sha1/sha1_plugin.c
@@ -38,13 +38,22 @@ METHOD(plugin_t, get_name, char*,
return "sha1";
}
+METHOD(plugin_t, get_features, int,
+ private_sha1_plugin_t *this, plugin_feature_t *features[])
+{
+ static plugin_feature_t f[] = {
+ PLUGIN_REGISTER(HASHER, sha1_hasher_create),
+ PLUGIN_PROVIDE(HASHER, HASH_SHA1),
+ PLUGIN_REGISTER(PRF, sha1_prf_create),
+ PLUGIN_PROVIDE(PRF, PRF_KEYED_SHA1),
+ };
+ *features = f;
+ return countof(f);
+}
+
METHOD(plugin_t, destroy, void,
private_sha1_plugin_t *this)
{
- lib->crypto->remove_hasher(lib->crypto,
- (hasher_constructor_t)sha1_hasher_create);
- lib->crypto->remove_prf(lib->crypto,
- (prf_constructor_t)sha1_prf_create);
free(this);
}
@@ -59,17 +68,12 @@ plugin_t *sha1_plugin_create()
.public = {
.plugin = {
.get_name = _get_name,
- .reload = (void*)return_false,
+ .get_features = _get_features,
.destroy = _destroy,
},
},
);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA1, get_name(this),
- (hasher_constructor_t)sha1_hasher_create);
- lib->crypto->add_prf(lib->crypto, PRF_KEYED_SHA1, get_name(this),
- (prf_constructor_t)sha1_prf_create);
-
return &this->public.plugin;
}