ike.h
Go to the documentation of this file.
1 /**
2  * @file ike.h
3  * @brief IKEv2 (Internet Key Exchange Protocol)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2022-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneIPSEC Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _IKE_H
32 #define _IKE_H
33 
34 //Dependencies
35 #include "ipsec/ipsec.h"
38 #include "pkix/x509_common.h"
39 
40 //IKEv2 support
41 #ifndef IKE_SUPPORT
42  #define IKE_SUPPORT ENABLED
43 #elif (IKE_SUPPORT != ENABLED && IKE_SUPPORT != DISABLED)
44  #error IKE_SUPPORT parameter is not valid
45 #endif
46 
47 //Stack size required to run the IKE service
48 #ifndef IKE_STACK_SIZE
49  #define IKE_STACK_SIZE 650
50 #elif (IKE_STACK_SIZE < 1)
51  #error IKE_STACK_SIZE parameter is not valid
52 #endif
53 
54 //Priority at which the IKE service should run
55 #ifndef IKE_PRIORITY
56  #define IKE_PRIORITY OS_TASK_PRIORITY_NORMAL
57 #endif
58 
59 //IKE tick interval
60 #ifndef IKE_TICK_INTERVAL
61  #define IKE_TICK_INTERVAL 500
62 #elif (IKE_TICK_INTERVAL < 100)
63  #error IKE_TICK_INTERVAL parameter is not valid
64 #endif
65 
66 //Default lifetime for IKE SAs
67 #ifndef IKE_DEFAULT_SA_LIFETIME
68  #define IKE_DEFAULT_SA_LIFETIME 14400000
69 #elif (IKE_DEFAULT_SA_LIFETIME < 1000)
70  #error IKE_DEFAULT_SA_LIFETIME parameter is not valid
71 #endif
72 
73 //Default lifetime for Child SAs
74 #ifndef IKE_DEFAULT_CHILD_SA_LIFETIME
75  #define IKE_DEFAULT_CHILD_SA_LIFETIME 3600000
76 #elif (IKE_DEFAULT_CHILD_SA_LIFETIME < 1000)
77  #error IKE_DEFAULT_CHILD_SA_LIFETIME parameter is not valid
78 #endif
79 
80 //Certificate authentication
81 #ifndef IKE_CERT_AUTH_SUPPORT
82  #define IKE_CERT_AUTH_SUPPORT ENABLED
83 #elif (IKE_CERT_AUTH_SUPPORT != ENABLED && IKE_CERT_AUTH_SUPPORT != DISABLED)
84  #error IKE_CERT_AUTH_SUPPORT parameter is not valid
85 #endif
86 
87 //Pre-shared key authentication
88 #ifndef IKE_PSK_AUTH_SUPPORT
89  #define IKE_PSK_AUTH_SUPPORT ENABLED
90 #elif (IKE_PSK_AUTH_SUPPORT != ENABLED && IKE_PSK_AUTH_SUPPORT != DISABLED)
91  #error IKE_PSK_AUTH_SUPPORT parameter is not valid
92 #endif
93 
94 //Cookie support
95 #ifndef IKE_COOKIE_SUPPORT
96  #define IKE_COOKIE_SUPPORT DISABLED
97 #elif (IKE_COOKIE_SUPPORT != ENABLED && IKE_COOKIE_SUPPORT != DISABLED)
98  #error IKE_COOKIE_SUPPORT parameter is not valid
99 #endif
100 
101 //INITIAL_CONTACT notification support
102 #ifndef IKE_INITIAL_CONTACT_SUPPORT
103  #define IKE_INITIAL_CONTACT_SUPPORT ENABLED
104 #elif (IKE_INITIAL_CONTACT_SUPPORT != ENABLED && IKE_INITIAL_CONTACT_SUPPORT != DISABLED)
105  #error IKE_INITIAL_CONTACT_SUPPORT parameter is not valid
106 #endif
107 
108 //SIGNATURE_HASH_ALGORITHMS notification support
109 #ifndef IKE_SIGN_HASH_ALGOS_SUPPORT
110  #define IKE_SIGN_HASH_ALGOS_SUPPORT ENABLED
111 #elif (IKE_SIGN_HASH_ALGOS_SUPPORT != ENABLED && IKE_SIGN_HASH_ALGOS_SUPPORT != DISABLED)
112  #error IKE_SIGN_HASH_ALGOS_SUPPORT parameter is not valid
113 #endif
114 
115 //CREATE_CHILD_SA support
116 #ifndef IKE_CREATE_CHILD_SA_SUPPORT
117  #define IKE_CREATE_CHILD_SA_SUPPORT ENABLED
118 #elif (IKE_CREATE_CHILD_SA_SUPPORT != ENABLED && IKE_CREATE_CHILD_SA_SUPPORT != DISABLED)
119  #error IKE_CREATE_CHILD_SA_SUPPORT parameter is not valid
120 #endif
121 
122 //Dead peer detection support
123 #ifndef IKE_DPD_SUPPORT
124  #define IKE_DPD_SUPPORT ENABLED
125 #elif (IKE_DPD_SUPPORT != ENABLED && IKE_DPD_SUPPORT != DISABLED)
126  #error IKE_DPD_SUPPORT parameter is not valid
127 #endif
128 
129 //Maximum number of retransmissions of IKE requests
130 #ifndef IKE_MAX_RETRIES
131  #define IKE_MAX_RETRIES 5
132 #elif (IKE_MAX_RETRIES < 1)
133  #error IKE_MAX_RETRIES parameter is not valid
134 #endif
135 
136 //Initial retransmission timeout
137 #ifndef IKE_INIT_TIMEOUT
138  #define IKE_INIT_TIMEOUT 3000
139 #elif (IKE_INIT_TIMEOUT < 1000)
140  #error IKE_INIT_TIMEOUT parameter is not valid
141 #endif
142 
143 //Maximum retransmission timeout
144 #ifndef IKE_MAX_TIMEOUT
145  #define IKE_MAX_TIMEOUT 60000
146 #elif (IKE_MAX_TIMEOUT < 1000)
147  #error IKE_MAX_TIMEOUT parameter is not valid
148 #endif
149 
150 //Timeout for half-open IKE SAs
151 #ifndef IKE_HALF_OPEN_TIMEOUT
152  #define IKE_HALF_OPEN_TIMEOUT 30000
153 #elif (IKE_HALF_OPEN_TIMEOUT < 1000)
154  #error IKE_HALF_OPEN_TIMEOUT parameter is not valid
155 #endif
156 
157 //Maximum jitter in percent applied randomly to calculated timeouts
158 #ifndef IKE_RANDOM_JITTER
159  #define IKE_RANDOM_JITTER 10
160 #elif (IKE_RANDOM_JITTER < 0 || IKE_RANDOM_JITTER > 100)
161  #error IKE_RANDOM_JITTER parameter is not valid
162 #endif
163 
164 //Maximum size of IKE messages
165 #ifndef IKE_MAX_MSG_SIZE
166  #define IKE_MAX_MSG_SIZE 1452
167 #elif (IKE_MAX_MSG_SIZE < 1280)
168  #error IKE_MAX_MSG_SIZE parameter is not valid
169 #endif
170 
171 //Minimum size for cookies
172 #ifndef IKE_MIN_COOKIE_SIZE
173  #define IKE_MIN_COOKIE_SIZE 1
174 #elif (IKE_MIN_COOKIE_SIZE < 1)
175  #error IKE_MIN_COOKIE_SIZE parameter is not valid
176 #endif
177 
178 //Maximum size for cookies
179 #ifndef IKE_MAX_COOKIE_SIZE
180  #define IKE_MAX_COOKIE_SIZE 64
181 #elif (IKE_MAX_COOKIE_SIZE < 64)
182  #error IKE_MAX_COOKIE_SIZE parameter is not valid
183 #endif
184 
185 //Minimum size for nonce
186 #ifndef IKE_MIN_NONCE_SIZE
187  #define IKE_MIN_NONCE_SIZE 16
188 #elif (IKE_MIN_NONCE_SIZE < 16 || IKE_MIN_NONCE_SIZE > 256)
189  #error IKE_MIN_NONCE_SIZE parameter is not valid
190 #endif
191 
192 //Default size for nonce
193 #ifndef IKE_DEFAULT_NONCE_SIZE
194  #define IKE_DEFAULT_NONCE_SIZE 32
195 #elif (IKE_DEFAULT_NONCE_SIZE < 16 || IKE_DEFAULT_NONCE_SIZE > 256)
196  #error IKE_DEFAULT_NONCE_SIZE parameter is not valid
197 #endif
198 
199 //Maximum size for nonce
200 #ifndef IKE_MAX_NONCE_SIZE
201  #define IKE_MAX_NONCE_SIZE 64
202 #elif (IKE_MAX_NONCE_SIZE < 16 || IKE_MAX_NONCE_SIZE > 256)
203  #error IKE_MAX_NONCE_SIZE parameter is not valid
204 #endif
205 
206 //Maximum length of ID
207 #ifndef IKE_MAX_ID_LEN
208  #define IKE_MAX_ID_LEN 64
209 #elif (IKE_MAX_ID_LEN < 0)
210  #error IKE_MAX_ID_LEN is not valid
211 #endif
212 
213 //Maximum length of pre-shared keys
214 #ifndef IKE_MAX_PSK_LEN
215  #define IKE_MAX_PSK_LEN 64
216 #elif (IKE_MAX_PSK_LEN < 0)
217  #error IKE_MAX_PSK_LEN is not valid
218 #endif
219 
220 //Maximum length of password
221 #ifndef IKE_MAX_PASSWORD_LEN
222  #define IKE_MAX_PASSWORD_LEN 32
223 #elif (IKE_MAX_PASSWORD_LEN < 0)
224  #error IKE_MAX_PASSWORD_LEN parameter is not valid
225 #endif
226 
227 //CBC cipher mode support
228 #ifndef IKE_CBC_SUPPORT
229  #define IKE_CBC_SUPPORT ENABLED
230 #elif (IKE_CBC_SUPPORT != ENABLED && IKE_CBC_SUPPORT != DISABLED)
231  #error IKE_CBC_SUPPORT parameter is not valid
232 #endif
233 
234 //CTR cipher mode support
235 #ifndef IKE_CTR_SUPPORT
236  #define IKE_CTR_SUPPORT DISABLED
237 #elif (IKE_CTR_SUPPORT != ENABLED && IKE_CTR_SUPPORT != DISABLED)
238  #error IKE_CTR_SUPPORT parameter is not valid
239 #endif
240 
241 //CCM_8 AEAD support
242 #ifndef IKE_CCM_8_SUPPORT
243  #define IKE_CCM_8_SUPPORT DISABLED
244 #elif (IKE_CCM_8_SUPPORT != ENABLED && IKE_CCM_8_SUPPORT != DISABLED)
245  #error IKE_CCM_8_SUPPORT parameter is not valid
246 #endif
247 
248 //CCM_12 AEAD support
249 #ifndef IKE_CCM_12_SUPPORT
250  #define IKE_CCM_12_SUPPORT DISABLED
251 #elif (IKE_CCM_12_SUPPORT != ENABLED && IKE_CCM_12_SUPPORT != DISABLED)
252  #error IKE_CCM_12_SUPPORT parameter is not valid
253 #endif
254 
255 //CCM_16 AEAD support
256 #ifndef IKE_CCM_16_SUPPORT
257  #define IKE_CCM_16_SUPPORT DISABLED
258 #elif (IKE_CCM_16_SUPPORT != ENABLED && IKE_CCM_16_SUPPORT != DISABLED)
259  #error IKE_CCM_16_SUPPORT parameter is not valid
260 #endif
261 
262 //GCM_8 AEAD support
263 #ifndef IKE_GCM_8_SUPPORT
264  #define IKE_GCM_8_SUPPORT DISABLED
265 #elif (IKE_GCM_8_SUPPORT != ENABLED && IKE_GCM_8_SUPPORT != DISABLED)
266  #error IKE_GCM_8_SUPPORT parameter is not valid
267 #endif
268 
269 //GCM_12 AEAD support
270 #ifndef IKE_GCM_12_SUPPORT
271  #define IKE_GCM_12_SUPPORT DISABLED
272 #elif (IKE_GCM_12_SUPPORT != ENABLED && IKE_GCM_12_SUPPORT != DISABLED)
273  #error IKE_GCM_12_SUPPORT parameter is not valid
274 #endif
275 
276 //GCM_16 AEAD support
277 #ifndef IKE_GCM_16_SUPPORT
278  #define IKE_GCM_16_SUPPORT ENABLED
279 #elif (IKE_GCM_16_SUPPORT != ENABLED && IKE_GCM_16_SUPPORT != DISABLED)
280  #error IKE_GCM_16_SUPPORT parameter is not valid
281 #endif
282 
283 //ChaCha20Poly1305 AEAD support
284 #ifndef IKE_CHACHA20_POLY1305_SUPPORT
285  #define IKE_CHACHA20_POLY1305_SUPPORT ENABLED
286 #elif (IKE_CHACHA20_POLY1305_SUPPORT != ENABLED && IKE_CHACHA20_POLY1305_SUPPORT != DISABLED)
287  #error IKE_CHACHA20_POLY1305_SUPPORT parameter is not valid
288 #endif
289 
290 //CMAC integrity support
291 #ifndef IKE_CMAC_AUTH_SUPPORT
292  #define IKE_CMAC_AUTH_SUPPORT DISABLED
293 #elif (IKE_CMAC_AUTH_SUPPORT != ENABLED && IKE_CMAC_AUTH_SUPPORT != DISABLED)
294  #error IKE_CMAC_AUTH_SUPPORT parameter is not valid
295 #endif
296 
297 //HMAC integrity support
298 #ifndef IKE_HMAC_AUTH_SUPPORT
299  #define IKE_HMAC_AUTH_SUPPORT ENABLED
300 #elif (IKE_HMAC_AUTH_SUPPORT != ENABLED && IKE_HMAC_AUTH_SUPPORT != DISABLED)
301  #error IKE_HMAC_AUTH_SUPPORT parameter is not valid
302 #endif
303 
304 //XCBC-MAC integrity support
305 #ifndef IKE_XCBC_MAC_AUTH_SUPPORT
306  #define IKE_XCBC_MAC_AUTH_SUPPORT DISABLED
307 #elif (IKE_XCBC_MAC_AUTH_SUPPORT != ENABLED && IKE_XCBC_MAC_AUTH_SUPPORT != DISABLED)
308  #error IKE_XCBC_MAC_AUTH_SUPPORT parameter is not valid
309 #endif
310 
311 //CMAC PRF support
312 #ifndef IKE_CMAC_PRF_SUPPORT
313  #define IKE_CMAC_PRF_SUPPORT DISABLED
314 #elif (IKE_CMAC_PRF_SUPPORT != ENABLED && IKE_CMAC_PRF_SUPPORT != DISABLED)
315  #error IKE_CMAC_PRF_SUPPORT parameter is not valid
316 #endif
317 
318 //HMAC PRF support
319 #ifndef IKE_HMAC_PRF_SUPPORT
320  #define IKE_HMAC_PRF_SUPPORT ENABLED
321 #elif (IKE_HMAC_PRF_SUPPORT != ENABLED && IKE_HMAC_PRF_SUPPORT != DISABLED)
322  #error IKE_HMAC_PRF_SUPPORT parameter is not valid
323 #endif
324 
325 //XCBC-MAC PRF support
326 #ifndef IKE_XCBC_MAC_PRF_SUPPORT
327  #define IKE_XCBC_MAC_PRF_SUPPORT DISABLED
328 #elif (IKE_XCBC_MAC_PRF_SUPPORT != ENABLED && IKE_XCBC_MAC_PRF_SUPPORT != DISABLED)
329  #error IKE_XCBC_MAC_PRF_SUPPORT parameter is not valid
330 #endif
331 
332 //IDEA cipher support (insecure)
333 #ifndef IKE_IDEA_SUPPORT
334  #define IKE_IDEA_SUPPORT DISABLED
335 #elif (IKE_IDEA_SUPPORT != ENABLED && IKE_IDEA_SUPPORT != DISABLED)
336  #error IKE_IDEA_SUPPORT parameter is not valid
337 #endif
338 
339 //DES cipher support (insecure)
340 #ifndef IKE_DES_SUPPORT
341  #define IKE_DES_SUPPORT DISABLED
342 #elif (IKE_DES_SUPPORT != ENABLED && IKE_DES_SUPPORT != DISABLED)
343  #error IKE_DES_SUPPORT parameter is not valid
344 #endif
345 
346 //Triple DES cipher support (weak)
347 #ifndef IKE_3DES_SUPPORT
348  #define IKE_3DES_SUPPORT DISABLED
349 #elif (IKE_3DES_SUPPORT != ENABLED && IKE_3DES_SUPPORT != DISABLED)
350  #error IKE_3DES_SUPPORT parameter is not valid
351 #endif
352 
353 //AES 128-bit cipher support
354 #ifndef IKE_AES_128_SUPPORT
355  #define IKE_AES_128_SUPPORT ENABLED
356 #elif (IKE_AES_128_SUPPORT != ENABLED && IKE_AES_128_SUPPORT != DISABLED)
357  #error IKE_AES_128_SUPPORT parameter is not valid
358 #endif
359 
360 //AES 192-bit cipher support
361 #ifndef IKE_AES_192_SUPPORT
362  #define IKE_AES_192_SUPPORT ENABLED
363 #elif (IKE_AES_192_SUPPORT != ENABLED && IKE_AES_192_SUPPORT != DISABLED)
364  #error IKE_AES_192_SUPPORT parameter is not valid
365 #endif
366 
367 //AES 256-bit cipher support
368 #ifndef IKE_AES_256_SUPPORT
369  #define IKE_AES_256_SUPPORT ENABLED
370 #elif (IKE_AES_256_SUPPORT != ENABLED && IKE_AES_256_SUPPORT != DISABLED)
371  #error IKE_AES_256_SUPPORT parameter is not valid
372 #endif
373 
374 //Camellia 128-bit cipher support
375 #ifndef IKE_CAMELLIA_128_SUPPORT
376  #define IKE_CAMELLIA_128_SUPPORT DISABLED
377 #elif (IKE_CAMELLIA_128_SUPPORT != ENABLED && IKE_CAMELLIA_128_SUPPORT != DISABLED)
378  #error IKE_CAMELLIA_128_SUPPORT parameter is not valid
379 #endif
380 
381 //Camellia 192-bit cipher support
382 #ifndef IKE_CAMELLIA_192_SUPPORT
383  #define IKE_CAMELLIA_192_SUPPORT DISABLED
384 #elif (IKE_CAMELLIA_192_SUPPORT != ENABLED && IKE_CAMELLIA_192_SUPPORT != DISABLED)
385  #error IKE_CAMELLIA_192_SUPPORT parameter is not valid
386 #endif
387 
388 //Camellia 256-bit cipher support
389 #ifndef IKE_CAMELLIA_256_SUPPORT
390  #define IKE_CAMELLIA_256_SUPPORT DISABLED
391 #elif (IKE_CAMELLIA_256_SUPPORT != ENABLED && IKE_CAMELLIA_256_SUPPORT != DISABLED)
392  #error IKE_CAMELLIA_256_SUPPORT parameter is not valid
393 #endif
394 
395 //MD5 hash support (insecure)
396 #ifndef IKE_MD5_SUPPORT
397  #define IKE_MD5_SUPPORT DISABLED
398 #elif (IKE_MD5_SUPPORT != ENABLED && IKE_MD5_SUPPORT != DISABLED)
399  #error IKE_MD5_SUPPORT parameter is not valid
400 #endif
401 
402 //SHA-1 hash support (weak)
403 #ifndef IKE_SHA1_SUPPORT
404  #define IKE_SHA1_SUPPORT ENABLED
405 #elif (IKE_SHA1_SUPPORT != ENABLED && IKE_SHA1_SUPPORT != DISABLED)
406  #error IKE_SHA1_SUPPORT parameter is not valid
407 #endif
408 
409 //SHA-256 hash support
410 #ifndef IKE_SHA256_SUPPORT
411  #define IKE_SHA256_SUPPORT ENABLED
412 #elif (IKE_SHA256_SUPPORT != ENABLED && IKE_SHA256_SUPPORT != DISABLED)
413  #error IKE_SHA256_SUPPORT parameter is not valid
414 #endif
415 
416 //SHA-384 hash support
417 #ifndef IKE_SHA384_SUPPORT
418  #define IKE_SHA384_SUPPORT ENABLED
419 #elif (IKE_SHA384_SUPPORT != ENABLED && IKE_SHA384_SUPPORT != DISABLED)
420  #error IKE_SHA384_SUPPORT parameter is not valid
421 #endif
422 
423 //SHA-512 hash support
424 #ifndef IKE_SHA512_SUPPORT
425  #define IKE_SHA512_SUPPORT ENABLED
426 #elif (IKE_SHA512_SUPPORT != ENABLED && IKE_SHA512_SUPPORT != DISABLED)
427  #error IKE_SHA512_SUPPORT parameter is not valid
428 #endif
429 
430 //Tiger hash support
431 #ifndef IKE_TIGER_SUPPORT
432  #define IKE_TIGER_SUPPORT DISABLED
433 #elif (IKE_TIGER_SUPPORT != ENABLED && IKE_TIGER_SUPPORT != DISABLED)
434  #error IKE_TIGER_SUPPORT parameter is not valid
435 #endif
436 
437 //Diffie-Hellman key exchange support
438 #ifndef IKE_DH_KE_SUPPORT
439  #define IKE_DH_KE_SUPPORT ENABLED
440 #elif (IKE_DH_KE_SUPPORT != ENABLED && IKE_DH_KE_SUPPORT != DISABLED)
441  #error IKE_DH_KE_SUPPORT parameter is not valid
442 #endif
443 
444 //ECDH key exchange support
445 #ifndef IKE_ECDH_KE_SUPPORT
446  #define IKE_ECDH_KE_SUPPORT ENABLED
447 #elif (IKE_ECDH_KE_SUPPORT != ENABLED && IKE_ECDH_KE_SUPPORT != DISABLED)
448  #error IKE_ECDH_KE_SUPPORT parameter is not valid
449 #endif
450 
451 //RSA signature support
452 #ifndef IKE_RSA_SIGN_SUPPORT
453  #define IKE_RSA_SIGN_SUPPORT ENABLED
454 #elif (IKE_RSA_SIGN_SUPPORT != ENABLED && IKE_RSA_SIGN_SUPPORT != DISABLED)
455  #error IKE_RSA_SIGN_SUPPORT parameter is not valid
456 #endif
457 
458 //RSA-PSS signature support
459 #ifndef IKE_RSA_PSS_SIGN_SUPPORT
460  #define IKE_RSA_PSS_SIGN_SUPPORT DISABLED
461 #elif (IKE_RSA_PSS_SIGN_SUPPORT != ENABLED && IKE_RSA_PSS_SIGN_SUPPORT != DISABLED)
462  #error IKE_RSA_PSS_SIGN_SUPPORT parameter is not valid
463 #endif
464 
465 //DSA signature support
466 #ifndef IKE_DSA_SIGN_SUPPORT
467  #define IKE_DSA_SIGN_SUPPORT DISABLED
468 #elif (IKE_DSA_SIGN_SUPPORT != ENABLED && IKE_DSA_SIGN_SUPPORT != DISABLED)
469  #error IKE_DSA_SIGN_SUPPORT parameter is not valid
470 #endif
471 
472 //ECDSA signature support
473 #ifndef IKE_ECDSA_SIGN_SUPPORT
474  #define IKE_ECDSA_SIGN_SUPPORT ENABLED
475 #elif (IKE_ECDSA_SIGN_SUPPORT != ENABLED && IKE_ECDSA_SIGN_SUPPORT != DISABLED)
476  #error IKE_ECDSA_SIGN_SUPPORT parameter is not valid
477 #endif
478 
479 //Ed25519 signature support
480 #ifndef IKE_ED25519_SIGN_SUPPORT
481  #define IKE_ED25519_SIGN_SUPPORT ENABLED
482 #elif (IKE_ED25519_SIGN_SUPPORT != ENABLED && IKE_ED25519_SIGN_SUPPORT != DISABLED)
483  #error IKE_ED25519_SIGN_SUPPORT parameter is not valid
484 #endif
485 
486 //Ed448 signature support
487 #ifndef IKE_ED448_SIGN_SUPPORT
488  #define IKE_ED448_SIGN_SUPPORT DISABLED
489 #elif (IKE_ED448_SIGN_SUPPORT != ENABLED && IKE_ED448_SIGN_SUPPORT != DISABLED)
490  #error IKE_ED448_SIGN_SUPPORT parameter is not valid
491 #endif
492 
493 //NIST P-192 elliptic curve support (weak)
494 #ifndef IKE_ECP_192_SUPPORT
495  #define IKE_ECP_192_SUPPORT DISABLED
496 #elif (IKE_ECP_192_SUPPORT != ENABLED && IKE_ECP_192_SUPPORT != DISABLED)
497  #error IKE_ECP_192_SUPPORT parameter is not valid
498 #endif
499 
500 //NIST P-224 elliptic curve support
501 #ifndef IKE_ECP_224_SUPPORT
502  #define IKE_ECP_224_SUPPORT DISABLED
503 #elif (IKE_ECP_224_SUPPORT != ENABLED && IKE_ECP_224_SUPPORT != DISABLED)
504  #error IKE_ECP_224_SUPPORT parameter is not valid
505 #endif
506 
507 //NIST P-256 elliptic curve support
508 #ifndef IKE_ECP_256_SUPPORT
509  #define IKE_ECP_256_SUPPORT ENABLED
510 #elif (IKE_ECP_256_SUPPORT != ENABLED && IKE_ECP_256_SUPPORT != DISABLED)
511  #error IKE_ECP_256_SUPPORT parameter is not valid
512 #endif
513 
514 //NIST P-384 elliptic curve support
515 #ifndef IKE_ECP_384_SUPPORT
516  #define IKE_ECP_384_SUPPORT ENABLED
517 #elif (IKE_ECP_384_SUPPORT != ENABLED && IKE_ECP_384_SUPPORT != DISABLED)
518  #error IKE_ECP_384_SUPPORT parameter is not valid
519 #endif
520 
521 //NIST P-521 elliptic curve support
522 #ifndef IKE_ECP_521_SUPPORT
523  #define IKE_ECP_521_SUPPORT DISABLED
524 #elif (IKE_ECP_521_SUPPORT != ENABLED && IKE_ECP_521_SUPPORT != DISABLED)
525  #error IKE_ECP_521_SUPPORT parameter is not valid
526 #endif
527 
528 //brainpoolP224r1 elliptic curve support
529 #ifndef IKE_BRAINPOOLP224R1_SUPPORT
530  #define IKE_BRAINPOOLP224R1_SUPPORT DISABLED
531 #elif (IKE_BRAINPOOLP224R1_SUPPORT != ENABLED && IKE_BRAINPOOLP224R1_SUPPORT != DISABLED)
532  #error IKE_BRAINPOOLP224R1_SUPPORT parameter is not valid
533 #endif
534 
535 //brainpoolP256r1 elliptic curve support
536 #ifndef IKE_BRAINPOOLP256R1_SUPPORT
537  #define IKE_BRAINPOOLP256R1_SUPPORT DISABLED
538 #elif (IKE_BRAINPOOLP256R1_SUPPORT != ENABLED && IKE_BRAINPOOLP256R1_SUPPORT != DISABLED)
539  #error IKE_BRAINPOOLP256R1_SUPPORT parameter is not valid
540 #endif
541 
542 //brainpoolP384r1 elliptic curve support
543 #ifndef IKE_BRAINPOOLP384R1_SUPPORT
544  #define IKE_BRAINPOOLP384R1_SUPPORT DISABLED
545 #elif (IKE_BRAINPOOLP384R1_SUPPORT != ENABLED && IKE_BRAINPOOLP384R1_SUPPORT != DISABLED)
546  #error IKE_BRAINPOOLP384R1_SUPPORT parameter is not valid
547 #endif
548 
549 //brainpoolP512r1 elliptic curve support
550 #ifndef IKE_BRAINPOOLP512R1_SUPPORT
551  #define IKE_BRAINPOOLP512R1_SUPPORT DISABLED
552 #elif (IKE_BRAINPOOLP512R1_SUPPORT != ENABLED && IKE_BRAINPOOLP512R1_SUPPORT != DISABLED)
553  #error IKE_BRAINPOOLP512R1_SUPPORT parameter is not valid
554 #endif
555 
556 //Curve25519 elliptic curve support
557 #ifndef IKE_CURVE25519_SUPPORT
558  #define IKE_CURVE25519_SUPPORT ENABLED
559 #elif (IKE_CURVE25519_SUPPORT != ENABLED && IKE_CURVE25519_SUPPORT != DISABLED)
560  #error IKE_CURVE25519_SUPPORT parameter is not valid
561 #endif
562 
563 //Curve448 elliptic curve support
564 #ifndef IKE_CURVE448_SUPPORT
565  #define IKE_CURVE448_SUPPORT DISABLED
566 #elif (IKE_CURVE448_SUPPORT != ENABLED && IKE_CURVE448_SUPPORT != DISABLED)
567  #error IKE_CURVE448_SUPPORT parameter is not valid
568 #endif
569 
570 //Minimum acceptable size for Diffie-Hellman prime modulus
571 #ifndef IKE_MIN_DH_MODULUS_SIZE
572  #define IKE_MIN_DH_MODULUS_SIZE 1024
573 #elif (IKE_MIN_DH_MODULUS_SIZE < 768)
574  #error IKE_MIN_DH_MODULUS_SIZE parameter is not valid
575 #endif
576 
577 //Maximum acceptable size for Diffie-Hellman prime modulus
578 #ifndef IKE_MAX_DH_MODULUS_SIZE
579  #define IKE_MAX_DH_MODULUS_SIZE 2048
580 #elif (IKE_MAX_DH_MODULUS_SIZE < IKE_PREFERRED_DH_MODULUS_SIZE)
581  #error IKE_MAX_DH_MODULUS_SIZE parameter is not valid
582 #endif
583 
584 //Minimum acceptable size for RSA modulus
585 #ifndef IKE_MIN_RSA_MODULUS_SIZE
586  #define IKE_MIN_RSA_MODULUS_SIZE 1024
587 #elif (IKE_MIN_RSA_MODULUS_SIZE < 512)
588  #error IKE_MIN_RSA_MODULUS_SIZE parameter is not valid
589 #endif
590 
591 //Maximum acceptable size for RSA modulus
592 #ifndef IKE_MAX_RSA_MODULUS_SIZE
593  #define IKE_MAX_RSA_MODULUS_SIZE 4096
594 #elif (IKE_MAX_RSA_MODULUS_SIZE < IKE_MIN_RSA_MODULUS_SIZE)
595  #error IKE_MAX_RSA_MODULUS_SIZE parameter is not valid
596 #endif
597 
598 //Minimum acceptable size for DSA prime modulus
599 #ifndef IKE_MIN_DSA_MODULUS_SIZE
600  #define IKE_MIN_DSA_MODULUS_SIZE 1024
601 #elif (IKE_MIN_DSA_MODULUS_SIZE < 512)
602  #error IKE_MIN_DSA_MODULUS_SIZE parameter is not valid
603 #endif
604 
605 //Maximum acceptable size for DSA prime modulus
606 #ifndef IKE_MAX_DSA_MODULUS_SIZE
607  #define IKE_MAX_DSA_MODULUS_SIZE 4096
608 #elif (IKE_MAX_DSA_MODULUS_SIZE < IKE_MIN_DSA_MODULUS_SIZE)
609  #error IKE_MAX_DSA_MODULUS_SIZE parameter is not valid
610 #endif
611 
612 //Maximum length of IKE SA key material
613 #ifndef IKE_MAX_SA_KEY_MAT_LEN
614  #define IKE_MAX_SA_KEY_MAT_LEN 392
615 #elif (IKE_MAX_SA_KEY_MAT_LEN < 1)
616  #error IKE_MAX_SA_KEY_MAT_LEN parameter is not valid
617 #endif
618 
619 //Maximum length of Child SA key material
620 #ifndef IKE_MAX_CHILD_SA_KEY_MAT_LEN
621  #define IKE_MAX_CHILD_SA_KEY_MAT_LEN 200
622 #elif (IKE_MAX_CHILD_SA_KEY_MAT_LEN < 1)
623  #error IKE_MAX_CHILD_SA_KEY_MAT_LEN parameter is not valid
624 #endif
625 
626 //Allocate memory block
627 #ifndef ikeAllocMem
628  #define ikeAllocMem(size) osAllocMem(size)
629 #endif
630 
631 //Deallocate memory block
632 #ifndef ikeFreeMem
633  #define ikeFreeMem(p) osFreeMem(p)
634 #endif
635 
636 //Maximum shared secret length (Diffie-Hellman key exchange)
637 #if (IKE_DH_KE_SUPPORT == ENABLED)
638  #define IKE_MAX_DH_SHARED_SECRET_LEN ((IKE_MAX_DH_MODULUS_SIZE + 7) / 8)
639 #else
640  #define IKE_MAX_DH_SHARED_SECRET_LEN 0
641 #endif
642 
643 //Maximum shared secret length (ECDH key exchange)
644 #if (IKE_ECDH_KE_SUPPORT == ENABLED && IKE_ECP_521_SUPPORT == ENABLED)
645  #define IKE_MAX_ECDH_SHARED_SECRET_LEN 66
646 #elif (IKE_ECDH_KE_SUPPORT == ENABLED && IKE_CURVE448_SUPPORT == ENABLED)
647  #define IKE_MAX_ECDH_SHARED_SECRET_LEN 56
648 #elif (IKE_ECDH_KE_SUPPORT == ENABLED && IKE_ECP_384_SUPPORT == ENABLED)
649  #define IKE_MAX_ECDH_SHARED_SECRET_LEN 48
650 #else
651  #define IKE_MAX_ECDH_SHARED_SECRET_LEN 32
652 #endif
653 
654 //Maximum shared secret length
655 #if (IKE_MAX_DH_SHARED_SECRET_LEN >= IKE_MAX_ECDH_SHARED_SECRET_LEN)
656  #define IKE_MAX_SHARED_SECRET_LEN IKE_MAX_DH_SHARED_SECRET_LEN
657 #else
658  #define IKE_MAX_SHARED_SECRET_LEN IKE_MAX_ECDH_SHARED_SECRET_LEN
659 #endif
660 
661 //Major version of the IKE protocol
662 #define IKE_MAJOR_VERSION 2
663 //Minor version of the IKE protocol
664 #define IKE_MINOR_VERSION 0
665 
666 //UDP port number used by IKE
667 #define IKE_PORT 500
668 //UDP port number used by UDP-encapsulated IKE
669 #define IKE_ALT_PORT 4500
670 
671 //Size of IKE SPI
672 #define IKE_SPI_SIZE 8
673 //Size of SHA-1 digest
674 #define IKE_SHA1_DIGEST_SIZE 20
675 
676 //Forward declaration of IkeContext structure
677 struct _IkeContext;
678 #define IkeContext struct _IkeContext
679 
680 //Forward declaration of IkeSaEntry structure
681 struct _IkeSaEntry;
682 #define IkeSaEntry struct _IkeSaEntry
683 
684 //Forward declaration of IkeChildSaEntry structure
685 struct _IkeChildSaEntry;
686 #define IkeChildSaEntry struct _IkeChildSaEntry
687 
688 //C++ guard
689 #ifdef __cplusplus
690 extern "C" {
691 #endif
692 
693 
694 /**
695  * @brief Exchange types
696  **/
697 
698 typedef enum
699 {
700  IKE_EXCHANGE_TYPE_IKE_SA_INIT = 34, ///<IKE_SA_INIT
701  IKE_EXCHANGE_TYPE_IKE_AUTH = 35, ///<IKE_AUTH
702  IKE_EXCHANGE_TYPE_CREATE_CHILD_SA = 36, ///<CREATE_CHILD_SA
703  IKE_EXCHANGE_TYPE_INFORMATIONAL = 37, ///<INFORMATIONAL
704  IKE_EXCHANGE_TYPE_IKE_SESSION_RESUME = 38, ///<IKE_SESSION_RESUME
705  IKE_EXCHANGE_TYPE_IKE_INTERMEDIATE = 43 ///<IKE_INTERMEDIATE
707 
708 
709 /**
710  * @brief Flags
711  **/
712 
713 typedef enum
714 {
715  IKE_FLAGS_R = 0x20, ///<Response flag
716  IKE_FLAGS_V = 0x10, ///<Version flag
717  IKE_FLAGS_I = 0x08 ///<Initiator flag
719 
720 
721 /**
722  * @brief Payload types
723  **/
724 
725 typedef enum
726 {
727  IKE_PAYLOAD_TYPE_LAST = 0, ///<No Next Payload
728  IKE_PAYLOAD_TYPE_SA = 33, ///<Security Association
729  IKE_PAYLOAD_TYPE_KE = 34, ///<Key Exchange
730  IKE_PAYLOAD_TYPE_IDI = 35, ///<Identification - Initiator
731  IKE_PAYLOAD_TYPE_IDR = 36, ///<Identification - Responder
732  IKE_PAYLOAD_TYPE_CERT = 37, ///<Certificate
733  IKE_PAYLOAD_TYPE_CERTREQ = 38, ///<Certificate Request
734  IKE_PAYLOAD_TYPE_AUTH = 39, ///<Authentication
735  IKE_PAYLOAD_TYPE_NONCE = 40, ///<Nonce
736  IKE_PAYLOAD_TYPE_N = 41, ///<Notify
737  IKE_PAYLOAD_TYPE_D = 42, ///<Delete
738  IKE_PAYLOAD_TYPE_V = 43, ///<Vendor ID
739  IKE_PAYLOAD_TYPE_TSI = 44, ///<Traffic Selector - Initiator
740  IKE_PAYLOAD_TYPE_TSR = 45, ///<Traffic Selector - Responder
741  IKE_PAYLOAD_TYPE_SK = 46, ///<Encrypted and Authenticated
742  IKE_PAYLOAD_TYPE_CP = 47, ///<Configuration
743  IKE_PAYLOAD_TYPE_EAP = 48, ///<Extensible Authentication
744  IKE_PAYLOAD_TYPE_GSPM = 49, ///<Generic Secure Password Method
745  IKE_PAYLOAD_TYPE_SKF = 53, ///<Encrypted and Authenticated Fragment
746  IKE_PAYLOAD_TYPE_PS = 54 ///<Puzzle Solution
748 
749 
750 /**
751  * @brief Last Substruc values
752  **/
753 
754 typedef enum
755 {
756  IKE_LAST_SUBSTRUC_LAST = 0, ///<Last proposal/transform substructure
757  IKE_LAST_SUBSTRUC_MORE_PROPOSALS = 2, ///<More proposal substructures
758  IKE_LAST_SUBSTRUC_MORE_TRANSFORMS = 3 ///<More transform substructures
760 
761 
762 /**
763  * @brief Protocol IDs
764  **/
765 
766 typedef enum
767 {
768  IKE_PROTOCOL_ID_IKE = 1, ///<IKE protocol
769  IKE_PROTOCOL_ID_AH = 2, ///<AH protocol
770  IKE_PROTOCOL_ID_ESP = 3 ///<ESP protocol
772 
773 
774 /**
775  * @brief Transform types
776  **/
777 
778 typedef enum
779 {
780  IKE_TRANSFORM_TYPE_ENCR = 1, ///<Encryption Algorithm
781  IKE_TRANSFORM_TYPE_PRF = 2, ///<Pseudorandom Function
782  IKE_TRANSFORM_TYPE_INTEG = 3, ///<Integrity Algorithm
783  IKE_TRANSFORM_TYPE_DH = 4, ///<Diffie-Hellman Group
784  IKE_TRANSFORM_TYPE_ESN = 5 ///<Extended Sequence Numbers
786 
787 
788 /**
789  * @brief Transform IDs (Encryption Algorithm)
790  **/
791 
792 typedef enum
793 {
828 
829 
830 /**
831  * @brief Transform IDs (Pseudorandom Function)
832  **/
833 
834 typedef enum
835 {
847 
848 
849 /**
850  * @brief Transform IDs (Integrity Algorithm)
851  **/
852 
853 typedef enum
854 {
871 
872 
873 /**
874  * @brief Transform IDs (Diffie-Hellman Group)
875  **/
876 
877 typedef enum
878 {
880  IKE_TRANSFORM_ID_DH_GROUP_MODP_768 = 1, ///<768-bit MODP Group
881  IKE_TRANSFORM_ID_DH_GROUP_MODP_1024 = 2, ///<1024-bit MODP Group
882  IKE_TRANSFORM_ID_DH_GROUP_MODP_1536 = 5, ///<1536-bit MODP Group
883  IKE_TRANSFORM_ID_DH_GROUP_MODP_2048 = 14, ///<2048-bit MODP Group
884  IKE_TRANSFORM_ID_DH_GROUP_MODP_3072 = 15, ///<3072-bit MODP Group
885  IKE_TRANSFORM_ID_DH_GROUP_MODP_4096 = 16, ///<4096-bit MODP Group
886  IKE_TRANSFORM_ID_DH_GROUP_MODP_6144 = 17, ///<6144-bit MODP Group
887  IKE_TRANSFORM_ID_DH_GROUP_MODP_8192 = 18, ///<8192-bit MODP Group
888  IKE_TRANSFORM_ID_DH_GROUP_ECP_256 = 19, ///<256-bit Random ECP Group
889  IKE_TRANSFORM_ID_DH_GROUP_ECP_384 = 20, ///<384-bit Random ECP Group
890  IKE_TRANSFORM_ID_DH_GROUP_ECP_521 = 21, ///<521-bit Random ECP Group
891  IKE_TRANSFORM_ID_DH_GROUP_MODP_1024_160 = 22, ///<1024-bit MODP Group with 160-bit Prime Order Subgroup
892  IKE_TRANSFORM_ID_DH_GROUP_MODP_2048_224 = 23, ///<2048-bit MODP Group with 224-bit Prime Order Subgroup
893  IKE_TRANSFORM_ID_DH_GROUP_MODP_2048_256 = 24, ///<2048-bit MODP Group with 256-bit Prime Order Subgroup
894  IKE_TRANSFORM_ID_DH_GROUP_ECP_192 = 25, ///<192-bit Random ECP Group
895  IKE_TRANSFORM_ID_DH_GROUP_ECP_224 = 26, ///<224-bit Random ECP Group
896  IKE_TRANSFORM_ID_DH_GROUP_BRAINPOOLP224R1 = 27, ///<224-bit Brainpool ECP Group
897  IKE_TRANSFORM_ID_DH_GROUP_BRAINPOOLP256R1 = 28, ///<256-bit Brainpool ECP Group
898  IKE_TRANSFORM_ID_DH_GROUP_BRAINPOOLP384R1 = 29, ///<384-bit Brainpool ECP Group
899  IKE_TRANSFORM_ID_DH_GROUP_BRAINPOOLP512R1 = 30, ///<512-bit Brainpool ECP Group
903  IKE_TRANSFORM_ID_DH_GROUP_GOST3410_2012_512 = 32 ///<GOST3410_2012_512
905 
906 
907 /**
908  * @brief Transform IDs (Extended Sequence Numbers)
909  **/
910 
911 typedef enum
912 {
913  IKE_TRANSFORM_ID_ESN_NO = 0, ///<No Extended Sequence Numbers
914  IKE_TRANSFORM_ID_ESN_YES = 1 ///<Extended Sequence Numbers
916 
917 
918 /**
919  * @brief Transform attribute format
920  **/
921 
922 typedef enum
923 {
924  IKE_ATTR_FORMAT_TLV = 0x0000, ///<Type/Length/Value format
925  IKE_ATTR_FORMAT_TV = 0x8000 ///<shortened Type/Value format
927 
928 
929 /**
930  * @brief Transform attribute types
931  **/
932 
933 typedef enum
934 {
935  IKE_TRANSFORM_ATTR_TYPE_KEY_LEN = 14 ///<Key Length (in bits)
937 
938 
939 /**
940  * @brief ID types
941  **/
942 
943 typedef enum
944 {
954  IKE_ID_TYPE_NULL = 13
956 
957 
958 /**
959  * @brief Certificate encodings
960  **/
961 
962 typedef enum
963 {
964  IKE_CERT_ENCODING_PKCS7_X509_CERT = 1, ///<PKCS #7 wrapped X.509 certificate
965  IKE_CERT_ENCODING_PGP_CERT = 2, ///<PGP certificate
966  IKE_CERT_ENCODING_DNS_SIGNED_KEY = 3, ///<DNS signed key
967  IKE_CERT_ENCODING_X509_CERT_SIGN = 4, ///<X.509 certificate - signature
968  IKE_CERT_ENCODING_KERBEROS_TOKEN = 6, ///<Kerberos token
969  IKE_CERT_ENCODING_CRL = 7, ///<Certificate revocation list
970  IKE_CERT_ENCODING_ARL = 8, ///<Authority revocation list
971  IKE_CERT_ENCODING_SPKI_CERT = 9, ///<SPKI certificate
972  IKE_CERT_ENCODING_X509_CERT_ATTR = 10, ///<X.509 certificate - attribute
973  IKE_CERT_ENCODING_RAW_RSA_KEY = 11, ///<Raw RSA key (deprecated)
974  IKE_CERT_ENCODING_HASH_URL_X509_CERT = 12, ///<Hash and URL of X.509 certificate
975  IKE_CERT_ENCODING_HASH_URL_X509_BUNDLE = 13, ///<Hash and URL of X.509 bundle
976  IKE_CERT_ENCODING_OCSP_CONTENT = 14, ///<OCSP Content
977  IKE_CERT_ENCODING_RAW_PUBLIC_KEY = 15 ///<Raw Public Key
979 
980 
981 /**
982  * @brief Authentication methods
983  **/
984 
985 typedef enum
986 {
987  IKE_AUTH_METHOD_RSA = 1, ///<RSA Digital Signature
988  IKE_AUTH_METHOD_SHARED_KEY = 2, ///<Shared Key Message Integrity Code
989  IKE_AUTH_METHOD_DSS = 3, ///<DSS Digital Signature
990  IKE_AUTH_METHOD_ECDSA_P256_SHA256 = 9, ///<ECDSA with SHA-256 on the P-256 curve
991  IKE_AUTH_METHOD_ECDSA_P384_SHA384 = 10, ///<ECDSA with SHA-384 on the P-384 curve
992  IKE_AUTH_METHOD_ECDSA_P521_SHA512 = 11, ///<ECDSA with SHA-512 on the P-521 curve
993  IKE_AUTH_METHOD_GSPAM = 12, ///<Generic Secure Password Authentication Method
994  IKE_AUTH_METHOD_NULL = 13, ///<NULL Authentication
995  IKE_AUTH_METHOD_DIGITAL_SIGN = 14 ///<Digital Signature
997 
998 
999 /**
1000  * @brief Notify message types
1001  **/
1002 
1003 typedef enum
1004 {
1035  IKE_NOTIFY_MSG_TYPE_COOKIE = 16390, //RFC 7296
1038  IKE_NOTIFY_MSG_TYPE_REKEY_SA = 16393, //RFC 7296
1046  IKE_NOTIFY_MSG_TYPE_COOKIE2 = 16401, //RFC 4555
1052  IKE_NOTIFY_MSG_TYPE_REDIRECT = 16407, //RFC 5685
1059  IKE_NOTIFY_MSG_TYPE_LINK_ID = 16414, //RFC 5739
1079  IKE_NOTIFY_MSG_TYPE_PUZZLE = 16434, //RFC 8019
1080  IKE_NOTIFY_MSG_TYPE_USE_PPK = 16435, //RFC 8784
1088  IKE_NOTIFY_MSG_TYPE_R_U_THERE = 36136, //RFC 3706
1089  IKE_NOTIFY_MSG_TYPE_R_U_THERE_ACK = 36137 //RFC 3706
1091 
1092 
1093 /**
1094  * @brief Traffic selector types
1095  **/
1096 
1097 typedef enum
1098 {
1102 
1103 
1104 /**
1105  * @brief IP protocol IDs
1106  **/
1107 
1108 typedef enum
1109 {
1114 } IkeIpProtocolId;
1115 
1116 
1117 /**
1118  * @brief Configuration types
1119  **/
1120 
1121 typedef enum
1122 {
1128 
1129 
1130 /**
1131  * @brief Configuration attribute types
1132  **/
1133 
1134 typedef enum
1135 {
1156 
1157 
1158 /**
1159  * @brief IKE Security Association state
1160  **/
1161 
1162 typedef enum
1163 {
1186 
1187 
1188 /**
1189  * @brief Child Security Association state
1190  **/
1191 
1192 typedef enum
1193 {
1201 
1202 
1203 /**
1204  * @brief Hash algorithms
1205  **/
1206 
1207 typedef enum
1208 {
1215 
1216 
1217 /**
1218  * @brief Certificate types
1219  **/
1220 
1221 typedef enum
1222 {
1234  IKE_CERT_TYPE_ED448 = 11
1236 
1237 
1238 //CC-RX, CodeWarrior or Win32 compiler?
1239 #if defined(__CCRX__)
1240  #pragma pack
1241 #elif defined(__CWCC__) || defined(_WIN32)
1242  #pragma pack(push, 1)
1243 #endif
1244 
1245 
1246 /**
1247  * @brief IKE header
1248  **/
1249 
1251 {
1252  uint8_t initiatorSpi[IKE_SPI_SIZE]; //0-7
1253  uint8_t responderSpi[IKE_SPI_SIZE]; //8-15
1254  uint8_t nextPayload; //16
1255 #if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
1256  uint8_t majorVersion : 4; //17
1257  uint8_t minorVersion : 4;
1258 #else
1259  uint8_t minorVersion : 4; //17
1260  uint8_t majorVersion : 4;
1261 #endif
1262  uint8_t exchangeType; //18
1263  uint8_t flags; //19
1264  uint32_t messageId; //20-23
1265  uint32_t length; //24-27
1267 
1268 
1269 /**
1270  * @brief Generic payload header
1271  **/
1272 
1273 typedef __packed_struct
1274 {
1275  uint8_t nextPayload; //0
1276 #if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
1277  uint8_t critical : 1; //1
1278  uint8_t reserved : 7;
1279 #else
1280  uint8_t reserved : 7; //1
1281  uint8_t critical : 1;
1282 #endif
1283  uint16_t payloadLength; //2-3
1285 
1286 
1287 /**
1288  * @brief Security Association payload
1289  **/
1290 
1291 typedef __packed_struct
1292 {
1293  IkePayloadHeader header; //0-3
1294  uint8_t proposals[]; //4
1296 
1297 
1298 /**
1299  * @brief Proposal substructure
1300  **/
1301 
1302 typedef __packed_struct
1303 {
1304  uint8_t lastSubstruc; //0
1305  uint8_t reserved; //1
1306  uint16_t proposalLength; //2-3
1307  uint8_t proposalNum; //4
1308  uint8_t protocolId; //5
1309  uint8_t spiSize; //6
1310  uint8_t numTransforms; //7
1311  uint8_t spi[]; //8
1313 
1314 
1315 /**
1316  * @brief Transform substructure
1317  **/
1318 
1319 typedef __packed_struct
1320 {
1321  uint8_t lastSubstruc; //0
1322  uint8_t reserved1; //1
1323  uint16_t transformLength; //2-3
1324  uint8_t transformType; //4
1325  uint8_t reserved2; //5
1326  uint16_t transformId; //6-7
1327  uint8_t transformAttr[]; //8
1329 
1330 
1331 /**
1332  * @brief Transform attribute
1333  **/
1334 
1335 typedef __packed_struct
1336 {
1337  uint16_t type; //0-1
1338  uint16_t length; //2-3
1339  uint8_t value[]; //4
1341 
1342 
1343 /**
1344  * @brief Key Exchange payload
1345  **/
1346 
1347 typedef __packed_struct
1348 {
1349  IkePayloadHeader header; //0-3
1350  uint16_t dhGroupNum; //4-5
1351  uint16_t reserved; //6-7
1352  uint8_t keyExchangeData[]; //8
1354 
1355 
1356 /**
1357  * @brief Identification payload
1358  **/
1359 
1360 typedef __packed_struct
1361 {
1362  IkePayloadHeader header; //0-3
1363  uint8_t idType; //4
1364  uint8_t reserved[3]; //5-7
1365  uint8_t idData[]; //8
1367 
1368 
1369 /**
1370  * @brief Certificate payload
1371  **/
1372 
1373 typedef __packed_struct
1374 {
1375  IkePayloadHeader header; //0-3
1376  uint8_t certEncoding; //4
1377  uint8_t certData[]; //5
1379 
1380 
1381 /**
1382  * @brief Certificate Request payload
1383  **/
1384 
1385 typedef __packed_struct
1386 {
1387  IkePayloadHeader header; //0-3
1388  uint8_t certEncoding; //4
1389  uint8_t certAuthority[]; //5
1391 
1392 
1393 /**
1394  * @brief Authentication payload
1395  **/
1396 
1397 typedef __packed_struct
1398 {
1399  IkePayloadHeader header; //0-3
1400  uint8_t authMethod; //4
1401  uint8_t reserved[3]; //4-7
1402  uint8_t authData[]; //8
1404 
1405 
1406 /**
1407  * @brief Authentication data for digital signatures
1408  **/
1409 
1410 typedef __packed_struct
1411 {
1412  uint8_t algoIdLen; //0
1413  uint8_t algoId[]; //1
1415 
1416 
1417 /**
1418  * @brief Nonce payload
1419  **/
1420 
1421 typedef __packed_struct
1422 {
1423  IkePayloadHeader header; //0-3
1424  uint8_t nonceData[]; //4
1426 
1427 
1428 /**
1429  * @brief Notify payload
1430  **/
1431 
1432 typedef __packed_struct
1433 {
1434  IkePayloadHeader header; //0-3
1435  uint8_t protocolId; //4
1436  uint8_t spiSize; //5
1437  uint16_t notifyMsgType; //6-7
1438  uint8_t spi[]; //8
1440 
1441 
1442 /**
1443  * @brief Delete payload
1444  **/
1445 
1446 typedef __packed_struct
1447 {
1448  IkePayloadHeader header; //0-3
1449  uint8_t protocolId; //4
1450  uint8_t spiSize; //5
1451  uint16_t numSpi; //6-7
1452  uint8_t spi[]; //8
1454 
1455 
1456 /**
1457  * @brief Vendor ID payload
1458  **/
1459 
1460 typedef __packed_struct
1461 {
1462  IkePayloadHeader header; //0-3
1463  uint8_t vid[]; //4
1465 
1466 
1467 /**
1468  * @brief Traffic Selector payload
1469  **/
1470 
1471 typedef __packed_struct
1472 {
1473  IkePayloadHeader header; //0-3
1474  uint8_t numTs; //4
1475  uint8_t reserved[3]; //5-7
1476  uint8_t trafficSelectors[]; //8
1478 
1479 
1480 /**
1481  * @brief Traffic selector
1482  **/
1483 
1484 typedef __packed_struct
1485 {
1486  uint8_t tsType; //0
1487  uint8_t ipProtocolId; //1
1488  uint16_t selectorLength; //2-3
1489  uint16_t startPort; //4-5
1490  uint16_t endPort; //6-7
1491  uint8_t startAddr[]; //8
1493 
1494 
1495 /**
1496  * @brief Encrypted payload
1497  **/
1498 
1499 typedef __packed_struct
1500 {
1501  IkePayloadHeader header; //0-3
1502  uint8_t iv[]; //4
1504 
1505 
1506 /**
1507  * @brief Configuration payload
1508  **/
1509 
1510 typedef __packed_struct
1511 {
1512  IkePayloadHeader header; //0-3
1513  uint8_t configType; //4
1514  uint8_t reserved[3]; //5-7
1515  uint8_t configAttributes[]; //8
1517 
1518 
1519 /**
1520  * @brief Configuration attribute
1521  **/
1522 
1523 typedef __packed_struct
1524 {
1525  uint16_t type; //0-1
1526  uint16_t length; //2-3
1527  uint8_t value[]; //4
1529 
1530 
1531 /**
1532  * @brief EAP payload
1533  **/
1534 
1535 typedef __packed_struct
1536 {
1537  IkePayloadHeader header; //0-3
1538  uint8_t eapMessage[]; //4
1540 
1541 
1542 /**
1543  * @brief EAP message
1544  **/
1545 
1546 typedef __packed_struct
1547 {
1548  uint8_t code; //0
1549  uint8_t identifier; //1
1550  uint16_t length; //2-3
1551  uint8_t type; //4
1552  uint8_t data[]; //5
1554 
1555 
1556 /**
1557  * @brief Encrypted Fragment payload
1558  **/
1559 
1560 typedef __packed_struct
1561 {
1562  IkePayloadHeader header; //0-3
1563  uint16_t fragNum; //4-5
1564  uint16_t totalFrags; //6-7
1565  uint8_t iv[]; //8
1567 
1568 
1569 //CC-RX, CodeWarrior or Win32 compiler?
1570 #if defined(__CCRX__)
1571  #pragma unpack
1572 #elif defined(__CWCC__) || defined(_WIN32)
1573  #pragma pack(pop)
1574 #endif
1575 
1576 
1577 /**
1578  * @brief Certificate verification callback function
1579  **/
1580 
1582  const X509CertInfo *certInfo, uint_t pathLen);
1583 
1584 
1585 /**
1586  * @brief Cookie generation callback function
1587  **/
1588 
1590  const IpAddr *ipAddr, const uint8_t *spi, const uint8_t *nonce,
1591  size_t nonceLen, uint8_t *cookie, size_t *cookieLen);
1592 
1593 
1594 /**
1595  * @brief Cookie verification callback function
1596  **/
1597 
1599  const IpAddr *ipAddr, const uint8_t *spi, const uint8_t *nonce,
1600  size_t nonceLen, const uint8_t *cookie, size_t cookieLen);
1601 
1602 
1603 /**
1604  * @brief Traffic selector parameters
1605  **/
1606 
1607 typedef struct
1608 {
1611  uint8_t ipProtocolId;
1612  uint16_t startPort;
1613  uint16_t endPort;
1614 } IkeTsParams;
1615 
1616 
1617 /**
1618  * @brief IKE Security Association entry
1619  **/
1620 
1622 {
1623  IkeSaState state; ///<IKE SA state
1624  IkeContext *context; ///<IKE context
1625  IkeSaEntry *oldSa; ///<Old IKE SA
1626  IkeSaEntry *newSa; ///<New IKE SA
1627  IkeChildSaEntry *childSa; ///<Child SA
1628  IpAddr remoteIpAddr; ///<IP address of the peer
1629  uint16_t remotePort;
1630  bool_t originalInitiator; ///<Original initiator of the IKE SA
1632  systime_t lifetime; ///<Lifetime of the IKE SA
1633  systime_t reauthPeriod; ///<Reauthentication period
1634 #if (IKE_DPD_SUPPORT == ENABLED)
1636  systime_t dpdPeriod; ///<Dead peer detection period
1637 #endif
1641  uint32_t txMessageId;
1642  uint32_t rxMessageId;
1643  uint8_t cookie[IKE_MAX_COOKIE_SIZE]; ///<Cookie
1644  size_t cookieLen; ///<Length of the cookie, in bytes
1645  uint8_t initiatorSpi[IKE_SPI_SIZE]; ///<Initiator SPI
1646  uint8_t responderSpi[IKE_SPI_SIZE]; ///<Responder SPI
1647 
1652 
1653  IkeIdType peerIdType; ///<Peer ID type
1654  uint8_t peerId[IKE_MAX_ID_LEN]; ///<Peer ID
1655  size_t peerIdLen; ///<Length of the peer ID, in bytes
1656 
1660  uint8_t notifySpi[4];
1661 
1662  uint16_t encAlgoId; ///<Encryption algorithm
1663  uint16_t prfAlgoId; ///<Pseudorandom function
1664  uint16_t authAlgoId; ///<Integrity algorithm
1665  uint16_t dhGroupNum; ///<Diffie-Hellman group number
1666 
1667  uint8_t sharedSecret[IKE_MAX_SHARED_SECRET_LEN]; ///<Shared secret
1668  size_t sharedSecretLen; ///<Length of the shared secret, in bytes
1669  uint8_t keyMaterial[IKE_MAX_SA_KEY_MAT_LEN]; ///<Keying material
1670  const uint8_t *skd; ///<Key used for deriving new keys for Child SAs
1671  const uint8_t *skai; ///<Integrity protection key (initiator)
1672  const uint8_t *skar; ///<Integrity protection key (responder)
1673  const uint8_t *skei; ///<Encryption key (initiator)
1674  const uint8_t *sker; ///<Encryption key (responder)
1675  const uint8_t *skpi; ///<Key used for generating AUTH payload (initiator)
1676  const uint8_t *skpr; ///<Key used for generating AUTH payload (responder)
1677 
1678  CipherMode cipherMode; ///<Cipher mode of operation
1679  const CipherAlgo *cipherAlgo; ///<Cipher algorithm
1680  CipherContext cipherContext; ///<Cipher context
1681  const HashAlgo *authHashAlgo; ///<Hash algorithm for HMAC-based integrity calculations
1682  const CipherAlgo *authCipherAlgo; ///<Cipher algorithm for CMAC-based integrity calculations
1683  const HashAlgo *prfHashAlgo; ///<Hash algorithm for HMAC-based PRF calculations
1684  const CipherAlgo *prfCipherAlgo; ///<Cipher algorithm for CMAC-based PRF calculations
1685  size_t encKeyLen; ///<Size of the encryption key, in bytes
1686  size_t authKeyLen; ///<Size of the integrity protection key, in bytes
1687  size_t prfKeyLen; ///<Preferred size of the PRF key, in bytes
1688  size_t saltLen; ///<Length of the salt, in bytes
1689  size_t ivLen; ///<Length of the initialization vector, in bytes
1690  size_t icvLen; ///<Length of the ICV tag, in bytes
1691  uint8_t iv[8]; ///<Initialization vector
1692 
1693 #if (IKE_DH_KE_SUPPORT == ENABLED)
1694  DhContext dhContext; ///<Diffie-Hellman context
1695 #endif
1696 #if (IKE_ECDH_KE_SUPPORT == ENABLED)
1697  EcdhContext ecdhContext; ///<ECDH context
1698 #endif
1699 
1700  uint8_t *initiatorSaInit; ///<Pointer to the IKE_SA_INIT request
1701  size_t initiatorSaInitLen; ///<Length of the IKE_SA_INIT request, in bytes
1702  uint8_t *responderSaInit; ///<Pointer to the IKE_SA_INIT response
1703  size_t responderSaInitLen; ///<Length of the IKE_SA_INIT response, in bytes
1704 
1705  uint8_t request[IKE_MAX_MSG_SIZE]; ///<Request message
1706  size_t requestLen; ///<Length of the request message, in bytes
1707  uint8_t response[IKE_MAX_MSG_SIZE]; ///<Response message
1708  size_t responseLen; ///<Length of the response message, in bytes
1709 
1710  bool_t rekeyRequest; ///<IKE SA rekey request
1711  bool_t reauthRequest; ///<IKE SA reauthentication request
1712  bool_t reauthPending; ///<Reauthentication process is on-going
1713  bool_t deleteRequest; ///<IKE SA delete request
1715  bool_t nonAdditionalSas; ///<NO_ADDITIONAL_SAS notification received
1716 #if (IKE_INITIAL_CONTACT_SUPPORT == ENABLED)
1717  bool_t initialContact; ///<INITIAL_CONTACT notification received
1718 #endif
1719 #if (IKE_SIGN_HASH_ALGOS_SUPPORT == ENABLED)
1720  uint32_t signHashAlgos; ///<List of hash algorithms supported by the peer
1721 #endif
1722 };
1723 
1724 
1725 /**
1726  * @brief Child Security Association entry
1727  **/
1728 
1730 {
1731  IkeChildSaState state; ///<Child SA state
1732  IkeContext *context; ///<IKE context
1733  IkeSaEntry *sa; ///<IKE SA entry
1734  IkeChildSaEntry *oldChildSa; ///<Old Child SA
1735  IpAddr remoteIpAddr; ///<IP address of the peer
1736  IpsecMode mode; ///<IPsec mode (tunnel or transport)
1737  IpsecProtocol protocol; ///<Security protocol (AH or ESP)
1738  bool_t initiator; ///<Initiator of the CREATE_CHILD_SA exchange
1740  uint8_t initiatorNonce[IKE_MAX_NONCE_SIZE]; ///<Initiator nonce
1741  size_t initiatorNonceLen; ///<Length of the initiator nonce
1742  uint8_t responderNonce[IKE_MAX_NONCE_SIZE]; ///<Responder nonce
1743  size_t responderNonceLen; ///<Length of the responder nonce
1744  uint8_t localSpi[4];
1745  uint8_t remoteSpi[4];
1746  uint16_t encAlgoId; ///<Encryption algorithm
1747  uint16_t authAlgoId; ///<Integrity algorithm
1748  uint16_t esn; ///<Extended sequence numbers
1749 
1750  uint8_t keyMaterial[IKE_MAX_CHILD_SA_KEY_MAT_LEN]; ///<Keying material
1751  const uint8_t *skai; ///<Integrity protection key (initiator)
1752  const uint8_t *skar; ///<Integrity protection key (responder)
1753  const uint8_t *skei; ///<Encryption key (initiator)
1754  const uint8_t *sker; ///<Encryption key (responder)
1755 
1756  CipherMode cipherMode; ///<Cipher mode of operation
1757  const CipherAlgo *cipherAlgo; ///<Cipher algorithm
1758  const HashAlgo *authHashAlgo; ///<Hash algorithm for HMAC-based integrity calculations
1759  const CipherAlgo *authCipherAlgo; ///<Cipher algorithm for CMAC-based integrity calculations
1760  size_t encKeyLen; ///<Length of the encryption key, in bytes
1761  size_t authKeyLen; ///<Length of the integrity protection key, in bytes
1762  size_t saltLen; ///<Length of the salt, in bytes
1763  size_t ivLen; ///<Length of the initialization vector, in bytes
1764  size_t icvLen; ///<Length of the ICV tag, in bytes
1765  uint8_t iv[8]; ///<Initialization vector
1766 
1769 
1770  bool_t rekeyRequest; ///<Child SA rekey request
1771  bool_t deleteRequest; ///<Child SA delete request
1773 
1774  int_t inboundSa; ///<Inbound SAD entry
1775  int_t outboundSa; ///<Outbound SAD entry
1776 };
1777 
1778 
1779 /**
1780  * @brief IKE settings
1781  **/
1782 
1783 typedef struct
1784 {
1785  OsTaskParameters task; ///<Task parameters
1786  NetInterface *interface; ///<Underlying network interface
1787  const PrngAlgo *prngAlgo; ///<Pseudo-random number generator to be used
1788  void *prngContext; ///<Pseudo-random number generator context
1789  IkeSaEntry *saEntries; ///<IKE SA entries
1790  uint_t numSaEntries; ///<Number of IKE SA entries
1791  IkeChildSaEntry *childSaEntries; ///<Child SA entries
1792  uint_t numChildSaEntries; ///<Number of Child SA entries
1793  systime_t saLifetime; ///<Lifetime of IKE SAs
1794  systime_t childSaLifetime; ///<Lifetime of Child SAs
1795  systime_t reauthPeriod; ///<Reauthentication period
1796 #if (IKE_DPD_SUPPORT == ENABLED)
1797  systime_t dpdPeriod; ///<Dead peer detection period
1798 #endif
1799 #if (IKE_COOKIE_SUPPORT == ENABLED)
1800  IkeCookieGenerateCallback cookieGenerateCallback; ///<Cookie generation callback function
1801  IkeCookieVerifyCallback cookieVerifyCallback; ///<Cookie verification callback function
1802 #endif
1803 #if (IKE_CERT_AUTH_SUPPORT == ENABLED)
1804  IkeCertVerifyCallback certVerifyCallback; ///<Certificate verification callback function
1805 #endif
1806 } IkeSettings;
1807 
1808 
1809 /**
1810  * @brief IKE context
1811  **/
1812 
1814 {
1815  bool_t running; ///<Operational state of IKEv2
1816  bool_t stop; ///<Stop request
1817  OsEvent event; ///<Event object used to poll the underlying socket
1818  OsTaskParameters taskParams; ///<Task parameters
1819  OsTaskId taskId; ///<Task identifier
1820  NetInterface *interface; ///<Underlying network interface
1821  const PrngAlgo *prngAlgo; ///<Pseudo-random number generator to be used
1822  void *prngContext; ///<Pseudo-random number generator context
1823  systime_t saLifetime; ///<Lifetime of IKE SAs
1824  systime_t childSaLifetime; ///<Lifetime of Child SAs
1825  systime_t reauthPeriod; ///<Reauthentication period
1826 #if (IKE_DPD_SUPPORT == ENABLED)
1827  systime_t dpdPeriod; ///<Dead peer detection period
1828 #endif
1829  uint16_t preferredDhGroupNum; ///<Preferred Diffie-Hellman group number
1830  IkeIdType idType; ///<ID type
1831  uint8_t id[IKE_MAX_ID_LEN]; ///<ID
1832  size_t idLen; ///<Length of the ID, in bytes
1833  uint8_t psk[IKE_MAX_PSK_LEN]; ///<Pre-shared key
1834  size_t pskLen; ///<Length of the pre-shared key, in bytes
1835  IkeCertType certType; ///<Certificate type
1836  const char_t *certChain; ///<Entity's certificate chain (PEM format)
1837  size_t certChainLen; ///<Length of the certificate chain
1838  const char_t *privateKey; ///<Entity's private key (PEM format)
1839  size_t privateKeyLen; ///<Length of the private key
1840  char_t password[IKE_MAX_PASSWORD_LEN]; ///<Password used to decrypt the private key
1841 
1842  Socket *socket; ///<Underlying UDP socket
1843  IpAddr localIpAddr; ///<Destination IP address of the received IKE message
1844  IpAddr remoteIpAddr; ///<Source IP address of the received IKE message
1845  uint16_t remotePort; ///<Source port of the received IKE message
1846  IkeSaEntry *sa; ///<IKE SA entries
1847  uint_t numSaEntries; ///<Number of IKE SA entries
1848  IkeChildSaEntry *childSa; ///<Child SA entries
1849  uint_t numChildSaEntries; ///<Number of Child SA entries
1850  uint8_t message[IKE_MAX_MSG_SIZE]; ///<Incoming IKE message
1851  size_t messageLen; ///<Length of the incoming IKE message, in bytes
1852 
1853 #if (IKE_CMAC_AUTH_SUPPORT == ENABLED || IKE_CMAC_PRF_SUPPORT == ENABLED)
1854  CmacContext cmacContext; ///<CMAC context
1855 #endif
1856 #if (IKE_HMAC_AUTH_SUPPORT == ENABLED || IKE_HMAC_PRF_SUPPORT == ENABLED)
1857  HmacContext hmacContext; ///<HMAC context
1858 #endif
1859 #if (IKE_XCBC_MAC_AUTH_SUPPORT == ENABLED || IKE_XCBC_MAC_PRF_SUPPORT == ENABLED)
1860  XcbcMacContext xcbcMacContext; ///<XCBC-MAC context
1861 #endif
1862 
1863 #if (IKE_COOKIE_SUPPORT == ENABLED)
1864  IkeCookieGenerateCallback cookieGenerateCallback; ///<Cookie generation callback function
1865  IkeCookieVerifyCallback cookieVerifyCallback; ///<Cookie verification callback function
1866 #endif
1867 #if (IKE_CERT_AUTH_SUPPORT == ENABLED)
1868  IkeCertVerifyCallback certVerifyCallback; ///<Certificate verification callback function
1869 #endif
1870 };
1871 
1872 
1873 //IKEv2 related functions
1874 void ikeGetDefaultSettings(IkeSettings *settings);
1875 
1876 error_t ikeInit(IkeContext *context, const IkeSettings *settings);
1877 error_t ikeStart(IkeContext *context);
1878 error_t ikeStop(IkeContext *context);
1879 
1881 
1882 error_t ikeSetId(IkeContext *context, IkeIdType idType, const void *id,
1883  size_t idLen);
1884 
1885 error_t ikeSetPsk(IkeContext *context, const uint8_t *psk, size_t pskLen);
1886 
1887 error_t ikeSetCertificate(IkeContext *context, const char_t *certChain,
1888  size_t certChainLen, const char_t *privateKey, size_t privateKeyLen,
1889  const char_t *password);
1890 
1894 
1895 error_t ikeCreateChildSa(IkeContext *context, const IpsecPacketInfo *packet);
1898 
1899 void ikeTask(IkeContext *context);
1900 
1901 void ikeDeinit(IkeContext *context);
1902 
1903 //C++ guard
1904 #ifdef __cplusplus
1905 }
1906 #endif
1907 
1908 #endif
uint16_t remotePort
Definition: ike.h:1629
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP4_ADDRESS
Definition: ike.h:1136
IkeSaState
IKE Security Association state.
Definition: ike.h:1163
@ IKE_TRANSFORM_ID_ENCR_AES_GCM_8
Definition: ike.h:810
DhContext dhContext
Diffie-Hellman context.
Definition: ike.h:1694
@ IKE_CHILD_SA_STATE_DELETE
Definition: ike.h:1199
@ IKE_TRANSFORM_ID_AUTH_AES_CMAC_96
Definition: ike.h:863
@ IKE_TRANSFORM_ID_ENCR_RESERVED
Definition: ike.h:794
@ IKE_NOTIFY_MSG_TYPE_PSK_CONFIRM
Definition: ike.h:1071
@ IKE_ID_TYPE_FC_NAME
Definition: ike.h:953
@ IKE_TRANSFORM_ID_DH_GROUP_CURVE448
Curve448.
Definition: ike.h:901
uint8_t reserved2
Definition: ike.h:1325
size_t encKeyLen
Size of the encryption key, in bytes.
Definition: ike.h:1685
@ IKE_CONFIG_TYPE_REPLY
Definition: ike.h:1124
IkeCertType
Certificate types.
Definition: ike.h:1222
IkeTransformIdEncr
Transform IDs (Encryption Algorithm)
Definition: ike.h:793
X.509 common definitions.
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP4_NETMASK
Definition: ike.h:1137
IkeCookieVerifyCallback cookieVerifyCallback
Cookie verification callback function.
Definition: ike.h:1865
XCBC-MAC algorithm context.
Definition: xcbc_mac.h:54
IpsecSelector selector
Definition: ike.h:1768
@ IKE_TRANSFORM_ID_AUTH_HMAC_SHA2_384_192
Definition: ike.h:868
#define IKE_MAX_MSG_SIZE
Definition: ike.h:166
@ IKE_TRANSFORM_ID_DH_GROUP_MODP_1024
1024-bit MODP Group
Definition: ike.h:881
Collection of key exchange algorithms.
size_t responderNonceLen
Length of the responder nonce.
Definition: ike.h:1743
@ IKE_TRANSFORM_ID_DH_GROUP_ECP_192
192-bit Random ECP Group
Definition: ike.h:894
IkeAuthData
Definition: ike.h:1414
size_t saltLen
Length of the salt, in bytes.
Definition: ike.h:1762
@ IKE_NOTIFY_MSG_TYPE_CLONE_IKE_SA
Definition: ike.h:1078
@ IKE_TRANSFORM_ID_AUTH_HMAC_SHA1_96
Definition: ike.h:857
@ IKE_TS_TYPE_IPV4_ADDR_RANGE
Definition: ike.h:1099
uint8_t initiatorNonce[IKE_MAX_NONCE_SIZE]
Definition: ike.h:1648
IpsecMode
IPsec protocol modes.
Definition: ipsec.h:202
uint8_t code
Definition: coap_common.h:179
int bool_t
Definition: compiler_port.h:53
HMAC algorithm context.
Definition: hmac.h:59
@ IKE_TRANSFORM_ID_PRF_AES128_CMAC
Definition: ike.h:844
IkeContext * context
IKE context.
Definition: ike.h:1732
@ IKE_TRANSFORM_ID_ENCR_AES_CCM_16
Definition: ike.h:809
@ IKE_NOTIFY_MSG_TYPE_IPCOMP_SUPPORTED
Definition: ike.h:1032
@ IKE_TRANSFORM_ID_ENCR_KUZNYECHIK_MGM_KTREE
Definition: ike.h:823
IkeCertReqPayload
Definition: ike.h:1390
uint8_t startAddr[]
Definition: ike.h:1491
uint16_t payloadLength
Definition: ike.h:1283
@ IKE_NOTIFY_MSG_TYPE_INVALID_MESSAGE_ID
Definition: ike.h:1010
@ IKE_TRANSFORM_ID_ENCR_AES_CTR
Definition: ike.h:806
@ IKE_CERT_TYPE_ECDSA_BRAINPOOLP384R1
Definition: ike.h:1231
@ IKE_NOTIFY_MSG_TYPE_ERX_SUPPORTED
Definition: ike.h:1072
uint8_t flags
Definition: ike.h:1263
@ IKE_TRANSFORM_ID_DH_GROUP_NONE
None.
Definition: ike.h:879
@ IKE_NOTIFY_MSG_TYPE_IKEV2_FRAGMENTATION_SUPPORTED
Definition: ike.h:1075
IkeVendorIdPayload
Definition: ike.h:1464
@ IKE_HASH_ALGO_SHA256
Definition: ike.h:1210
@ IKE_NOTIFY_MSG_TYPE_INVALID_SPI
Definition: ike.h:1011
@ IKE_CERT_ENCODING_RAW_RSA_KEY
Raw RSA key (deprecated)
Definition: ike.h:973
@ IKE_NOTIFY_MSG_TYPE_SET_WINDOW_SIZE
Definition: ike.h:1030
@ IKE_IP_PROTOCOL_ID_ICMP
Definition: ike.h:1110
@ IKE_IP_PROTOCOL_ID_TCP
Definition: ike.h:1111
error_t(* IkeCookieVerifyCallback)(IkeContext *context, const IpAddr *ipAddr, const uint8_t *spi, const uint8_t *nonce, size_t nonceLen, const uint8_t *cookie, size_t cookieLen)
Cookie verification callback function.
Definition: ike.h:1598
size_t initiatorNonceLen
Definition: ike.h:1649
uint16_t fragNum
Definition: ike.h:1563
typedef __packed_struct
IKE header.
Definition: ike.h:1251
signed int int_t
Definition: compiler_port.h:49
IkeCookieGenerateCallback cookieGenerateCallback
Cookie generation callback function.
Definition: ike.h:1864
systime_t saLifetime
Lifetime of IKE SAs.
Definition: ike.h:1823
@ IKE_ID_TYPE_NULL
Definition: ike.h:954
@ IKE_NOTIFY_MSG_TYPE_REKEY_SA
Definition: ike.h:1038
@ IKE_NOTIFY_MSG_TYPE_CHILD_SA_NOT_FOUND
Definition: ike.h:1025
#define IKE_MAX_SA_KEY_MAT_LEN
Definition: ike.h:614
IPsec selector.
Definition: ipsec.h:302
uint8_t certEncoding
Definition: ike.h:1376
IP network address.
Definition: ip.h:90
uint16_t authAlgoId
Integrity algorithm.
Definition: ike.h:1747
bool_t stop
Stop request.
Definition: ike.h:1816
bool_t nonAdditionalSas
NO_ADDITIONAL_SAS notification received.
Definition: ike.h:1715
size_t responseLen
Length of the response message, in bytes.
Definition: ike.h:1708
@ IKE_TRANSFORM_ID_AUTH_HMAC_SHA1_160
Definition: ike.h:862
const HashAlgo * authHashAlgo
Hash algorithm for HMAC-based integrity calculations.
Definition: ike.h:1681
@ IKE_NOTIFY_MSG_TYPE_ADDITIONAL_TS_POSSIBLE
Definition: ike.h:1031
@ IKE_HASH_ALGO_SHA1
Definition: ike.h:1209
systime_t dpdStart
Definition: ike.h:1635
uint8_t keyExchangeData[]
Definition: ike.h:1352
#define PrngAlgo
Definition: crypto.h:938
@ IKE_ID_TYPE_IPV4_ADDR
Definition: ike.h:946
IkeIdType idType
ID type.
Definition: ike.h:1830
@ IKE_NOTIFY_MSG_TYPE_NO_PROPOSAL_CHOSEN
Definition: ike.h:1012
error_t ikeSetCertificate(IkeContext *context, const char_t *certChain, size_t certChainLen, const char_t *privateKey, size_t privateKeyLen, const char_t *password)
Load entity's certificate.
Definition: ike.c:426
@ IKE_PAYLOAD_TYPE_CP
Configuration.
Definition: ike.h:742
@ IKE_NOTIFY_MSG_TYPE_ADDITIONAL_IP6_ADDRESS
Definition: ike.h:1043
NetInterface * interface
Underlying network interface.
Definition: ike.h:1820
const char_t * certChain
Entity's certificate chain (PEM format)
Definition: ike.h:1836
IkeTransformAttrFormat
Transform attribute format.
Definition: ike.h:923
const CipherAlgo * cipherAlgo
Cipher algorithm.
Definition: ike.h:1757
IkeKePayload
Definition: ike.h:1353
IkeChildSaEntry * childSa
Child SA.
Definition: ike.h:1627
@ IKE_TRANSFORM_ID_ENCR_CAMELLIA_CBC
Definition: ike.h:814
@ IKE_ID_TYPE_DER_ASN1_DN
Definition: ike.h:950
@ IKE_CERT_TYPE_RSA_PSS
Definition: ike.h:1225
@ IKE_TRANSFORM_ID_ENCR_IDEA
Definition: ike.h:799
@ IKE_TRANSFORM_ID_AUTH_AES_128_GMAC
Definition: ike.h:864
@ IKE_TRANSFORM_ID_AUTH_HMAC_MD5_96
Definition: ike.h:856
@ IKE_TRANSFORM_ID_DH_GROUP_MODP_4096
4096-bit MODP Group
Definition: ike.h:885
@ IKE_SA_STATE_DELETE_REQ
Definition: ike.h:1175
IkeConfigPayload
Definition: ike.h:1516
@ IKE_CONFIG_TYPE_REQUEST
Definition: ike.h:1123
error_t ikeSetPsk(IkeContext *context, const uint8_t *psk, size_t pskLen)
Set entity's pre-shared key.
Definition: ike.c:388
uint16_t proposalLength
Definition: ike.h:1306
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP6_LINK
Definition: ike.h:1149
@ IKE_CERT_ENCODING_DNS_SIGNED_KEY
DNS signed key.
Definition: ike.h:966
@ IKE_LAST_SUBSTRUC_MORE_TRANSFORMS
More transform substructures.
Definition: ike.h:758
@ IKE_AUTH_METHOD_ECDSA_P521_SHA512
ECDSA with SHA-512 on the P-521 curve.
Definition: ike.h:992
IpAddr startAddr
Definition: ike.h:1609
Collection of AEAD algorithms.
size_t peerIdLen
Length of the peer ID, in bytes.
Definition: ike.h:1655
@ IKE_TRANSFORM_ID_DH_GROUP_MODP_2048
2048-bit MODP Group
Definition: ike.h:883
uint8_t reserved
Definition: ike.h:1280
IpsecMode mode
IPsec mode (tunnel or transport)
Definition: ike.h:1736
uint8_t idData[]
Definition: ike.h:1365
@ IKE_NOTIFY_MSG_TYPE_PUZZLE
Definition: ike.h:1079
@ IKE_CONFIG_ATTR_TYPE_MIP6_HOME_PREFIX
Definition: ike.h:1148
@ IKE_TRANSFORM_ID_DH_GROUP_MODP_8192
8192-bit MODP Group
Definition: ike.h:887
Event object.
int_t inboundSa
Inbound SAD entry.
Definition: ike.h:1774
Generic cipher algorithm context.
uint32_t signHashAlgos
List of hash algorithms supported by the peer.
Definition: ike.h:1720
IkeNotifyPayload
Definition: ike.h:1439
@ IKE_TRANSFORM_TYPE_DH
Diffie-Hellman Group.
Definition: ike.h:783
uint8_t numTransforms
Definition: ike.h:1310
IpsecPacketInfo packetInfo
Definition: ike.h:1767
@ IKE_TRANSFORM_ID_ESN_NO
No Extended Sequence Numbers.
Definition: ike.h:913
size_t encKeyLen
Length of the encryption key, in bytes.
Definition: ike.h:1760
@ IKE_AUTH_METHOD_GSPAM
Generic Secure Password Authentication Method.
Definition: ike.h:993
uint_t numChildSaEntries
Number of Child SA entries.
Definition: ike.h:1792
@ IKE_NOTIFY_MSG_TYPE_UPDATE_SA_ADDRESSES
Definition: ike.h:1045
systime_t dpdPeriod
Dead peer detection period.
Definition: ike.h:1827
@ IKE_TRANSFORM_ID_ENCR_CAST
Definition: ike.h:800
size_t responderNonceLen
Definition: ike.h:1651
IpAddr remoteIpAddr
Source IP address of the received IKE message.
Definition: ike.h:1844
IkeSaEntry * newSa
New IKE SA.
Definition: ike.h:1626
@ IKE_AUTH_METHOD_RSA
RSA Digital Signature.
Definition: ike.h:987
IpAddr endAddr
Definition: ike.h:1610
@ IKE_PROTOCOL_ID_AH
AH protocol.
Definition: ike.h:769
@ IKE_TRANSFORM_ID_ENCR_CAMELLIA_CCM_8
Definition: ike.h:816
@ IKE_EXCHANGE_TYPE_IKE_SESSION_RESUME
IKE_SESSION_RESUME.
Definition: ike.h:704
uint8_t configType
Definition: ike.h:1513
@ IKE_LAST_SUBSTRUC_LAST
Last proposal/transform substructure.
Definition: ike.h:756
uint8_t keyMaterial[IKE_MAX_CHILD_SA_KEY_MAT_LEN]
Keying material.
Definition: ike.h:1750
@ IKE_NOTIFY_MSG_TYPE_USE_WESP_MODE
Definition: ike.h:1060
size_t icvLen
Length of the ICV tag, in bytes.
Definition: ike.h:1690
IkePayloadHeader
Definition: ike.h:1284
IkeNotifyMsgType notifyMsgType
Definition: ike.h:1657
@ IKE_PAYLOAD_TYPE_CERTREQ
Certificate Request.
Definition: ike.h:733
error_t ikeRekeyChildSa(IkeChildSaEntry *childSa)
uint8_t value[]
Definition: ike.h:1339
IkeContext * context
IKE context.
Definition: ike.h:1624
@ IKE_TRANSFORM_ID_ENCR_CAMELLIA_CCM_16
Definition: ike.h:818
IkeIdType peerIdType
Peer ID type.
Definition: ike.h:1653
size_t prfKeyLen
Preferred size of the PRF key, in bytes.
Definition: ike.h:1687
@ IKE_TRANSFORM_ID_ENCR_MAGMA_MGM_MAC_KTREE
Definition: ike.h:826
uint8_t protocolId
Definition: ike.h:1308
systime_t reauthPeriod
Reauthentication period.
Definition: ike.h:1633
@ IKE_NOTIFY_MSG_TYPE_SENDER_REQUEST_ID
Definition: ike.h:1074
@ IKE_TRANSFORM_ID_DH_GROUP_GOST3410_2012_256
GOST3410_2012_256.
Definition: ike.h:902
systime_t timestamp
Definition: ike.h:1638
IkeSaEntry * sa
IKE SA entries.
Definition: ike.h:1846
@ IKE_TRANSFORM_ID_AUTH_AES_192_GMAC
Definition: ike.h:865
@ IKE_NOTIFY_MSG_TYPE_IFOM_CAPABILITY
Definition: ike.h:1073
error_t ikeRekeySa(IkeSaEntry *sa)
@ IKE_NOTIFY_MSG_TYPE_ROHC_SUPPORTED
Definition: ike.h:1061
bool_t rekeyRequest
Child SA rekey request.
Definition: ike.h:1770
IkeIdType
ID types.
Definition: ike.h:944
@ IKE_NOTIFY_MSG_TYPE_TICKET_NACK
Definition: ike.h:1057
@ IKE_TRANSFORM_ID_ENCR_CHACHA20_POLY1305_IIV
Definition: ike.h:822
uint8_t * initiatorSaInit
Pointer to the IKE_SA_INIT request.
Definition: ike.h:1700
@ IKE_IP_PROTOCOL_ID_UDP
Definition: ike.h:1112
uint8_t iv[8]
Initialization vector.
Definition: ike.h:1691
@ IKE_TRANSFORM_ID_ENCR_DES_IV64
Definition: ike.h:795
@ IKE_TRANSFORM_ID_ENCR_AES_GCM_16_IIV
Definition: ike.h:821
IkePayloadType
Payload types.
Definition: ike.h:726
@ IKE_CERT_ENCODING_HASH_URL_X509_BUNDLE
Hash and URL of X.509 bundle.
Definition: ike.h:975
error_t ikeCreateSa(IkeContext *context, const IpsecPacketInfo *packet)
const HashAlgo * prfHashAlgo
Hash algorithm for HMAC-based PRF calculations.
Definition: ike.h:1683
uint16_t remotePort
Source port of the received IKE message.
Definition: ike.h:1845
const uint8_t * skd
Key used for deriving new keys for Child SAs.
Definition: ike.h:1670
@ IKE_CERT_TYPE_ECDSA_P384
Definition: ike.h:1228
void ikeTask(IkeContext *context)
IKE task.
Definition: ike.c:714
uint32_t messageId
Definition: ike.h:1264
uint16_t dhGroupNum
Definition: ike.h:1350
systime_t timeout
Definition: ike.h:1639
@ IKE_AUTH_METHOD_NULL
NULL Authentication.
Definition: ike.h:994
IkeTransform
Definition: ike.h:1328
@ IKE_TRANSFORM_ID_DH_GROUP_CURVE25519
Curve25519.
Definition: ike.h:900
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_DNS_DOMAIN
Definition: ike.h:1153
const uint8_t * skei
Encryption key (initiator)
Definition: ike.h:1753
@ IKE_TRANSFORM_ID_DH_GROUP_BRAINPOOLP224R1
224-bit Brainpool ECP Group
Definition: ike.h:896
uint8_t response[IKE_MAX_MSG_SIZE]
Response message.
Definition: ike.h:1707
uint8_t initiatorNonce[IKE_MAX_NONCE_SIZE]
Initiator nonce.
Definition: ike.h:1740
uint8_t proposals[]
Definition: ike.h:1294
@ IKE_NOTIFY_MSG_TYPE_SIGNATURE_HASH_ALGORITHMS
Definition: ike.h:1076
@ IKE_TRANSFORM_ID_ENCR_CHACHA20_POLY1305
Definition: ike.h:819
IkeCertType certType
Certificate type.
Definition: ike.h:1835
@ IKE_ATTR_FORMAT_TV
shortened Type/Value format
Definition: ike.h:925
@ IKE_TRANSFORM_ID_AUTH_AES_XCBC_96
Definition: ike.h:860
CipherMode cipherMode
Cipher mode of operation.
Definition: ike.h:1678
uint8_t responderNonce[IKE_MAX_NONCE_SIZE]
Responder nonce.
Definition: ike.h:1742
EcdhContext ecdhContext
ECDH context.
Definition: ike.h:1697
@ IKE_SA_STATE_CLOSED
Definition: ike.h:1164
@ IKE_TRANSFORM_ID_PRF_HMAC_SHA2_384
Definition: ike.h:842
bool_t initialContact
INITIAL_CONTACT notification received.
Definition: ike.h:1717
@ IKE_CHILD_SA_STATE_REKEY
Definition: ike.h:1198
@ IKE_NOTIFY_MSG_TYPE_USE_AGGFRAG
Definition: ike.h:1087
@ IKE_NOTIFY_MSG_TYPE_NAT_DETECTION_SOURCE_IP
Definition: ike.h:1033
IkeAuthMethod
Authentication methods.
Definition: ike.h:986
@ IKE_SA_STATE_REKEY_REQ
Definition: ike.h:1173
@ IKE_CERT_TYPE_ECDSA_BRAINPOOLP256R1
Definition: ike.h:1230
error_t ikeCreateChildSa(IkeContext *context, const IpsecPacketInfo *packet)
Create a new Child SA.
Definition: ike.c:577
uint8_t identifier
Definition: ike.h:1549
@ IKE_CONFIG_TYPE_ACK
Definition: ike.h:1126
@ IKE_TRANSFORM_TYPE_ESN
Extended Sequence Numbers.
Definition: ike.h:784
@ IKE_NOTIFY_MSG_TYPE_TS_UNACCEPTABLE
Definition: ike.h:1019
size_t saltLen
Length of the salt, in bytes.
Definition: ike.h:1688
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_DNSSEC_TA
Definition: ike.h:1154
IkeCertVerifyCallback certVerifyCallback
Certificate verification callback function.
Definition: ike.h:1804
#define IKE_MAX_SHARED_SECRET_LEN
Definition: ike.h:656
IkeCertVerifyCallback certVerifyCallback
Certificate verification callback function.
Definition: ike.h:1868
@ IKE_TRANSFORM_ID_DH_GROUP_ECP_224
224-bit Random ECP Group
Definition: ike.h:895
@ IKE_NOTIFY_MSG_TYPE_LINK_ID
Definition: ike.h:1059
systime_t dpdPeriod
Dead peer detection period.
Definition: ike.h:1636
IpsecProtocol protocol
Security protocol (AH or ESP)
Definition: ike.h:1737
@ IKE_NOTIFY_MSG_TYPE_NAT_DETECTION_DESTINATION_IP
Definition: ike.h:1034
@ IKE_TRANSFORM_ID_ENCR_AES_CBC
Definition: ike.h:805
@ IKE_PAYLOAD_TYPE_EAP
Extensible Authentication.
Definition: ike.h:743
@ IKE_ID_TYPE_DER_ASN1_GN
Definition: ike.h:951
@ IKE_TRANSFORM_ATTR_TYPE_KEY_LEN
Key Length (in bits)
Definition: ike.h:935
Traffic selector parameters.
Definition: ike.h:1608
uint8_t spi[]
Definition: ike.h:1311
uint8_t majorVersion
Definition: ike.h:1260
const char_t * privateKey
Entity's private key (PEM format)
Definition: ike.h:1838
const uint8_t * skar
Integrity protection key (responder)
Definition: ike.h:1672
#define IkeContext
Definition: ike.h:678
IkeAuthPayload
Definition: ike.h:1403
uint_t numSaEntries
Number of IKE SA entries.
Definition: ike.h:1790
@ IKE_NOTIFY_MSG_TYPE_FAILED_CP_REQUIRED
Definition: ike.h:1018
size_t icvLen
Length of the ICV tag, in bytes.
Definition: ike.h:1764
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP6_DHCP
Definition: ike.h:1144
@ IKE_NOTIFY_MSG_TYPE_IPSEC_REPLAY_COUNTER_SYNC
Definition: ike.h:1068
@ IKE_EXCHANGE_TYPE_IKE_AUTH
IKE_AUTH.
Definition: ike.h:701
@ IKE_SA_STATE_DELETE_CHILD_RESP
Definition: ike.h:1182
OsTaskParameters taskParams
Task parameters.
Definition: ike.h:1818
@ IKE_ID_TYPE_IPV6_ADDR
Definition: ike.h:949
size_t requestLen
Length of the request message, in bytes.
Definition: ike.h:1706
@ IKE_NOTIFY_MSG_TYPE_CHILDLESS_IKEV2_SUPPORTED
Definition: ike.h:1063
uint8_t psk[IKE_MAX_PSK_LEN]
Pre-shared key.
Definition: ike.h:1833
Diffie-Hellman context.
Definition: dh.h:60
uint16_t authAlgoId
Integrity algorithm.
Definition: ike.h:1664
@ IKE_NOTIFY_MSG_TYPE_INVALID_SELECTORS
Definition: ike.h:1020
IKE context.
Definition: ike.h:1814
@ IKE_NOTIFY_MSG_TYPE_ANOTHER_AUTH_FOLLOWS
Definition: ike.h:1050
@ IKE_ATTR_FORMAT_TLV
Type/Length/Value format.
Definition: ike.h:924
uint16_t notifyMsgType
Definition: ike.h:1437
systime_t reauthPeriod
Reauthentication period.
Definition: ike.h:1825
IkeHashAlgo
Hash algorithms.
Definition: ike.h:1208
systime_t childSaLifetime
Lifetime of Child SAs.
Definition: ike.h:1824
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP4_SUBNET
Definition: ike.h:1145
@ IKE_NOTIFY_MSG_TYPE_IP4_ALLOWED
Definition: ike.h:1084
uint16_t prfAlgoId
Pseudorandom function.
Definition: ike.h:1663
@ IKE_SA_STATE_RESERVED
Definition: ike.h:1165
X.509 certificate.
Definition: x509_common.h:1071
IkeSaState state
IKE SA state.
Definition: ike.h:1623
systime_t dpdPeriod
Dead peer detection period.
Definition: ike.h:1797
@ IKE_FLAGS_I
Initiator flag.
Definition: ike.h:717
@ IKE_SA_STATE_OPEN
Definition: ike.h:1170
error_t
Error codes.
Definition: error.h:43
@ IKE_CERT_TYPE_INVALID
Definition: ike.h:1223
uint8_t notifyProtocolId
Definition: ike.h:1659
OsEvent event
Event object used to poll the underlying socket.
Definition: ike.h:1817
IkeChildSaEntry * childSa
Child SA entries.
Definition: ike.h:1848
@ IKE_PAYLOAD_TYPE_SK
Encrypted and Authenticated.
Definition: ike.h:741
@ IKE_TRANSFORM_ID_DH_GROUP_MODP_768
768-bit MODP Group
Definition: ike.h:880
IkeIdPayload
Definition: ike.h:1366
uint8_t algoId[]
Definition: ike.h:1413
@ IKE_SA_STATE_AUTH_FAILURE_RESP
Definition: ike.h:1184
@ IKE_TRANSFORM_ID_PRF_RESERVED
Definition: ike.h:836
systime_t lifetimeStart
Definition: ike.h:1739
@ IKE_PAYLOAD_TYPE_AUTH
Authentication.
Definition: ike.h:734
@ IKE_TRANSFORM_ID_ENCR_NULL
Definition: ike.h:804
bool_t originalInitiator
Original initiator of the IKE SA.
Definition: ike.h:1630
@ IKE_PAYLOAD_TYPE_CERT
Certificate.
Definition: ike.h:732
bool_t deleteRequest
IKE SA delete request.
Definition: ike.h:1713
uint8_t spiSize
Definition: ike.h:1309
@ IKE_SA_STATE_REKEY_CHILD_REQ
Definition: ike.h:1179
IkeTsPayload
Definition: ike.h:1477
size_t ivLen
Length of the initialization vector, in bytes.
Definition: ike.h:1763
@ IKE_AUTH_METHOD_DIGITAL_SIGN
Digital Signature.
Definition: ike.h:995
bool_t reauthPending
Reauthentication process is on-going.
Definition: ike.h:1712
size_t idLen
Length of the ID, in bytes.
Definition: ike.h:1832
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP4_DHCP
Definition: ike.h:1140
size_t certChainLen
Length of the certificate chain.
Definition: ike.h:1837
uint8_t ipProtocolId
Definition: ike.h:1611
@ IKE_EXCHANGE_TYPE_IKE_INTERMEDIATE
IKE_INTERMEDIATE.
Definition: ike.h:705
IkeLastSubstruc
Last Substruc values.
Definition: ike.h:755
@ IKE_NOTIFY_MSG_TYPE_NO_NATS_ALLOWED
Definition: ike.h:1047
const CipherAlgo * authCipherAlgo
Cipher algorithm for CMAC-based integrity calculations.
Definition: ike.h:1759
systime_t lifetimeStart
Definition: ike.h:1631
uint16_t encAlgoId
Encryption algorithm.
Definition: ike.h:1746
const PrngAlgo * prngAlgo
Pseudo-random number generator to be used.
Definition: ike.h:1821
const uint8_t * sker
Encryption key (responder)
Definition: ike.h:1674
uint8_t proposalNum
Definition: ike.h:1307
@ IKE_TRANSFORM_ID_ENCR_KUZNYECHIK_MGM_MAC_KTREE
Definition: ike.h:825
#define IKE_SPI_SIZE
Definition: ike.h:672
@ IKE_HASH_ALGO_SHA512
Definition: ike.h:1212
HmacContext hmacContext
HMAC context.
Definition: ike.h:1857
IkeChildSaState
Child Security Association state.
Definition: ike.h:1193
NetInterface * interface
Underlying network interface.
Definition: ike.h:1786
@ IKE_SA_STATE_INIT_REQ
Definition: ike.h:1166
const PrngAlgo * prngAlgo
Pseudo-random number generator to be used.
Definition: ike.h:1787
@ IKE_SA_STATE_AUTH_REQ
Definition: ike.h:1168
@ IKE_PROTOCOL_ID_ESP
ESP protocol.
Definition: ike.h:770
error_t ikeStart(IkeContext *context)
Start IKE service.
Definition: ike.c:207
#define IKE_MAX_NONCE_SIZE
Definition: ike.h:201
size_t ivLen
Length of the initialization vector, in bytes.
Definition: ike.h:1689
#define NetInterface
Definition: net.h:36
@ IKE_NOTIFY_MSG_TYPE_NO_PPK_AUTH
Definition: ike.h:1082
IpAddr remoteIpAddr
IP address of the peer.
Definition: ike.h:1628
@ IKE_TRANSFORM_ID_PRF_HMAC_MD5
Definition: ike.h:837
@ IKE_NOTIFY_MSG_TYPE_PPK_IDENTITY
Definition: ike.h:1081
@ IKE_NOTIFY_MSG_TYPE_QUICK_CRASH_DETECTION
Definition: ike.h:1064
#define IKE_MAX_PASSWORD_LEN
Definition: ike.h:222
error_t ikeStop(IkeContext *context)
Stop IKE service.
Definition: ike.c:290
uint8_t localSpi[4]
Definition: ike.h:1744
@ IKE_CERT_ENCODING_PGP_CERT
PGP certificate.
Definition: ike.h:965
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP6_DNS
Definition: ike.h:1143
const uint8_t * skai
Integrity protection key (initiator)
Definition: ike.h:1671
@ IKE_TRANSFORM_ID_DH_GROUP_BRAINPOOLP512R1
512-bit Brainpool ECP Group
Definition: ike.h:899
#define IKE_MAX_ID_LEN
Definition: ike.h:208
@ IKE_IP_PROTOCOL_ID_ICMPV6
Definition: ike.h:1113
IkeExchangeType
Exchange types.
Definition: ike.h:699
uint32_t txMessageId
Definition: ike.h:1641
uint8_t iv[8]
Initialization vector.
Definition: ike.h:1765
uint16_t startPort
Definition: ike.h:1489
uint8_t exchangeType
Definition: ike.h:1262
uint8_t ipProtocolId
Definition: ike.h:1487
@ IKE_TRANSFORM_ID_PRF_HMAC_SHA1
Definition: ike.h:838
@ IKE_NOTIFY_MSG_TYPE_R_U_THERE
Definition: ike.h:1088
@ IKE_CERT_ENCODING_X509_CERT_ATTR
X.509 certificate - attribute.
Definition: ike.h:972
@ IKE_NOTIFY_MSG_TYPE_MOBIKE_SUPPORTED
Definition: ike.h:1041
#define IKE_MAX_PSK_LEN
Definition: ike.h:215
uint16_t endPort
Definition: ike.h:1490
@ IKE_TRANSFORM_ID_ENCR_AES_GCM_12
Definition: ike.h:811
@ IKE_CHILD_SA_STATE_INIT
Definition: ike.h:1196
@ IKE_CONFIG_ATTR_TYPE_P_CSCF_IP6_ADDRESS
Definition: ike.h:1152
IkeCookieGenerateCallback cookieGenerateCallback
Cookie generation callback function.
Definition: ike.h:1800
IkeTransformAttr
Definition: ike.h:1340
@ IKE_CERT_ENCODING_OCSP_CONTENT
OCSP Content.
Definition: ike.h:976
@ IKE_TRANSFORM_ID_ENCR_AES_CCM_8_IIV
Definition: ike.h:820
@ IKE_PAYLOAD_TYPE_V
Vendor ID.
Definition: ike.h:738
uint8_t certAuthority[]
Definition: ike.h:1389
uint8_t authMethod
Definition: ike.h:1400
uint8_t iv[]
Definition: ike.h:1502
uint8_t idType
Definition: ike.h:1363
@ IKE_TRANSFORM_ID_ENCR_MAGMA_MGM_KTREE
Definition: ike.h:824
uint8_t transformType
Definition: ike.h:1324
@ IKE_PAYLOAD_TYPE_IDI
Identification - Initiator.
Definition: ike.h:730
@ IKE_NOTIFY_MSG_TYPE_REDIRECTED_FROM
Definition: ike.h:1053
error_t(* IkeCertVerifyCallback)(IkeSaEntry *sa, const X509CertInfo *certInfo, uint_t pathLen)
Certificate verification callback function.
Definition: ike.h:1581
XcbcMacContext xcbcMacContext
XCBC-MAC context.
Definition: ike.h:1860
Task parameters.
void * prngContext
Pseudo-random number generator context.
Definition: ike.h:1788
bool_t initiator
Initiator of the CREATE_CHILD_SA exchange.
Definition: ike.h:1738
@ IKE_TRANSFORM_ID_ENCR_BLOWFISH
Definition: ike.h:801
@ IKE_TRANSFORM_ID_DH_GROUP_MODP_1536
1536-bit MODP Group
Definition: ike.h:882
error_t ikeSetPreferredDhGroup(IkeContext *context, uint16_t dhGroupNum)
Specify the preferred Diffie-Hellman group.
Definition: ike.c:332
@ IKE_TRANSFORM_TYPE_ENCR
Encryption Algorithm.
Definition: ike.h:780
@ IKE_TRANSFORM_ID_ENCR_DES_IV32
Definition: ike.h:803
@ IKE_TRANSFORM_ID_PRF_AES128_XCBC
Definition: ike.h:840
@ IKE_TRANSFORM_ID_AUTH_HMAC_MD5_128
Definition: ike.h:861
uint8_t transformAttr[]
Definition: ike.h:1327
uint16_t numSpi
Definition: ike.h:1451
@ IKE_CERT_ENCODING_HASH_URL_X509_CERT
Hash and URL of X.509 certificate.
Definition: ike.h:974
systime_t lifetime
Lifetime of the IKE SA.
Definition: ike.h:1632
IkeHeader
Definition: ike.h:1266
@ IKE_TRANSFORM_ID_DH_GROUP_MODP_2048_224
2048-bit MODP Group with 224-bit Prime Order Subgroup
Definition: ike.h:892
IkeIpProtocolId
IP protocol IDs.
Definition: ike.h:1109
@ IKE_NOTIFY_MSG_TYPE_USE_PPK
Definition: ike.h:1080
@ IKE_NOTIFY_MSG_TYPE_IP6_ALLOWED
Definition: ike.h:1085
@ IKE_EXCHANGE_TYPE_CREATE_CHILD_SA
CREATE_CHILD_SA.
Definition: ike.h:702
uint8_t * responderSaInit
Pointer to the IKE_SA_INIT response.
Definition: ike.h:1702
uint16_t transformLength
Definition: ike.h:1323
@ IKE_NOTIFY_MSG_TYPE_TICKET_OPAQUE
Definition: ike.h:1058
IkeSaEntry * sa
IKE SA entry.
Definition: ike.h:1733
error_t ikeDeleteSa(IkeSaEntry *sa)
Delete an IKE SA.
Definition: ike.c:542
CipherMode
Cipher operation modes.
Definition: crypto.h:962
@ IKE_NOTIFY_MSG_TYPE_UNEXPECTED_NAT_DETECTED
Definition: ike.h:1022
@ IKE_AUTH_METHOD_SHARED_KEY
Shared Key Message Integrity Code.
Definition: ike.h:988
IkeTransformType
Transform types.
Definition: ike.h:779
@ IKE_CERT_TYPE_DSA
Definition: ike.h:1226
@ IKE_NOTIFY_MSG_TYPE_HTTP_CERT_LOOKUP_SUPPORTED
Definition: ike.h:1037
@ IKE_TRANSFORM_ID_DH_GROUP_ECP_384
384-bit Random ECP Group
Definition: ike.h:889
IkeCertEncoding
Certificate encodings.
Definition: ike.h:963
@ IKE_CONFIG_ATTR_TYPE_SUPPORTED_ATTRIBUTES
Definition: ike.h:1146
@ IKE_TRANSFORM_ID_PRF_HMAC_SHA2_256
Definition: ike.h:841
@ IKE_NOTIFY_MSG_TYPE_ESP_TFC_PADDING_NOT_SUPPORTED
Definition: ike.h:1039
@ IKE_CHILD_SA_STATE_CLOSED
Definition: ike.h:1194
error_t(* IkeCookieGenerateCallback)(IkeContext *context, const IpAddr *ipAddr, const uint8_t *spi, const uint8_t *nonce, size_t nonceLen, uint8_t *cookie, size_t *cookieLen)
Cookie generation callback function.
Definition: ike.h:1589
IkeEncryptedPayload
Definition: ike.h:1503
@ IKE_CERT_ENCODING_CRL
Certificate revocation list.
Definition: ike.h:969
CMAC algorithm context.
Definition: cmac.h:54
uint8_t eapMessage[]
Definition: ike.h:1538
IpsecProtocol
Security protocols.
Definition: ipsec.h:190
uint8_t configAttributes[]
Definition: ike.h:1515
@ IKE_NOTIFY_MSG_TYPE_STATE_NOT_FOUND
Definition: ike.h:1028
@ IKE_CONFIG_ATTR_TYPE_APPLICATION_VERSION
Definition: ike.h:1141
@ IKE_CERT_TYPE_RSA
Definition: ike.h:1224
@ IKE_NOTIFY_MSG_TYPE_NON_FIRST_FRAGMENTS_ALSO
Definition: ike.h:1040
@ IKE_CERT_TYPE_ECDSA_BRAINPOOLP512R1
Definition: ike.h:1232
@ IKE_TRANSFORM_ID_DH_GROUP_GOST3410_2012_512
GOST3410_2012_512.
Definition: ike.h:903
@ IKE_TRANSFORM_ID_AUTH_HMAC_SHA2_256_128
Definition: ike.h:867
size_t authKeyLen
Size of the integrity protection key, in bytes.
Definition: ike.h:1686
IkeDeletePayload
Definition: ike.h:1453
#define IKE_MAX_COOKIE_SIZE
Definition: ike.h:180
uint16_t preferredDhGroupNum
Preferred Diffie-Hellman group number.
Definition: ike.h:1829
uint16_t encAlgoId
Encryption algorithm.
Definition: ike.h:1662
@ IKE_TRANSFORM_ID_ENCR_DES
Definition: ike.h:796
size_t privateKeyLen
Length of the private key.
Definition: ike.h:1839
bool_t deleteReceived
Definition: ike.h:1772
@ IKE_CERT_TYPE_ED25519
Definition: ike.h:1233
@ IKE_CERT_TYPE_ED448
Definition: ike.h:1234
bool_t deleteRequest
Child SA delete request.
Definition: ike.h:1771
uint8_t unsupportedCriticalPayload
Definition: ike.h:1658
uint8_t numTs
Definition: ike.h:1474
@ IKE_NOTIFY_MSG_TYPE_AUTHORIZATION_FAILED
Definition: ike.h:1027
uint32_t systime_t
System time.
@ IKE_TRANSFORM_ID_AUTH_KPDK_MD5
Definition: ike.h:859
uint16_t startPort
Definition: ike.h:1612
@ IKE_TRANSFORM_ID_AUTH_AES_256_GMAC
Definition: ike.h:866
const uint8_t * skai
Integrity protection key (initiator)
Definition: ike.h:1751
IkeTs
Definition: ike.h:1492
@ IKE_TRANSFORM_ID_ENCR_NULL_AUTH_AES_GMAC
Definition: ike.h:813
uint8_t message[IKE_MAX_MSG_SIZE]
Incoming IKE message.
Definition: ike.h:1850
@ IKE_CONFIG_TYPE_SET
Definition: ike.h:1125
IkeProposal
Definition: ike.h:1312
@ IKE_SA_STATE_CREATE_CHILD_REQ
Definition: ike.h:1177
char char_t
Definition: compiler_port.h:48
@ IKE_CERT_ENCODING_PKCS7_X509_CERT
PKCS #7 wrapped X.509 certificate.
Definition: ike.h:964
@ IKE_PAYLOAD_TYPE_PS
Puzzle Solution.
Definition: ike.h:746
@ IKE_EXCHANGE_TYPE_IKE_SA_INIT
IKE_SA_INIT.
Definition: ike.h:700
@ IKE_PAYLOAD_TYPE_NONCE
Nonce.
Definition: ike.h:735
@ IKE_NOTIFY_MSG_TYPE_INVALID_KE_PAYLOAD
Definition: ike.h:1013
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP6_SUBNET
Definition: ike.h:1147
uint8_t initiatorSpi[IKE_SPI_SIZE]
Initiator SPI.
Definition: ike.h:1645
size_t messageLen
Length of the incoming IKE message, in bytes.
Definition: ike.h:1851
IKE settings.
Definition: ike.h:1784
@ IKE_TRANSFORM_ID_PRF_HMAC_STREEBOG_512
Definition: ike.h:845
#define IkeSaEntry
Definition: ike.h:682
uint8_t minorVersion
Definition: ike.h:1259
@ IKE_TRANSFORM_ID_DH_GROUP_MODP_1024_160
1024-bit MODP Group with 160-bit Prime Order Subgroup
Definition: ike.h:891
bool_t rekeyRequest
IKE SA rekey request.
Definition: ike.h:1710
@ IKE_TRANSFORM_ID_ENCR_3DES
Definition: ike.h:797
int_t outboundSa
Outbound SAD entry.
Definition: ike.h:1775
@ IKE_TRANSFORM_ID_ENCR_AES_GCM_16
Definition: ike.h:812
IkeSaEntry * oldSa
Old IKE SA.
Definition: ike.h:1625
@ IKE_NOTIFY_MSG_TYPE_INTERMEDIATE_EXCHANGE_SUPPORTED
Definition: ike.h:1083
@ IKE_NOTIFY_MSG_TYPE_NO_ADDITIONAL_SAS
Definition: ike.h:1016
void ikeDeinit(IkeContext *context)
Release IKE context.
Definition: ike.c:777
IkeChildSaEntry * oldChildSa
Old Child SA.
Definition: ike.h:1734
@ IKE_NOTIFY_MSG_TYPE_UNSUPPORTED_CRITICAL_PAYLOAD
Definition: ike.h:1006
CipherMode cipherMode
Cipher mode of operation.
Definition: ike.h:1756
IkeConfigAttr
Definition: ike.h:1528
IPsec (IP security)
systime_t childSaLifetime
Lifetime of Child SAs.
Definition: ike.h:1794
@ IKE_TRANSFORM_ID_PRF_HMAC_TIGER
Definition: ike.h:839
uint8_t responderSpi[IKE_SPI_SIZE]
Definition: ike.h:1253
@ IKE_NOTIFY_MSG_TYPE_NONE
Definition: ike.h:1005
uint8_t peerId[IKE_MAX_ID_LEN]
Peer ID.
Definition: ike.h:1654
@ IKE_PAYLOAD_TYPE_SKF
Encrypted and Authenticated Fragment.
Definition: ike.h:745
@ IKE_TRANSFORM_ID_DH_GROUP_MODP_3072
3072-bit MODP Group
Definition: ike.h:884
CmacContext cmacContext
CMAC context.
Definition: ike.h:1854
uint8_t trafficSelectors[]
Definition: ike.h:1476
@ IKE_SA_STATE_REKEY_CHILD_RESP
Definition: ike.h:1180
IkeCertPayload
Definition: ike.h:1378
error_t ikeInit(IkeContext *context, const IkeSettings *settings)
IKE service initialization.
Definition: ike.c:109
IkeEapMessage
Definition: ike.h:1553
uint8_t request[IKE_MAX_MSG_SIZE]
Request message.
Definition: ike.h:1705
size_t initiatorSaInitLen
Length of the IKE_SA_INIT request, in bytes.
Definition: ike.h:1701
error_t ikeSetId(IkeContext *context, IkeIdType idType, const void *id, size_t idLen)
Set entity's ID.
Definition: ike.c:359
IkeChildSaEntry * childSaEntries
Child SA entries.
Definition: ike.h:1791
uint8_t notifySpi[4]
Definition: ike.h:1660
IP packet information.
Definition: ipsec.h:316
uint8_t data[]
Definition: ike.h:1552
@ IKE_TRANSFORM_ID_ENCR_AES_CCM_12
Definition: ike.h:808
OsTaskParameters task
Task parameters.
Definition: ike.h:1785
const uint8_t * skei
Encryption key (initiator)
Definition: ike.h:1673
@ IKE_TRANSFORM_TYPE_PRF
Pseudorandom Function.
Definition: ike.h:781
@ IKE_TRANSFORM_ID_ESN_YES
Extended Sequence Numbers.
Definition: ike.h:914
const HashAlgo * authHashAlgo
Hash algorithm for HMAC-based integrity calculations.
Definition: ike.h:1758
@ IKE_NOTIFY_MSG_TYPE_TICKET_LT_OPAQUE
Definition: ike.h:1054
IpAddr localIpAddr
Destination IP address of the received IKE message.
Definition: ike.h:1843
const uint8_t * sker
Encryption key (responder)
Definition: ike.h:1754
IkeEncryptedFragPayload
Definition: ike.h:1566
const uint8_t * skpr
Key used for generating AUTH payload (responder)
Definition: ike.h:1676
const CipherAlgo * cipherAlgo
Cipher algorithm.
Definition: ike.h:1679
@ IKE_NOTIFY_MSG_TYPE_SECURE_PASSWORD_METHODS
Definition: ike.h:1069
uint32_t length
Definition: ike.h:1265
@ IKE_TRANSFORM_ID_ENCR_CAMELLIA_CTR
Definition: ike.h:815
#define Socket
Definition: socket.h:36
@ IKE_CERT_ENCODING_ARL
Authority revocation list.
Definition: ike.h:970
bool_t reauthRequest
IKE SA reauthentication request.
Definition: ike.h:1711
@ IKE_SA_STATE_DPD_REQ
Definition: ike.h:1171
Socket * socket
Underlying UDP socket.
Definition: ike.h:1842
@ IKE_NOTIFY_MSG_TYPE_USE_ASSIGNED_HOA
Definition: ike.h:1023
uint16_t esn
Extended sequence numbers.
Definition: ike.h:1748
IkeTransformIdDhGroup
Transform IDs (Diffie-Hellman Group)
Definition: ike.h:878
void ikeGetDefaultSettings(IkeSettings *settings)
Initialize settings with default values.
Definition: ike.c:56
@ IKE_ID_TYPE_RFC822_ADDR
Definition: ike.h:948
@ IKE_SA_STATE_DELETE_RESP
Definition: ike.h:1176
#define IKE_MAX_CHILD_SA_KEY_MAT_LEN
Definition: ike.h:621
uint16_t transformId
Definition: ike.h:1326
@ IKE_PROTOCOL_ID_IKE
IKE protocol.
Definition: ike.h:768
@ IKE_ID_TYPE_INVALID
Definition: ike.h:945
bool_t deleteReceived
Definition: ike.h:1714
size_t cookieLen
Length of the cookie, in bytes.
Definition: ike.h:1644
@ IKE_AUTH_METHOD_DSS
DSS Digital Signature.
Definition: ike.h:989
@ IKE_NOTIFY_MSG_TYPE_AUTH_FAILED
Definition: ike.h:1014
@ IKE_NOTIFY_MSG_TYPE_TEMPORARY_FAILURE
Definition: ike.h:1024
systime_t saLifetime
Lifetime of IKE SAs.
Definition: ike.h:1793
@ IKE_TRANSFORM_ID_ENCR_3IDEA
Definition: ike.h:802
@ IKE_SA_STATE_AUTH_RESP
Definition: ike.h:1169
Common interface for encryption algorithms.
Definition: crypto.h:1068
size_t authKeyLen
Length of the integrity protection key, in bytes.
Definition: ike.h:1761
@ IKE_EXCHANGE_TYPE_INFORMATIONAL
INFORMATIONAL.
Definition: ike.h:703
@ IKE_PAYLOAD_TYPE_LAST
No Next Payload.
Definition: ike.h:727
uint8_t critical
Definition: ike.h:1281
uint8_t cookie[IKE_MAX_COOKIE_SIZE]
Cookie.
Definition: ike.h:1643
IkeNotifyMsgType
Notify message types.
Definition: ike.h:1004
@ IKE_LAST_SUBSTRUC_MORE_PROPOSALS
More proposal substructures.
Definition: ike.h:757
@ IKE_NOTIFY_MSG_TYPE_TICKET_REQUEST
Definition: ike.h:1055
@ IKE_SA_STATE_INIT_RESP
Definition: ike.h:1167
const CipherAlgo * authCipherAlgo
Cipher algorithm for CMAC-based integrity calculations.
Definition: ike.h:1682
IkeCookieVerifyCallback cookieVerifyCallback
Cookie verification callback function.
Definition: ike.h:1801
uint8_t cookie[]
Definition: dtls_misc.h:206
@ IKE_CERT_ENCODING_SPKI_CERT
SPKI certificate.
Definition: ike.h:971
@ IKE_NOTIFY_MSG_TYPE_INITIAL_CONTACT
Definition: ike.h:1029
@ IKE_NOTIFY_MSG_TYPE_INTERNAL_ADDRESS_FAILURE
Definition: ike.h:1017
@ IKE_PAYLOAD_TYPE_KE
Key Exchange.
Definition: ike.h:729
IkeProtocolId
Protocol IDs.
Definition: ike.h:767
CipherContext cipherContext
Cipher context.
Definition: ike.h:1680
size_t responderSaInitLen
Length of the IKE_SA_INIT response, in bytes.
Definition: ike.h:1703
Child Security Association entry.
Definition: ike.h:1730
@ IKE_NOTIFY_MSG_TYPE_IKEV2_MESSAGE_ID_SYNC_SUPPORTED
Definition: ike.h:1065
@ IKE_SA_STATE_AUTH_FAILURE_REQ
Definition: ike.h:1183
@ IKE_NOTIFY_MSG_TYPE_REDIRECT
Definition: ike.h:1052
uint32_t rxMessageId
Definition: ike.h:1642
@ IKE_NOTIFY_MSG_TYPE_AUTH_LIFETIME
Definition: ike.h:1048
uint8_t nextPayload
Definition: ike.h:1254
@ IKE_AUTH_METHOD_ECDSA_P256_SHA256
ECDSA with SHA-256 on the P-256 curve.
Definition: ike.h:990
@ IKE_NOTIFY_MSG_TYPE_COOKIE
Definition: ike.h:1035
@ IKE_ID_TYPE_KEY_ID
Definition: ike.h:952
systime_t reauthPeriod
Reauthentication period.
Definition: ike.h:1795
@ IKE_NOTIFY_MSG_TYPE_IPSEC_REPLAY_COUNTER_SYNC_SUPPORTED
Definition: ike.h:1066
@ IKE_FLAGS_R
Response flag.
Definition: ike.h:715
@ IKE_PAYLOAD_TYPE_TSI
Traffic Selector - Initiator.
Definition: ike.h:739
@ IKE_NOTIFY_MSG_TYPE_USE_TRANSPORT_MODE
Definition: ike.h:1036
@ IKE_SA_STATE_REKEY_RESP
Definition: ike.h:1174
uint8_t sharedSecret[IKE_MAX_SHARED_SECRET_LEN]
Shared secret.
Definition: ike.h:1667
@ IKE_CERT_ENCODING_X509_CERT_SIGN
X.509 certificate - signature.
Definition: ike.h:967
Ipv4Addr ipAddr
Definition: ipcp.h:105
IkeNoncePayload
Definition: ike.h:1425
char_t password[IKE_MAX_PASSWORD_LEN]
Password used to decrypt the private key.
Definition: ike.h:1840
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP4_NBNS
Definition: ike.h:1139
size_t sharedSecretLen
Length of the shared secret, in bytes.
Definition: ike.h:1668
uint8_t keyMaterial[IKE_MAX_SA_KEY_MAT_LEN]
Keying material.
Definition: ike.h:1669
uint8_t reserved1
Definition: ike.h:1322
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP6_PREFIX
Definition: ike.h:1150
Common interface for hash algorithms.
Definition: crypto.h:1046
@ IKE_NOTIFY_MSG_TYPE_SINGLE_PAIR_REQUIRED
Definition: ike.h:1015
@ IKE_TRANSFORM_ID_AUTH_DES_MAC
Definition: ike.h:858
@ IKE_SA_STATE_CREATE_CHILD_RESP
Definition: ike.h:1178
@ IKE_TRANSFORM_ID_DH_GROUP_MODP_2048_256
2048-bit MODP Group with 256-bit Prime Order Subgroup
Definition: ike.h:893
@ IKE_SA_STATE_DPD_RESP
Definition: ike.h:1172
@ IKE_TRANSFORM_ID_DH_GROUP_ECP_256
256-bit Random ECP Group
Definition: ike.h:888
uint8_t type
Definition: ike.h:1551
uint8_t certData[]
Definition: ike.h:1377
thread_t * OsTaskId
Task identifier.
@ IKE_CERT_TYPE_ECDSA_P521
Definition: ike.h:1229
@ IKE_NOTIFY_MSG_TYPE_TICKET_ACK
Definition: ike.h:1056
const uint8_t * skpi
Key used for generating AUTH payload (initiator)
Definition: ike.h:1675
@ IKE_NOTIFY_MSG_TYPE_REDIRECT_SUPPORTED
Definition: ike.h:1051
void * prngContext
Pseudo-random number generator context.
Definition: ike.h:1822
bool_t running
Operational state of IKEv2.
Definition: ike.h:1815
@ IKE_NOTIFY_MSG_TYPE_MULTIPLE_AUTH_SUPPORTED
Definition: ike.h:1049
@ IKE_PAYLOAD_TYPE_IDR
Identification - Responder.
Definition: ike.h:731
OsTaskId taskId
Task identifier.
Definition: ike.h:1819
uint_t numSaEntries
Number of IKE SA entries.
Definition: ike.h:1847
const CipherAlgo * prfCipherAlgo
Cipher algorithm for CMAC-based PRF calculations.
Definition: ike.h:1684
@ IKE_NOTIFY_MSG_TYPE_ADDITIONAL_KEY_EXCHANGE
Definition: ike.h:1086
uint8_t vid[]
Definition: ike.h:1463
@ IKE_TRANSFORM_ID_AUTH_HMAC_SHA2_512_256
Definition: ike.h:869
uint8_t responderNonce[IKE_MAX_NONCE_SIZE]
Definition: ike.h:1650
unsigned int uint_t
Definition: compiler_port.h:50
@ IKE_PAYLOAD_TYPE_D
Delete.
Definition: ike.h:737
@ IKE_NOTIFY_MSG_TYPE_EAP_ONLY_AUTHENTICATION
Definition: ike.h:1062
@ IKE_NOTIFY_MSG_TYPE_COOKIE2
Definition: ike.h:1046
uint8_t authData[]
Definition: ike.h:1402
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP6_ADDRESS
Definition: ike.h:1142
@ IKE_PAYLOAD_TYPE_SA
Security Association.
Definition: ike.h:728
@ IKE_NOTIFY_MSG_TYPE_INVALID_GROUP_ID
Definition: ike.h:1026
IKE Security Association entry.
Definition: ike.h:1622
@ IKE_TRANSFORM_ID_AUTH_NONE
Definition: ike.h:855
IpAddr remoteIpAddr
IP address of the peer.
Definition: ike.h:1735
IkeEapPayload
Definition: ike.h:1539
IkeSaEntry * saEntries
IKE SA entries.
Definition: ike.h:1789
uint8_t responderSpi[IKE_SPI_SIZE]
Responder SPI.
Definition: ike.h:1646
uint8_t nonceData[]
Definition: ike.h:1424
@ IKE_FLAGS_V
Version flag.
Definition: ike.h:716
@ IKE_NOTIFY_MSG_TYPE_PSK_PERSIST
Definition: ike.h:1070
IkeTransformIdPrf
Transform IDs (Pseudorandom Function)
Definition: ike.h:835
IkeAttrType
Configuration attribute types.
Definition: ike.h:1135
@ IKE_TRANSFORM_ID_DH_GROUP_BRAINPOOLP384R1
384-bit Brainpool ECP Group
Definition: ike.h:898
@ IKE_NOTIFY_MSG_TYPE_INVALID_MAJOR_VERSION
Definition: ike.h:1008
@ IKE_CERT_ENCODING_KERBEROS_TOKEN
Kerberos token.
Definition: ike.h:968
@ IKE_NOTIFY_MSG_TYPE_IKEV2_MESSAGE_ID_SYNC
Definition: ike.h:1067
IkeFlags
Flags.
Definition: ike.h:714
@ IKE_NOTIFY_MSG_TYPE_NO_ADDITIONAL_ADDRESSES
Definition: ike.h:1044
@ IKE_NOTIFY_MSG_TYPE_INVALID_IKE_SPI
Definition: ike.h:1007
@ IKE_NOTIFY_MSG_TYPE_UNACCEPTABLE_ADDRESSES
Definition: ike.h:1021
IkeTransformIdAuth
Transform IDs (Integrity Algorithm)
Definition: ike.h:854
@ IKE_TRANSFORM_ID_DH_GROUP_ECP_521
521-bit Random ECP Group
Definition: ike.h:890
@ IKE_NOTIFY_MSG_TYPE_CLONE_IKE_SA_SUPPORTED
Definition: ike.h:1077
@ IKE_CONFIG_ATTR_TYPE_INTERNAL_IP4_DNS
Definition: ike.h:1138
#define IkeChildSaEntry
Definition: ike.h:686
uint16_t totalFrags
Definition: ike.h:1564
uint16_t endPort
Definition: ike.h:1613
@ IKE_AUTH_METHOD_ECDSA_P384_SHA384
ECDSA with SHA-384 on the P-384 curve.
Definition: ike.h:991
uint8_t remoteSpi[4]
Definition: ike.h:1745
IkeTransformAttrType
Transform attribute types.
Definition: ike.h:934
@ IKE_TRANSFORM_ID_ENCR_RC5
Definition: ike.h:798
@ IKE_HASH_ALGO_SHA384
Definition: ike.h:1211
@ IKE_NOTIFY_MSG_TYPE_ADDITIONAL_IP4_ADDRESS
Definition: ike.h:1042
size_t initiatorNonceLen
Length of the initiator nonce.
Definition: ike.h:1741
@ IKE_HASH_ALGO_IDENTITY
Definition: ike.h:1213
IkeTransformIdEsn
Transform IDs (Extended Sequence Numbers)
Definition: ike.h:912
@ IKE_PAYLOAD_TYPE_N
Notify.
Definition: ike.h:736
@ IKE_CHILD_SA_STATE_RESERVED
Definition: ike.h:1195
uint_t numChildSaEntries
Number of Child SA entries.
Definition: ike.h:1849
uint16_t dhGroupNum
Diffie-Hellman group number.
Definition: ike.h:1665
size_t pskLen
Length of the pre-shared key, in bytes.
Definition: ike.h:1834
ECDH context.
Definition: ecdh.h:59
uint8_t nonce[]
Definition: ntp_common.h:233
@ IKE_TRANSFORM_ID_DH_GROUP_BRAINPOOLP256R1
256-bit Brainpool ECP Group
Definition: ike.h:897
@ IKE_TRANSFORM_ID_PRF_HMAC_SHA2_512
Definition: ike.h:843
@ IKE_TRANSFORM_ID_DH_GROUP_MODP_6144
6144-bit MODP Group
Definition: ike.h:886
uint_t retransmitCount
Definition: ike.h:1640
const uint8_t * skar
Integrity protection key (responder)
Definition: ike.h:1752
@ IKE_TS_TYPE_IPV6_ADDR_RANGE
Definition: ike.h:1100
@ IKE_CONFIG_ATTR_TYPE_P_CSCF_IP4_ADDRESS
Definition: ike.h:1151
IkeConfigType
Configuration types.
Definition: ike.h:1122
@ IKE_NOTIFY_MSG_TYPE_R_U_THERE_ACK
Definition: ike.h:1089
@ IKE_ID_TYPE_FQDN
Definition: ike.h:947
uint16_t selectorLength
Definition: ike.h:1488
IkeTsType
Traffic selector types.
Definition: ike.h:1098
IkeSaPayload
Definition: ike.h:1295
@ IKE_SA_STATE_DELETE_CHILD_REQ
Definition: ike.h:1181
@ IKE_CERT_ENCODING_RAW_PUBLIC_KEY
Raw Public Key.
Definition: ike.h:977
@ IKE_PAYLOAD_TYPE_GSPM
Generic Secure Password Method.
Definition: ike.h:744
@ IKE_PAYLOAD_TYPE_TSR
Traffic Selector - Responder.
Definition: ike.h:740
error_t ikeDeleteChildSa(IkeChildSaEntry *childSa)
Delete a Child SA.
Definition: ike.c:681
IkeChildSaState state
Child SA state.
Definition: ike.h:1731
@ IKE_NOTIFY_MSG_TYPE_INVALID_SYNTAX
Definition: ike.h:1009
@ IKE_TRANSFORM_ID_ENCR_CAMELLIA_CCM_12
Definition: ike.h:817
@ IKE_CHILD_SA_STATE_OPEN
Definition: ike.h:1197
@ IKE_TRANSFORM_ID_ENCR_AES_CCM_8
Definition: ike.h:807
@ IKE_CERT_TYPE_ECDSA_P256
Definition: ike.h:1227
@ IKE_TRANSFORM_TYPE_INTEG
Integrity Algorithm.
Definition: ike.h:782