diff options
Diffstat (limited to 'src/pluto/ike_alg.c')
-rw-r--r-- | src/pluto/ike_alg.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/pluto/ike_alg.c b/src/pluto/ike_alg.c index 08353907e..eabe6c86e 100644 --- a/src/pluto/ike_alg.c +++ b/src/pluto/ike_alg.c @@ -72,7 +72,11 @@ static struct ike_alg *ike_alg_find(u_int algo_type, u_int algo_id, /** * "raw" ike_alg list adding function */ +<<<<<<< HEAD int ike_alg_add(struct ike_alg* a) +======= +int ike_alg_add(struct ike_alg* a, const char *plugin_name) +>>>>>>> upstream/4.5.1 { if (a->algo_type > IKE_ALG_MAX) { @@ -96,6 +100,10 @@ int ike_alg_add(struct ike_alg* a) e = *ep; } *ep = a; +<<<<<<< HEAD +======= + a->plugin_name = plugin_name; +>>>>>>> upstream/4.5.1 a->algo_next = e; return 0; } @@ -304,19 +312,51 @@ fail: } /** +<<<<<<< HEAD +======= + * Print the name of an algorithm plus the name of the plugin that registered it + */ +static void print_alg(char *buf, int *len, enum_names *alg_names, int alg_type, + const char *plugin_name) +{ + char alg_name[BUF_LEN]; + int alg_name_len; + + alg_name_len = sprintf(alg_name, " %s[%s]", enum_name(alg_names, alg_type), + plugin_name); + if (*len + alg_name_len > CRYPTO_MAX_ALG_LINE) + { + whack_log(RC_COMMENT, "%s", buf); + *len = sprintf(buf, " "); + } + sprintf(buf + *len, "%s", alg_name); + *len += alg_name_len; +} + +/** +>>>>>>> upstream/4.5.1 * Show registered IKE algorithms */ void ike_alg_list(void) { +<<<<<<< HEAD char buf[BUF_LEN]; char *pos; int n, len; +======= + rng_quality_t quality; + enumerator_t *enumerator; + const char *plugin_name; + char buf[BUF_LEN]; + int len; +>>>>>>> upstream/4.5.1 struct ike_alg *a; whack_log(RC_COMMENT, " "); whack_log(RC_COMMENT, "List of registered IKEv1 Algorithms:"); whack_log(RC_COMMENT, " "); +<<<<<<< HEAD pos = buf; *pos = '\0'; len = BUF_LEN; @@ -361,6 +401,38 @@ void ike_alg_list(void) } } whack_log(RC_COMMENT, " dh-group: %s", buf); +======= + len = sprintf(buf, " encryption:"); + for (a = ike_alg_base[IKE_ALG_ENCRYPT]; a != NULL; a = a->algo_next) + { + print_alg(buf, &len, &oakley_enc_names, a->algo_id, a->plugin_name); + } + whack_log(RC_COMMENT, "%s", buf); + + len = sprintf(buf, " integrity: "); + for (a = ike_alg_base[IKE_ALG_HASH]; a != NULL; a = a->algo_next) + { + print_alg(buf, &len, &oakley_hash_names, a->algo_id, a->plugin_name); + } + whack_log(RC_COMMENT, "%s", buf); + + len = sprintf(buf, " dh-group: "); + for (a = ike_alg_base[IKE_ALG_DH_GROUP]; a != NULL; a = a->algo_next) + { + print_alg(buf, &len, &oakley_group_names, a->algo_id, a->plugin_name); + } + whack_log(RC_COMMENT, "%s", buf); + + len = sprintf(buf, " random-gen:"); + enumerator = lib->crypto->create_rng_enumerator(lib->crypto); + while (enumerator->enumerate(enumerator, &quality, &plugin_name)) + { + len += sprintf(buf + len, " %N[%s]", rng_quality_names, quality, + plugin_name); + } + enumerator->destroy(enumerator); + whack_log(RC_COMMENT, "%s", buf); +>>>>>>> upstream/4.5.1 } /** |