2 * @file create_child_sa.c
4 * @brief Implementation of create_child_sa_t transaction.
9 * Copyright (C) 2006 Martin Willi
10 * Hochschule fuer Technik Rapperswil
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>.
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
23 #include "create_child_sa.h"
28 #include <encoding/payloads/sa_payload.h>
29 #include <encoding/payloads/nonce_payload.h>
30 #include <encoding/payloads/ts_payload.h>
31 #include <sa/transactions/delete_child_sa.h>
32 #include <utils/randomizer.h>
35 typedef struct private_create_child_sa_t private_create_child_sa_t
;
38 * Private members of a create_child_sa_t object..
40 struct private_create_child_sa_t
{
43 * Public methods and transaction_t interface.
45 create_child_sa_t
public;
53 * Message sent by our peer, if already generated
58 * Message ID this transaction uses
63 * Times we did send the request
68 * initiators inbound SPI of the CHILD_SA which gets rekeyed
73 * connection of IKE_SA
75 connection_t
*connection
;
78 * policy definition used
83 * Negotiated proposal used for CHILD_SA
88 * initiator chosen nonce
93 * responder chosen nonce
98 * lower of the nonces of a simultaneus rekeying request
103 * Negotiated traffic selectors for initiator
108 * Negotiated traffic selectors for responder
113 * CHILD_SA created by this transaction
115 child_sa_t
*child_sa
;
118 * CHILD_SA rekeyed if we are rekeying
120 child_sa_t
*rekeyed_sa
;
123 * Have we lost the simultaneous rekeying nonce compare?
128 * source of randomness
130 randomizer_t
*randomizer
;
139 * Implementation of transaction_t.get_message_id.
141 static u_int32_t
get_message_id(private_create_child_sa_t
*this)
143 return this->message_id
;
147 * Implementation of transaction_t.requested.
149 static u_int32_t
requested(private_create_child_sa_t
*this)
151 return this->requested
++;
155 * Implementation of create_child_sa_t.rekeys_child.
157 static void rekeys_child(private_create_child_sa_t
*this, child_sa_t
*child_sa
)
159 this->rekeyed_sa
= child_sa
;
163 * Implementation of create_child_sa_t.cancel.
165 static void cancel(private_create_child_sa_t
*this)
167 this->rekeyed_sa
= NULL
;
172 * Implementation of transaction_t.get_request.
174 static status_t
get_request(private_create_child_sa_t
*this, message_t
**result
)
179 /* check if we are not already rekeying */
180 if (this->rekeyed_sa
)
182 switch (this->rekeyed_sa
->get_state(this->rekeyed_sa
))
185 this->logger
->log(this->logger
, ERROR
,
186 "rekeying a CHILD_SA which is already rekeying, aborted");
189 this->logger
->log(this->logger
, ERROR
,
190 "rekeying a CHILD_SA which is deleting, aborted");
195 this->rekeyed_sa
->set_state(this->rekeyed_sa
, CHILD_REKEYING
);
198 /* check if we already have built a message (retransmission) */
201 *result
= this->message
;
205 this->connection
= this->ike_sa
->get_connection(this->ike_sa
);
206 me
= this->connection
->get_my_host(this->connection
);
207 other
= this->connection
->get_other_host(this->connection
);
208 this->policy
= this->ike_sa
->get_policy(this->ike_sa
);
210 /* build the request */
211 request
= message_create();
212 request
->set_source(request
, me
->clone(me
));
213 request
->set_destination(request
, other
->clone(other
));
214 request
->set_exchange_type(request
, CREATE_CHILD_SA
);
215 request
->set_request(request
, TRUE
);
216 request
->set_ike_sa_id(request
, this->ike_sa
->get_id(this->ike_sa
));
218 this->message
= request
;
220 { /* build SA payload */
221 sa_payload_t
*sa_payload
;
222 linked_list_t
*proposals
;
226 if (this->rekeyed_sa
)
228 reqid
= this->rekeyed_sa
->get_reqid(this->rekeyed_sa
);
231 proposals
= this->policy
->get_proposals(this->policy
);
232 use_natt
= this->ike_sa
->is_natt_enabled(this->ike_sa
);
233 this->child_sa
= child_sa_create(reqid
, me
, other
,
234 this->policy
->get_soft_lifetime(this->policy
),
235 this->policy
->get_hard_lifetime(this->policy
),
237 if (this->child_sa
->alloc(this->child_sa
, proposals
) != SUCCESS
)
239 this->logger
->log(this->logger
, ERROR
,
240 "could not install CHILD_SA, CHILD_SA creation aborted");
243 sa_payload
= sa_payload_create_from_proposal_list(proposals
);
244 request
->add_payload(request
, (payload_t
*)sa_payload
);
247 { /* build the NONCE payload for us (initiator) */
248 nonce_payload_t
*nonce_payload
;
250 if (this->randomizer
->allocate_pseudo_random_bytes(this->randomizer
,
251 NONCE_SIZE
, &this->nonce_i
) != SUCCESS
)
255 nonce_payload
= nonce_payload_create();
256 nonce_payload
->set_nonce(nonce_payload
, this->nonce_i
);
257 request
->add_payload(request
, (payload_t
*)nonce_payload
);
260 { /* build TSi payload */
261 linked_list_t
*ts_list
;
262 ts_payload_t
*ts_payload
;
264 ts_list
= this->policy
->get_my_traffic_selectors(this->policy
);
265 ts_payload
= ts_payload_create_from_traffic_selectors(TRUE
, ts_list
);
266 request
->add_payload(request
, (payload_t
*)ts_payload
);
269 { /* build TSr payload */
270 linked_list_t
*ts_list
;
271 ts_payload_t
*ts_payload
;
273 ts_list
= this->policy
->get_other_traffic_selectors(this->policy
);
274 ts_payload
= ts_payload_create_from_traffic_selectors(FALSE
, ts_list
);
275 request
->add_payload(request
, (payload_t
*)ts_payload
);
278 if (this->rekeyed_sa
)
279 { /* add REKEY_SA notify if we are rekeying */
280 notify_payload_t
*notify
;
281 protocol_id_t protocol
;
283 protocol
= this->rekeyed_sa
->get_protocol(this->rekeyed_sa
);
284 notify
= notify_payload_create_from_protocol_and_type(protocol
, REKEY_SA
);
285 notify
->set_spi(notify
, this->rekeyed_sa
->get_spi(this->rekeyed_sa
, TRUE
));
286 request
->add_payload(request
, (payload_t
*)notify
);
288 /* register us as rekeying to detect multiple rekeying */
289 this->rekeyed_sa
->set_rekeying_transaction(this->rekeyed_sa
, &this->public);
292 this->message_id
= this->ike_sa
->get_next_message_id(this->ike_sa
);
293 request
->set_message_id(request
, this->message_id
);
299 * Handle all kind of notifys
301 static status_t
process_notifys(private_create_child_sa_t
*this, notify_payload_t
*notify_payload
)
303 notify_type_t notify_type
= notify_payload
->get_notify_type(notify_payload
);
305 this->logger
->log(this->logger
, CONTROL
|LEVEL1
, "process notify type %s",
306 mapping_find(notify_type_m
, notify_type
));
310 case SINGLE_PAIR_REQUIRED
:
312 this->logger
->log(this->logger
, AUDIT
,
313 "received a SINGLE_PAIR_REQUIRED notify");
316 case TS_UNACCEPTABLE
:
318 this->logger
->log(this->logger
, CONTROL
,
319 "received TS_UNACCEPTABLE notify");
322 case NO_PROPOSAL_CHOSEN
:
324 this->logger
->log(this->logger
, CONTROL
,
325 "received NO_PROPOSAL_CHOSEN notify");
331 protocol_id_t protocol
;
333 protocol
= notify_payload
->get_protocol_id(notify_payload
);
338 spi
= notify_payload
->get_spi(notify_payload
);
339 this->rekeyed_sa
= this->ike_sa
->get_child_sa(this->ike_sa
,
350 if (notify_type
< 16383)
352 this->logger
->log(this->logger
, AUDIT
,
353 "received %s notify error (%d), deleting IKE_SA",
354 mapping_find(notify_type_m
, notify_type
),
360 this->logger
->log(this->logger
, CONTROL
,
361 "received %s notify (%d), ignored",
362 mapping_find(notify_type_m
, notify_type
),
371 * Build a notify message.
373 static void build_notify(notify_type_t type
, message_t
*message
, bool flush_message
)
375 notify_payload_t
*notify
;
380 iterator_t
*iterator
= message
->get_payload_iterator(message
);
381 while (iterator
->iterate(iterator
, (void**)&payload
))
383 payload
->destroy(payload
);
384 iterator
->remove(iterator
);
386 iterator
->destroy(iterator
);
389 notify
= notify_payload_create();
390 notify
->set_notify_type(notify
, type
);
391 message
->add_payload(message
, (payload_t
*)notify
);
395 * Install a CHILD_SA for usage
397 static status_t
install_child_sa(private_create_child_sa_t
*this, bool initiator
)
399 prf_plus_t
*prf_plus
;
403 seed
= chunk_alloc(this->nonce_i
.len
+ this->nonce_r
.len
);
404 memcpy(seed
.ptr
, this->nonce_i
.ptr
, this->nonce_i
.len
);
405 memcpy(seed
.ptr
+ this->nonce_i
.len
, this->nonce_r
.ptr
, this->nonce_r
.len
);
406 prf_plus
= prf_plus_create(this->ike_sa
->get_child_prf(this->ike_sa
), seed
);
411 status
= this->child_sa
->update(this->child_sa
, this->proposal
, prf_plus
);
415 status
= this->child_sa
->add(this->child_sa
, this->proposal
, prf_plus
);
417 prf_plus
->destroy(prf_plus
);
418 if (status
!= SUCCESS
)
424 status
= this->child_sa
->add_policies(this->child_sa
, this->tsi
, this->tsr
);
428 status
= this->child_sa
->add_policies(this->child_sa
, this->tsr
, this->tsi
);
430 if (status
!= SUCCESS
)
434 /* add to IKE_SA, and remove from transaction */
435 this->ike_sa
->add_child_sa(this->ike_sa
, this->child_sa
);
436 this->child_sa
= NULL
;
441 * destroy a list of traffic selectors
443 static void destroy_ts_list(linked_list_t
*list
)
447 traffic_selector_t
*ts
;
448 while (list
->remove_last(list
, (void**)&ts
) == SUCCESS
)
457 * Implementation of transaction_t.get_response.
459 static status_t
get_response(private_create_child_sa_t
*this, message_t
*request
,
460 message_t
**result
, transaction_t
**next
)
465 iterator_t
*payloads
;
466 sa_payload_t
*sa_request
= NULL
;
467 nonce_payload_t
*nonce_request
= NULL
;
468 ts_payload_t
*tsi_request
= NULL
;
469 ts_payload_t
*tsr_request
= NULL
;
470 nonce_payload_t
*nonce_response
;
472 /* check if we already have built a response (retransmission) */
475 *result
= this->message
;
479 this->connection
= this->ike_sa
->get_connection(this->ike_sa
);
480 me
= this->connection
->get_my_host(this->connection
);
481 other
= this->connection
->get_other_host(this->connection
);
482 this->policy
= this->ike_sa
->get_policy(this->ike_sa
);
483 this->message_id
= request
->get_message_id(request
);
485 /* set up response */
486 response
= message_create();
487 response
->set_source(response
, me
->clone(me
));
488 response
->set_destination(response
, other
->clone(other
));
489 response
->set_exchange_type(response
, CREATE_CHILD_SA
);
490 response
->set_request(response
, FALSE
);
491 response
->set_message_id(response
, this->message_id
);
492 response
->set_ike_sa_id(response
, this->ike_sa
->get_id(this->ike_sa
));
493 this->message
= response
;
496 /* check message type */
497 if (request
->get_exchange_type(request
) != CREATE_CHILD_SA
)
499 this->logger
->log(this->logger
, ERROR
,
500 "CREATE_CHILD_SA response of invalid type, aborted");
504 /* Iterate over all payloads. */
505 payloads
= request
->get_payload_iterator(request
);
506 while (payloads
->has_next(payloads
))
509 payloads
->current(payloads
, (void**)&payload
);
510 switch (payload
->get_type(payload
))
512 case SECURITY_ASSOCIATION
:
513 sa_request
= (sa_payload_t
*)payload
;
516 nonce_request
= (nonce_payload_t
*)payload
;
518 case TRAFFIC_SELECTOR_INITIATOR
:
519 tsi_request
= (ts_payload_t
*)payload
;
521 case TRAFFIC_SELECTOR_RESPONDER
:
522 tsr_request
= (ts_payload_t
*)payload
;
526 status
= process_notifys(this, (notify_payload_t
*)payload
);
527 if (status
!= SUCCESS
)
529 payloads
->destroy(payloads
);
536 this->logger
->log(this->logger
, ERROR
, "ignoring %s payload (%d)",
537 mapping_find(payload_type_m
, payload
->get_type(payload
)),
538 payload
->get_type(payload
));
543 payloads
->destroy(payloads
);
545 /* check if we have all payloads */
546 if (!(sa_request
&& nonce_request
&& tsi_request
&& tsr_request
))
548 build_notify(INVALID_SYNTAX
, response
, TRUE
);
549 this->logger
->log(this->logger
, AUDIT
,
550 "request message incomplete, no CHILD_SA created");
554 { /* process nonce payload */
555 this->nonce_i
= nonce_request
->get_nonce(nonce_request
);
556 if (this->randomizer
->allocate_pseudo_random_bytes(this->randomizer
,
557 NONCE_SIZE
, &this->nonce_r
) != SUCCESS
)
559 build_notify(NO_PROPOSAL_CHOSEN
, response
, TRUE
);
562 nonce_response
= nonce_payload_create();
563 nonce_response
->set_nonce(nonce_response
, this->nonce_r
);
566 { /* process traffic selectors for other */
567 linked_list_t
*ts_received
= tsi_request
->get_traffic_selectors(tsi_request
);
568 this->tsi
= this->policy
->select_other_traffic_selectors(this->policy
, ts_received
);
569 destroy_ts_list(ts_received
);
572 { /* process traffic selectors for us */
573 linked_list_t
*ts_received
= ts_received
= tsr_request
->get_traffic_selectors(tsr_request
);
574 this->tsr
= this->policy
->select_my_traffic_selectors(this->policy
, ts_received
);
575 destroy_ts_list(ts_received
);
578 { /* process SA payload */
579 proposal_t
*proposal
;
580 linked_list_t
*proposal_list
;
581 sa_payload_t
*sa_response
;
582 ts_payload_t
*ts_response
;
584 u_int32_t soft_lifetime
, hard_lifetime
;
586 sa_response
= sa_payload_create();
587 /* get proposals from request, and select one with ours */
588 proposal_list
= sa_request
->get_proposals(sa_request
);
589 this->logger
->log(this->logger
, CONTROL
|LEVEL1
, "selecting proposals:");
590 this->proposal
= this->policy
->select_proposal(this->policy
, proposal_list
);
591 /* list is not needed anymore */
592 while (proposal_list
->remove_last(proposal_list
, (void**)&proposal
) == SUCCESS
)
594 proposal
->destroy(proposal
);
596 proposal_list
->destroy(proposal_list
);
598 /* do we have a proposal? */
599 if (this->proposal
== NULL
)
601 this->logger
->log(this->logger
, AUDIT
,
602 "CHILD_SA proposals unacceptable, adding NO_PROPOSAL_CHOSEN notify");
603 build_notify(NO_PROPOSAL_CHOSEN
, response
, TRUE
);
606 /* do we have traffic selectors? */
607 else if (this->tsi
->get_count(this->tsi
) == 0 || this->tsr
->get_count(this->tsr
) == 0)
609 this->logger
->log(this->logger
, AUDIT
,
610 "CHILD_SA traffic selectors unacceptable, adding TS_UNACCEPTABLE notify");
611 build_notify(TS_UNACCEPTABLE
, response
, TRUE
);
615 { /* create child sa */
618 if (this->rekeyed_sa
)
620 reqid
= this->rekeyed_sa
->get_reqid(this->rekeyed_sa
);
622 soft_lifetime
= this->policy
->get_soft_lifetime(this->policy
);
623 hard_lifetime
= this->policy
->get_hard_lifetime(this->policy
);
624 use_natt
= this->ike_sa
->is_natt_enabled(this->ike_sa
);
625 this->child_sa
= child_sa_create(reqid
, me
, other
,
626 soft_lifetime
, hard_lifetime
,
628 if (install_child_sa(this, FALSE
) != SUCCESS
)
630 this->logger
->log(this->logger
, ERROR
,
631 "installing CHILD_SA failed, adding NO_PROPOSAL_CHOSEN notify");
632 build_notify(NO_PROPOSAL_CHOSEN
, response
, TRUE
);
635 /* add proposal to sa payload */
636 sa_response
->add_proposal(sa_response
, this->proposal
);
638 response
->add_payload(response
, (payload_t
*)sa_response
);
640 /* add nonce/ts payload after sa payload */
641 response
->add_payload(response
, (payload_t
*)nonce_response
);
642 ts_response
= ts_payload_create_from_traffic_selectors(TRUE
, this->tsi
);
643 response
->add_payload(response
, (payload_t
*)ts_response
);
644 ts_response
= ts_payload_create_from_traffic_selectors(FALSE
, this->tsr
);
645 response
->add_payload(response
, (payload_t
*)ts_response
);
647 /* CHILD_SA successfully created. If another transaction is already rekeying
648 * this SA, our lower nonce must be registered for a later nonce compare. */
649 if (this->rekeyed_sa
)
651 private_create_child_sa_t
*other
;
653 other
= this->rekeyed_sa
->get_rekeying_transaction(this->rekeyed_sa
);
656 /* store our lower nonce in the simultaneus transaction, it
657 * will later compare it against his nonces when it calls conclude().
659 if (memcmp(this->nonce_i
.ptr
, this->nonce_r
.ptr
,
660 min(this->nonce_i
.len
, this->nonce_r
.len
)) < 0)
662 other
->nonce_s
= chunk_clone(this->nonce_i
);
666 other
->nonce_s
= chunk_clone(this->nonce_r
);
669 this->rekeyed_sa
->set_state(this->rekeyed_sa
, CHILD_REKEYING
);
675 * Implementation of transaction_t.conclude
677 static status_t
conclude(private_create_child_sa_t
*this, message_t
*response
,
678 transaction_t
**next
)
680 iterator_t
*payloads
;
682 sa_payload_t
*sa_payload
= NULL
;
683 nonce_payload_t
*nonce_payload
= NULL
;
684 ts_payload_t
*tsi_payload
= NULL
;
685 ts_payload_t
*tsr_payload
= NULL
;
687 child_sa_t
*new_child
= NULL
;
688 delete_child_sa_t
*delete_child_sa
;
690 /* check message type */
691 if (response
->get_exchange_type(response
) != CREATE_CHILD_SA
)
693 this->logger
->log(this->logger
, ERROR
,
694 "CREATE_CHILD_SA response of invalid type, aborting");
698 me
= this->connection
->get_my_host(this->connection
);
699 other
= this->connection
->get_other_host(this->connection
);
701 /* Iterate over all payloads to collect them */
702 payloads
= response
->get_payload_iterator(response
);
703 while (payloads
->has_next(payloads
))
706 payloads
->current(payloads
, (void**)&payload
);
707 switch (payload
->get_type(payload
))
709 case SECURITY_ASSOCIATION
:
710 sa_payload
= (sa_payload_t
*)payload
;
713 nonce_payload
= (nonce_payload_t
*)payload
;
715 case TRAFFIC_SELECTOR_INITIATOR
:
716 tsi_payload
= (ts_payload_t
*)payload
;
718 case TRAFFIC_SELECTOR_RESPONDER
:
719 tsr_payload
= (ts_payload_t
*)payload
;
723 status
= process_notifys(this, (notify_payload_t
*)payload
);
724 if (status
!= SUCCESS
)
726 payloads
->destroy(payloads
);
733 this->logger
->log(this->logger
, ERROR
, "ignoring %s payload (%d)",
734 mapping_find(payload_type_m
, payload
->get_type(payload
)),
735 payload
->get_type(payload
));
740 payloads
->destroy(payloads
);
742 if (!(sa_payload
&& nonce_payload
&& tsi_payload
&& tsr_payload
))
744 this->logger
->log(this->logger
, AUDIT
, "response message incomplete, no CHILD_SA built");
748 { /* process NONCE payload */
749 this->nonce_r
= nonce_payload
->get_nonce(nonce_payload
);
752 { /* process traffic selectors for us */
753 linked_list_t
*ts_received
= tsi_payload
->get_traffic_selectors(tsi_payload
);
754 this->tsi
= this->policy
->select_my_traffic_selectors(this->policy
, ts_received
);
755 destroy_ts_list(ts_received
);
758 { /* process traffic selectors for other */
759 linked_list_t
*ts_received
= tsr_payload
->get_traffic_selectors(tsr_payload
);
760 this->tsr
= this->policy
->select_other_traffic_selectors(this->policy
, ts_received
);
761 destroy_ts_list(ts_received
);
764 { /* process sa payload */
765 proposal_t
*proposal
;
766 linked_list_t
*proposal_list
;
768 proposal_list
= sa_payload
->get_proposals(sa_payload
);
769 /* we have to re-check here if other's selection is valid */
770 this->proposal
= this->policy
->select_proposal(this->policy
, proposal_list
);
771 /* list not needed anymore */
772 while (proposal_list
->remove_last(proposal_list
, (void**)&proposal
) == SUCCESS
)
774 proposal
->destroy(proposal
);
776 proposal_list
->destroy(proposal_list
);
778 /* everything fine to create CHILD? */
779 if (this->proposal
== NULL
||
780 this->tsi
->get_count(this->tsi
) == 0 ||
781 this->tsr
->get_count(this->tsr
) == 0)
783 this->logger
->log(this->logger
, AUDIT
,
784 "CHILD_SA creation failed");
787 new_child
= this->child_sa
;
788 if (install_child_sa(this, TRUE
) != SUCCESS
)
790 this->logger
->log(this->logger
, ERROR
,
791 "installing CHILD_SA failed, no CHILD_SA built");
795 /* CHILD_SA successfully created. If the other peer initiated rekeying
796 * in the meantime, we detect this by comparing the rekeying_transaction
797 * of the SA. If it changed, we are not alone. Then we must compare the nonces.
798 * If no simultaneous rekeying is going on, we just initiate the delete of
799 * the superseded SA. */
800 if (this->rekeyed_sa
)
802 /* rekeying finished, update SA status */
803 this->rekeyed_sa
->set_rekeying_transaction(this->rekeyed_sa
, NULL
);
805 if (this->nonce_s
.ptr
)
806 { /* simlutaneous rekeying is going on, not so good */
809 /* first get our lowest nonce */
810 if (memcmp(this->nonce_i
.ptr
, this->nonce_r
.ptr
,
811 min(this->nonce_i
.len
, this->nonce_r
.len
)) < 0)
813 this_lowest
= this->nonce_i
;
817 this_lowest
= this->nonce_r
;
819 /* then compare against other lowest nonce */
820 if (memcmp(this_lowest
.ptr
, this->nonce_s
.ptr
,
821 min(this_lowest
.len
, this->nonce_s
.len
)) < 0)
823 this->logger
->log(this->logger
, ERROR
,
824 "detected simultaneous CHILD_SA rekeying, deleting ours");
829 this->logger
->log(this->logger
, ERROR
,
830 "detected simultaneous CHILD_SA rekeying, but ours is preferred");
833 /* delete the old SA if we have won the rekeying nonce compare*/
836 delete_child_sa
= delete_child_sa_create(this->ike_sa
);
837 delete_child_sa
->set_child_sa(delete_child_sa
, this->rekeyed_sa
);
838 *next
= (transaction_t
*)delete_child_sa
;
843 /* we have lost simlutaneous rekeying, delete the CHILD_SA we just have created */
844 delete_child_sa
= delete_child_sa_create(this->ike_sa
);
845 delete_child_sa
->set_child_sa(delete_child_sa
, new_child
);
846 *next
= (transaction_t
*)delete_child_sa
;
852 * implements transaction_t.destroy
854 static void destroy(private_create_child_sa_t
*this)
858 this->message
->destroy(this->message
);
862 this->proposal
->destroy(this->proposal
);
866 this->child_sa
->destroy(this->child_sa
);
868 destroy_ts_list(this->tsi
);
869 destroy_ts_list(this->tsr
);
870 chunk_free(&this->nonce_i
);
871 chunk_free(&this->nonce_r
);
872 chunk_free(&this->nonce_s
);
873 this->randomizer
->destroy(this->randomizer
);
878 * Described in header.
880 create_child_sa_t
*create_child_sa_create(ike_sa_t
*ike_sa
)
882 private_create_child_sa_t
*this = malloc_thing(private_create_child_sa_t
);
884 /* transaction interface functions */
885 this->public.transaction
.get_request
= (status_t(*)(transaction_t
*,message_t
**))get_request
;
886 this->public.transaction
.get_response
= (status_t(*)(transaction_t
*,message_t
*,message_t
**,transaction_t
**))get_response
;
887 this->public.transaction
.conclude
= (status_t(*)(transaction_t
*,message_t
*,transaction_t
**))conclude
;
888 this->public.transaction
.get_message_id
= (u_int32_t(*)(transaction_t
*))get_message_id
;
889 this->public.transaction
.requested
= (u_int32_t(*)(transaction_t
*))requested
;
890 this->public.transaction
.destroy
= (void(*)(transaction_t
*))destroy
;
892 /* public functions */
893 this->public.rekeys_child
= (void(*)(create_child_sa_t
*,child_sa_t
*))rekeys_child
;
894 this->public.cancel
= (void(*)(create_child_sa_t
*))cancel
;
897 this->ike_sa
= ike_sa
;
898 this->message_id
= 0;
899 this->message
= NULL
;
902 this->nonce_i
= CHUNK_INITIALIZER
;
903 this->nonce_r
= CHUNK_INITIALIZER
;
904 this->nonce_s
= CHUNK_INITIALIZER
;
905 this->child_sa
= NULL
;
906 this->rekeyed_sa
= NULL
;
908 this->proposal
= NULL
;
911 this->randomizer
= randomizer_create();
912 this->logger
= logger_manager
->get_logger(logger_manager
, IKE_SA
);
914 return &this->public;