Add a return value to prf_t.allocate_bytes()
[strongswan.git] / src / libcharon / sa / ikev2 / keymat_v2.c
1 /*
2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #include "keymat_v2.h"
17
18 #include <daemon.h>
19 #include <crypto/prf_plus.h>
20
21 typedef struct private_keymat_v2_t private_keymat_v2_t;
22
23 /**
24 * Private data of an keymat_t object.
25 */
26 struct private_keymat_v2_t {
27
28 /**
29 * Public keymat_v2_t interface.
30 */
31 keymat_v2_t public;
32
33 /**
34 * IKE_SA Role, initiator or responder
35 */
36 bool initiator;
37
38 /**
39 * inbound AEAD
40 */
41 aead_t *aead_in;
42
43 /**
44 * outbound AEAD
45 */
46 aead_t *aead_out;
47
48 /**
49 * General purpose PRF
50 */
51 prf_t *prf;
52
53 /**
54 * Negotiated PRF algorithm
55 */
56 pseudo_random_function_t prf_alg;
57
58 /**
59 * Key to derive key material from for CHILD_SAs, rekeying
60 */
61 chunk_t skd;
62
63 /**
64 * Key to build outging authentication data (SKp)
65 */
66 chunk_t skp_build;
67
68 /**
69 * Key to verify incoming authentication data (SKp)
70 */
71 chunk_t skp_verify;
72 };
73
74 METHOD(keymat_t, get_version, ike_version_t,
75 private_keymat_v2_t *this)
76 {
77 return IKEV2;
78 }
79
80 METHOD(keymat_t, create_dh, diffie_hellman_t*,
81 private_keymat_v2_t *this, diffie_hellman_group_t group)
82 {
83 return lib->crypto->create_dh(lib->crypto, group);
84 }
85
86 METHOD(keymat_t, create_nonce_gen, nonce_gen_t*,
87 private_keymat_v2_t *this)
88 {
89 return lib->crypto->create_nonce_gen(lib->crypto);
90 }
91
92 /**
93 * Derive IKE keys for a combined AEAD algorithm
94 */
95 static bool derive_ike_aead(private_keymat_v2_t *this, u_int16_t alg,
96 u_int16_t key_size, prf_plus_t *prf_plus)
97 {
98 aead_t *aead_i, *aead_r;
99 chunk_t key;
100
101 /* SK_ei/SK_er used for encryption */
102 aead_i = lib->crypto->create_aead(lib->crypto, alg, key_size / 8);
103 aead_r = lib->crypto->create_aead(lib->crypto, alg, key_size / 8);
104 if (aead_i == NULL || aead_r == NULL)
105 {
106 DBG1(DBG_IKE, "%N %N (key size %d) not supported!",
107 transform_type_names, ENCRYPTION_ALGORITHM,
108 encryption_algorithm_names, alg, key_size);
109 return FALSE;
110 }
111 key_size = aead_i->get_key_size(aead_i);
112
113 if (!prf_plus->allocate_bytes(prf_plus, key_size, &key))
114 {
115 return FALSE;
116 }
117 DBG4(DBG_IKE, "Sk_ei secret %B", &key);
118 if (!aead_i->set_key(aead_i, key))
119 {
120 chunk_clear(&key);
121 return FALSE;
122 }
123 chunk_clear(&key);
124
125 if (!prf_plus->allocate_bytes(prf_plus, key_size, &key))
126 {
127 return FALSE;
128 }
129 DBG4(DBG_IKE, "Sk_er secret %B", &key);
130 if (!aead_r->set_key(aead_r, key))
131 {
132 chunk_clear(&key);
133 return FALSE;
134 }
135 chunk_clear(&key);
136
137 if (this->initiator)
138 {
139 this->aead_in = aead_r;
140 this->aead_out = aead_i;
141 }
142 else
143 {
144 this->aead_in = aead_i;
145 this->aead_out = aead_r;
146 }
147 return TRUE;
148 }
149
150 /**
151 * Derive IKE keys for traditional encryption and MAC algorithms
152 */
153 static bool derive_ike_traditional(private_keymat_v2_t *this, u_int16_t enc_alg,
154 u_int16_t enc_size, u_int16_t int_alg, prf_plus_t *prf_plus)
155 {
156 crypter_t *crypter_i, *crypter_r;
157 signer_t *signer_i, *signer_r;
158 size_t key_size;
159 chunk_t key;
160
161 /* SK_ai/SK_ar used for integrity protection */
162 signer_i = lib->crypto->create_signer(lib->crypto, int_alg);
163 signer_r = lib->crypto->create_signer(lib->crypto, int_alg);
164 if (signer_i == NULL || signer_r == NULL)
165 {
166 DBG1(DBG_IKE, "%N %N not supported!",
167 transform_type_names, INTEGRITY_ALGORITHM,
168 integrity_algorithm_names, int_alg);
169 return FALSE;
170 }
171 key_size = signer_i->get_key_size(signer_i);
172
173 if (!prf_plus->allocate_bytes(prf_plus, key_size, &key))
174 {
175 signer_i->destroy(signer_i);
176 signer_r->destroy(signer_r);
177 return FALSE;
178 }
179 DBG4(DBG_IKE, "Sk_ai secret %B", &key);
180 if (!signer_i->set_key(signer_i, key))
181 {
182 signer_i->destroy(signer_i);
183 signer_r->destroy(signer_r);
184 chunk_clear(&key);
185 return FALSE;
186 }
187 chunk_clear(&key);
188
189 if (!prf_plus->allocate_bytes(prf_plus, key_size, &key))
190 {
191 signer_i->destroy(signer_i);
192 signer_r->destroy(signer_r);
193 return FALSE;
194 }
195 DBG4(DBG_IKE, "Sk_ar secret %B", &key);
196 if (!signer_r->set_key(signer_r, key))
197 {
198 signer_i->destroy(signer_i);
199 signer_r->destroy(signer_r);
200 chunk_clear(&key);
201 return FALSE;
202 }
203 chunk_clear(&key);
204
205 /* SK_ei/SK_er used for encryption */
206 crypter_i = lib->crypto->create_crypter(lib->crypto, enc_alg, enc_size / 8);
207 crypter_r = lib->crypto->create_crypter(lib->crypto, enc_alg, enc_size / 8);
208 if (crypter_i == NULL || crypter_r == NULL)
209 {
210 DBG1(DBG_IKE, "%N %N (key size %d) not supported!",
211 transform_type_names, ENCRYPTION_ALGORITHM,
212 encryption_algorithm_names, enc_alg, enc_size);
213 signer_i->destroy(signer_i);
214 signer_r->destroy(signer_r);
215 return FALSE;
216 }
217 key_size = crypter_i->get_key_size(crypter_i);
218
219 if (!prf_plus->allocate_bytes(prf_plus, key_size, &key))
220 {
221 crypter_i->destroy(crypter_i);
222 crypter_r->destroy(crypter_r);
223 signer_i->destroy(signer_i);
224 signer_r->destroy(signer_r);
225 return FALSE;
226 }
227 DBG4(DBG_IKE, "Sk_ei secret %B", &key);
228 crypter_i->set_key(crypter_i, key);
229 chunk_clear(&key);
230
231 if (!prf_plus->allocate_bytes(prf_plus, key_size, &key))
232 {
233 crypter_i->destroy(crypter_i);
234 crypter_r->destroy(crypter_r);
235 signer_i->destroy(signer_i);
236 signer_r->destroy(signer_r);
237 return FALSE;
238 }
239 DBG4(DBG_IKE, "Sk_er secret %B", &key);
240 crypter_r->set_key(crypter_r, key);
241 chunk_clear(&key);
242
243 if (this->initiator)
244 {
245 this->aead_in = aead_create(crypter_r, signer_r);
246 this->aead_out = aead_create(crypter_i, signer_i);
247 }
248 else
249 {
250 this->aead_in = aead_create(crypter_i, signer_i);
251 this->aead_out = aead_create(crypter_r, signer_r);
252 }
253 return TRUE;
254 }
255
256 METHOD(keymat_v2_t, derive_ike_keys, bool,
257 private_keymat_v2_t *this, proposal_t *proposal, diffie_hellman_t *dh,
258 chunk_t nonce_i, chunk_t nonce_r, ike_sa_id_t *id,
259 pseudo_random_function_t rekey_function, chunk_t rekey_skd)
260 {
261 chunk_t skeyseed, key, secret, full_nonce, fixed_nonce, prf_plus_seed;
262 chunk_t spi_i, spi_r;
263 prf_plus_t *prf_plus = NULL;
264 u_int16_t alg, key_size, int_alg;
265 prf_t *rekey_prf = NULL;
266
267 spi_i = chunk_alloca(sizeof(u_int64_t));
268 spi_r = chunk_alloca(sizeof(u_int64_t));
269
270 if (dh->get_shared_secret(dh, &secret) != SUCCESS)
271 {
272 return FALSE;
273 }
274
275 /* Create SAs general purpose PRF first, we may use it here */
276 if (!proposal->get_algorithm(proposal, PSEUDO_RANDOM_FUNCTION, &alg, NULL))
277 {
278 DBG1(DBG_IKE, "no %N selected",
279 transform_type_names, PSEUDO_RANDOM_FUNCTION);
280 return FALSE;
281 }
282 this->prf_alg = alg;
283 this->prf = lib->crypto->create_prf(lib->crypto, alg);
284 if (this->prf == NULL)
285 {
286 DBG1(DBG_IKE, "%N %N not supported!",
287 transform_type_names, PSEUDO_RANDOM_FUNCTION,
288 pseudo_random_function_names, alg);
289 return FALSE;
290 }
291 DBG4(DBG_IKE, "shared Diffie Hellman secret %B", &secret);
292 /* full nonce is used as seed for PRF+ ... */
293 full_nonce = chunk_cat("cc", nonce_i, nonce_r);
294 /* but the PRF may need a fixed key which only uses the first bytes of
295 * the nonces. */
296 switch (alg)
297 {
298 case PRF_AES128_XCBC:
299 /* while rfc4434 defines variable keys for AES-XCBC, rfc3664 does
300 * not and therefore fixed key semantics apply to XCBC for key
301 * derivation. */
302 case PRF_CAMELLIA128_XCBC:
303 /* draft-kanno-ipsecme-camellia-xcbc refers to rfc 4434, we
304 * assume fixed key length. */
305 key_size = this->prf->get_key_size(this->prf)/2;
306 nonce_i.len = min(nonce_i.len, key_size);
307 nonce_r.len = min(nonce_r.len, key_size);
308 break;
309 default:
310 /* all other algorithms use variable key length, full nonce */
311 break;
312 }
313 fixed_nonce = chunk_cat("cc", nonce_i, nonce_r);
314 *((u_int64_t*)spi_i.ptr) = id->get_initiator_spi(id);
315 *((u_int64_t*)spi_r.ptr) = id->get_responder_spi(id);
316 prf_plus_seed = chunk_cat("ccc", full_nonce, spi_i, spi_r);
317
318 /* KEYMAT = prf+ (SKEYSEED, Ni | Nr | SPIi | SPIr)
319 *
320 * if we are rekeying, SKEYSEED is built on another way
321 */
322 if (rekey_function == PRF_UNDEFINED) /* not rekeying */
323 {
324 /* SKEYSEED = prf(Ni | Nr, g^ir) */
325 this->prf->set_key(this->prf, fixed_nonce);
326 if (this->prf->allocate_bytes(this->prf, secret, &skeyseed))
327 {
328 this->prf->set_key(this->prf, skeyseed);
329 prf_plus = prf_plus_create(this->prf, TRUE, prf_plus_seed);
330 }
331 }
332 else
333 {
334 /* SKEYSEED = prf(SK_d (old), [g^ir (new)] | Ni | Nr)
335 * use OLD SAs PRF functions for both prf_plus and prf */
336 rekey_prf = lib->crypto->create_prf(lib->crypto, rekey_function);
337 if (!rekey_prf)
338 {
339 DBG1(DBG_IKE, "PRF of old SA %N not supported!",
340 pseudo_random_function_names, rekey_function);
341 chunk_free(&full_nonce);
342 chunk_free(&fixed_nonce);
343 chunk_clear(&prf_plus_seed);
344 return FALSE;
345 }
346 secret = chunk_cat("mc", secret, full_nonce);
347 rekey_prf->set_key(rekey_prf, rekey_skd);
348 if (rekey_prf->allocate_bytes(rekey_prf, secret, &skeyseed))
349 {
350 rekey_prf->set_key(rekey_prf, skeyseed);
351 prf_plus = prf_plus_create(rekey_prf, TRUE, prf_plus_seed);
352 }
353 }
354 DBG4(DBG_IKE, "SKEYSEED %B", &skeyseed);
355
356 chunk_clear(&skeyseed);
357 chunk_clear(&secret);
358 chunk_free(&full_nonce);
359 chunk_free(&fixed_nonce);
360 chunk_clear(&prf_plus_seed);
361
362 if (!prf_plus)
363 {
364 DESTROY_IF(rekey_prf);
365 return FALSE;
366 }
367
368 /* KEYMAT = SK_d | SK_ai | SK_ar | SK_ei | SK_er | SK_pi | SK_pr */
369
370 /* SK_d is used for generating CHILD_SA key mat => store for later use */
371 key_size = this->prf->get_key_size(this->prf);
372 if (!prf_plus->allocate_bytes(prf_plus, key_size, &this->skd))
373 {
374 prf_plus->destroy(prf_plus);
375 DESTROY_IF(rekey_prf);
376 return FALSE;
377 }
378 DBG4(DBG_IKE, "Sk_d secret %B", &this->skd);
379
380 if (!proposal->get_algorithm(proposal, ENCRYPTION_ALGORITHM, &alg, &key_size))
381 {
382 DBG1(DBG_IKE, "no %N selected",
383 transform_type_names, ENCRYPTION_ALGORITHM);
384 prf_plus->destroy(prf_plus);
385 DESTROY_IF(rekey_prf);
386 return FALSE;
387 }
388
389 if (encryption_algorithm_is_aead(alg))
390 {
391 if (!derive_ike_aead(this, alg, key_size, prf_plus))
392 {
393 prf_plus->destroy(prf_plus);
394 DESTROY_IF(rekey_prf);
395 return FALSE;
396 }
397 }
398 else
399 {
400 if (!proposal->get_algorithm(proposal, INTEGRITY_ALGORITHM,
401 &int_alg, NULL))
402 {
403 DBG1(DBG_IKE, "no %N selected",
404 transform_type_names, INTEGRITY_ALGORITHM);
405 prf_plus->destroy(prf_plus);
406 DESTROY_IF(rekey_prf);
407 return FALSE;
408 }
409 if (!derive_ike_traditional(this, alg, key_size, int_alg, prf_plus))
410 {
411 prf_plus->destroy(prf_plus);
412 DESTROY_IF(rekey_prf);
413 return FALSE;
414 }
415 }
416
417 /* SK_pi/SK_pr used for authentication => stored for later */
418 key_size = this->prf->get_key_size(this->prf);
419 if (!prf_plus->allocate_bytes(prf_plus, key_size, &key))
420 {
421 prf_plus->destroy(prf_plus);
422 DESTROY_IF(rekey_prf);
423 return FALSE;
424 }
425 DBG4(DBG_IKE, "Sk_pi secret %B", &key);
426 if (this->initiator)
427 {
428 this->skp_build = key;
429 }
430 else
431 {
432 this->skp_verify = key;
433 }
434 if (!prf_plus->allocate_bytes(prf_plus, key_size, &key))
435 {
436 prf_plus->destroy(prf_plus);
437 DESTROY_IF(rekey_prf);
438 return FALSE;
439 }
440 DBG4(DBG_IKE, "Sk_pr secret %B", &key);
441 if (this->initiator)
442 {
443 this->skp_verify = key;
444 }
445 else
446 {
447 this->skp_build = key;
448 }
449
450 /* all done, prf_plus not needed anymore */
451 prf_plus->destroy(prf_plus);
452 DESTROY_IF(rekey_prf);
453
454 return TRUE;
455 }
456
457 METHOD(keymat_v2_t, derive_child_keys, bool,
458 private_keymat_v2_t *this, proposal_t *proposal, diffie_hellman_t *dh,
459 chunk_t nonce_i, chunk_t nonce_r, chunk_t *encr_i, chunk_t *integ_i,
460 chunk_t *encr_r, chunk_t *integ_r)
461 {
462 u_int16_t enc_alg, int_alg, enc_size = 0, int_size = 0;
463 chunk_t seed, secret = chunk_empty;
464 prf_plus_t *prf_plus;
465
466 if (dh)
467 {
468 if (dh->get_shared_secret(dh, &secret) != SUCCESS)
469 {
470 return FALSE;
471 }
472 DBG4(DBG_CHD, "DH secret %B", &secret);
473 }
474 seed = chunk_cata("mcc", secret, nonce_i, nonce_r);
475 DBG4(DBG_CHD, "seed %B", &seed);
476
477 if (proposal->get_algorithm(proposal, ENCRYPTION_ALGORITHM,
478 &enc_alg, &enc_size))
479 {
480 DBG2(DBG_CHD, " using %N for encryption",
481 encryption_algorithm_names, enc_alg);
482
483 if (!enc_size)
484 {
485 enc_size = keymat_get_keylen_encr(enc_alg);
486 }
487 if (enc_alg != ENCR_NULL && !enc_size)
488 {
489 DBG1(DBG_CHD, "no keylength defined for %N",
490 encryption_algorithm_names, enc_alg);
491 return FALSE;
492 }
493 /* to bytes */
494 enc_size /= 8;
495
496 /* CCM/GCM/CTR/GMAC needs additional bytes */
497 switch (enc_alg)
498 {
499 case ENCR_AES_CCM_ICV8:
500 case ENCR_AES_CCM_ICV12:
501 case ENCR_AES_CCM_ICV16:
502 case ENCR_CAMELLIA_CCM_ICV8:
503 case ENCR_CAMELLIA_CCM_ICV12:
504 case ENCR_CAMELLIA_CCM_ICV16:
505 enc_size += 3;
506 break;
507 case ENCR_AES_GCM_ICV8:
508 case ENCR_AES_GCM_ICV12:
509 case ENCR_AES_GCM_ICV16:
510 case ENCR_AES_CTR:
511 case ENCR_NULL_AUTH_AES_GMAC:
512 enc_size += 4;
513 break;
514 default:
515 break;
516 }
517 }
518
519 if (proposal->get_algorithm(proposal, INTEGRITY_ALGORITHM,
520 &int_alg, &int_size))
521 {
522 DBG2(DBG_CHD, " using %N for integrity",
523 integrity_algorithm_names, int_alg);
524
525 if (!int_size)
526 {
527 int_size = keymat_get_keylen_integ(int_alg);
528 }
529 if (!int_size)
530 {
531 DBG1(DBG_CHD, "no keylength defined for %N",
532 integrity_algorithm_names, int_alg);
533 return FALSE;
534 }
535 /* to bytes */
536 int_size /= 8;
537 }
538
539 this->prf->set_key(this->prf, this->skd);
540 prf_plus = prf_plus_create(this->prf, TRUE, seed);
541 if (!prf_plus)
542 {
543 return FALSE;
544 }
545
546 if (!prf_plus->allocate_bytes(prf_plus, enc_size, encr_i) ||
547 !prf_plus->allocate_bytes(prf_plus, int_size, integ_i) ||
548 !prf_plus->allocate_bytes(prf_plus, enc_size, encr_r) ||
549 !prf_plus->allocate_bytes(prf_plus, int_size, integ_r))
550 {
551 prf_plus->destroy(prf_plus);
552 return FALSE;
553 }
554
555 prf_plus->destroy(prf_plus);
556
557 if (enc_size)
558 {
559 DBG4(DBG_CHD, "encryption initiator key %B", encr_i);
560 DBG4(DBG_CHD, "encryption responder key %B", encr_r);
561 }
562 if (int_size)
563 {
564 DBG4(DBG_CHD, "integrity initiator key %B", integ_i);
565 DBG4(DBG_CHD, "integrity responder key %B", integ_r);
566 }
567 return TRUE;
568 }
569
570 METHOD(keymat_v2_t, get_skd, pseudo_random_function_t,
571 private_keymat_v2_t *this, chunk_t *skd)
572 {
573 *skd = this->skd;
574 return this->prf_alg;
575 }
576
577 METHOD(keymat_t, get_aead, aead_t*,
578 private_keymat_v2_t *this, bool in)
579 {
580 return in ? this->aead_in : this->aead_out;
581 }
582
583 METHOD(keymat_v2_t, get_auth_octets, bool,
584 private_keymat_v2_t *this, bool verify, chunk_t ike_sa_init,
585 chunk_t nonce, identification_t *id, char reserved[3], chunk_t *octets)
586 {
587 chunk_t chunk, idx;
588 chunk_t skp;
589
590 skp = verify ? this->skp_verify : this->skp_build;
591
592 chunk = chunk_alloca(4);
593 chunk.ptr[0] = id->get_type(id);
594 memcpy(chunk.ptr + 1, reserved, 3);
595 idx = chunk_cata("cc", chunk, id->get_encoding(id));
596
597 DBG3(DBG_IKE, "IDx' %B", &idx);
598 DBG3(DBG_IKE, "SK_p %B", &skp);
599 this->prf->set_key(this->prf, skp);
600 if (!this->prf->allocate_bytes(this->prf, idx, &chunk))
601 {
602 return FALSE;
603 }
604 *octets = chunk_cat("ccm", ike_sa_init, nonce, chunk);
605 DBG3(DBG_IKE, "octets = message + nonce + prf(Sk_px, IDx') %B", octets);
606 return TRUE;
607 }
608
609 /**
610 * Key pad for the AUTH method SHARED_KEY_MESSAGE_INTEGRITY_CODE.
611 */
612 #define IKEV2_KEY_PAD "Key Pad for IKEv2"
613 #define IKEV2_KEY_PAD_LENGTH 17
614
615 METHOD(keymat_v2_t, get_psk_sig, bool,
616 private_keymat_v2_t *this, bool verify, chunk_t ike_sa_init, chunk_t nonce,
617 chunk_t secret, identification_t *id, char reserved[3], chunk_t *sig)
618 {
619 chunk_t key_pad, key, octets;
620
621 if (!secret.len)
622 { /* EAP uses SK_p if no MSK has been established */
623 secret = verify ? this->skp_verify : this->skp_build;
624 }
625 if (!get_auth_octets(this, verify, ike_sa_init, nonce, id, reserved, &octets))
626 {
627 return FALSE;
628 }
629 /* AUTH = prf(prf(Shared Secret,"Key Pad for IKEv2"), <msg octets>) */
630 key_pad = chunk_create(IKEV2_KEY_PAD, IKEV2_KEY_PAD_LENGTH);
631 this->prf->set_key(this->prf, secret);
632 if (!this->prf->allocate_bytes(this->prf, key_pad, &key))
633 {
634 chunk_free(&octets);
635 return FALSE;
636 }
637 this->prf->set_key(this->prf, key);
638 if (!this->prf->allocate_bytes(this->prf, octets, sig))
639 {
640 chunk_free(&key);
641 chunk_free(&octets);
642 return FALSE;
643 }
644 DBG4(DBG_IKE, "secret %B", &secret);
645 DBG4(DBG_IKE, "prf(secret, keypad) %B", &key);
646 DBG3(DBG_IKE, "AUTH = prf(prf(secret, keypad), octets) %B", sig);
647 chunk_free(&octets);
648 chunk_free(&key);
649
650 return TRUE;
651 }
652
653 METHOD(keymat_t, destroy, void,
654 private_keymat_v2_t *this)
655 {
656 DESTROY_IF(this->aead_in);
657 DESTROY_IF(this->aead_out);
658 DESTROY_IF(this->prf);
659 chunk_clear(&this->skd);
660 chunk_clear(&this->skp_verify);
661 chunk_clear(&this->skp_build);
662 free(this);
663 }
664
665 /**
666 * See header
667 */
668 keymat_v2_t *keymat_v2_create(bool initiator)
669 {
670 private_keymat_v2_t *this;
671
672 INIT(this,
673 .public = {
674 .keymat = {
675 .get_version = _get_version,
676 .create_dh = _create_dh,
677 .create_nonce_gen = _create_nonce_gen,
678 .get_aead = _get_aead,
679 .destroy = _destroy,
680 },
681 .derive_ike_keys = _derive_ike_keys,
682 .derive_child_keys = _derive_child_keys,
683 .get_skd = _get_skd,
684 .get_auth_octets = _get_auth_octets,
685 .get_psk_sig = _get_psk_sig,
686 },
687 .initiator = initiator,
688 .prf_alg = PRF_UNDEFINED,
689 );
690
691 return &this->public;
692 }