- fixed policy setup bug
[strongswan.git] / Source / charon / sa / states / ike_sa_init_responded.c
1 /**
2 * @file ike_sa_init_responded.c
3 *
4 * @brief State of a IKE_SA after responding to an IKE_SA_INIT request
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #include "ike_sa_init_responded.h"
24
25 #include <daemon.h>
26 #include <utils/allocator.h>
27 #include <sa/authenticator.h>
28 #include <sa/child_sa.h>
29 #include <encoding/payloads/ts_payload.h>
30 #include <encoding/payloads/sa_payload.h>
31 #include <encoding/payloads/id_payload.h>
32 #include <encoding/payloads/auth_payload.h>
33 #include <encoding/payloads/notify_payload.h>
34 #include <transforms/signers/signer.h>
35 #include <transforms/crypters/crypter.h>
36 #include <sa/states/ike_sa_established.h>
37
38
39 typedef struct private_ike_sa_init_responded_t private_ike_sa_init_responded_t;
40
41 /**
42 * Private data of a ike_sa_init_responded_t object.
43 *
44 */
45 struct private_ike_sa_init_responded_t {
46 /**
47 * Public interface of ike_sa_init_responded_t.
48 */
49 ike_sa_init_responded_t public;
50
51 /**
52 * Assigned IKE_SA.
53 */
54 protected_ike_sa_t *ike_sa;
55
56 /**
57 * Received nonce.
58 */
59 chunk_t received_nonce;
60
61 /**
62 * Sent nonce.
63 */
64 chunk_t sent_nonce;
65
66 /**
67 * Binary representation of the IKE_SA_INIT response.
68 */
69 chunk_t ike_sa_init_response_data;
70
71 /**
72 * Binary representation of the IKE_SA_INIT request.
73 */
74 chunk_t ike_sa_init_request_data;
75
76 /**
77 * SA config to use.
78 */
79 sa_config_t *sa_config;
80
81 /**
82 * CHILD_SA, if set up
83 */
84 child_sa_t *child_sa;
85
86 /**
87 * Traffic selectors applicable at our site
88 */
89 linked_list_t *my_ts;
90
91 /**
92 * Traffic selectors applicable at remote site
93 */
94 linked_list_t *other_ts;
95
96 /**
97 * Assigned logger.
98 *
99 * Is logger of ike_sa!
100 */
101 logger_t *logger;
102
103 /**
104 * Process received IDi and IDr payload and build IDr payload for IKE_AUTH response.
105 *
106 * @param this calling object
107 * @param request_idi ID payload representing initiator
108 * @param request_idr ID payload representing responder (May be zero)
109 * @param response The created IDr payload is added to this message_t object
110 * @param response_idr The created IDr payload is also written to this location
111 */
112 status_t (*build_idr_payload) (private_ike_sa_init_responded_t *this,
113 id_payload_t *request_idi,
114 id_payload_t *request_idr,
115 message_t *response,
116 id_payload_t **response_idr);
117
118 /**
119 * Process received SA payload and build SA payload for IKE_AUTH response.
120 *
121 * @param this calling object
122 * @param request SA payload received in IKE_AUTH request
123 * @param response The created SA payload is added to this message_t object
124 */
125 status_t (*build_sa_payload) (private_ike_sa_init_responded_t *this, sa_payload_t *request, message_t *response);
126
127 /**
128 * Process received AUTH payload and build AUTH payload for IKE_AUTH response.
129 *
130 * @param this calling object
131 * @param request AUTH payload received in IKE_AUTH request
132 * @param other_id_payload other ID payload needed to verify AUTH data
133 * @param my_id_payload my ID payload needed to compute AUTH data
134 * @param response The created AUTH payload is added to this message_t object
135 */
136 status_t (*build_auth_payload) (private_ike_sa_init_responded_t *this, auth_payload_t *request,id_payload_t *other_id_payload,id_payload_t *my_id_payload, message_t* response);
137
138 /**
139 * Process received TS payload and build TS payload for IKE_AUTH response.
140 *
141 * @param this calling object
142 * @param is_initiator type of TS payload. TRUE for TSi, FALSE for TSr
143 * @param request TS payload received in IKE_AUTH request
144 * @param response the created TS payload is added to this message_t object
145 */
146 status_t (*build_ts_payload) (private_ike_sa_init_responded_t *this, bool ts_initiator, ts_payload_t *request, message_t *response);
147
148 /**
149 * Sends a IKE_AUTH reply containing a notify payload.
150 *
151 * @param this calling object
152 * @param notify_payload payload to process
153 * @return
154 * - DELETE_ME if IKE_SA should be deleted
155 * - SUCCSS if processed successfull
156 */
157 status_t (*process_notify_payload) (private_ike_sa_init_responded_t *this, notify_payload_t* notify_payload);
158
159 /**
160 * Destroy function called internally of this class after state change to
161 * state IKE_SA_ESTABLISHED succeeded.
162 *
163 * This destroy function does not destroy objects which were passed to the new state.
164 *
165 * @param this calling object
166 */
167 void (*destroy_after_state_change) (private_ike_sa_init_responded_t *this);
168 };
169
170 /**
171 * Implements state_t.get_state
172 */
173 static status_t process_message(private_ike_sa_init_responded_t *this, message_t *request)
174 {
175 id_payload_t *idi_request = NULL, *idr_request = NULL,*idr_response;
176 ts_payload_t *tsi_request = NULL, *tsr_request = NULL;
177 auth_payload_t *auth_request = NULL;
178 sa_payload_t *sa_request = NULL;
179 iterator_t *payloads;
180 message_t *response;
181 crypter_t *crypter;
182 signer_t *signer;
183 status_t status;
184 host_t *my_host, *other_host;
185
186
187 if (request->get_exchange_type(request) != IKE_AUTH)
188 {
189 this->logger->log(this->logger, ERROR | LEVEL1, "Message of type %s not supported in state ike_sa_init_responded",
190 mapping_find(exchange_type_m,request->get_exchange_type(request)));
191 return FAILED;
192 }
193
194 if (!request->get_request(request))
195 {
196 this->logger->log(this->logger, ERROR | LEVEL1, "IKE_AUTH responses not allowed state ike_sa_init_responded");
197 return FAILED;
198 }
199
200 /* get signer for verification and crypter for decryption */
201 signer = this->ike_sa->get_signer_initiator(this->ike_sa);
202 crypter = this->ike_sa->get_crypter_initiator(this->ike_sa);
203
204 status = request->parse_body(request, crypter, signer);
205 if (status != SUCCESS)
206 {
207 if (status == NOT_SUPPORTED)
208 {
209 this->logger->log(this->logger, ERROR | LEVEL1, "IKE_AUTH request contains unsupported payload with critical flag set."
210 "Deleting IKE_SA");
211 this->ike_sa->send_notify(this->ike_sa, IKE_AUTH, UNSUPPORTED_CRITICAL_PAYLOAD, CHUNK_INITIALIZER);
212 return DELETE_ME;
213 }
214 else
215 {
216 this->logger->log(this->logger, AUDIT, "IKE_AUTH request decryption faild. Ignoring message");
217 }
218 return status;
219 }
220
221 /* iterate over incoming payloads. Message is verified, we can be sure there are the required payloads */
222 payloads = request->get_payload_iterator(request);
223 while (payloads->has_next(payloads))
224 {
225 payload_t *payload;
226 payloads->current(payloads, (void**)&payload);
227
228 switch (payload->get_type(payload))
229 {
230 case ID_INITIATOR:
231 {
232 idi_request = (id_payload_t*)payload;
233 break;
234 }
235 case AUTHENTICATION:
236 {
237 auth_request = (auth_payload_t*)payload;
238 break;
239 }
240 case ID_RESPONDER:
241 {
242 idr_request = (id_payload_t*)payload;
243 break;
244 }
245 case SECURITY_ASSOCIATION:
246 {
247 sa_request = (sa_payload_t*)payload;
248 break;
249 }
250
251 case TRAFFIC_SELECTOR_INITIATOR:
252 {
253 tsi_request = (ts_payload_t*)payload;
254 break;
255 }
256 case TRAFFIC_SELECTOR_RESPONDER:
257 {
258 tsr_request = (ts_payload_t*)payload;
259 break;
260 }
261 case NOTIFY:
262 {
263 notify_payload_t *notify_payload = (notify_payload_t *) payload;
264 status = this->process_notify_payload(this, notify_payload);
265 if (status != SUCCESS)
266 {
267 payloads->destroy(payloads);
268 return status;
269 }
270 }
271 case CERTIFICATE:
272 {
273 /* TODO handle cert payloads */
274 }
275 case CERTIFICATE_REQUEST:
276 {
277 /* TODO handle certrequest payloads */
278 }
279 default:
280 {
281 this->logger->log(this->logger, ERROR|LEVEL1, "Ignoring payload %s (%d)",
282 mapping_find(payload_type_m, payload->get_type(payload)), payload->get_type(payload));
283 break;
284 }
285 }
286 }
287 /* iterator can be destroyed */
288 payloads->destroy(payloads);
289
290 /* check if we have all payloads */
291 if (!(idi_request && sa_request && auth_request && tsi_request && tsr_request))
292 {
293 this->logger->log(this->logger, AUDIT, "IKE_AUTH reply did not contain all required payloads. Deleting IKE_SA");
294 return DELETE_ME;
295 }
296
297 /* build response */
298 this->ike_sa->build_message(this->ike_sa, IKE_AUTH, FALSE, &response);
299
300 /* add payloads to it */
301 status = this->build_idr_payload(this, idi_request, idr_request, response,&idr_response);
302 if (status != SUCCESS)
303 {
304 response->destroy(response);
305 return status;
306 }
307 status = this->build_auth_payload(this, auth_request,idi_request, idr_response,response);
308 if (status != SUCCESS)
309 {
310 response->destroy(response);
311 return status;
312 }
313 status = this->build_sa_payload(this, sa_request, response);
314 if (status != SUCCESS)
315 {
316 response->destroy(response);
317 return status;
318 }
319 status = this->build_ts_payload(this, TRUE, tsi_request, response);
320 if (status != SUCCESS)
321 {
322 response->destroy(response);
323 return status;
324 }
325 status = this->build_ts_payload(this, FALSE, tsr_request, response);
326 if (status != SUCCESS)
327 {
328 response->destroy(response);
329 return status;
330 }
331
332 status = this->ike_sa->send_response(this->ike_sa, response);
333 /* message can now be sent (must not be destroyed) */
334 if (status != SUCCESS)
335 {
336 this->logger->log(this->logger, AUDIT, "Unable to send IKE_AUTH reply. Deleting IKE_SA");
337 response->destroy(response);
338 return DELETE_ME;
339 }
340
341 /* install child SA policies */
342 if (!this->child_sa)
343 {
344 this->logger->log(this->logger, CONTROL, "Proposal negotiation failed, no CHILD_SA built");
345 }
346 else if (this->my_ts->get_count(this->my_ts) == 0 || this->other_ts->get_count(this->other_ts) == 0)
347 {
348 this->logger->log(this->logger, CONTROL, "Traffic selector negotiation failed, no CHILD_SA built");
349 }
350 else
351 {
352 status = this->child_sa->add_policy(this->child_sa, this->my_ts, this->other_ts);
353 if (status != SUCCESS)
354 {
355 this->logger->log(this->logger, AUDIT, "Could not install CHILD_SA policy! Deleting IKE_SA");
356 return DELETE_ME;
357 }
358 this->ike_sa->add_child_sa(this->ike_sa, this->child_sa);
359 }
360
361 /* create new state */
362 my_host = this->ike_sa->get_my_host(this->ike_sa);
363 other_host = this->ike_sa->get_other_host(this->ike_sa);
364 this->logger->log(this->logger, AUDIT, "IKE_SA established between %s - %s, authenticated peer with %s",
365 my_host->get_address(my_host), other_host->get_address(other_host),
366 mapping_find(auth_method_m, auth_request->get_auth_method(auth_request)));
367
368 this->ike_sa->create_delete_established_ike_sa_job(this->ike_sa,this->sa_config->get_ike_sa_lifetime(this->sa_config));
369 this->ike_sa->set_new_state(this->ike_sa, (state_t*)ike_sa_established_create(this->ike_sa));
370 this->destroy_after_state_change(this);
371
372 return SUCCESS;
373 }
374
375 /**
376 * Implementation of private_ike_sa_init_responded_t.build_idr_payload.
377 */
378 static status_t build_idr_payload(private_ike_sa_init_responded_t *this, id_payload_t *request_idi, id_payload_t *request_idr, message_t *response,id_payload_t **response_idr)
379 {
380 identification_t *other_id, *my_id = NULL;
381 init_config_t *init_config;
382 status_t status;
383 id_payload_t *idr_response;
384
385 other_id = request_idi->get_identification(request_idi);
386 if (request_idr)
387 {
388 my_id = request_idr->get_identification(request_idr);
389 }
390
391 /* build new sa config */
392 init_config = this->ike_sa->get_init_config(this->ike_sa);
393 status = charon->configuration_manager->get_sa_config_for_init_config_and_id(charon->configuration_manager,init_config, other_id,my_id, &(this->sa_config));
394 if (status != SUCCESS)
395 {
396 if (my_id)
397 {
398 this->logger->log(this->logger, AUDIT, "IKE_AUTH request uses IDs %s to %s, which we have no config for",
399 other_id->get_string(other_id),my_id->get_string(my_id));
400 my_id->destroy(my_id);
401 }
402 else
403 {
404 this->logger->log(this->logger, AUDIT, "IKE_AUTH request uses ID %s, which we have no config for",
405 other_id->get_string(other_id));
406 }
407 other_id->destroy(other_id);
408 return DELETE_ME;
409 }
410
411 if (my_id)
412 {
413 my_id->destroy(my_id);
414 }
415 other_id->destroy(other_id);
416
417 /* get my id, if not requested */
418 my_id = this->sa_config->get_my_id(this->sa_config);
419
420 /* set sa_config in ike_sa for other states */
421 this->ike_sa->set_sa_config(this->ike_sa, this->sa_config);
422
423 /* build response */
424 idr_response = id_payload_create_from_identification(FALSE, my_id);
425 response->add_payload(response, (payload_t*)idr_response);
426 *response_idr = idr_response;
427
428 return SUCCESS;
429 }
430
431 /**
432 * Implementation of private_ike_sa_init_responded_t.build_sa_payload.
433 */
434 static status_t build_sa_payload(private_ike_sa_init_responded_t *this, sa_payload_t *request, message_t *response)
435 {
436 proposal_t *proposal, *proposal_tmp;
437 linked_list_t *proposal_list;
438 sa_payload_t *sa_response;
439 chunk_t seed;
440 prf_plus_t *prf_plus;
441 status_t status;
442
443 /* get proposals from request */
444 proposal_list = request->get_proposals(request);
445 if (proposal_list->get_count(proposal_list) == 0)
446 {
447 /* if the other side did not offer any proposals, we do not create child sa's */
448 this->logger->log(this->logger, AUDIT, "IKE_AUH request did not contain any proposals. No CHILD_SA created");
449 sa_response = sa_payload_create();
450 response->add_payload(response, (payload_t*)sa_response);
451 proposal_list->destroy(proposal_list);
452 return SUCCESS;
453 }
454
455 /* now select a proposal */
456 this->logger->log(this->logger, CONTROL|LEVEL1, "Selecting proposals:");
457 proposal = this->sa_config->select_proposal(this->sa_config, proposal_list);
458 /* list is not needed anymore */
459 while (proposal_list->remove_last(proposal_list, (void**)&proposal_tmp) == SUCCESS)
460 {
461 proposal_tmp->destroy(proposal_tmp);
462 }
463 proposal_list->destroy(proposal_list);
464 /* do we have a proposal */
465 if (proposal == NULL)
466 {
467 this->logger->log(this->logger, AUDIT, "IKE_AUTH request did not contain any proposals we accept. Deleting IKE_SA");
468 this->ike_sa->send_notify(this->ike_sa, IKE_AUTH, NO_PROPOSAL_CHOSEN, CHUNK_INITIALIZER);
469 return DELETE_ME;
470 }
471
472 /* set up child sa */
473 seed = allocator_alloc_as_chunk(this->received_nonce.len + this->sent_nonce.len);
474 memcpy(seed.ptr, this->received_nonce.ptr, this->received_nonce.len);
475 memcpy(seed.ptr + this->received_nonce.len, this->sent_nonce.ptr, this->sent_nonce.len);
476 prf_plus = prf_plus_create(this->ike_sa->get_child_prf(this->ike_sa), seed);
477 allocator_free_chunk(&seed);
478
479 this->child_sa = child_sa_create(this->ike_sa->get_my_host(this->ike_sa),
480 this->ike_sa->get_other_host(this->ike_sa));
481
482 status = this->child_sa->add(this->child_sa, proposal, prf_plus);
483 prf_plus->destroy(prf_plus);
484 if (status != SUCCESS)
485 {
486 this->logger->log(this->logger, AUDIT, "Could not install CHILD_SA! Deleting IKE_SA");
487 return DELETE_ME;
488 }
489
490 /* create payload with selected propsal */
491 sa_response = sa_payload_create_from_proposal(proposal);
492 response->add_payload(response, (payload_t*)sa_response);
493 proposal->destroy(proposal);
494 return SUCCESS;
495 }
496
497 /**
498 * Implementation of private_ike_sa_init_responded_t.build_auth_payload.
499 */
500 static status_t build_auth_payload(private_ike_sa_init_responded_t *this, auth_payload_t *auth_request,id_payload_t *other_id_payload,id_payload_t *my_id_payload, message_t* response)
501 {
502 authenticator_t *authenticator;
503 auth_payload_t *auth_reply;
504 status_t status;
505
506 authenticator = authenticator_create(this->ike_sa);
507 status = authenticator->verify_auth_data(authenticator,auth_request, this->ike_sa_init_request_data,this->sent_nonce,other_id_payload,TRUE);
508
509 if (status != SUCCESS)
510 {
511 this->logger->log(this->logger, AUDIT, "IKE_AUTH request verification failed. Deleting IKE_SA");
512 this->ike_sa->send_notify(this->ike_sa, IKE_AUTH, AUTHENTICATION_FAILED, CHUNK_INITIALIZER);
513 authenticator->destroy(authenticator);
514 return DELETE_ME;
515 }
516
517 status = authenticator->compute_auth_data(authenticator,&auth_reply, this->ike_sa_init_response_data,this->received_nonce,my_id_payload,FALSE);
518 authenticator->destroy(authenticator);
519 if (status != SUCCESS)
520 {
521 this->logger->log(this->logger, AUDIT, "Unable to build authentication data for IKE_AUTH reply. Deleting IKE_SA");
522 return DELETE_ME;
523
524 }
525
526 response->add_payload(response, (payload_t *)auth_reply);
527 return SUCCESS;
528 }
529
530 /**
531 * Implementation of private_ike_sa_init_responded_t.build_ts_payload.
532 */
533 static status_t build_ts_payload(private_ike_sa_init_responded_t *this, bool ts_initiator, ts_payload_t *request, message_t* response)
534 {
535 linked_list_t *ts_received, *ts_selected;
536 traffic_selector_t *ts;
537 status_t status = SUCCESS;
538 ts_payload_t *ts_response;
539
540 /* build a reply payload with selected traffic selectors */
541 ts_received = request->get_traffic_selectors(request);
542 /* select ts depending on payload type */
543 if (ts_initiator)
544 {
545 ts_selected = this->sa_config->select_other_traffic_selectors(this->sa_config, ts_received);
546 this->other_ts = ts_selected;
547 }
548 else
549 {
550 ts_selected = this->sa_config->select_my_traffic_selectors(this->sa_config, ts_received);
551 this->my_ts = ts_selected;
552 }
553
554 ts_response = ts_payload_create_from_traffic_selectors(ts_initiator, ts_selected);
555 response->add_payload(response, (payload_t*)ts_response);
556
557 /* cleanup */
558 while (ts_received->remove_last(ts_received, (void**)&ts) == SUCCESS)
559 {
560 ts->destroy(ts);
561 }
562 ts_received->destroy(ts_received);
563
564 return status;
565 }
566
567 static status_t process_notify_payload(private_ike_sa_init_responded_t *this, notify_payload_t *notify_payload)
568 {
569 notify_message_type_t notify_message_type = notify_payload->get_notify_message_type(notify_payload);
570
571 this->logger->log(this->logger, CONTROL|LEVEL1, "Process notify type %s for protocol %s",
572 mapping_find(notify_message_type_m, notify_message_type),
573 mapping_find(protocol_id_m, notify_payload->get_protocol_id(notify_payload)));
574
575 switch (notify_message_type)
576 {
577 case SET_WINDOW_SIZE:
578 /*
579 * TODO Increase window size.
580 */
581 case INITIAL_CONTACT:
582 /*
583 * TODO Delete existing IKE_SA's with other Identity.
584 */
585 default:
586 {
587 this->logger->log(this->logger, AUDIT, "IKE_AUTH request contained an unknown notify (%d), ignored.", notify_message_type);
588 }
589 }
590
591 return SUCCESS;
592 }
593
594 /**
595 * Implementation of state_t.get_state.
596 */
597 static ike_sa_state_t get_state(private_ike_sa_init_responded_t *this)
598 {
599 return IKE_SA_INIT_RESPONDED;
600 }
601
602 /**
603 * Implementation of state_t.destroy.
604 */
605 static void destroy(private_ike_sa_init_responded_t *this)
606 {
607 allocator_free_chunk(&(this->received_nonce));
608 allocator_free_chunk(&(this->sent_nonce));
609 allocator_free_chunk(&(this->ike_sa_init_response_data));
610 allocator_free_chunk(&(this->ike_sa_init_request_data));
611 if (this->my_ts)
612 {
613 traffic_selector_t *ts;
614 while (this->my_ts->remove_last(this->my_ts, (void**)&ts) == SUCCESS)
615 {
616 ts->destroy(ts);
617 }
618 this->my_ts->destroy(this->my_ts);
619 }
620 if (this->other_ts)
621 {
622 traffic_selector_t *ts;
623 while (this->other_ts->remove_last(this->other_ts, (void**)&ts) == SUCCESS)
624 {
625 ts->destroy(ts);
626 }
627 this->other_ts->destroy(this->other_ts);
628 }
629 if (this->child_sa)
630 {
631 this->child_sa->destroy(this->child_sa);
632 }
633
634 allocator_free(this);
635 }
636 /**
637 * Implementation of private_ike_sa_init_responded.destroy_after_state_change.
638 */
639 static void destroy_after_state_change(private_ike_sa_init_responded_t *this)
640 {
641 allocator_free_chunk(&(this->received_nonce));
642 allocator_free_chunk(&(this->sent_nonce));
643 allocator_free_chunk(&(this->ike_sa_init_response_data));
644 allocator_free_chunk(&(this->ike_sa_init_request_data));
645 if (this->my_ts)
646 {
647 traffic_selector_t *ts;
648 while (this->my_ts->remove_last(this->my_ts, (void**)&ts) == SUCCESS)
649 {
650 ts->destroy(ts);
651 }
652 this->my_ts->destroy(this->my_ts);
653 }
654 if (this->other_ts)
655 {
656 traffic_selector_t *ts;
657 while (this->other_ts->remove_last(this->other_ts, (void**)&ts) == SUCCESS)
658 {
659 ts->destroy(ts);
660 }
661 this->other_ts->destroy(this->other_ts);
662 }
663
664 allocator_free(this);
665 }
666
667 /*
668 * Described in header.
669 */
670 ike_sa_init_responded_t *ike_sa_init_responded_create(protected_ike_sa_t *ike_sa, chunk_t received_nonce, chunk_t sent_nonce,chunk_t ike_sa_init_request_data, chunk_t ike_sa_init_response_data)
671 {
672 private_ike_sa_init_responded_t *this = allocator_alloc_thing(private_ike_sa_init_responded_t);
673
674 /* interface functions */
675 this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *)) process_message;
676 this->public.state_interface.get_state = (ike_sa_state_t (*) (state_t *)) get_state;
677 this->public.state_interface.destroy = (void (*) (state_t *)) destroy;
678
679 /* private functions */
680 this->build_idr_payload = build_idr_payload;
681 this->build_sa_payload = build_sa_payload;
682 this->build_auth_payload = build_auth_payload;
683 this->build_ts_payload = build_ts_payload;
684 this->process_notify_payload = process_notify_payload;
685 this->destroy_after_state_change = destroy_after_state_change;
686
687 /* private data */
688 this->ike_sa = ike_sa;
689 this->received_nonce = received_nonce;
690 this->sent_nonce = sent_nonce;
691 this->ike_sa_init_response_data = ike_sa_init_response_data;
692 this->ike_sa_init_request_data = ike_sa_init_request_data;
693 this->my_ts = NULL;
694 this->other_ts = NULL;
695 this->child_sa = NULL;
696 this->logger = this->ike_sa->get_logger(this->ike_sa);
697
698 return &(this->public);
699 }