ikev2: Consider signature schemes in rightauth when sending hash algorithms
[strongswan.git] / src / libcharon / sa / ikev2 / tasks / ike_init.c
1 /*
2 * Copyright (C) 2008-2015 Tobias Brunner
3 * Copyright (C) 2005-2008 Martin Willi
4 * Copyright (C) 2005 Jan Hutter
5 * Hochschule fuer Technik Rapperswil
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 */
17
18 #include "ike_init.h"
19
20 #include <string.h>
21
22 #include <daemon.h>
23 #include <bio/bio_reader.h>
24 #include <bio/bio_writer.h>
25 #include <sa/ikev2/keymat_v2.h>
26 #include <crypto/diffie_hellman.h>
27 #include <crypto/hashers/hash_algorithm_set.h>
28 #include <encoding/payloads/sa_payload.h>
29 #include <encoding/payloads/ke_payload.h>
30 #include <encoding/payloads/nonce_payload.h>
31
32 /** maximum retries to do with cookies/other dh groups */
33 #define MAX_RETRIES 5
34
35 typedef struct private_ike_init_t private_ike_init_t;
36
37 /**
38 * Private members of a ike_init_t task.
39 */
40 struct private_ike_init_t {
41
42 /**
43 * Public methods and task_t interface.
44 */
45 ike_init_t public;
46
47 /**
48 * Assigned IKE_SA.
49 */
50 ike_sa_t *ike_sa;
51
52 /**
53 * Are we the initiator?
54 */
55 bool initiator;
56
57 /**
58 * IKE config to establish
59 */
60 ike_cfg_t *config;
61
62 /**
63 * diffie hellman group to use
64 */
65 diffie_hellman_group_t dh_group;
66
67 /**
68 * diffie hellman key exchange
69 */
70 diffie_hellman_t *dh;
71
72 /**
73 * Keymat derivation (from IKE_SA)
74 */
75 keymat_v2_t *keymat;
76
77 /**
78 * nonce chosen by us
79 */
80 chunk_t my_nonce;
81
82 /**
83 * nonce chosen by peer
84 */
85 chunk_t other_nonce;
86
87 /**
88 * Negotiated proposal used for IKE_SA
89 */
90 proposal_t *proposal;
91
92 /**
93 * Old IKE_SA which gets rekeyed
94 */
95 ike_sa_t *old_sa;
96
97 /**
98 * cookie received from responder
99 */
100 chunk_t cookie;
101
102 /**
103 * retries done so far after failure (cookie or bad dh group)
104 */
105 u_int retry;
106
107 /**
108 * Whether to use Signature Authentication as per RFC 7427
109 */
110 bool signature_authentication;
111 };
112
113 /**
114 * Notify the peer about the hash algorithms we support or expect,
115 * as per RFC 7427
116 */
117 static void send_supported_hash_algorithms(private_ike_init_t *this,
118 message_t *message)
119 {
120 hash_algorithm_set_t *algos;
121 enumerator_t *enumerator, *rounds;
122 bio_writer_t *writer;
123 hash_algorithm_t hash;
124 peer_cfg_t *peer;
125 auth_cfg_t *auth;
126 auth_rule_t rule;
127 uintptr_t config;
128 char *plugin_name;
129
130 algos = hash_algorithm_set_create();
131 peer = this->ike_sa->get_peer_cfg(this->ike_sa);
132 if (peer)
133 {
134 rounds = peer->create_auth_cfg_enumerator(peer, FALSE);
135 while (rounds->enumerate(rounds, &auth))
136 {
137 enumerator = auth->create_enumerator(auth);
138 while (enumerator->enumerate(enumerator, &rule, &config))
139 {
140 if (rule == AUTH_RULE_SIGNATURE_SCHEME)
141 {
142 hash = hasher_from_signature_scheme(config);
143 if (hasher_algorithm_for_ikev2(hash))
144 {
145 algos->add(algos, hash);
146 }
147 }
148 }
149 enumerator->destroy(enumerator);
150 }
151 rounds->destroy(rounds);
152 }
153
154 if (!algos->count(algos))
155 {
156 enumerator = lib->crypto->create_hasher_enumerator(lib->crypto);
157 while (enumerator->enumerate(enumerator, &hash, &plugin_name))
158 {
159 if (hasher_algorithm_for_ikev2(hash))
160 {
161 algos->add(algos, hash);
162 }
163 }
164 enumerator->destroy(enumerator);
165 }
166
167 if (algos->count(algos))
168 {
169 writer = bio_writer_create(0);
170 enumerator = algos->create_enumerator(algos);
171 while (enumerator->enumerate(enumerator, &hash))
172 {
173 writer->write_uint16(writer, hash);
174 }
175 enumerator->destroy(enumerator);
176 message->add_notify(message, FALSE, SIGNATURE_HASH_ALGORITHMS,
177 writer->get_buf(writer));
178 writer->destroy(writer);
179 }
180 algos->destroy(algos);
181 }
182
183 /**
184 * Store algorithms supported by other peer
185 */
186 static void handle_supported_hash_algorithms(private_ike_init_t *this,
187 notify_payload_t *notify)
188 {
189 bio_reader_t *reader;
190 u_int16_t algo;
191 bool added = FALSE;
192
193 reader = bio_reader_create(notify->get_notification_data(notify));
194 while (reader->remaining(reader) >= 2 && reader->read_uint16(reader, &algo))
195 {
196 if (hasher_algorithm_for_ikev2(algo))
197 {
198 this->keymat->add_hash_algorithm(this->keymat, algo);
199 added = TRUE;
200 }
201 }
202 reader->destroy(reader);
203
204 if (added)
205 {
206 this->ike_sa->enable_extension(this->ike_sa, EXT_SIGNATURE_AUTH);
207 }
208 }
209
210 /**
211 * build the payloads for the message
212 */
213 static void build_payloads(private_ike_init_t *this, message_t *message)
214 {
215 sa_payload_t *sa_payload;
216 ke_payload_t *ke_payload;
217 nonce_payload_t *nonce_payload;
218 linked_list_t *proposal_list;
219 ike_sa_id_t *id;
220 proposal_t *proposal;
221 enumerator_t *enumerator;
222
223 id = this->ike_sa->get_id(this->ike_sa);
224
225 this->config = this->ike_sa->get_ike_cfg(this->ike_sa);
226
227 if (this->initiator)
228 {
229 proposal_list = this->config->get_proposals(this->config);
230 if (this->old_sa)
231 {
232 /* include SPI of new IKE_SA when we are rekeying */
233 enumerator = proposal_list->create_enumerator(proposal_list);
234 while (enumerator->enumerate(enumerator, (void**)&proposal))
235 {
236 proposal->set_spi(proposal, id->get_initiator_spi(id));
237 }
238 enumerator->destroy(enumerator);
239 }
240
241 sa_payload = sa_payload_create_from_proposals_v2(proposal_list);
242 proposal_list->destroy_offset(proposal_list, offsetof(proposal_t, destroy));
243 }
244 else
245 {
246 if (this->old_sa)
247 {
248 /* include SPI of new IKE_SA when we are rekeying */
249 this->proposal->set_spi(this->proposal, id->get_responder_spi(id));
250 }
251 sa_payload = sa_payload_create_from_proposal_v2(this->proposal);
252 }
253 message->add_payload(message, (payload_t*)sa_payload);
254
255 nonce_payload = nonce_payload_create(PLV2_NONCE);
256 nonce_payload->set_nonce(nonce_payload, this->my_nonce);
257 ke_payload = ke_payload_create_from_diffie_hellman(PLV2_KEY_EXCHANGE, this->dh);
258
259 if (this->old_sa)
260 { /* payload order differs if we are rekeying */
261 message->add_payload(message, (payload_t*)nonce_payload);
262 message->add_payload(message, (payload_t*)ke_payload);
263 }
264 else
265 {
266 message->add_payload(message, (payload_t*)ke_payload);
267 message->add_payload(message, (payload_t*)nonce_payload);
268 }
269
270 /* negotiate fragmentation if we are not rekeying */
271 if (!this->old_sa &&
272 this->config->fragmentation(this->config) != FRAGMENTATION_NO)
273 {
274 if (this->initiator ||
275 this->ike_sa->supports_extension(this->ike_sa,
276 EXT_IKE_FRAGMENTATION))
277 {
278 message->add_notify(message, FALSE, FRAGMENTATION_SUPPORTED,
279 chunk_empty);
280 }
281 }
282 /* submit supported hash algorithms for signature authentication */
283 if (!this->old_sa && this->signature_authentication)
284 {
285 if (this->initiator ||
286 this->ike_sa->supports_extension(this->ike_sa,
287 EXT_SIGNATURE_AUTH))
288 {
289 send_supported_hash_algorithms(this, message);
290 }
291 }
292 }
293
294 /**
295 * Read payloads from message
296 */
297 static void process_payloads(private_ike_init_t *this, message_t *message)
298 {
299 enumerator_t *enumerator;
300 payload_t *payload;
301 ke_payload_t *ke_payload = NULL;
302
303 enumerator = message->create_payload_enumerator(message);
304 while (enumerator->enumerate(enumerator, &payload))
305 {
306 switch (payload->get_type(payload))
307 {
308 case PLV2_SECURITY_ASSOCIATION:
309 {
310 sa_payload_t *sa_payload = (sa_payload_t*)payload;
311 linked_list_t *proposal_list;
312 bool private;
313
314 proposal_list = sa_payload->get_proposals(sa_payload);
315 private = this->ike_sa->supports_extension(this->ike_sa,
316 EXT_STRONGSWAN);
317 this->proposal = this->config->select_proposal(this->config,
318 proposal_list, private);
319 if (!this->proposal)
320 {
321 charon->bus->alert(charon->bus, ALERT_PROPOSAL_MISMATCH_IKE,
322 proposal_list);
323 }
324 proposal_list->destroy_offset(proposal_list,
325 offsetof(proposal_t, destroy));
326 break;
327 }
328 case PLV2_KEY_EXCHANGE:
329 {
330 ke_payload = (ke_payload_t*)payload;
331
332 this->dh_group = ke_payload->get_dh_group_number(ke_payload);
333 break;
334 }
335 case PLV2_NONCE:
336 {
337 nonce_payload_t *nonce_payload = (nonce_payload_t*)payload;
338
339 this->other_nonce = nonce_payload->get_nonce(nonce_payload);
340 break;
341 }
342 case PLV2_NOTIFY:
343 {
344 notify_payload_t *notify = (notify_payload_t*)payload;
345
346 switch (notify->get_notify_type(notify))
347 {
348 case FRAGMENTATION_SUPPORTED:
349 this->ike_sa->enable_extension(this->ike_sa,
350 EXT_IKE_FRAGMENTATION);
351 break;
352 case SIGNATURE_HASH_ALGORITHMS:
353 if (this->signature_authentication)
354 {
355 handle_supported_hash_algorithms(this, notify);
356 }
357 break;
358 default:
359 /* other notifies are handled elsewhere */
360 break;
361 }
362
363 }
364 default:
365 break;
366 }
367 }
368 enumerator->destroy(enumerator);
369
370 if (ke_payload && this->proposal &&
371 this->proposal->has_dh_group(this->proposal, this->dh_group))
372 {
373 if (!this->initiator)
374 {
375 this->dh = this->keymat->keymat.create_dh(
376 &this->keymat->keymat, this->dh_group);
377 }
378 if (this->dh)
379 {
380 this->dh->set_other_public_value(this->dh,
381 ke_payload->get_key_exchange_data(ke_payload));
382 }
383 }
384 }
385
386 METHOD(task_t, build_i, status_t,
387 private_ike_init_t *this, message_t *message)
388 {
389 this->config = this->ike_sa->get_ike_cfg(this->ike_sa);
390 DBG0(DBG_IKE, "initiating IKE_SA %s[%d] to %H",
391 this->ike_sa->get_name(this->ike_sa),
392 this->ike_sa->get_unique_id(this->ike_sa),
393 this->ike_sa->get_other_host(this->ike_sa));
394 this->ike_sa->set_state(this->ike_sa, IKE_CONNECTING);
395
396 if (this->retry >= MAX_RETRIES)
397 {
398 DBG1(DBG_IKE, "giving up after %d retries", MAX_RETRIES);
399 return FAILED;
400 }
401
402 /* if the DH group is set via use_dh_group(), we already have a DH object */
403 if (!this->dh)
404 {
405 this->dh_group = this->config->get_dh_group(this->config);
406 this->dh = this->keymat->keymat.create_dh(&this->keymat->keymat,
407 this->dh_group);
408 if (!this->dh)
409 {
410 DBG1(DBG_IKE, "configured DH group %N not supported",
411 diffie_hellman_group_names, this->dh_group);
412 return FAILED;
413 }
414 }
415
416 /* generate nonce only when we are trying the first time */
417 if (this->my_nonce.ptr == NULL)
418 {
419 nonce_gen_t *nonceg;
420
421 nonceg = this->keymat->keymat.create_nonce_gen(&this->keymat->keymat);
422 if (!nonceg)
423 {
424 DBG1(DBG_IKE, "no nonce generator found to create nonce");
425 return FAILED;
426 }
427 if (!nonceg->allocate_nonce(nonceg, NONCE_SIZE, &this->my_nonce))
428 {
429 DBG1(DBG_IKE, "nonce allocation failed");
430 nonceg->destroy(nonceg);
431 return FAILED;
432 }
433 nonceg->destroy(nonceg);
434 }
435
436 if (this->cookie.ptr)
437 {
438 message->add_notify(message, FALSE, COOKIE, this->cookie);
439 }
440
441 build_payloads(this, message);
442
443 #ifdef ME
444 {
445 chunk_t connect_id = this->ike_sa->get_connect_id(this->ike_sa);
446 if (connect_id.ptr)
447 {
448 message->add_notify(message, FALSE, ME_CONNECTID, connect_id);
449 }
450 }
451 #endif /* ME */
452
453 return NEED_MORE;
454 }
455
456 METHOD(task_t, process_r, status_t,
457 private_ike_init_t *this, message_t *message)
458 {
459 nonce_gen_t *nonceg;
460
461 this->config = this->ike_sa->get_ike_cfg(this->ike_sa);
462 DBG0(DBG_IKE, "%H is initiating an IKE_SA", message->get_source(message));
463 this->ike_sa->set_state(this->ike_sa, IKE_CONNECTING);
464
465 nonceg = this->keymat->keymat.create_nonce_gen(&this->keymat->keymat);
466 if (!nonceg)
467 {
468 DBG1(DBG_IKE, "no nonce generator found to create nonce");
469 return FAILED;
470 }
471 if (!nonceg->allocate_nonce(nonceg, NONCE_SIZE, &this->my_nonce))
472 {
473 DBG1(DBG_IKE, "nonce allocation failed");
474 nonceg->destroy(nonceg);
475 return FAILED;
476 }
477 nonceg->destroy(nonceg);
478
479 #ifdef ME
480 {
481 notify_payload_t *notify = message->get_notify(message, ME_CONNECTID);
482 if (notify)
483 {
484 chunk_t connect_id = notify->get_notification_data(notify);
485 DBG2(DBG_IKE, "received ME_CONNECTID %#B", &connect_id);
486 charon->connect_manager->stop_checks(charon->connect_manager,
487 connect_id);
488 }
489 }
490 #endif /* ME */
491
492 process_payloads(this, message);
493
494 return NEED_MORE;
495 }
496
497 /**
498 * Derive the keymat for the IKE_SA
499 */
500 static bool derive_keys(private_ike_init_t *this,
501 chunk_t nonce_i, chunk_t nonce_r)
502 {
503 keymat_v2_t *old_keymat;
504 pseudo_random_function_t prf_alg = PRF_UNDEFINED;
505 chunk_t skd = chunk_empty;
506 ike_sa_id_t *id;
507
508 id = this->ike_sa->get_id(this->ike_sa);
509 if (this->old_sa)
510 {
511 /* rekeying: Include old SKd, use old PRF, apply SPI */
512 old_keymat = (keymat_v2_t*)this->old_sa->get_keymat(this->old_sa);
513 prf_alg = old_keymat->get_skd(old_keymat, &skd);
514 if (this->initiator)
515 {
516 id->set_responder_spi(id, this->proposal->get_spi(this->proposal));
517 }
518 else
519 {
520 id->set_initiator_spi(id, this->proposal->get_spi(this->proposal));
521 }
522 }
523 if (!this->keymat->derive_ike_keys(this->keymat, this->proposal, this->dh,
524 nonce_i, nonce_r, id, prf_alg, skd))
525 {
526 return FALSE;
527 }
528 charon->bus->ike_keys(charon->bus, this->ike_sa, this->dh, chunk_empty,
529 nonce_i, nonce_r, this->old_sa, NULL);
530 return TRUE;
531 }
532
533 METHOD(task_t, build_r, status_t,
534 private_ike_init_t *this, message_t *message)
535 {
536 /* check if we have everything we need */
537 if (this->proposal == NULL ||
538 this->other_nonce.len == 0 || this->my_nonce.len == 0)
539 {
540 DBG1(DBG_IKE, "received proposals inacceptable");
541 message->add_notify(message, TRUE, NO_PROPOSAL_CHOSEN, chunk_empty);
542 return FAILED;
543 }
544 this->ike_sa->set_proposal(this->ike_sa, this->proposal);
545
546 if (this->dh == NULL ||
547 !this->proposal->has_dh_group(this->proposal, this->dh_group))
548 {
549 u_int16_t group;
550
551 if (this->proposal->get_algorithm(this->proposal, DIFFIE_HELLMAN_GROUP,
552 &group, NULL))
553 {
554 DBG1(DBG_IKE, "DH group %N inacceptable, requesting %N",
555 diffie_hellman_group_names, this->dh_group,
556 diffie_hellman_group_names, group);
557 this->dh_group = group;
558 group = htons(group);
559 message->add_notify(message, FALSE, INVALID_KE_PAYLOAD,
560 chunk_from_thing(group));
561 }
562 else
563 {
564 DBG1(DBG_IKE, "no acceptable proposal found");
565 }
566 return FAILED;
567 }
568
569 if (!derive_keys(this, this->other_nonce, this->my_nonce))
570 {
571 DBG1(DBG_IKE, "key derivation failed");
572 message->add_notify(message, TRUE, NO_PROPOSAL_CHOSEN, chunk_empty);
573 return FAILED;
574 }
575 build_payloads(this, message);
576 return SUCCESS;
577 }
578
579 /**
580 * Raise alerts for received notify errors
581 */
582 static void raise_alerts(private_ike_init_t *this, notify_type_t type)
583 {
584 linked_list_t *list;
585
586 switch (type)
587 {
588 case NO_PROPOSAL_CHOSEN:
589 list = this->config->get_proposals(this->config);
590 charon->bus->alert(charon->bus, ALERT_PROPOSAL_MISMATCH_IKE, list);
591 list->destroy_offset(list, offsetof(proposal_t, destroy));
592 break;
593 default:
594 break;
595 }
596 }
597
598 METHOD(task_t, process_i, status_t,
599 private_ike_init_t *this, message_t *message)
600 {
601 enumerator_t *enumerator;
602 payload_t *payload;
603
604 /* check for erroneous notifies */
605 enumerator = message->create_payload_enumerator(message);
606 while (enumerator->enumerate(enumerator, &payload))
607 {
608 if (payload->get_type(payload) == PLV2_NOTIFY)
609 {
610 notify_payload_t *notify = (notify_payload_t*)payload;
611 notify_type_t type = notify->get_notify_type(notify);
612
613 switch (type)
614 {
615 case INVALID_KE_PAYLOAD:
616 {
617 chunk_t data;
618 diffie_hellman_group_t bad_group;
619
620 bad_group = this->dh_group;
621 data = notify->get_notification_data(notify);
622 this->dh_group = ntohs(*((u_int16_t*)data.ptr));
623 DBG1(DBG_IKE, "peer didn't accept DH group %N, "
624 "it requested %N", diffie_hellman_group_names,
625 bad_group, diffie_hellman_group_names, this->dh_group);
626
627 if (this->old_sa == NULL)
628 { /* reset the IKE_SA if we are not rekeying */
629 this->ike_sa->reset(this->ike_sa);
630 }
631
632 enumerator->destroy(enumerator);
633 this->retry++;
634 return NEED_MORE;
635 }
636 case NAT_DETECTION_SOURCE_IP:
637 case NAT_DETECTION_DESTINATION_IP:
638 /* skip, handled in ike_natd_t */
639 break;
640 case MULTIPLE_AUTH_SUPPORTED:
641 /* handled in ike_auth_t */
642 break;
643 case COOKIE:
644 {
645 chunk_free(&this->cookie);
646 this->cookie = chunk_clone(notify->get_notification_data(notify));
647 this->ike_sa->reset(this->ike_sa);
648 enumerator->destroy(enumerator);
649 DBG2(DBG_IKE, "received %N notify", notify_type_names, type);
650 this->retry++;
651 return NEED_MORE;
652 }
653 default:
654 {
655 if (type <= 16383)
656 {
657 DBG1(DBG_IKE, "received %N notify error",
658 notify_type_names, type);
659 enumerator->destroy(enumerator);
660 raise_alerts(this, type);
661 return FAILED;
662 }
663 DBG2(DBG_IKE, "received %N notify",
664 notify_type_names, type);
665 break;
666 }
667 }
668 }
669 }
670 enumerator->destroy(enumerator);
671
672 process_payloads(this, message);
673
674 /* check if we have everything */
675 if (this->proposal == NULL ||
676 this->other_nonce.len == 0 || this->my_nonce.len == 0)
677 {
678 DBG1(DBG_IKE, "peers proposal selection invalid");
679 return FAILED;
680 }
681 this->ike_sa->set_proposal(this->ike_sa, this->proposal);
682
683 if (this->dh == NULL ||
684 !this->proposal->has_dh_group(this->proposal, this->dh_group))
685 {
686 DBG1(DBG_IKE, "peer DH group selection invalid");
687 return FAILED;
688 }
689
690 if (!derive_keys(this, this->my_nonce, this->other_nonce))
691 {
692 DBG1(DBG_IKE, "key derivation failed");
693 return FAILED;
694 }
695 return SUCCESS;
696 }
697
698 METHOD(task_t, get_type, task_type_t,
699 private_ike_init_t *this)
700 {
701 return TASK_IKE_INIT;
702 }
703
704 METHOD(task_t, migrate, void,
705 private_ike_init_t *this, ike_sa_t *ike_sa)
706 {
707 DESTROY_IF(this->proposal);
708 chunk_free(&this->other_nonce);
709
710 this->ike_sa = ike_sa;
711 this->keymat = (keymat_v2_t*)ike_sa->get_keymat(ike_sa);
712 this->proposal = NULL;
713 if (this->dh && this->dh->get_dh_group(this->dh) != this->dh_group)
714 { /* reset DH value only if group changed (INVALID_KE_PAYLOAD) */
715 this->dh->destroy(this->dh);
716 this->dh = this->keymat->keymat.create_dh(&this->keymat->keymat,
717 this->dh_group);
718 }
719 }
720
721 METHOD(task_t, destroy, void,
722 private_ike_init_t *this)
723 {
724 DESTROY_IF(this->dh);
725 DESTROY_IF(this->proposal);
726 chunk_free(&this->my_nonce);
727 chunk_free(&this->other_nonce);
728 chunk_free(&this->cookie);
729 free(this);
730 }
731
732 METHOD(ike_init_t, get_lower_nonce, chunk_t,
733 private_ike_init_t *this)
734 {
735 if (memcmp(this->my_nonce.ptr, this->other_nonce.ptr,
736 min(this->my_nonce.len, this->other_nonce.len)) < 0)
737 {
738 return this->my_nonce;
739 }
740 else
741 {
742 return this->other_nonce;
743 }
744 }
745
746 /*
747 * Described in header.
748 */
749 ike_init_t *ike_init_create(ike_sa_t *ike_sa, bool initiator, ike_sa_t *old_sa)
750 {
751 private_ike_init_t *this;
752
753 INIT(this,
754 .public = {
755 .task = {
756 .get_type = _get_type,
757 .migrate = _migrate,
758 .destroy = _destroy,
759 },
760 .get_lower_nonce = _get_lower_nonce,
761 },
762 .ike_sa = ike_sa,
763 .initiator = initiator,
764 .dh_group = MODP_NONE,
765 .keymat = (keymat_v2_t*)ike_sa->get_keymat(ike_sa),
766 .old_sa = old_sa,
767 .signature_authentication = lib->settings->get_bool(lib->settings,
768 "%s.signature_authentication", TRUE, lib->ns),
769 );
770
771 if (initiator)
772 {
773 this->public.task.build = _build_i;
774 this->public.task.process = _process_i;
775 }
776 else
777 {
778 this->public.task.build = _build_r;
779 this->public.task.process = _process_r;
780 }
781
782 return &this->public;
783 }