bus: Support multiple key exchanges in ike/child_keys() events
This commit is contained in:
@@ -220,6 +220,7 @@ METHOD(phase1_t, derive_keys, bool,
|
||||
private_phase1_t *this, peer_cfg_t *peer_cfg, auth_method_t method)
|
||||
{
|
||||
shared_key_t *shared_key = NULL;
|
||||
array_t *kes = NULL;
|
||||
|
||||
switch (method)
|
||||
{
|
||||
@@ -245,9 +246,11 @@ METHOD(phase1_t, derive_keys, bool,
|
||||
DBG1(DBG_IKE, "key derivation for %N failed", auth_method_names, method);
|
||||
return FALSE;
|
||||
}
|
||||
charon->bus->ike_keys(charon->bus, this->ike_sa, this->dh, this->dh_value,
|
||||
array_insert_create(&kes, ARRAY_HEAD, this->dh);
|
||||
charon->bus->ike_keys(charon->bus, this->ike_sa, kes, this->dh_value,
|
||||
this->nonce_i, this->nonce_r, NULL, shared_key,
|
||||
method);
|
||||
array_destroy(kes);
|
||||
DESTROY_IF(shared_key);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -270,6 +270,7 @@ static bool install(private_quick_mode_t *this)
|
||||
chunk_t encr_i, encr_r, integ_i, integ_r;
|
||||
linked_list_t *tsi, *tsr, *my_ts, *other_ts;
|
||||
child_sa_t *old = NULL;
|
||||
array_t *kes = NULL;
|
||||
|
||||
this->child_sa->set_proposal(this->child_sa, this->proposal);
|
||||
this->child_sa->set_state(this->child_sa, CHILD_INSTALLING);
|
||||
@@ -377,8 +378,13 @@ static bool install(private_quick_mode_t *this)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (this->dh)
|
||||
{
|
||||
array_insert_create(&kes, ARRAY_HEAD, this->dh);
|
||||
}
|
||||
charon->bus->child_keys(charon->bus, this->child_sa, this->initiator,
|
||||
this->dh, this->nonce_i, this->nonce_r);
|
||||
kes, this->nonce_i, this->nonce_r);
|
||||
array_destroy(kes);
|
||||
|
||||
my_ts = linked_list_create_from_enumerator(
|
||||
this->child_sa->create_ts_enumerator(this->child_sa, TRUE));
|
||||
|
||||
@@ -768,6 +768,8 @@ static status_t select_and_install(private_child_create_t *this,
|
||||
charon->bus->child_derived_keys(charon->bus, this->child_sa,
|
||||
this->initiator, encr_i, encr_r,
|
||||
integ_i, integ_r);
|
||||
charon->bus->child_keys(charon->bus, this->child_sa,
|
||||
this->initiator, kes, nonce_i, nonce_r);
|
||||
}
|
||||
}
|
||||
chunk_clear(&integ_i);
|
||||
@@ -781,9 +783,6 @@ static status_t select_and_install(private_child_create_t *this,
|
||||
return status;
|
||||
}
|
||||
|
||||
charon->bus->child_keys(charon->bus, this->child_sa, this->initiator,
|
||||
this->dh, nonce_i, nonce_r);
|
||||
|
||||
#if DEBUG_LEVEL >= 0
|
||||
child_sa_outbound_state_t out_state;
|
||||
|
||||
|
||||
@@ -802,7 +802,7 @@ static bool derive_keys_internal(private_ike_init_t *this, chunk_t nonce_i,
|
||||
pseudo_random_function_t prf_alg = PRF_UNDEFINED;
|
||||
chunk_t skd = chunk_empty;
|
||||
ike_sa_id_t *id;
|
||||
array_t *kes;
|
||||
array_t *kes = NULL;
|
||||
|
||||
id = this->ike_sa->get_id(this->ike_sa);
|
||||
if (this->old_sa)
|
||||
@@ -818,9 +818,9 @@ static bool derive_keys_internal(private_ike_init_t *this, chunk_t nonce_i,
|
||||
array_destroy(kes);
|
||||
return FALSE;
|
||||
}
|
||||
array_destroy(kes);
|
||||
charon->bus->ike_keys(charon->bus, this->ike_sa, this->dh, chunk_empty,
|
||||
charon->bus->ike_keys(charon->bus, this->ike_sa, kes, chunk_empty,
|
||||
nonce_i, nonce_r, this->old_sa, NULL, AUTH_NONE);
|
||||
array_destroy(kes);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user