Rename diffie_hellman_t to key_exchange_t and change the interface etc.
This makes it more generic so we can use it for QSKE methods.
This commit is contained in:
@@ -216,16 +216,16 @@ CALLBACK(match_proposal, bool,
|
||||
}
|
||||
|
||||
METHOD(child_cfg_t, get_proposals, linked_list_t*,
|
||||
private_child_cfg_t *this, bool strip_dh)
|
||||
private_child_cfg_t *this, bool strip_ke)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
proposal_t *current;
|
||||
proposal_selection_flag_t flags = 0;
|
||||
linked_list_t *proposals = linked_list_create();
|
||||
|
||||
if (strip_dh)
|
||||
if (strip_ke)
|
||||
{
|
||||
flags |= PROPOSAL_SKIP_DH;
|
||||
flags |= PROPOSAL_SKIP_KE;
|
||||
}
|
||||
|
||||
enumerator = this->proposals->create_enumerator(this->proposals);
|
||||
@@ -484,23 +484,24 @@ METHOD(child_cfg_t, get_close_action, action_t,
|
||||
return this->close_action;
|
||||
}
|
||||
|
||||
METHOD(child_cfg_t, get_dh_group, diffie_hellman_group_t,
|
||||
METHOD(child_cfg_t, get_ke_method, key_exchange_method_t,
|
||||
private_child_cfg_t *this)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
proposal_t *proposal;
|
||||
uint16_t dh_group = MODP_NONE;
|
||||
uint16_t method = MODP_NONE;
|
||||
|
||||
enumerator = this->proposals->create_enumerator(this->proposals);
|
||||
while (enumerator->enumerate(enumerator, &proposal))
|
||||
{
|
||||
if (proposal->get_algorithm(proposal, DIFFIE_HELLMAN_GROUP, &dh_group, NULL))
|
||||
if (proposal->get_algorithm(proposal, KEY_EXCHANGE_METHOD, &method,
|
||||
NULL))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
return dh_group;
|
||||
return method;
|
||||
}
|
||||
|
||||
METHOD(child_cfg_t, get_inactivity, uint32_t,
|
||||
@@ -758,7 +759,7 @@ child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data)
|
||||
.get_dpd_action = _get_dpd_action,
|
||||
.get_close_action = _get_close_action,
|
||||
.get_lifetime = _get_lifetime,
|
||||
.get_dh_group = _get_dh_group,
|
||||
.get_ke_method = _get_ke_method,
|
||||
.get_inactivity = _get_inactivity,
|
||||
.get_reqid = _get_reqid,
|
||||
.get_if_id = _get_if_id,
|
||||
|
||||
@@ -89,10 +89,10 @@ struct child_cfg_t {
|
||||
*
|
||||
* Resulting list and all of its proposals must be freed after use.
|
||||
*
|
||||
* @param strip_dh TRUE strip out diffie hellman groups
|
||||
* @param strip_ke TRUE strip out key exchange methods
|
||||
* @return list of proposals
|
||||
*/
|
||||
linked_list_t* (*get_proposals)(child_cfg_t *this, bool strip_dh);
|
||||
linked_list_t* (*get_proposals)(child_cfg_t *this, bool strip_ke);
|
||||
|
||||
/**
|
||||
* Select a proposal from a supplied list.
|
||||
@@ -204,11 +204,11 @@ struct child_cfg_t {
|
||||
action_t (*get_close_action) (child_cfg_t *this);
|
||||
|
||||
/**
|
||||
* Get the DH group to use for CHILD_SA setup.
|
||||
* Get the key exchange method to use for CHILD_SA setup.
|
||||
*
|
||||
* @return dh group to use
|
||||
* @return key exchange method to use
|
||||
*/
|
||||
diffie_hellman_group_t (*get_dh_group)(child_cfg_t *this);
|
||||
key_exchange_method_t (*get_ke_method)(child_cfg_t *this);
|
||||
|
||||
/**
|
||||
* Get the inactivity timeout value.
|
||||
|
||||
@@ -348,23 +348,24 @@ METHOD(ike_cfg_t, select_proposal, proposal_t*,
|
||||
return proposal_select(this->proposals, proposals, flags);
|
||||
}
|
||||
|
||||
METHOD(ike_cfg_t, get_dh_group, diffie_hellman_group_t,
|
||||
METHOD(ike_cfg_t, get_ke_method, key_exchange_method_t,
|
||||
private_ike_cfg_t *this)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
proposal_t *proposal;
|
||||
uint16_t dh_group = MODP_NONE;
|
||||
uint16_t method = MODP_NONE;
|
||||
|
||||
enumerator = this->proposals->create_enumerator(this->proposals);
|
||||
while (enumerator->enumerate(enumerator, &proposal))
|
||||
{
|
||||
if (proposal->get_algorithm(proposal, DIFFIE_HELLMAN_GROUP, &dh_group, NULL))
|
||||
if (proposal->get_algorithm(proposal, KEY_EXCHANGE_METHOD, &method,
|
||||
NULL))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
return dh_group;
|
||||
return method;
|
||||
}
|
||||
|
||||
METHOD(ike_cfg_t, equals, bool,
|
||||
@@ -603,7 +604,7 @@ ike_cfg_t *ike_cfg_create(ike_cfg_create_t *data)
|
||||
.get_proposals = _get_proposals,
|
||||
.select_proposal = _select_proposal,
|
||||
.has_proposal = _has_proposal,
|
||||
.get_dh_group = _get_dh_group,
|
||||
.get_ke_method = _get_ke_method,
|
||||
.equals = _equals,
|
||||
.get_ref = _get_ref,
|
||||
.destroy = _destroy,
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef struct ike_cfg_create_t ike_cfg_create_t;
|
||||
#include <collections/linked_list.h>
|
||||
#include <utils/identification.h>
|
||||
#include <crypto/proposal/proposal.h>
|
||||
#include <crypto/diffie_hellman.h>
|
||||
#include <crypto/key_exchange.h>
|
||||
|
||||
/**
|
||||
* IKE version.
|
||||
@@ -231,11 +231,11 @@ struct ike_cfg_t {
|
||||
childless_t (*childless)(ike_cfg_t *this);
|
||||
|
||||
/**
|
||||
* Get the DH group to use for IKE_SA setup.
|
||||
* Get the key exchange method to use for IKE_SA setup.
|
||||
*
|
||||
* @return dh group to use for initialization
|
||||
* @return key exchange method to use for initialization
|
||||
*/
|
||||
diffie_hellman_group_t (*get_dh_group)(ike_cfg_t *this);
|
||||
key_exchange_method_t (*get_ke_method)(ike_cfg_t *this);
|
||||
|
||||
/**
|
||||
* Check if two IKE configs are equal.
|
||||
|
||||
Reference in New Issue
Block a user