From: Martin Willi Date: Thu, 19 May 2011 15:34:57 +0000 (+0200) Subject: Add features support to sha1 plugin X-Git-Tag: 4.6.0~195 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cec7dd14eb65429d971d88bbbf43660879488273;p=thirdparty%2Fstrongswan.git Add features support to sha1 plugin --- diff --git a/src/libstrongswan/plugins/sha1/sha1_plugin.c b/src/libstrongswan/plugins/sha1/sha1_plugin.c index a9b84e7905..66c80b292a 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; }