proposal: Add prefix for additional key exchanges when logging proposals

This commit is contained in:
Tobias Brunner
2024-08-07 16:20:18 +02:00
parent e05d86b27a
commit c5a6938b9e
+9 -4
View File
@@ -849,7 +849,7 @@ static int print_alg(private_proposal_t *this, printf_hook_data_t *data,
enumerator = array_create_enumerator(this->transforms); enumerator = array_create_enumerator(this->transforms);
while (enumerator->enumerate(enumerator, &entry)) while (enumerator->enumerate(enumerator, &entry))
{ {
char *prefix = "/"; char *prefix = "/", ake_prefix[5] = "";
if (type != entry->type) if (type != entry->type)
{ {
@@ -860,14 +860,19 @@ static int print_alg(private_proposal_t *this, printf_hook_data_t *data,
prefix = ""; prefix = "";
*first = FALSE; *first = FALSE;
} }
if (is_ke_transform(type) && type != KEY_EXCHANGE_METHOD)
{
sprintf(ake_prefix, "KE%d_", type - ADDITIONAL_KEY_EXCHANGE_1 + 1);
}
if (names) if (names)
{ {
written += print_in_hook(data, "%s%N", prefix, names, entry->alg); written += print_in_hook(data, "%s%s%N", prefix, ake_prefix,
names, entry->alg);
} }
else else
{ {
written += print_in_hook(data, "%sUNKNOWN_%u_%u", prefix, written += print_in_hook(data, "%s%sUNKNOWN_%u_%u", prefix,
entry->type, entry->alg); ake_prefix, entry->type, entry->alg);
} }
if (entry->key_size) if (entry->key_size)
{ {