proposal: Add helper to check if additional key exchanges are contained

This commit is contained in:
Tobias Brunner
2024-08-07 16:20:19 +02:00
parent 882ff93bfd
commit 1d5e921911
3 changed files with 50 additions and 0 deletions
@@ -1426,3 +1426,27 @@ proposal_t *proposal_select(linked_list_t *configured, linked_list_t *supplied,
}
return selected;
}
/*
* Described in header
*/
bool proposal_has_additional_ke(proposal_t *public)
{
private_proposal_t *this = (private_proposal_t*)public;
enumerator_t *enumerator;
entry_t *entry;
bool found = FALSE;
enumerator = array_create_enumerator(this->transforms);
while (enumerator->enumerate(enumerator, &entry))
{
if (entry->type != KEY_EXCHANGE_METHOD &&
is_ke_transform(entry->type))
{
found = TRUE;
break;
}
}
enumerator->destroy(enumerator);
return found;
}
@@ -287,6 +287,14 @@ proposal_t *proposal_create_from_string(protocol_id_t protocol,
proposal_t *proposal_select(linked_list_t *configured, linked_list_t *supplied,
proposal_selection_flag_t flags);
/**
* Check whether this proposal contains algorithms for any additional key
* exchange method transform types.
*
* @return TRUE if found
*/
bool proposal_has_additional_ke(proposal_t *this);
/**
* printf hook function for proposal_t.
*