aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/sa/ike_sa.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2008-10-28 10:12:21 +0000
committerMartin Willi <martin@strongswan.org>2008-10-28 10:12:21 +0000
commit3c8234d408cc81899576dd73f0a83d6211af17e8 (patch)
tree4bae27911064f410a9516a1877231c509f681b61 /src/charon/sa/ike_sa.c
parent20fb67190438f12e63dfe8542f660878359352fa (diff)
downloadstrongswan-3c8234d408cc81899576dd73f0a83d6211af17e8.tar.bz2
strongswan-3c8234d408cc81899576dd73f0a83d6211af17e8.tar.xz
store IKE proposal implicitly during derive_keys
Diffstat (limited to 'src/charon/sa/ike_sa.c')
-rw-r--r--src/charon/sa/ike_sa.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/charon/sa/ike_sa.c b/src/charon/sa/ike_sa.c
index ba8c352c5..d4ee4bb35 100644
--- a/src/charon/sa/ike_sa.c
+++ b/src/charon/sa/ike_sa.c
@@ -191,10 +191,10 @@ struct private_ike_sa_t {
linked_list_t *child_sas;
/**
- * String describing the selected IKE proposal
+ * Selected IKE proposal
*/
- char *selected_proposal;
-
+ proposal_t *selected_proposal;
+
/**
* crypter for inbound traffic
*/
@@ -1767,27 +1767,21 @@ static status_t derive_keys(private_ike_sa_t *this,
/* all done, prf_plus not needed anymore */
prf_plus->destroy(prf_plus);
+ /* save selected proposal */
+ this->selected_proposal = proposal->clone(proposal);
+
return SUCCESS;
}
/**
* Implementation of ike_sa_t.get_proposal.
*/
-static char* get_proposal(private_ike_sa_t *this)
+static proposal_t* get_proposal(private_ike_sa_t *this)
{
return this->selected_proposal;
}
/**
- * Implementation of ike_sa_t.set_proposal.
- */
-static void set_proposal(private_ike_sa_t *this, char *proposal)
-{
- free(this->selected_proposal);
- this->selected_proposal = strdup(proposal);
-}
-
-/**
* Implementation of ike_sa_t.add_child_sa.
*/
static void add_child_sa(private_ike_sa_t *this, child_sa_t *child_sa)
@@ -2467,7 +2461,7 @@ static void destroy(private_ike_sa_t *this)
DESTROY_IF(this->child_prf);
chunk_free(&this->skp_verify);
chunk_free(&this->skp_build);
- free(this->selected_proposal);
+ DESTROY_IF(this->selected_proposal);
if (this->my_virtual_ip)
{
@@ -2572,8 +2566,7 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
this->public.get_skp_verify = (chunk_t (*)(ike_sa_t *)) get_skp_verify;
this->public.get_skp_build = (chunk_t (*)(ike_sa_t *)) get_skp_build;
this->public.derive_keys = (status_t (*)(ike_sa_t *,proposal_t*,chunk_t,chunk_t,chunk_t,bool,prf_t*,prf_t*)) derive_keys;
- this->public.get_proposal = (char* (*)(ike_sa_t*)) get_proposal;
- this->public.set_proposal = (void (*)(ike_sa_t*,char*)) set_proposal;
+ this->public.get_proposal = (proposal_t* (*)(ike_sa_t*)) get_proposal;
this->public.add_child_sa = (void (*)(ike_sa_t*,child_sa_t*)) add_child_sa;
this->public.get_child_sa = (child_sa_t* (*)(ike_sa_t*,protocol_id_t,u_int32_t,bool)) get_child_sa;
this->public.create_child_sa_iterator = (iterator_t* (*)(ike_sa_t*)) create_child_sa_iterator;