ike.c File Reference

IKEv2 (Internet Key Exchange Protocol) More...

#include "ipsec/ipsec_misc.h"
#include "ike/ike.h"
#include "ike/ike_fsm.h"
#include "ike/ike_algorithms.h"
#include "ike/ike_certificate.h"
#include "ike/ike_message_parse.h"
#include "ike/ike_misc.h"
#include "ike/ike_debug.h"
#include "pkix/pem_import.h"
#include "pkix/x509_cert_parse.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   IKE_TRACE_LEVEL
 

Functions

void ikeGetDefaultSettings (IkeSettings *settings)
 Initialize settings with default values. More...
 
error_t ikeInit (IkeContext *context, const IkeSettings *settings)
 IKE service initialization. More...
 
error_t ikeStart (IkeContext *context)
 Start IKE service. More...
 
error_t ikeStop (IkeContext *context)
 Stop IKE service. More...
 
error_t ikeSetPreferredDhGroup (IkeContext *context, uint16_t dhGroupNum)
 Specify the preferred Diffie-Hellman group. More...
 
error_t ikeSetId (IkeContext *context, IkeIdType idType, const void *id, size_t idLen)
 Set entity's ID. More...
 
error_t ikeSetPsk (IkeContext *context, const uint8_t *psk, size_t pskLen)
 Set entity's pre-shared key. More...
 
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. More...
 
error_t ikeDeleteSa (IkeSaEntry *sa)
 Delete an IKE SA. More...
 
error_t ikeCreateChildSa (IkeContext *context, const IpsecPacketInfo *packet)
 Create a new Child SA. More...
 
error_t ikeDeleteChildSa (IkeChildSaEntry *childSa)
 Delete a Child SA. More...
 
void ikeTask (IkeContext *context)
 IKE task. More...
 
void ikeDeinit (IkeContext *context)
 Release IKE context. More...
 

Detailed Description

IKEv2 (Internet Key Exchange Protocol)

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2022-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneIPSEC Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file ike.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   IKE_TRACE_LEVEL

Definition at line 32 of file ike.c.

Function Documentation

◆ ikeCreateChildSa()

error_t ikeCreateChildSa ( IkeContext context,
const IpsecPacketInfo packet 
)

Create a new Child SA.

Parameters
[in]contextPointer to the IKE context
[in]packetTriggering packet
Returns
Error code

Definition at line 575 of file ike.c.

◆ ikeDeinit()

void ikeDeinit ( IkeContext context)

Release IKE context.

Parameters
[in]contextPointer to the IKE context

Definition at line 775 of file ike.c.

◆ ikeDeleteChildSa()

error_t ikeDeleteChildSa ( IkeChildSaEntry childSa)

Delete a Child SA.

Parameters
[in]childSaPointer to the Child SA to delete
Returns
Error code

Definition at line 679 of file ike.c.

◆ ikeDeleteSa()

error_t ikeDeleteSa ( IkeSaEntry sa)

Delete an IKE SA.

Parameters
[in]saPointer to the IKE SA to delete
Returns
Error code

Definition at line 540 of file ike.c.

◆ ikeGetDefaultSettings()

void ikeGetDefaultSettings ( IkeSettings settings)

Initialize settings with default values.

Parameters
[out]settingsStructure that contains IKE settings

Definition at line 56 of file ike.c.

◆ ikeInit()

error_t ikeInit ( IkeContext context,
const IkeSettings settings 
)

IKE service initialization.

Parameters
[in]contextPointer to the IKE context
[in]settingsIKE specific settings
Returns
Error code

Definition at line 109 of file ike.c.

◆ ikeSetCertificate()

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.

Parameters
[in]contextPointer to the IKE context
[in]certChainCertificate chain (PEM format). This parameter is taken as reference
[in]certChainLenLength of the certificate chain
[in]privateKeyPrivate key (PEM format). This parameter is taken as reference
[in]privateKeyLenLength of the private key
[in]passwordNULL-terminated string containing the password. This parameter is required if the private key is encrypted
Returns
Error code

Definition at line 424 of file ike.c.

◆ ikeSetId()

error_t ikeSetId ( IkeContext context,
IkeIdType  idType,
const void *  id,
size_t  idLen 
)

Set entity's ID.

Parameters
[in]contextPointer to the IKE context
[in]idTypeID type
[in]idPointer to the identification data
[in]idLenLength of the identification data, in bytes
Returns
Error code

Definition at line 357 of file ike.c.

◆ ikeSetPreferredDhGroup()

error_t ikeSetPreferredDhGroup ( IkeContext context,
uint16_t  dhGroupNum 
)

Specify the preferred Diffie-Hellman group.

Parameters
[in]contextPointer to the IKE context
[in]dhGroupNumPreferred Diffie-Hellman group number
Returns
Error code

Definition at line 330 of file ike.c.

◆ ikeSetPsk()

error_t ikeSetPsk ( IkeContext context,
const uint8_t *  psk,
size_t  pskLen 
)

Set entity's pre-shared key.

Parameters
[in]contextPointer to the IKE context
[in]pskPointer to the pre-shared key
[in]pskLenLength of the pre-shared key, in bytes
Returns
Error code

Definition at line 386 of file ike.c.

◆ ikeStart()

error_t ikeStart ( IkeContext context)

Start IKE service.

Parameters
[in]contextPointer to the IKE context
Returns
Error code

Definition at line 207 of file ike.c.

◆ ikeStop()

error_t ikeStop ( IkeContext context)

Stop IKE service.

Parameters
[in]contextPointer to the IKE context
Returns
Error code

Definition at line 290 of file ike.c.

◆ ikeTask()

void ikeTask ( IkeContext context)

IKE task.

Parameters
[in]contextPointer to the IKE context

Definition at line 712 of file ike.c.