aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2010-12-18 16:31:01 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2010-12-18 16:31:12 +0100
commit5932f41fccf168253c30fdca4f53055a20cdba63 (patch)
treef783622ffaef2196e9043b3ddead8492da087040
parentae09bc62bc481b347593532db49dfe6a281f4225 (diff)
downloadstrongswan-5932f41fccf168253c30fdca4f53055a20cdba63.tar.bz2
strongswan-5932f41fccf168253c30fdca4f53055a20cdba63.tar.xz
trace back crypto algorithms to the plugins that registered them
-rw-r--r--src/libcharon/config/proposal.c9
-rw-r--r--src/libcharon/plugins/load_tester/load_tester_plugin.c4
-rw-r--r--src/libcharon/plugins/stroke/stroke_list.c39
-rw-r--r--src/libstrongswan/crypto/crypto_factory.c133
-rw-r--r--src/libstrongswan/crypto/crypto_factory.h29
-rw-r--r--src/libstrongswan/crypto/crypto_tester.c128
-rw-r--r--src/libstrongswan/crypto/crypto_tester.h16
-rw-r--r--src/libstrongswan/plugins/aes/aes_plugin.c4
-rw-r--r--src/libstrongswan/plugins/blowfish/blowfish_plugin.c4
-rw-r--r--src/libstrongswan/plugins/ccm/ccm_plugin.c14
-rw-r--r--src/libstrongswan/plugins/ctr/ctr_plugin.c6
-rw-r--r--src/libstrongswan/plugins/des/des_plugin.c8
-rw-r--r--src/libstrongswan/plugins/fips_prf/fips_prf_plugin.c4
-rw-r--r--src/libstrongswan/plugins/gcm/gcm_plugin.c8
-rw-r--r--src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c68
-rw-r--r--src/libstrongswan/plugins/gmp/gmp_plugin.c26
-rw-r--r--src/libstrongswan/plugins/hmac/hmac_plugin.c32
-rw-r--r--src/libstrongswan/plugins/md4/md4_plugin.c4
-rw-r--r--src/libstrongswan/plugins/md5/md5_plugin.c4
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_plugin.c74
-rw-r--r--src/libstrongswan/plugins/padlock/padlock_plugin.c12
-rw-r--r--src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c14
-rw-r--r--src/libstrongswan/plugins/random/random_plugin.c6
-rw-r--r--src/libstrongswan/plugins/sha1/sha1_plugin.c6
-rw-r--r--src/libstrongswan/plugins/sha2/sha2_plugin.c10
-rw-r--r--src/libstrongswan/plugins/xcbc/xcbc_plugin.c10
-rw-r--r--src/libtls/tls_crypto.c7
-rw-r--r--src/pluto/crypto.c279
-rw-r--r--src/pluto/ike_alg.c35
-rw-r--r--src/pluto/ike_alg.h6
30 files changed, 593 insertions, 406 deletions
diff --git a/src/libcharon/config/proposal.c b/src/libcharon/config/proposal.c
index f680982d5..86a59bc1b 100644
--- a/src/libcharon/config/proposal.c
+++ b/src/libcharon/config/proposal.c
@@ -741,9 +741,10 @@ static void proposal_add_supported_ike(private_proposal_t *this)
integrity_algorithm_t integrity;
pseudo_random_function_t prf;
diffie_hellman_group_t group;
+ const char *plugin_name;
enumerator = lib->crypto->create_crypter_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &encryption))
+ while (enumerator->enumerate(enumerator, &encryption, &plugin_name))
{
switch (encryption)
{
@@ -778,7 +779,7 @@ static void proposal_add_supported_ike(private_proposal_t *this)
enumerator->destroy(enumerator);
enumerator = lib->crypto->create_signer_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &integrity))
+ while (enumerator->enumerate(enumerator, &integrity, &plugin_name))
{
switch (integrity)
{
@@ -797,7 +798,7 @@ static void proposal_add_supported_ike(private_proposal_t *this)
enumerator->destroy(enumerator);
enumerator = lib->crypto->create_prf_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &prf))
+ while (enumerator->enumerate(enumerator, &prf, &plugin_name))
{
switch (prf)
{
@@ -816,7 +817,7 @@ static void proposal_add_supported_ike(private_proposal_t *this)
enumerator->destroy(enumerator);
enumerator = lib->crypto->create_dh_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &group))
+ while (enumerator->enumerate(enumerator, &group, &plugin_name))
{
switch (group)
{
diff --git a/src/libcharon/plugins/load_tester/load_tester_plugin.c b/src/libcharon/plugins/load_tester/load_tester_plugin.c
index cb9b80c7f..8fd65adfa 100644
--- a/src/libcharon/plugins/load_tester/load_tester_plugin.c
+++ b/src/libcharon/plugins/load_tester/load_tester_plugin.c
@@ -28,6 +28,8 @@
#include <threading/condvar.h>
#include <threading/mutex.h>
+static const char *plugin_name = "load_tester";
+
typedef struct private_load_tester_plugin_t private_load_tester_plugin_t;
/**
@@ -189,7 +191,7 @@ plugin_t *load_tester_plugin_create()
this = malloc_thing(private_load_tester_plugin_t);
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
- lib->crypto->add_dh(lib->crypto, MODP_NULL,
+ lib->crypto->add_dh(lib->crypto, MODP_NULL, plugin_name,
(dh_constructor_t)load_tester_diffie_hellman_create);
this->delay = lib->settings->get_int(lib->settings,
diff --git a/src/libcharon/plugins/stroke/stroke_list.c b/src/libcharon/plugins/stroke/stroke_list.c
index 86deea490..69fb1d5bb 100644
--- a/src/libcharon/plugins/stroke/stroke_list.c
+++ b/src/libcharon/plugins/stroke/stroke_list.c
@@ -1070,49 +1070,64 @@ static void list_algs(FILE *out)
hash_algorithm_t hash;
pseudo_random_function_t prf;
diffie_hellman_group_t group;
+ rng_quality_t quality;
+ const char *plugin_name;
fprintf(out, "\n");
fprintf(out, "List of registered IKEv2 Algorithms:\n");
fprintf(out, "\n encryption: ");
enumerator = lib->crypto->create_crypter_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &encryption))
+ while (enumerator->enumerate(enumerator, &encryption, &plugin_name))
{
- fprintf(out, "%N ", encryption_algorithm_names, encryption);
+ fprintf(out, "%N[%s] ", encryption_algorithm_names, encryption,
+ plugin_name);
}
enumerator->destroy(enumerator);
fprintf(out, "\n integrity: ");
enumerator = lib->crypto->create_signer_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &integrity))
+ while (enumerator->enumerate(enumerator, &integrity, &plugin_name))
{
- fprintf(out, "%N ", integrity_algorithm_names, integrity);
+ fprintf(out, "%N[%s] ", integrity_algorithm_names, integrity,
+ plugin_name);
}
enumerator->destroy(enumerator);
fprintf(out, "\n aead: ");
enumerator = lib->crypto->create_aead_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &encryption))
+ while (enumerator->enumerate(enumerator, &encryption, &plugin_name))
{
- fprintf(out, "%N ", encryption_algorithm_names, encryption);
+ fprintf(out, "%N[%s] ", encryption_algorithm_names, encryption,
+ plugin_name);
}
enumerator->destroy(enumerator);
fprintf(out, "\n hasher: ");
enumerator = lib->crypto->create_hasher_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &hash))
+ while (enumerator->enumerate(enumerator, &hash, &plugin_name))
{
- fprintf(out, "%N ", hash_algorithm_names, hash);
+ fprintf(out, "%N[%s] ", hash_algorithm_names, hash,
+ plugin_name);
}
enumerator->destroy(enumerator);
fprintf(out, "\n prf: ");
enumerator = lib->crypto->create_prf_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &prf))
+ while (enumerator->enumerate(enumerator, &prf, &plugin_name))
{
- fprintf(out, "%N ", pseudo_random_function_names, prf);
+ fprintf(out, "%N[%s] ", pseudo_random_function_names, prf,
+ plugin_name);
}
enumerator->destroy(enumerator);
fprintf(out, "\n dh-group: ");
enumerator = lib->crypto->create_dh_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &group))
+ while (enumerator->enumerate(enumerator, &group, &plugin_name))
{
- fprintf(out, "%N ", diffie_hellman_group_names, group);
+ fprintf(out, "%N[%s] ", diffie_hellman_group_names, group,
+ plugin_name);
+ }
+ enumerator->destroy(enumerator);
+ fprintf(out, "\n random-gen: ");
+ enumerator = lib->crypto->create_rng_enumerator(lib->crypto);
+ while (enumerator->enumerate(enumerator, &quality, &plugin_name))
+ {
+ fprintf(out, "%N[%s] ", rng_quality_names, quality, plugin_name);
}
enumerator->destroy(enumerator);
fprintf(out, "\n");
diff --git a/src/libstrongswan/crypto/crypto_factory.c b/src/libstrongswan/crypto/crypto_factory.c
index f2f01987d..2d13896d6 100644
--- a/src/libstrongswan/crypto/crypto_factory.c
+++ b/src/libstrongswan/crypto/crypto_factory.c
@@ -20,13 +20,29 @@
#include <utils/linked_list.h>
#include <crypto/crypto_tester.h>
+const char *default_plugin_name = "default";
+
typedef struct entry_t entry_t;
+
struct entry_t {
- /* algorithm */
+ /**
+ * algorithm
+ */
u_int algo;
- /* benchmarked speed */
+
+ /**
+ * plugin that registered this algorithm
+ */
+ const char *plugin_name;
+
+ /**
+ * benchmarked speed
+ */
u_int speed;
- /* constructor */
+
+ /**
+ * constructor
+ */
union {
crypter_constructor_t create_crypter;
aead_constructor_t create_aead;
@@ -128,7 +144,8 @@ METHOD(crypto_factory_t, create_crypter, crypter_t*,
{
if (this->test_on_create &&
!this->tester->test_crypter(this->tester, algo, key_size,
- entry->create_crypter, NULL))
+ entry->create_crypter, NULL,
+ default_plugin_name))
{
continue;
}
@@ -160,7 +177,8 @@ METHOD(crypto_factory_t, create_aead, aead_t*,
{
if (this->test_on_create &&
!this->tester->test_aead(this->tester, algo, key_size,
- entry->create_aead, NULL))
+ entry->create_aead, NULL,
+ default_plugin_name))
{
continue;
}
@@ -191,7 +209,8 @@ METHOD(crypto_factory_t, create_signer, signer_t*,
{
if (this->test_on_create &&
!this->tester->test_signer(this->tester, algo,
- entry->create_signer, NULL))
+ entry->create_signer, NULL,
+ default_plugin_name))
{
continue;
}
@@ -223,7 +242,8 @@ METHOD(crypto_factory_t, create_hasher, hasher_t*,
{
if (this->test_on_create && algo != HASH_PREFERRED &&
!this->tester->test_hasher(this->tester, algo,
- entry->create_hasher, NULL))
+ entry->create_hasher, NULL,
+ default_plugin_name))
{
continue;
}
@@ -254,7 +274,8 @@ METHOD(crypto_factory_t, create_prf, prf_t*,
{
if (this->test_on_create &&
!this->tester->test_prf(this->tester, algo,
- entry->create_prf, NULL))
+ entry->create_prf, NULL,
+ default_plugin_name))
{
continue;
}
@@ -286,7 +307,8 @@ METHOD(crypto_factory_t, create_rng, rng_t*,
{
if (this->test_on_create &&
!this->tester->test_rng(this->tester, quality,
- entry->create_rng, NULL))
+ entry->create_rng, NULL,
+ default_plugin_name))
{
continue;
}
@@ -350,7 +372,8 @@ METHOD(crypto_factory_t, create_dh, diffie_hellman_t*,
* Insert an algorithm entry to a list
*/
static void add_entry(private_crypto_factory_t *this, linked_list_t *list,
- int algo, u_int speed, void *create)
+ int algo, const char *plugin_name,
+ u_int speed, void *create)
{
entry_t *entry, *current;
linked_list_t *tmp;
@@ -358,6 +381,7 @@ static void add_entry(private_crypto_factory_t *this, linked_list_t *list,
INIT(entry,
.algo = algo,
+ .plugin_name = plugin_name,
.speed = speed,
);
entry->create = create;
@@ -391,16 +415,16 @@ static void add_entry(private_crypto_factory_t *this, linked_list_t *list,
}
METHOD(crypto_factory_t, add_crypter, void,
- private_crypto_factory_t *this, encryption_algorithm_t algo,
- crypter_constructor_t create)
+ private_crypto_factory_t *this, encryption_algorithm_t algo,
+ const char *plugin_name, crypter_constructor_t create)
{
u_int speed = 0;
if (!this->test_on_add ||
this->tester->test_crypter(this->tester, algo, 0, create,
- this->bench ? &speed : NULL))
+ this->bench ? &speed : NULL, plugin_name))
{
- add_entry(this, this->crypters, algo, speed, create);
+ add_entry(this, this->crypters, algo, plugin_name, speed, create);
}
}
@@ -425,16 +449,16 @@ METHOD(crypto_factory_t, remove_crypter, void,
}
METHOD(crypto_factory_t, add_aead, void,
- private_crypto_factory_t *this, encryption_algorithm_t algo,
- aead_constructor_t create)
+ private_crypto_factory_t *this, encryption_algorithm_t algo,
+ const char *plugin_name, aead_constructor_t create)
{
u_int speed = 0;
if (!this->test_on_add ||
this->tester->test_aead(this->tester, algo, 0, create,
- this->bench ? &speed : NULL))
+ this->bench ? &speed : NULL, plugin_name))
{
- add_entry(this, this->aeads, algo, speed, create);
+ add_entry(this, this->aeads, algo, plugin_name, speed, create);
}
}
@@ -459,16 +483,16 @@ METHOD(crypto_factory_t, remove_aead, void,
}
METHOD(crypto_factory_t, add_signer, void,
- private_crypto_factory_t *this, integrity_algorithm_t algo,
- signer_constructor_t create)
+ private_crypto_factory_t *this, integrity_algorithm_t algo,
+ const char *plugin_name, signer_constructor_t create)
{
u_int speed = 0;
if (!this->test_on_add ||
this->tester->test_signer(this->tester, algo, create,
- this->bench ? &speed : NULL))
+ this->bench ? &speed : NULL, plugin_name))
{
- add_entry(this, this->signers, algo, speed, create);
+ add_entry(this, this->signers, algo, plugin_name, speed, create);
}
}
@@ -493,16 +517,16 @@ METHOD(crypto_factory_t, remove_signer, void,
}
METHOD(crypto_factory_t, add_hasher, void,
- private_crypto_factory_t *this, hash_algorithm_t algo,
- hasher_constructor_t create)
+ private_crypto_factory_t *this, hash_algorithm_t algo,
+ const char *plugin_name, hasher_constructor_t create)
{
u_int speed = 0;
if (!this->test_on_add ||
this->tester->test_hasher(this->tester, algo, create,
- this->bench ? &speed : NULL))
+ this->bench ? &speed : NULL, plugin_name))
{
- add_entry(this, this->hashers, algo, speed, create);
+ add_entry(this, this->hashers, algo, plugin_name, speed, create);
}
}
@@ -527,16 +551,16 @@ METHOD(crypto_factory_t, remove_hasher, void,
}
METHOD(crypto_factory_t, add_prf, void,
- private_crypto_factory_t *this, pseudo_random_function_t algo,
- prf_constructor_t create)
+ private_crypto_factory_t *this, pseudo_random_function_t algo,
+ const char *plugin_name, prf_constructor_t create)
{
u_int speed = 0;
if (!this->test_on_add ||
this->tester->test_prf(this->tester, algo, create,
- this->bench ? &speed : NULL))
+ this->bench ? &speed : NULL, plugin_name))
{
- add_entry(this, this->prfs, algo, speed, create);
+ add_entry(this, this->prfs, algo, plugin_name, speed, create);
}
}
@@ -562,15 +586,15 @@ METHOD(crypto_factory_t, remove_prf, void,
METHOD(crypto_factory_t, add_rng, void,
private_crypto_factory_t *this, rng_quality_t quality,
- rng_constructor_t create)
+ const char *plugin_name, rng_constructor_t create)
{
u_int speed = 0;
if (!this->test_on_add ||
this->tester->test_rng(this->tester, quality, create,
- this->bench ? &speed : NULL))
+ this->bench ? &speed : NULL, plugin_name))
{
- add_entry(this, this->rngs, quality, speed, create);
+ add_entry(this, this->rngs, quality, plugin_name, speed, create);
}
}
@@ -595,10 +619,10 @@ METHOD(crypto_factory_t, remove_rng, void,
}
METHOD(crypto_factory_t, add_dh, void,
- private_crypto_factory_t *this, diffie_hellman_group_t group,
- dh_constructor_t create)
+ private_crypto_factory_t *this, diffie_hellman_group_t group,
+ const char *plugin_name, dh_constructor_t create)
{
- add_entry(this, this->dhs, group, 0, create);
+ add_entry(this, this->dhs, group, plugin_name, 0, create);
}
METHOD(crypto_factory_t, remove_dh, void,
@@ -660,9 +684,11 @@ static enumerator_t *create_enumerator(private_crypto_factory_t *this,
/**
* Filter function to enumerate algorithm, not entry
*/
-static bool crypter_filter(void *n, entry_t **entry, encryption_algorithm_t *algo)
+static bool crypter_filter(void *n, entry_t **entry, encryption_algorithm_t *algo,
+ void *i2, const char **plugin_name)
{
*algo = (*entry)->algo;
+ *plugin_name = (*entry)->plugin_name;
return TRUE;
}
@@ -681,9 +707,11 @@ METHOD(crypto_factory_t, create_aead_enumerator, enumerator_t*,
/**
* Filter function to enumerate algorithm, not entry
*/
-static bool signer_filter(void *n, entry_t **entry, integrity_algorithm_t *algo)
+static bool signer_filter(void *n, entry_t **entry, integrity_algorithm_t *algo,
+ void *i2, const char **plugin_name)
{
*algo = (*entry)->algo;
+ *plugin_name = (*entry)->plugin_name;
return TRUE;
}
@@ -696,9 +724,11 @@ METHOD(crypto_factory_t, create_signer_enumerator, enumerator_t*,
/**
* Filter function to enumerate algorithm, not entry
*/
-static bool hasher_filter(void *n, entry_t **entry, hash_algorithm_t *algo)
+static bool hasher_filter(void *n, entry_t **entry, hash_algorithm_t *algo,
+ void *i2, const char **plugin_name)
{
*algo = (*entry)->algo;
+ *plugin_name = (*entry)->plugin_name;
return TRUE;
}
@@ -711,9 +741,11 @@ METHOD(crypto_factory_t, create_hasher_enumerator, enumerator_t*,
/**
* Filter function to enumerate algorithm, not entry
*/
-static bool prf_filter(void *n, entry_t **entry, pseudo_random_function_t *algo)
+static bool prf_filter(void *n, entry_t **entry, pseudo_random_function_t *algo,
+ void *i2, const char **plugin_name)
{
*algo = (*entry)->algo;
+ *plugin_name = (*entry)->plugin_name;
return TRUE;
}
@@ -726,9 +758,11 @@ METHOD(crypto_factory_t, create_prf_enumerator, enumerator_t*,
/**
* Filter function to enumerate algorithm, not entry
*/
-static bool dh_filter(void *n, entry_t **entry, diffie_hellman_group_t *group)
+static bool dh_filter(void *n, entry_t **entry, diffie_hellman_group_t *group,
+ void *i2, const char **plugin_name)
{
*group = (*entry)->algo;
+ *plugin_name = (*entry)->plugin_name;
return TRUE;
}
@@ -738,6 +772,22 @@ METHOD(crypto_factory_t, create_dh_enumerator, enumerator_t*,
return create_enumerator(this, this->dhs, dh_filter);
}
+/**
+ * Filter function to enumerate algorithm, not entry
+ */
+static bool rng_filter(void *n, entry_t **entry, rng_quality_t *quality,
+ void *i2, const char **plugin_name)
+{
+ *quality = (*entry)->algo;
+ *plugin_name = (*entry)->plugin_name;
+ return TRUE;
+}
+
+METHOD(crypto_factory_t, create_rng_enumerator, enumerator_t*,
+ private_crypto_factory_t *this)
+{
+ return create_enumerator(this, this->rngs, rng_filter);
+}
METHOD(crypto_factory_t, add_test_vector, void,
private_crypto_factory_t *this, transform_type_t type, void *vector)
{
@@ -812,6 +862,7 @@ crypto_factory_t *crypto_factory_create()
.create_hasher_enumerator = _create_hasher_enumerator,
.create_prf_enumerator = _create_prf_enumerator,
.create_dh_enumerator = _create_dh_enumerator,
+ .create_rng_enumerator = _create_rng_enumerator,
.add_test_vector = _add_test_vector,
.destroy = _destroy,
},
diff --git a/src/libstrongswan/crypto/crypto_factory.h b/src/libstrongswan/crypto/crypto_factory.h
index ff06eda7b..b45ffeedb 100644
--- a/src/libstrongswan/crypto/crypto_factory.h
+++ b/src/libstrongswan/crypto/crypto_factory.h
@@ -144,11 +144,12 @@ struct crypto_factory_t {
* Register a crypter constructor.
*
* @param algo algorithm to constructor
+ * @param plugin_name plugin that registered this algorithm
* @param create constructor function for that algorithm
* @return
*/
void (*add_crypter)(crypto_factory_t *this, encryption_algorithm_t algo,
- crypter_constructor_t create);
+ const char *plugin_name, crypter_constructor_t create);
/**
* Unregister a crypter constructor.
@@ -168,21 +169,23 @@ struct crypto_factory_t {
* Register a aead constructor.
*
* @param algo algorithm to constructor
+ * @param plugin_name plugin that registered this algorithm
* @param create constructor function for that algorithm
* @return
*/
void (*add_aead)(crypto_factory_t *this, encryption_algorithm_t algo,
- aead_constructor_t create);
+ const char *plugin_name, aead_constructor_t create);
/**
* Register a signer constructor.
*
* @param algo algorithm to constructor
+ * @param plugin_name plugin that registered this algorithm
* @param create constructor function for that algorithm
* @return
*/
void (*add_signer)(crypto_factory_t *this, integrity_algorithm_t algo,
- signer_constructor_t create);
+ const char *plugin_name, signer_constructor_t create);
/**
* Unregister a signer constructor.
@@ -198,11 +201,12 @@ struct crypto_factory_t {
* create_hasher(HASH_PREFERRED).
*
* @param algo algorithm to constructor
+ * @param plugin_name plugin that registered this algorithm
* @param create constructor function for that algorithm
* @return
*/
void (*add_hasher)(crypto_factory_t *this, hash_algorithm_t algo,
- hasher_constructor_t create);
+ const char *plugin_name, hasher_constructor_t create);
/**
* Unregister a hasher constructor.
@@ -215,11 +219,12 @@ struct crypto_factory_t {
* Register a prf constructor.
*
* @param algo algorithm to constructor
+ * @param plugin_name plugin that registered this algorithm
* @param create constructor function for that algorithm
* @return
*/
void (*add_prf)(crypto_factory_t *this, pseudo_random_function_t algo,
- prf_constructor_t create);
+ const char *plugin_name, prf_constructor_t create);
/**
* Unregister a prf constructor.
@@ -232,9 +237,11 @@ struct crypto_factory_t {
* Register a source of randomness.
*
* @param quality quality of randomness this RNG serves
+ * @param plugin_name plugin that registered this algorithm
* @param create constructor function for such a quality
*/
- void (*add_rng)(crypto_factory_t *this, rng_quality_t quality, rng_constructor_t create);
+ void (*add_rng)(crypto_factory_t *this, rng_quality_t quality,
+ const char *plugin_name, rng_constructor_t create);
/**
* Unregister a source of randomness.
@@ -247,11 +254,12 @@ struct crypto_factory_t {
* Register a diffie hellman constructor.
*
* @param group dh group to constructor
+ * @param plugin_name plugin that registered this algorithm
* @param create constructor function for that algorithm
* @return
*/
void (*add_dh)(crypto_factory_t *this, diffie_hellman_group_t group,
- dh_constructor_t create);
+ const char *plugin_name, dh_constructor_t create);
/**
* Unregister a diffie hellman constructor.
@@ -303,6 +311,13 @@ struct crypto_factory_t {
enumerator_t* (*create_dh_enumerator)(crypto_factory_t *this);
/**
+ * Create an enumerator over all registered random generators.
+ *
+ * @return enumerator over rng_quality_t
+ */
+ enumerator_t* (*create_rng_enumerator)(crypto_factory_t *this);
+
+ /**
* Add a test vector to the crypto factory.
*
* @param type type of the test vector
diff --git a/src/libstrongswan/crypto/crypto_tester.c b/src/libstrongswan/crypto/crypto_tester.c
index d17485ff2..46f0a0fac 100644
--- a/src/libstrongswan/crypto/crypto_tester.c
+++ b/src/libstrongswan/crypto/crypto_tester.c
@@ -165,7 +165,7 @@ static u_int bench_crypter(private_crypto_tester_t *this,
METHOD(crypto_tester_t, test_crypter, bool,
private_crypto_tester_t *this, encryption_algorithm_t alg, size_t key_size,
- crypter_constructor_t create, u_int *speed)
+ crypter_constructor_t create, u_int *speed, const char *plugin_name)
{
enumerator_t *enumerator;
crypter_test_vector_t *vector;
@@ -231,17 +231,17 @@ METHOD(crypto_tester_t, test_crypter, bool,
crypter->destroy(crypter);
if (failed)
{
- DBG1(DBG_LIB, "disabled %N: %s test vector failed",
- encryption_algorithm_names, alg, get_name(vector));
+ DBG1(DBG_LIB, "disabled %N[%s]: %s test vector failed",
+ encryption_algorithm_names, alg, plugin_name, get_name(vector));
break;
}
}
enumerator->destroy(enumerator);
if (!tested)
{
- DBG1(DBG_LIB, "%s %N: no test vectors found",
+ DBG1(DBG_LIB, "%s %N[%s]: no test vectors found",
this->required ? "disabled" : "enabled ",
- encryption_algorithm_names, alg);
+ encryption_algorithm_names, alg, plugin_name);
return !this->required;
}
if (!failed)
@@ -249,13 +249,13 @@ METHOD(crypto_tester_t, test_crypter, bool,
if (speed)
{
*speed = bench_crypter(this, alg, create);
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors, %d points",
- encryption_algorithm_names, alg, tested, *speed);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors, %d points",
+ encryption_algorithm_names, alg, tested, plugin_name, *speed);
}
else
{
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors",
- encryption_algorithm_names, alg, tested);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors",
+ encryption_algorithm_names, alg, plugin_name, tested);
}
}
return !failed;
@@ -311,7 +311,7 @@ static u_int bench_aead(private_crypto_tester_t *this,
METHOD(crypto_tester_t, test_aead, bool,
private_crypto_tester_t *this, encryption_algorithm_t alg, size_t key_size,
- aead_constructor_t create, u_int *speed)
+ aead_constructor_t create, u_int *speed, const char *plugin_name)
{
enumerator_t *enumerator;
aead_test_vector_t *vector;
@@ -388,17 +388,17 @@ METHOD(crypto_tester_t, test_aead, bool,
aead->destroy(aead);
if (failed)
{
- DBG1(DBG_LIB, "disabled %N: %s test vector failed",
- encryption_algorithm_names, alg, get_name(vector));
+ DBG1(DBG_LIB, "disabled %N[%s]: %s test vector failed",
+ encryption_algorithm_names, alg, plugin_name, get_name(vector));
break;
}
}
enumerator->destroy(enumerator);
if (!tested)
{
- DBG1(DBG_LIB, "%s %N: no test vectors found",
+ DBG1(DBG_LIB, "%s %N[%s]: no test vectors found",
this->required ? "disabled" : "enabled ",
- encryption_algorithm_names, alg);
+ encryption_algorithm_names, alg, plugin_name);
return !this->required;
}
if (!failed)
@@ -406,13 +406,13 @@ METHOD(crypto_tester_t, test_aead, bool,
if (speed)
{
*speed = bench_aead(this, alg, create);
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors, %d points",
- encryption_algorithm_names, alg, tested, *speed);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors, %d points",
+ encryption_algorithm_names, alg, plugin_name, tested, *speed);
}
else
{
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors",
- encryption_algorithm_names, alg, tested);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors",
+ encryption_algorithm_names, alg, plugin_name, tested);
}
}
return !failed;
@@ -460,7 +460,7 @@ static u_int bench_signer(private_crypto_tester_t *this,
METHOD(crypto_tester_t, test_signer, bool,
private_crypto_tester_t *this, integrity_algorithm_t alg,
- signer_constructor_t create, u_int *speed)
+ signer_constructor_t create, u_int *speed, const char *plugin_name)
{
enumerator_t *enumerator;
signer_test_vector_t *vector;
@@ -482,8 +482,8 @@ METHOD(crypto_tester_t, test_signer, bool,
signer = create(alg);
if (!signer)
{
- DBG1(DBG_LIB, "disabled %N: creating instance failed",
- integrity_algorithm_names, alg);
+ DBG1(DBG_LIB, "disabled %N[%s]: creating instance failed",
+ integrity_algorithm_names, alg, plugin_name);
failed = TRUE;
break;
}
@@ -538,17 +538,17 @@ METHOD(crypto_tester_t, test_signer, bool,
signer->destroy(signer);
if (failed)
{
- DBG1(DBG_LIB, "disabled %N: %s test vector failed",
- integrity_algorithm_names, alg, get_name(vector));
+ DBG1(DBG_LIB, "disabled %N[%s]: %s test vector failed",
+ integrity_algorithm_names, alg, plugin_name, get_name(vector));
break;
}
}
enumerator->destroy(enumerator);
if (!tested)
{
- DBG1(DBG_LIB, "%s %N: no test vectors found",
+ DBG1(DBG_LIB, "%s %N[%s]: no test vectors found",
this->required ? "disabled" : "enabled ",
- integrity_algorithm_names, alg);
+ integrity_algorithm_names, alg, plugin_name);
return !this->required;
}
if (!failed)
@@ -556,13 +556,13 @@ METHOD(crypto_tester_t, test_signer, bool,
if (speed)
{
*speed = bench_signer(this, alg, create);
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors, %d points",
- integrity_algorithm_names, alg, tested, *speed);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors, %d points",
+ integrity_algorithm_names, alg, plugin_name, tested, *speed);
}
else
{
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors",
- integrity_algorithm_names, alg, tested);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors",
+ integrity_algorithm_names, alg, plugin_name, tested);
}
}
return !failed;
@@ -604,7 +604,7 @@ static u_int bench_hasher(private_crypto_tester_t *this,
METHOD(crypto_tester_t, test_hasher, bool,
private_crypto_tester_t *this, hash_algorithm_t alg,
- hasher_constructor_t create, u_int *speed)
+ hasher_constructor_t create, u_int *speed, const char *plugin_name)
{
enumerator_t *enumerator;
hasher_test_vector_t *vector;
@@ -626,8 +626,8 @@ METHOD(crypto_tester_t, test_hasher, bool,
hasher = create(alg);
if (!hasher)
{
- DBG1(DBG_LIB, "disabled %N: creating instance failed",
- hash_algorithm_names, alg);
+ DBG1(DBG_LIB, "disabled %N[%s]: creating instance failed",
+ hash_algorithm_names, alg, plugin_name);
failed = TRUE;
break;
}
@@ -669,17 +669,17 @@ METHOD(crypto_tester_t, test_hasher, bool,
hasher->destroy(hasher);
if (failed)
{
- DBG1(DBG_LIB, "disabled %N: %s test vector failed",
- hash_algorithm_names, alg, get_name(vector));
+ DBG1(DBG_LIB, "disabled %N[%s]: %s test vector failed",
+ hash_algorithm_names, alg, plugin_name, get_name(vector));
break;
}
}
enumerator->destroy(enumerator);
if (!tested)
{
- DBG1(DBG_LIB, "%s %N: no test vectors found",
+ DBG1(DBG_LIB, "%s %N[%s]: no test vectors found",
this->required ? "disabled" : "enabled ",
- hash_algorithm_names, alg);
+ hash_algorithm_names, alg, plugin_name);
return !this->required;
}
if (!failed)
@@ -687,13 +687,13 @@ METHOD(crypto_tester_t, test_hasher, bool,
if (speed)
{
*speed = bench_hasher(this, alg, create);
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors, %d points",
- hash_algorithm_names, alg, tested, *speed);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors, %d points",
+ hash_algorithm_names, alg, plugin_name, tested, *speed);
}
else
{
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors",
- hash_algorithm_names, alg, tested);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors",
+ hash_algorithm_names, alg, plugin_name, tested);
}
}
return !failed;
@@ -735,7 +735,7 @@ static u_int bench_prf(private_crypto_tester_t *this,
METHOD(crypto_tester_t, test_prf, bool,
private_crypto_tester_t *this, pseudo_random_function_t alg,
- prf_constructor_t create, u_int *speed)
+ prf_constructor_t create, u_int *speed, const char *plugin_name)
{
enumerator_t *enumerator;
prf_test_vector_t *vector;
@@ -757,8 +757,8 @@ METHOD(crypto_tester_t, test_prf, bool,
prf = create(alg);
if (!prf)
{
- DBG1(DBG_LIB, "disabled %N: creating instance failed",
- pseudo_random_function_names, alg);
+ DBG1(DBG_LIB, "disabled %N[%s]: creating instance failed",
+ pseudo_random_function_names, alg, plugin_name);
failed = TRUE;
break;
}
@@ -811,17 +811,17 @@ METHOD(crypto_tester_t, test_prf, bool,
prf->destroy(prf);
if (failed)
{
- DBG1(DBG_LIB, "disabled %N: %s test vector failed",
- pseudo_random_function_names, alg, get_name(vector));
+ DBG1(DBG_LIB, "disabled %N[%s]: %s test vector failed",
+ pseudo_random_function_names, alg, plugin_name, get_name(vector));
break;
}
}
enumerator->destroy(enumerator);
if (!tested)
{
- DBG1(DBG_LIB, "%s %N: no test vectors found",
+ DBG1(DBG_LIB, "%s %N[%s]: no test vectors found",
this->required ? "disabled" : "enabled ",
- pseudo_random_function_names, alg);
+ pseudo_random_function_names, alg, plugin_name);
return !this->required;
}
if (!failed)
@@ -829,13 +829,13 @@ METHOD(crypto_tester_t, test_prf, bool,
if (speed)
{
*speed = bench_prf(this, alg, create);
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors, %d points",
- pseudo_random_function_names, alg, tested, *speed);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors, %d points",
+ pseudo_random_function_names, alg, plugin_name, tested, *speed);
}
else
{
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors",
- pseudo_random_function_names, alg, tested);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors",
+ pseudo_random_function_names, alg, plugin_name, tested);
}
}
return !failed;
@@ -874,7 +874,7 @@ static u_int bench_rng(private_crypto_tester_t *this,
METHOD(crypto_tester_t, test_rng, bool,
private_crypto_tester_t *this, rng_quality_t quality,
- rng_constructor_t create, u_int *speed)
+ rng_constructor_t create, u_int *speed, const char *plugin_name)
{
enumerator_t *enumerator;
rng_test_vector_t *vector;
@@ -883,8 +883,8 @@ METHOD(crypto_tester_t, test_rng, bool,
if (!this->rng_true && quality == RNG_TRUE)
{
- DBG1(DBG_LIB, "enabled %N: skipping test (disabled by config)",
- rng_quality_names, quality);
+ DBG1(DBG_LIB, "enabled %N[%s]: skipping test (disabled by config)",
+ rng_quality_names, quality, plugin_name);
return TRUE;
}
@@ -903,8 +903,8 @@ METHOD(crypto_tester_t, test_rng, bool,
rng = create(quality);
if (!rng)
{
- DBG1(DBG_LIB, "disabled %N: creating instance failed",
- rng_quality_names, quality);
+ DBG1(DBG_LIB, "disabled %N[%s]: creating instance failed",
+ rng_quality_names, quality, plugin_name);
failed = TRUE;
break;
}
@@ -933,17 +933,17 @@ METHOD(crypto_tester_t, test_rng, bool,
rng->destroy(rng);
if (failed)
{
- DBG1(DBG_LIB, "disabled %N: %s test vector failed",
- rng_quality_names, quality, get_name(vector));
+ DBG1(DBG_LIB, "disabled %N[%s]: %s test vector failed",
+ rng_quality_names, quality, plugin_name, get_name(vector));
break;
}
}
enumerator->destroy(enumerator);
if (!tested)
{
- DBG1(DBG_LIB, "%s %N: no test vectors found",
+ DBG1(DBG_LIB, "%s %N[%s]: no test vectors found",
this->required ? ", disabled" : "enabled ",
- rng_quality_names, quality);
+ rng_quality_names, quality, plugin_name);
return !this->required;
}
if (!failed)
@@ -951,13 +951,13 @@ METHOD(crypto_tester_t, test_rng, bool,
if (speed)
{
*speed = bench_rng(this, quality, create);
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors, %d points",
- rng_quality_names, quality, tested, *speed);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors, %d points",
+ rng_quality_names, quality, plugin_name, tested, *speed);
}
else
{
- DBG1(DBG_LIB, "enabled %N: passed %u test vectors",
- rng_quality_names, quality, tested);
+ DBG1(DBG_LIB, "enabled %N[%s]: passed %u test vectors",
+ rng_quality_names, quality, plugin_name, tested);
}
}
return !failed;
diff --git a/src/libstrongswan/crypto/crypto_tester.h b/src/libstrongswan/crypto/crypto_tester.h
index cef0b3c18..019c87c39 100644
--- a/src/libstrongswan/crypto/crypto_tester.h
+++ b/src/libstrongswan/crypto/crypto_tester.h
@@ -143,7 +143,7 @@ struct crypto_tester_t {
*/
bool (*test_crypter)(crypto_tester_t *this, encryption_algorithm_t alg,
size_t key_size, crypter_constructor_t create,
- u_int *speed);
+ u_int *speed, const char *plugin_name);
/**
* Test an aead algorithm, optionally using a specified key size.
@@ -156,7 +156,7 @@ struct crypto_tester_t {
*/
bool (*test_aead)(crypto_tester_t *this, encryption_algorithm_t alg,
size_t key_size, aead_constructor_t create,
- u_int *speed);
+ u_int *speed, const char *plugin_name);
/**
* Test a signer algorithm.
*
@@ -166,7 +166,8 @@ struct crypto_tester_t {
* @return TRUE if test passed
*/
bool (*test_signer)(crypto_tester_t *this, integrity_algorithm_t alg,
- signer_constructor_t create, u_int *speed);
+ signer_constructor_t create,
+ u_int *speed, const char *plugin_name);
/**
* Test a hasher algorithm.
*
@@ -176,7 +177,8 @@ struct crypto_tester_t {
* @return TRUE if test passed
*/
bool (*test_hasher)(crypto_tester_t *this, hash_algorithm_t alg,
- hasher_constructor_t create, u_int *speed);
+ hasher_constructor_t create,
+ u_int *speed, const char *plugin_name);
/**
* Test a PRF algorithm.
*
@@ -186,7 +188,8 @@ struct crypto_tester_t {
* @return TRUE if test passed
*/
bool (*test_prf)(crypto_tester_t *this, pseudo_random_function_t alg,
- prf_constructor_t create, u_int *speed);
+ prf_constructor_t create,
+ u_int *speed, const char *plugin_name);
/**
* Test a RNG implementation.
*
@@ -196,7 +199,8 @@ struct crypto_tester_t {
* @return TRUE if test passed
*/
bool (*test_rng)(crypto_tester_t *this, rng_quality_t quality,
- rng_constructor_t create, u_int *speed);
+ rng_constructor_t create,
+ u_int *speed, const char *plugin_name);
/**
* Add a test vector to test a crypter.
*
diff --git a/src/libstrongswan/plugins/aes/aes_plugin.c b/src/libstrongswan/plugins/aes/aes_plugin.c
index 22b47e334..1c060b6c8 100644
--- a/src/libstrongswan/plugins/aes/aes_plugin.c
+++ b/src/libstrongswan/plugins/aes/aes_plugin.c
@@ -18,6 +18,8 @@
#include <library.h>
#include "aes_crypter.h"
+static const char *plugin_name = "aes";
+
typedef struct private_aes_plugin_t private_aes_plugin_t;
/**
@@ -54,7 +56,7 @@ plugin_t *aes_plugin_create()
},
);
- lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC,
+ lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, plugin_name,
(crypter_constructor_t)aes_crypter_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/blowfish/blowfish_plugin.c b/src/libstrongswan/plugins/blowfish/blowfish_plugin.c
index 6ab093d7b..5232eca28 100644
--- a/src/libstrongswan/plugins/blowfish/blowfish_plugin.c
+++ b/src/libstrongswan/plugins/blowfish/blowfish_plugin.c
@@ -19,6 +19,8 @@
#include <library.h>
#include "blowfish_crypter.h"
+static const char *plugin_name = "blowfish";
+
typedef struct private_blowfish_plugin_t private_blowfish_plugin_t;
/**
@@ -55,7 +57,7 @@ plugin_t *blowfish_plugin_create()
},
);
- lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH,
+ lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH, plugin_name,
(crypter_constructor_t)blowfish_crypter_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/ccm/ccm_plugin.c b/src/libstrongswan/plugins/ccm/ccm_plugin.c
index 5fc3b14d7..0b628ceae 100644
--- a/src/libstrongswan/plugins/ccm/ccm_plugin.c
+++ b/src/libstrongswan/plugins/ccm/ccm_plugin.c
@@ -19,6 +19,8 @@
#include "ccm_aead.h"
+static const char *plugin_name = "ccm";
+
typedef struct private_ccm_plugin_t private_ccm_plugin_t;
/**
@@ -52,17 +54,17 @@ plugin_t *ccm_plugin_create()
.public.plugin.destroy = _destroy,
);
- lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV8,
+ lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV8, plugin_name,
(aead_constructor_t)ccm_aead_create);
- lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV12,
+ lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV12, plugin_name,
(aead_constructor_t)ccm_aead_create);
- lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV16,
+ lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV16, plugin_name,
(aead_constructor_t)ccm_aead_create);
- lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV8,
+ lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV8, plugin_name,
(aead_constructor_t)ccm_aead_create);
- lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV12,
+ lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV12, plugin_name,
(aead_constructor_t)ccm_aead_create);
- lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV16,
+ lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV16, plugin_name,
(aead_constructor_t)ccm_aead_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/ctr/ctr_plugin.c b/src/libstrongswan/plugins/ctr/ctr_plugin.c
index 5e47f23ec..e8dadaffe 100644
--- a/src/libstrongswan/plugins/ctr/ctr_plugin.c
+++ b/src/libstrongswan/plugins/ctr/ctr_plugin.c
@@ -19,6 +19,8 @@
#include "ctr_ipsec_crypter.h"
+static const char *plugin_name = "ctr";
+
typedef struct private_ctr_plugin_t private_ctr_plugin_t;
/**
@@ -56,9 +58,9 @@ plugin_t *ctr_plugin_create()
},
);
- lib->crypto->add_crypter(lib->crypto, ENCR_AES_CTR,
+ lib->crypto->add_crypter(lib->crypto, ENCR_AES_CTR, plugin_name,
(crypter_constructor_t)ctr_ipsec_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CTR,
+ lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CTR, plugin_name,
(crypter_constructor_t)ctr_ipsec_crypter_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/des/des_plugin.c b/src/libstrongswan/plugins/des/des_plugin.c
index 43b457ce2..d420d789e 100644
--- a/src/libstrongswan/plugins/des/des_plugin.c
+++ b/src/libstrongswan/plugins/des/des_plugin.c
@@ -18,6 +18,8 @@
#include <library.h>
#include "des_crypter.h"
+static const char *plugin_name = "des";
+
typedef struct private_des_plugin_t private_des_plugin_t;
/**
@@ -54,11 +56,11 @@ plugin_t *des_plugin_create()
},
);
- lib->crypto->add_crypter(lib->crypto, ENCR_3DES,
+ lib->crypto->add_crypter(lib->crypto, ENCR_3DES, plugin_name,
(crypter_constructor_t)des_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_DES,
+ lib->crypto->add_crypter(lib->crypto, ENCR_DES, plugin_name,
(crypter_constructor_t)des_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB,
+ lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB, plugin_name,
(crypter_constructor_t)des_crypter_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/fips_prf/fips_prf_plugin.c b/src/libstrongswan/plugins/fips_prf/fips_prf_plugin.c
index fed3eafec..7f9e135f4 100644
--- a/src/libstrongswan/plugins/fips_prf/fips_prf_plugin.c
+++ b/src/libstrongswan/plugins/fips_prf/fips_prf_plugin.c
@@ -18,6 +18,8 @@
#include <library.h>
#include "fips_prf.h"
+static const char *plugin_name = "fips_prf";
+
typedef struct private_fips_prf_plugin_t private_fips_prf_plugin_t;
/**
@@ -54,7 +56,7 @@ plugin_t *fips_prf_plugin_create()
},
);
- lib->crypto->add_prf(lib->crypto, PRF_FIPS_SHA1_160,
+ lib->crypto->add_prf(lib->crypto, PRF_FIPS_SHA1_160, plugin_name,
(prf_constructor_t)fips_prf_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/gcm/gcm_plugin.c b/src/libstrongswan/plugins/gcm/gcm_plugin.c
index 061001b30..43ff3e7cc 100644
--- a/src/libstrongswan/plugins/gcm/gcm_plugin.c
+++ b/src/libstrongswan/plugins/gcm/gcm_plugin.c
@@ -19,6 +19,8 @@
#include "gcm_aead.h"
+static const char *plugin_name = "gcm";
+
typedef struct private_gcm_plugin_t private_gcm_plugin_t;
/**
@@ -52,11 +54,11 @@ plugin_t *gcm_plugin_create()
.public.plugin.destroy = _destroy,
);
- lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV8,
+ lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV8, plugin_name,
(aead_constructor_t)gcm_aead_create);
- lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV12,
+ lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV12, plugin_name,
(aead_constructor_t)gcm_aead_create);
- lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV16,
+ lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV16, plugin_name,
(aead_constructor_t)gcm_aead_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c b/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c
index 590add5c8..a53fed448 100644
--- a/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c
+++ b/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c
@@ -29,6 +29,8 @@
#include <errno.h>
#include <gcrypt.h>
+static const char *plugin_name = "gcrypt";
+
typedef struct private_gcrypt_plugin_t private_gcrypt_plugin_t;
/**
@@ -148,79 +150,79 @@ plugin_t *gcrypt_plugin_create()
);
/* hashers */
- lib->crypto->add_hasher(lib->crypto, HASH_SHA1,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA1, plugin_name,
(hasher_constructor_t)gcrypt_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_MD4,
+ lib->crypto->add_hasher(lib->crypto, HASH_MD4, plugin_name,
(hasher_constructor_t)gcrypt_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_MD5,
+ lib->crypto->add_hasher(lib->crypto, HASH_MD5, plugin_name,
(hasher_constructor_t)gcrypt_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA224,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA224, plugin_name,
(hasher_constructor_t)gcrypt_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA256,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA256, plugin_name,
(hasher_constructor_t)gcrypt_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA384,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA384, plugin_name,
(hasher_constructor_t)gcrypt_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA512,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA512, plugin_name,
(hasher_constructor_t)gcrypt_hasher_create);
/* crypters */
- lib->crypto->add_crypter(lib->crypto, ENCR_3DES,
+ lib->crypto->add_crypter(lib->crypto, ENCR_3DES, plugin_name,
(crypter_constructor_t)gcrypt_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_CAST,
+ lib->crypto->add_crypter(lib->crypto, ENCR_CAST, plugin_name,
(crypter_constructor_t)gcrypt_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH,
+ lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH, plugin_name,
(crypter_constructor_t)gcrypt_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_DES,
+ lib->crypto->add_crypter(lib->crypto, ENCR_DES, plugin_name,
(crypter_constructor_t)gcrypt_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB,
+ lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB, plugin_name,
(crypter_constructor_t)gcrypt_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC,
+ lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, plugin_name,
(crypter_constructor_t)gcrypt_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_AES_CTR,
+ lib->crypto->add_crypter(lib->crypto, ENCR_AES_CTR, plugin_name,
(crypter_constructor_t)gcrypt_crypter_create);
#ifdef HAVE_GCRY_CIPHER_CAMELLIA
- lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CBC,
+ lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CBC, plugin_name,
(crypter_constructor_t)gcrypt_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CTR,
+ lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CTR, plugin_name,
(crypter_constructor_t)gcrypt_crypter_create);
#endif /* HAVE_GCRY_CIPHER_CAMELLIA */
- lib->crypto->add_crypter(lib->crypto, ENCR_SERPENT_CBC,
+ lib->crypto->add_crypter(lib->crypto, ENCR_SERPENT_CBC, plugin_name,
(crypter_constructor_t)gcrypt_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_TWOFISH_CBC,
+ lib->crypto->add_crypter(lib->crypto, ENCR_TWOFISH_CBC, plugin_name,
(crypter_constructor_t)gcrypt_crypter_create);
/* random numbers */
- lib->crypto->add_rng(lib->crypto, RNG_WEAK,
+ lib->crypto->add_rng(lib->crypto, RNG_WEAK, plugin_name,
(rng_constructor_t)gcrypt_rng_create);
- lib->crypto->add_rng(lib->crypto, RNG_STRONG,
+ lib->crypto->add_rng(lib->crypto, RNG_STRONG, plugin_name,
(rng_constructor_t)gcrypt_rng_create);
- lib->crypto->add_rng(lib->crypto, RNG_TRUE,
+ lib->crypto->add_rng(lib->crypto, RNG_TRUE, plugin_name,
(rng_constructor_t)gcrypt_rng_create);
/* diffie hellman groups, using modp */
- lib->crypto->add_dh(lib->crypto, MODP_2048_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_2048_BIT, plugin_name,
(dh_constructor_t)gcrypt_dh_create);
- lib->crypto->add_dh(lib->crypto, MODP_2048_224,
+ lib->crypto->add_dh(lib->crypto, MODP_2048_224, plugin_name,
(dh_constructor_t)gcrypt_dh_create);
- lib->crypto->add_dh(lib->crypto, MODP_2048_256,
+ lib->crypto->add_dh(lib->crypto, MODP_2048_256, plugin_name,
(dh_constructor_t)gcrypt_dh_create);
- lib->crypto->add_dh(lib->crypto, MODP_1536_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_1536_BIT, plugin_name,
(dh_constructor_t)gcrypt_dh_create);
- lib->crypto->add_dh(lib->crypto, MODP_3072_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_3072_BIT, plugin_name,
(dh_constructor_t)gcrypt_dh_create);
- lib->crypto->add_dh(lib->crypto, MODP_4096_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_4096_BIT, plugin_name,
(dh_constructor_t)gcrypt_dh_create);
- lib->crypto->add_dh(lib->crypto, MODP_6144_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_6144_BIT, plugin_name,
(dh_constructor_t)gcrypt_dh_create);
- lib->crypto->add_dh(lib->crypto, MODP_8192_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_8192_BIT, plugin_name,
(dh_constructor_t)gcrypt_dh_create);
- lib->crypto->add_dh(lib->crypto, MODP_1024_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_1024_BIT, plugin_name,
(dh_constructor_t)gcrypt_dh_create);
- lib->crypto->add_dh(lib->crypto, MODP_1024_160,
+ lib->crypto->add_dh(lib->crypto, MODP_1024_160, plugin_name,
(dh_constructor_t)gcrypt_dh_create);
- lib->crypto->add_dh(lib->crypto, MODP_768_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_768_BIT, plugin_name,
(dh_constructor_t)gcrypt_dh_create);
- lib->crypto->add_dh(lib->crypto, MODP_CUSTOM,
+ lib->crypto->add_dh(lib->crypto, MODP_CUSTOM, plugin_name,
(dh_constructor_t)gcrypt_dh_create_custom);
/* RSA */
diff --git a/src/libstrongswan/plugins/gmp/gmp_plugin.c b/src/libstrongswan/plugins/gmp/gmp_plugin.c
index 9b4fad3da..e9bfbcc28 100644
--- a/src/libstrongswan/plugins/gmp/gmp_plugin.c
+++ b/src/libstrongswan/plugins/gmp/gmp_plugin.c
@@ -20,6 +20,8 @@
#include "gmp_rsa_private_key.h"
#include "gmp_rsa_public_key.h"
+static const char *plugin_name = "gmp";
+
typedef struct private_gmp_plugin_t private_gmp_plugin_t;
/**
@@ -64,30 +66,30 @@ plugin_t *gmp_plugin_create()
},
);
- lib->crypto->add_dh(lib->crypto, MODP_2048_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_2048_BIT, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_2048_224,
+ lib->crypto->add_dh(lib->crypto, MODP_2048_224, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_2048_256,
+ lib->crypto->add_dh(lib->crypto, MODP_2048_256, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_1536_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_1536_BIT, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_3072_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_3072_BIT, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_4096_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_4096_BIT, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_6144_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_6144_BIT, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_8192_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_8192_BIT, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_1024_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_1024_BIT, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_1024_160,
+ lib->crypto->add_dh(lib->crypto, MODP_1024_160, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_768_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_768_BIT, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_CUSTOM,
+ lib->crypto->add_dh(lib->crypto, MODP_CUSTOM, plugin_name,
(dh_constructor_t)gmp_diffie_hellman_create_custom);
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, FALSE,
diff --git a/src/libstrongswan/plugins/hmac/hmac_plugin.c b/src/libstrongswan/plugins/hmac/hmac_plugin.c
index 73df4dc6c..82451d1d3 100644
--- a/src/libstrongswan/plugins/hmac/hmac_plugin.c
+++ b/src/libstrongswan/plugins/hmac/hmac_plugin.c
@@ -19,6 +19,8 @@
#include "hmac_signer.h"
#include "hmac_prf.h"
+static const char *plugin_name = "hmac";
+
typedef struct private_hmac_plugin_t private_hmac_plugin_t;
/**
@@ -57,36 +59,36 @@ plugin_t *hmac_plugin_create()
},
);
- lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_256,
+ lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_256, plugin_name,
(prf_constructor_t)hmac_prf_create);
- lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA1,
+ lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA1, plugin_name,
(prf_constructor_t)hmac_prf_create);
- lib->crypto->add_prf(lib->crypto, PRF_HMAC_MD5,
+ lib->crypto->add_prf(lib->crypto, PRF_HMAC_MD5, plugin_name,
(prf_constructor_t)hmac_prf_create);
- lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_384,
+ lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_384, plugin_name,
(prf_constructor_t)hmac_prf_create);
- lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_512,
+ lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_512, plugin_name,
(prf_constructor_t)hmac_prf_create);
- lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_96,
+ lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_96, plugin_name,
(signer_constructor_t)hmac_signer_create);
- lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_128,
+ lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_128, plugin_name,
(signer_constructor_t)hmac_signer_create);
- lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_160,
+ lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_160, plugin_name,
(signer_constructor_t)hmac_signer_create);
- lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_256_128,
+ lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_256_128, plugin_name,
(signer_constructor_t)hmac_signer_create);
- lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_256_256,
+ lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_256_256, plugin_name,
(signer_constructor_t)hmac_signer_create);
- lib->crypto->add_signer(lib->crypto, AUTH_HMAC_MD5_96,
+ lib->crypto->add_signer(lib->crypto, AUTH_HMAC_MD5_96, plugin_name,
(signer_constructor_t)hmac_signer_create);
- lib->crypto->add_signer(lib->crypto, AUTH_HMAC_MD5_128,
+ lib->crypto->add_signer(lib->crypto, AUTH_HMAC_MD5_128, plugin_name,
(signer_constructor_t)hmac_signer_create);
- lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_384_192,
+ lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_384_192, plugin_name,
(signer_constructor_t)hmac_signer_create);
- lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_384_384,
+ lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_384_384, plugin_name,
(signer_constructor_t)hmac_signer_create);
- lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_512_256,
+ lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_512_256, plugin_name,
(signer_constructor_t)hmac_signer_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/md4/md4_plugin.c b/src/libstrongswan/plugins/md4/md4_plugin.c
index 366eaac19..cea1a61f3 100644
--- a/src/libstrongswan/plugins/md4/md4_plugin.c
+++ b/src/libstrongswan/plugins/md4/md4_plugin.c
@@ -18,6 +18,8 @@
#include <library.h>
#include "md4_hasher.h"
+static const char *plugin_name = "md4";
+
typedef struct private_md4_plugin_t private_md4_plugin_t;
/**
@@ -54,7 +56,7 @@ plugin_t *md4_plugin_create()
},
);
- lib->crypto->add_hasher(lib->crypto, HASH_MD4,
+ lib->crypto->add_hasher(lib->crypto, HASH_MD4, plugin_name,
(hasher_constructor_t)md4_hasher_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/md5/md5_plugin.c b/src/libstrongswan/plugins/md5/md5_plugin.c
index ad8f090dc..d11173817 100644
--- a/src/libstrongswan/plugins/md5/md5_plugin.c
+++ b/src/libstrongswan/plugins/md5/md5_plugin.c
@@ -18,6 +18,8 @@
#include <library.h>
#include "md5_hasher.h"
+static const char *plugin_name = "md5";
+
typedef struct private_md5_plugin_t private_md5_plugin_t;
/**
@@ -54,7 +56,7 @@ plugin_t *md5_plugin_create()
},
);
- lib->crypto->add_hasher(lib->crypto, HASH_MD5,
+ lib->crypto->add_hasher(lib->crypto, HASH_MD5, plugin_name,
(hasher_constructor_t)md5_hasher_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/openssl/openssl_plugin.c b/src/libstrongswan/plugins/openssl/openssl_plugin.c
index 0ab4eda9c..0050572ee 100644
--- a/src/libstrongswan/plugins/openssl/openssl_plugin.c
+++ b/src/libstrongswan/plugins/openssl/openssl_plugin.c
@@ -41,6 +41,8 @@
#include "openssl_x509.h"
#include "openssl_crl.h"
+static const char *plugin_name = "openssl";
+
typedef struct private_openssl_plugin_t private_openssl_plugin_t;
/**
@@ -272,85 +274,85 @@ plugin_t *openssl_plugin_create()
}
/* crypter */
- lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC,
+ lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, plugin_name,
(crypter_constructor_t)openssl_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CBC,
+ lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CBC, plugin_name,
(crypter_constructor_t)openssl_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_3DES,
+ lib->crypto->add_crypter(lib->crypto, ENCR_3DES, plugin_name,
(crypter_constructor_t)openssl_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_RC5,
+ lib->crypto->add_crypter(lib->crypto, ENCR_RC5, plugin_name,
(crypter_constructor_t)openssl_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_IDEA,
+ lib->crypto->add_crypter(lib->crypto, ENCR_IDEA, plugin_name,
(crypter_constructor_t)openssl_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_CAST,
+ lib->crypto->add_crypter(lib->crypto, ENCR_CAST, plugin_name,
(crypter_constructor_t)openssl_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH,
+ lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH, plugin_name,
(crypter_constructor_t)openssl_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_DES,
+ lib->crypto->add_crypter(lib->crypto, ENCR_DES, plugin_name,
(crypter_constructor_t)openssl_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB,
+ lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB, plugin_name,
(crypter_constructor_t)openssl_crypter_create);
- lib->crypto->add_crypter(lib->crypto, ENCR_NULL,
+ lib->crypto->add_crypter(lib->crypto, ENCR_NULL, plugin_name,
(crypter_constructor_t)openssl_crypter_create);
/* hasher */
- lib->crypto->add_hasher(lib->crypto, HASH_SHA1,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA1, plugin_name,
(hasher_constructor_t)openssl_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_MD2,
+ lib->crypto->add_hasher(lib->crypto, HASH_MD2, plugin_name,
(hasher_constructor_t)openssl_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_MD4,
+ lib->crypto->add_hasher(lib->crypto, HASH_MD4, plugin_name,
(hasher_constructor_t)openssl_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_MD5,
+ lib->crypto->add_hasher(lib->crypto, HASH_MD5, plugin_name,
(hasher_constructor_t)openssl_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA224,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA224, plugin_name,
(hasher_constructor_t)openssl_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA256,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA256, plugin_name,
(hasher_constructor_t)openssl_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA384,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA384, plugin_name,
(hasher_constructor_t)openssl_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA512,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA512, plugin_name,
(hasher_constructor_t)openssl_hasher_create);
/* prf */
- lib->crypto->add_prf(lib->crypto, PRF_KEYED_SHA1,
+ lib->crypto->add_prf(lib->crypto, PRF_KEYED_SHA1, plugin_name,
(prf_constructor_t)openssl_sha1_prf_create);
/* (ec) diffie hellman */
- lib->crypto->add_dh(lib->crypto, MODP_2048_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_2048_BIT, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_2048_224,
+ lib->crypto->add_dh(lib->crypto, MODP_2048_224, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_2048_256,
+ lib->crypto->add_dh(lib->crypto, MODP_2048_256, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_1536_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_1536_BIT, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
#ifndef OPENSSL_NO_EC
- lib->crypto->add_dh(lib->crypto, ECP_256_BIT,
+ lib->crypto->add_dh(lib->crypto, ECP_256_BIT, plugin_name,
(dh_constructor_t)openssl_ec_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, ECP_384_BIT,
+ lib->crypto->add_dh(lib->crypto, ECP_384_BIT, plugin_name,
(dh_constructor_t)openssl_ec_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, ECP_521_BIT,
+ lib->crypto->add_dh(lib->crypto, ECP_521_BIT, plugin_name,
(dh_constructor_t)openssl_ec_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, ECP_224_BIT,
+ lib->crypto->add_dh(lib->crypto, ECP_224_BIT, plugin_name,
(dh_constructor_t)openssl_ec_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, ECP_192_BIT,
+ lib->crypto->add_dh(lib->crypto, ECP_192_BIT, plugin_name,
(dh_constructor_t)openssl_ec_diffie_hellman_create);
#endif /* OPENSSL_NO_EC */
- lib->crypto->add_dh(lib->crypto, MODP_3072_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_3072_BIT, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_4096_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_4096_BIT, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_6144_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_6144_BIT, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_8192_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_8192_BIT, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_1024_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_1024_BIT, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_1024_160,
+ lib->crypto->add_dh(lib->crypto, MODP_1024_160, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_768_BIT,
+ lib->crypto->add_dh(lib->crypto, MODP_768_BIT, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
- lib->crypto->add_dh(lib->crypto, MODP_CUSTOM,
+ lib->crypto->add_dh(lib->crypto, MODP_CUSTOM, plugin_name,
(dh_constructor_t)openssl_diffie_hellman_create);
/* rsa */
diff --git a/src/libstrongswan/plugins/padlock/padlock_plugin.c b/src/libstrongswan/plugins/padlock/padlock_plugin.c
index 027c53c7b..695823acf 100644
--- a/src/libstrongswan/plugins/padlock/padlock_plugin.c
+++ b/src/libstrongswan/plugins/padlock/padlock_plugin.c
@@ -23,6 +23,8 @@
#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;
@@ -161,21 +163,21 @@ plugin_t *padlock_plugin_create()
if (this->features & PADLOCK_RNG_ENABLED)
{
- lib->crypto->add_rng(lib->crypto, RNG_TRUE,
+ lib->crypto->add_rng(lib->crypto, RNG_TRUE, plugin_name,
(rng_constructor_t)padlock_rng_create);
- lib->crypto->add_rng(lib->crypto, RNG_STRONG,
+ lib->crypto->add_rng(lib->crypto, RNG_STRONG, plugin_name,
(rng_constructor_t)padlock_rng_create);
- lib->crypto->add_rng(lib->crypto, RNG_WEAK,
+ lib->crypto->add_rng(lib->crypto, RNG_WEAK, plugin_name,
(rng_constructor_t)padlock_rng_create);
}
if (this->features & PADLOCK_ACE2_ENABLED)
{
- lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC,
+ lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, plugin_name,
(crypter_constructor_t)padlock_aes_crypter_create);
}
if (this->features & PADLOCK_PHE_ENABLED)
{
- lib->crypto->add_hasher(lib->crypto, HASH_SHA1,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA1, plugin_name,
(hasher_constructor_t)padlock_sha1_hasher_create);
}
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c b/src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c
index ace405c23..071d2f782 100644
--- a/src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c
+++ b/src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c
@@ -26,6 +26,8 @@
#include "pkcs11_public_key.h"
#include "pkcs11_hasher.h"
+static const char *plugin_name = "pkcs11";
+
typedef struct private_pkcs11_plugin_t private_pkcs11_plugin_t;
/**
@@ -146,17 +148,17 @@ plugin_t *pkcs11_plugin_create()
if (lib->settings->get_bool(lib->settings,
"libstrongswan.plugins.pkcs11.use_hasher", FALSE))
{
- lib->crypto->add_hasher(lib->crypto, HASH_MD2,
+ lib->crypto->add_hasher(lib->crypto, HASH_MD2, plugin_name,
(hasher_constructor_t)pkcs11_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_MD5,
+ lib->crypto->add_hasher(lib->crypto, HASH_MD5, plugin_name,
(hasher_constructor_t)pkcs11_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA1,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA1, plugin_name,
(hasher_constructor_t)pkcs11_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA256,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA256, plugin_name,
(hasher_constructor_t)pkcs11_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA384,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA384, plugin_name,
(hasher_constructor_t)pkcs11_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA512,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA512, plugin_name,
(hasher_constructor_t)pkcs11_hasher_create);
}
diff --git a/src/libstrongswan/plugins/random/random_plugin.c b/src/libstrongswan/plugins/random/random_plugin.c
index 2c4def9fb..cc5cb0a3c 100644
--- a/src/libstrongswan/plugins/random/random_plugin.c
+++ b/src/libstrongswan/plugins/random/random_plugin.c
@@ -18,6 +18,8 @@
#include <library.h>
#include "random_rng.h"
+static const char *plugin_name = "random";
+
typedef struct private_random_plugin_t private_random_plugin_t;
/**
@@ -54,9 +56,9 @@ plugin_t *random_plugin_create()
},
);
- lib->crypto->add_rng(lib->crypto, RNG_STRONG,
+ lib->crypto->add_rng(lib->crypto, RNG_STRONG, plugin_name,
(rng_constructor_t)random_rng_create);
- lib->crypto->add_rng(lib->crypto, RNG_TRUE,
+ lib->crypto->add_rng(lib->crypto, RNG_TRUE, plugin_name,
(rng_constructor_t)random_rng_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/sha1/sha1_plugin.c b/src/libstrongswan/plugins/sha1/sha1_plugin.c
index a951bb231..dda2cbc1a 100644
--- a/src/libstrongswan/plugins/sha1/sha1_plugin.c
+++ b/src/libstrongswan/plugins/sha1/sha1_plugin.c
@@ -19,6 +19,8 @@
#include "sha1_hasher.h"
#include "sha1_prf.h"
+static const char *plugin_name = "sha1";
+
typedef struct private_sha1_plugin_t private_sha1_plugin_t;
/**
@@ -57,9 +59,9 @@ plugin_t *sha1_plugin_create()
},
);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA1,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA1, plugin_name,
(hasher_constructor_t)sha1_hasher_create);
- lib->crypto->add_prf(lib->crypto, PRF_KEYED_SHA1,
+ lib->crypto->add_prf(lib->crypto, PRF_KEYED_SHA1, plugin_name,
(prf_constructor_t)sha1_prf_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/sha2/sha2_plugin.c b/src/libstrongswan/plugins/sha2/sha2_plugin.c
index dbb3c3f3b..a5937dbb2 100644
--- a/src/libstrongswan/plugins/sha2/sha2_plugin.c
+++ b/src/libstrongswan/plugins/sha2/sha2_plugin.c
@@ -18,6 +18,8 @@
#include <library.h>
#include "sha2_hasher.h"
+static const char *plugin_name = "sha2";
+
typedef struct private_sha2_plugin_t private_sha2_plugin_t;
/**
@@ -54,13 +56,13 @@ plugin_t *sha2_plugin_create()
},
);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA224,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA224, plugin_name,
(hasher_constructor_t)sha2_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA256,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA256, plugin_name,
(hasher_constructor_t)sha2_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA384,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA384, plugin_name,
(hasher_constructor_t)sha2_hasher_create);
- lib->crypto->add_hasher(lib->crypto, HASH_SHA512,
+ lib->crypto->add_hasher(lib->crypto, HASH_SHA512, plugin_name,
(hasher_constructor_t)sha2_hasher_create);
return &this->public.plugin;
diff --git a/src/libstrongswan/plugins/xcbc/xcbc_plugin.c b/src/libstrongswan/plugins/xcbc/xcbc_plugin.c
index 88156f383..7f649cada 100644
--- a/src/libstrongswan/plugins/xcbc/xcbc_plugin.c
+++ b/src/libstrongswan/plugins/xcbc/xcbc_plugin.c
@@ -19,6 +19,8 @@
#include "xcbc_signer.h"
#include "xcbc_prf.h"
+static const char *plugin_name = "xcbc";
+
typedef struct private_xcbc_plugin_t private_xcbc_plugin_t;
/**
@@ -57,13 +59,13 @@ plugin_t *xcbc_plugin_create()
},
);
- lib->crypto->add_prf(lib->crypto, PRF_AES128_XCBC,
+ lib->crypto->add_prf(lib->crypto, PRF_AES128_XCBC, plugin_name,
(prf_constructor_t)xcbc_prf_create);
- lib->crypto->add_prf(lib->crypto, PRF_CAMELLIA128_XCBC,
+ lib->crypto->add_prf(lib->crypto, PRF_CAMELLIA128_XCBC, plugin_name,
(prf_constructor_t)xcbc_prf_create);
- lib->crypto->add_signer(lib->crypto, AUTH_AES_XCBC_96,
+ lib->crypto->add_signer(lib->crypto, AUTH_AES_XCBC_96, plugin_name,
(signer_constructor_t)xcbc_signer_create);
- lib->crypto->add_signer(lib->crypto, AUTH_CAMELLIA_XCBC_96,
+ lib->crypto->add_signer(lib->crypto, AUTH_CAMELLIA_XCBC_96, plugin_name,
(signer_constructor_t)xcbc_signer_create);
return &this->public.plugin;
diff --git a/src/libtls/tls_crypto.c b/src/libtls/tls_crypto.c
index 78f2a796d..7b013e035 100644
--- a/src/libtls/tls_crypto.c
+++ b/src/libtls/tls_crypto.c
@@ -626,6 +626,7 @@ static void filter_suite(private_tls_crypto_t *this,
suite_algs_t suites[], int *count, int offset,
enumerator_t*(*create_enumerator)(crypto_factory_t*))
{
+ const char *plugin_name;
suite_algs_t current;
int i, remaining = 0;
enumerator_t *enumerator;
@@ -634,7 +635,8 @@ static void filter_suite(private_tls_crypto_t *this,
for (i = 0; i < *count; i++)
{
enumerator = create_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, ((char*)&current) + offset))
+ while (enumerator->enumerate(enumerator, ((char*)&current) + offset),
+ &plugin_name)
{
if ((suites[i].encr == ENCR_NULL ||
!current.encr || current.encr == suites[i].encr) &&
@@ -1060,10 +1062,11 @@ METHOD(tls_crypto_t, get_signature_algorithms, void,
enumerator_t *enumerator;
hash_algorithm_t alg;
tls_hash_algorithm_t hash;
+ const char *plugin_name;
supported = tls_writer_create(32);
enumerator = lib->crypto->create_hasher_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &alg))
+ while (enumerator->enumerate(enumerator, &alg, &plugin_name))
{
switch (alg)
{
diff --git a/src/pluto/crypto.c b/src/pluto/crypto.c
index 0684de618..f01966c72 100644
--- a/src/pluto/crypto.c
+++ b/src/pluto/crypto.c
@@ -26,14 +26,15 @@
static struct encrypt_desc encrypt_desc_3des =
{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_3DES_CBC,
- algo_next: NULL,
-
- enc_blocksize: DES_BLOCK_SIZE,
- keydeflen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
- keyminlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
- keymaxlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_3DES_CBC,
+ plugin_name: NULL,
+ algo_next: NULL,
+
+ enc_blocksize: DES_BLOCK_SIZE,
+ keydeflen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
+ keyminlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
+ keymaxlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
};
#define AES_KEY_MIN_LEN 128
@@ -42,14 +43,15 @@ static struct encrypt_desc encrypt_desc_3des =
static struct encrypt_desc encrypt_desc_aes =
{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_AES_CBC,
- algo_next: NULL,
-
- enc_blocksize: AES_BLOCK_SIZE,
- keyminlen: AES_KEY_MIN_LEN,
- keydeflen: AES_KEY_DEF_LEN,
- keymaxlen: AES_KEY_MAX_LEN,
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_AES_CBC,
+ plugin_name: NULL,
+ algo_next: NULL,
+
+ enc_blocksize: AES_BLOCK_SIZE,
+ keyminlen: AES_KEY_MIN_LEN,
+ keydeflen: AES_KEY_DEF_LEN,
+ keymaxlen: AES_KEY_MAX_LEN,
};
#define CAMELLIA_KEY_MIN_LEN 128
@@ -58,14 +60,15 @@ static struct encrypt_desc encrypt_desc_aes =
static struct encrypt_desc encrypt_desc_camellia =
{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_CAMELLIA_CBC,
- algo_next: NULL,
-
- enc_blocksize: CAMELLIA_BLOCK_SIZE,
- keyminlen: CAMELLIA_KEY_MIN_LEN,
- keydeflen: CAMELLIA_KEY_DEF_LEN,
- keymaxlen: CAMELLIA_KEY_MAX_LEN,
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_CAMELLIA_CBC,
+ plugin_name: NULL,
+ algo_next: NULL,
+
+ enc_blocksize: CAMELLIA_BLOCK_SIZE,
+ keyminlen: CAMELLIA_KEY_MIN_LEN,
+ keydeflen: CAMELLIA_KEY_DEF_LEN,
+ keymaxlen: CAMELLIA_KEY_MAX_LEN,
};
#define BLOWFISH_KEY_MIN_LEN 128
@@ -73,14 +76,15 @@ static struct encrypt_desc encrypt_desc_camellia =
static struct encrypt_desc encrypt_desc_blowfish =
{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_BLOWFISH_CBC,
- algo_next: NULL,
-
- enc_blocksize: BLOWFISH_BLOCK_SIZE,
- keyminlen: BLOWFISH_KEY_MIN_LEN,
- keydeflen: BLOWFISH_KEY_MIN_LEN,
- keymaxlen: BLOWFISH_KEY_MAX_LEN,
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_BLOWFISH_CBC,
+ plugin_name: NULL,
+ algo_next: NULL,
+
+ enc_blocksize: BLOWFISH_BLOCK_SIZE,
+ keyminlen: BLOWFISH_KEY_MIN_LEN,
+ keydeflen: BLOWFISH_KEY_MIN_LEN,
+ keymaxlen: BLOWFISH_KEY_MAX_LEN,
};
#define SERPENT_KEY_MIN_LEN 128
@@ -89,14 +93,15 @@ static struct encrypt_desc encrypt_desc_blowfish =
static struct encrypt_desc encrypt_desc_serpent =
{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_SERPENT_CBC,
- algo_next: NULL,
-
- enc_blocksize: SERPENT_BLOCK_SIZE,
- keyminlen: SERPENT_KEY_MIN_LEN,
- keydeflen: SERPENT_KEY_DEF_LEN,
- keymaxlen: SERPENT_KEY_MAX_LEN,
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_SERPENT_CBC,
+ plugin_name: NULL,
+ algo_next: NULL,
+
+ enc_blocksize: SERPENT_BLOCK_SIZE,
+ keyminlen: SERPENT_KEY_MIN_LEN,
+ keydeflen: SERPENT_KEY_DEF_LEN,
+ keymaxlen: SERPENT_KEY_MAX_LEN,
};
#define TWOFISH_KEY_MIN_LEN 128
@@ -105,32 +110,35 @@ static struct encrypt_desc encrypt_desc_serpent =
static struct encrypt_desc encrypt_desc_twofish =
{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_TWOFISH_CBC,
- algo_next: NULL,
-
- enc_blocksize: TWOFISH_BLOCK_SIZE,
- keydeflen: TWOFISH_KEY_MIN_LEN,
- keyminlen: TWOFISH_KEY_DEF_LEN,
- keymaxlen: TWOFISH_KEY_MAX_LEN,
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_TWOFISH_CBC,
+ plugin_name: NULL,
+ algo_next: NULL,
+
+ enc_blocksize: TWOFISH_BLOCK_SIZE,
+ keydeflen: TWOFISH_KEY_MIN_LEN,
+ keyminlen: TWOFISH_KEY_DEF_LEN,
+ keymaxlen: TWOFISH_KEY_MAX_LEN,
};
static struct encrypt_desc encrypt_desc_twofish_ssh =
{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_TWOFISH_CBC_SSH,
- algo_next: NULL,
-
- enc_blocksize: TWOFISH_BLOCK_SIZE,
- keydeflen: TWOFISH_KEY_MIN_LEN,
- keyminlen: TWOFISH_KEY_DEF_LEN,
- keymaxlen: TWOFISH_KEY_MAX_LEN,
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_TWOFISH_CBC_SSH,
+ plugin_name: NULL,
+ algo_next: NULL,
+
+ enc_blocksize: TWOFISH_BLOCK_SIZE,
+ keydeflen: TWOFISH_KEY_MIN_LEN,
+ keyminlen: TWOFISH_KEY_DEF_LEN,
+ keymaxlen: TWOFISH_KEY_MAX_LEN,
};
static struct hash_desc hash_desc_md5 =
{
algo_type: IKE_ALG_HASH,
algo_id: OAKLEY_MD5,
+ plugin_name: NULL,
algo_next: NULL,
hash_digest_size: HASH_SIZE_MD5,
};
@@ -139,6 +147,7 @@ static struct hash_desc hash_desc_sha1 =
{
algo_type: IKE_ALG_HASH,
algo_id: OAKLEY_SHA,
+ plugin_name: NULL,
algo_next: NULL,
hash_digest_size: HASH_SIZE_SHA1,
};
@@ -146,6 +155,7 @@ static struct hash_desc hash_desc_sha1 =
static struct hash_desc hash_desc_sha2_256 = {
algo_type: IKE_ALG_HASH,
algo_id: OAKLEY_SHA2_256,
+ plugin_name: NULL,
algo_next: NULL,
hash_digest_size: HASH_SIZE_SHA256,
};
@@ -153,6 +163,7 @@ static struct hash_desc hash_desc_sha2_256 = {
static struct hash_desc hash_desc_sha2_384 = {
algo_type: IKE_ALG_HASH,
algo_id: OAKLEY_SHA2_384,
+ plugin_name: NULL,
algo_next: NULL,
hash_digest_size: HASH_SIZE_SHA384,
};
@@ -160,120 +171,136 @@ static struct hash_desc hash_desc_sha2_384 = {
static struct hash_desc hash_desc_sha2_512 = {
algo_type: IKE_ALG_HASH,
algo_id: OAKLEY_SHA2_512,
+ plugin_name: NULL,
algo_next: NULL,
hash_digest_size: HASH_SIZE_SHA512,
};
const struct dh_desc unset_group = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_NONE,
- algo_next: NULL,
- ke_size: 0
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_NONE,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 0
};
static struct dh_desc dh_desc_modp_1024 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_1024_BIT,
- algo_next: NULL,
- ke_size: 1024 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_1024_BIT,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 1024 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_modp_1536 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_1536_BIT,
- algo_next: NULL,
- ke_size: 1536 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_1536_BIT,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 1536 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_modp_2048 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_2048_BIT,
- algo_next: NULL,
- ke_size: 2048 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_2048_BIT,
+ algo_next: NULL,
+ ke_size: 2048 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_modp_3072 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_3072_BIT,
- algo_next: NULL,
- ke_size: 3072 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_3072_BIT,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 3072 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_modp_4096 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_4096_BIT,
- algo_next: NULL,
- ke_size: 4096 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_4096_BIT,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 4096 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_modp_6144 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_6144_BIT,
- algo_next: NULL,
- ke_size: 6144 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_6144_BIT,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 6144 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_modp_8192 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_8192_BIT,
- algo_next: NULL,
- ke_size: 8192 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_8192_BIT,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 8192 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_ecp_256 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: ECP_256_BIT,
- algo_next: NULL,
- ke_size: 2*256 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: ECP_256_BIT,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 2*256 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_ecp_384 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: ECP_384_BIT,
- algo_next: NULL,
- ke_size: 2*384 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: ECP_384_BIT,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 2*384 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_ecp_521 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: ECP_521_BIT,
- algo_next: NULL,
- ke_size: 2*528 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: ECP_521_BIT,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 2*528 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_modp_1024_160 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_1024_160,
- algo_next: NULL,
- ke_size: 1024 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_1024_160,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 1024 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_modp_2048_224 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_2048_224,
- algo_next: NULL,
- ke_size: 2048 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_2048_224,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 2048 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_modp_2048_256 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_2048_256,
- algo_next: NULL,
- ke_size: 2048 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_2048_256,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 2048 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_ecp_192 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: ECP_192_BIT,
- algo_next: NULL,
- ke_size: 2*192 / BITS_PER_BYTE
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: ECP_192_BIT,
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 2*192 / BITS_PER_BYTE
};
static struct dh_desc dh_desc_ecp_224 = {
algo_type: IKE_ALG_DH_GROUP,
algo_id: ECP_224_BIT,
- algo_next: NULL,
- ke_size: 2*224 / BITS_PER_BYTE
+ plugin_name: NULL,
+ algo_next: NULL,
+ ke_size: 2*224 / BITS_PER_BYTE
};
bool init_crypto(void)
@@ -282,11 +309,12 @@ bool init_crypto(void)
encryption_algorithm_t encryption_alg;
hash_algorithm_t hash_alg;
diffie_hellman_group_t dh_group;
+ const char *plugin_name;
bool no_md5 = TRUE;
bool no_sha1 = TRUE;
enumerator = lib->crypto->create_hasher_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &hash_alg))
+ while (enumerator->enumerate(enumerator, &hash_alg, &plugin_name))
{
const struct hash_desc *desc;
@@ -312,7 +340,7 @@ bool init_crypto(void)
default:
continue;
}
- ike_alg_add((struct ike_alg *)desc);
+ ike_alg_add((struct ike_alg *)desc, plugin_name);
}
enumerator->destroy(enumerator);
@@ -326,7 +354,7 @@ bool init_crypto(void)
}
enumerator = lib->crypto->create_crypter_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &encryption_alg))
+ while (enumerator->enumerate(enumerator, &encryption_alg, &plugin_name))
{
const struct encrypt_desc *desc;
@@ -346,7 +374,8 @@ bool init_crypto(void)
break;
case ENCR_TWOFISH_CBC:
desc = &encrypt_desc_twofish;
- ike_alg_add((struct ike_alg *)&encrypt_desc_twofish_ssh);
+ ike_alg_add((struct ike_alg *)&encrypt_desc_twofish_ssh,
+ plugin_name);
break;
case ENCR_SERPENT_CBC:
desc = &encrypt_desc_serpent;
@@ -354,12 +383,12 @@ bool init_crypto(void)
default:
continue;
}
- ike_alg_add((struct ike_alg *)desc);
+ ike_alg_add((struct ike_alg *)desc, plugin_name);
}
enumerator->destroy(enumerator);
enumerator = lib->crypto->create_dh_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &dh_group))
+ while (enumerator->enumerate(enumerator, &dh_group, &plugin_name))
{
const struct dh_desc *desc;
@@ -413,7 +442,7 @@ bool init_crypto(void)
default:
continue;
}
- ike_alg_add((struct ike_alg *)desc);
+ ike_alg_add((struct ike_alg *)desc, plugin_name);
}
enumerator->destroy(enumerator);
return TRUE;
diff --git a/src/pluto/ike_alg.c b/src/pluto/ike_alg.c
index 08353907e..52976407e 100644
--- a/src/pluto/ike_alg.c
+++ b/src/pluto/ike_alg.c
@@ -72,7 +72,7 @@ static struct ike_alg *ike_alg_find(u_int algo_type, u_int algo_id,
/**
* "raw" ike_alg list adding function
*/
-int ike_alg_add(struct ike_alg* a)
+int ike_alg_add(struct ike_alg* a, const char *plugin_name)
{
if (a->algo_type > IKE_ALG_MAX)
{
@@ -96,6 +96,7 @@ int ike_alg_add(struct ike_alg* a)
e = *ep;
}
*ep = a;
+ a->plugin_name = plugin_name;
a->algo_next = e;
return 0;
}
@@ -308,7 +309,10 @@ fail:
*/
void ike_alg_list(void)
{
- char buf[BUF_LEN];
+ rng_quality_t quality;
+ enumerator_t *enumerator;
+ const char *plugin_name;
+ char buf[1024];
char *pos;
int n, len;
struct ike_alg *a;
@@ -322,7 +326,8 @@ void ike_alg_list(void)
len = BUF_LEN;
for (a = ike_alg_base[IKE_ALG_ENCRYPT]; a != NULL; a = a->algo_next)
{
- n = snprintf(pos, len, " %s", enum_name(&oakley_enc_names, a->algo_id));
+ n = snprintf(pos, len, " %s[%s]", enum_name(&oakley_enc_names,
+ a->algo_id), a->plugin_name);
pos += n;
len -= n;
if (len <= 0)
@@ -337,7 +342,8 @@ void ike_alg_list(void)
len = BUF_LEN;
for (a = ike_alg_base[IKE_ALG_HASH]; a != NULL; a = a->algo_next)
{
- n = snprintf(pos, len, " %s", enum_name(&oakley_hash_names, a->algo_id));
+ n = snprintf(pos, len, " %s[%s]", enum_name(&oakley_hash_names,
+ a->algo_id), a->plugin_name);
pos += n;
len -= n;
if (len <= 0)
@@ -352,7 +358,8 @@ void ike_alg_list(void)
len = BUF_LEN;
for (a = ike_alg_base[IKE_ALG_DH_GROUP]; a != NULL; a = a->algo_next)
{
- n = snprintf(pos, len, " %s", enum_name(&oakley_group_names, a->algo_id));
+ n = snprintf(pos, len, " %s[%s]", enum_name(&oakley_group_names,
+ a->algo_id), a->plugin_name);
pos += n;
len -= n;
if (len <= 0)
@@ -361,6 +368,24 @@ void ike_alg_list(void)
}
}
whack_log(RC_COMMENT, " dh-group: %s", buf);
+
+ pos = buf;
+ *pos = '\0';
+ len = BUF_LEN;
+ enumerator = lib->crypto->create_rng_enumerator(lib->crypto);
+ while (enumerator->enumerate(enumerator, &quality, &plugin_name))
+ {
+ n = snprintf(pos, len, " %N[%s]", rng_quality_names, quality,
+ plugin_name);
+ pos += n;
+ len -= n;
+ if (len <= 0)
+ {
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+ whack_log(RC_COMMENT, " random-gen:%s", buf);
}
/**
diff --git a/src/pluto/ike_alg.h b/src/pluto/ike_alg.h
index 458d14c3a..c3ce8bb38 100644
--- a/src/pluto/ike_alg.h
+++ b/src/pluto/ike_alg.h
@@ -22,12 +22,14 @@
struct ike_alg {
u_int16_t algo_type;
u_int16_t algo_id;
+ const char *plugin_name;
struct ike_alg *algo_next;
};
struct encrypt_desc {
u_int16_t algo_type;
u_int16_t algo_id;
+ const char *plugin_name;
struct ike_alg *algo_next;
size_t enc_blocksize;
@@ -39,6 +41,7 @@ struct encrypt_desc {
struct hash_desc {
u_int16_t algo_type;
u_int16_t algo_id;
+ const char *plugin_name;
struct ike_alg *algo_next;
size_t hash_digest_size;
@@ -47,6 +50,7 @@ struct hash_desc {
struct dh_desc {
u_int16_t algo_type;
u_int16_t algo_id;
+ const char *plugin_name;
struct ike_alg *algo_next;
size_t ke_size;
@@ -57,7 +61,7 @@ struct dh_desc {
#define IKE_ALG_DH_GROUP 2
#define IKE_ALG_MAX IKE_ALG_DH_GROUP
-extern int ike_alg_add(struct ike_alg *a);
+extern int ike_alg_add(struct ike_alg *a, const char *plugin_name);
extern struct hash_desc *ike_alg_get_hasher(u_int alg);
extern struct encrypt_desc *ike_alg_get_crypter(u_int alg);
extern struct dh_desc *ike_alg_get_dh_group(u_int alg);