Add features support to md5 plugin
authorMartin Willi <martin@revosec.ch>
Thu, 19 May 2011 15:42:40 +0000 (17:42 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 14 Oct 2011 08:05:45 +0000 (10:05 +0200)
src/libstrongswan/plugins/md5/md5_plugin.c

index c722841..a3ad7b3 100644 (file)
@@ -37,6 +37,17 @@ METHOD(plugin_t, get_name, char*,
        return "md5";
 }
 
+METHOD(plugin_t, get_features, int,
+       private_md5_plugin_t *this, plugin_feature_t *features[])
+{
+       static plugin_feature_t f[] = {
+               PLUGIN_REGISTER(HASHER, md5_hasher_create),
+                       PLUGIN_PROVIDE(HASHER, HASH_MD5),
+       };
+       *features = f;
+       return countof(f);
+}
+
 METHOD(plugin_t, destroy, void,
        private_md5_plugin_t *this)
 {
@@ -56,15 +67,12 @@ plugin_t *md5_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_MD5, get_name(this),
-                                                       (hasher_constructor_t)md5_hasher_create);
-
        return &this->public.plugin;
 }