Added a get_name() function to plugin_t, create_plugin_enumerator enumerates over plugin_t

This commit is contained in:
Martin Willi
2011-04-15 10:07:12 +02:00
parent 6e2791715b
commit 787b5884aa
107 changed files with 828 additions and 245 deletions
@@ -23,8 +23,6 @@
#include <library.h>
#include <debug.h>
static const char *plugin_name = "padlock";
typedef struct private_padlock_plugin_t private_padlock_plugin_t;
typedef enum padlock_feature_t padlock_feature_t;
@@ -103,6 +101,12 @@ static padlock_feature_t get_padlock_features()
return 0;
}
METHOD(plugin_t, get_name, char*,
private_padlock_plugin_t *this)
{
return "padlock";
}
METHOD(plugin_t, destroy, void,
private_padlock_plugin_t *this)
{
@@ -138,6 +142,7 @@ plugin_t *padlock_plugin_create()
INIT(this,
.public = {
.plugin = {
.get_name = _get_name,
.destroy = _destroy,
},
},
@@ -163,21 +168,21 @@ plugin_t *padlock_plugin_create()
if (this->features & PADLOCK_RNG_ENABLED)
{
lib->crypto->add_rng(lib->crypto, RNG_TRUE, plugin_name,
lib->crypto->add_rng(lib->crypto, RNG_TRUE, get_name(this),
(rng_constructor_t)padlock_rng_create);
lib->crypto->add_rng(lib->crypto, RNG_STRONG, plugin_name,
lib->crypto->add_rng(lib->crypto, RNG_STRONG, get_name(this),
(rng_constructor_t)padlock_rng_create);
lib->crypto->add_rng(lib->crypto, RNG_WEAK, plugin_name,
lib->crypto->add_rng(lib->crypto, RNG_WEAK, get_name(this),
(rng_constructor_t)padlock_rng_create);
}
if (this->features & PADLOCK_ACE2_ENABLED)
{
lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, plugin_name,
lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, get_name(this),
(crypter_constructor_t)padlock_aes_crypter_create);
}
if (this->features & PADLOCK_PHE_ENABLED)
{
lib->crypto->add_hasher(lib->crypto, HASH_SHA1, plugin_name,
lib->crypto->add_hasher(lib->crypto, HASH_SHA1, get_name(this),
(hasher_constructor_t)padlock_sha1_hasher_create);
}
return &this->public.plugin;