ike_message_format.c File Reference

IKE message formatting. More...

#include "ipsec/ipsec_misc.h"
#include "ike/ike.h"
#include "ike/ike_fsm.h"
#include "ike/ike_algorithms.h"
#include "ike/ike_message_format.h"
#include "ike/ike_message_encrypt.h"
#include "ike/ike_payload_format.h"
#include "ike/ike_auth.h"
#include "ike/ike_key_exchange.h"
#include "ike/ike_key_material.h"
#include "ike/ike_dh_groups.h"
#include "ike/ike_misc.h"
#include "ike/ike_debug.h"
#include "ah/ah_algorithms.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   IKE_TRACE_LEVEL
 

Functions

error_t ikeSendIkeSaInitRequest (IkeSaEntry *sa)
 Send IKE_SA_INIT request. More...
 
error_t ikeSendIkeSaInitResponse (IkeSaEntry *sa)
 Send IKE_SA_INIT response. More...
 
error_t ikeSendIkeAuthRequest (IkeSaEntry *sa)
 Send IKE_AUTH request. More...
 
error_t ikeSendIkeAuthResponse (IkeSaEntry *sa)
 Send IKE_AUTH response. More...
 
error_t ikeSendCreateChildSaRequest (IkeSaEntry *sa, IkeChildSaEntry *childSa)
 Send CREATE_CHILD_SA request. More...
 
error_t ikeSendCreateChildSaResponse (IkeSaEntry *sa, IkeChildSaEntry *childSa)
 Send CREATE_CHILD_SA response. More...
 
error_t ikeSendInformationalRequest (IkeSaEntry *sa)
 Send INFORMATIONAL request. More...
 
error_t ikeSendInformationalResponse (IkeSaEntry *sa)
 Send INFORMATIONAL response. More...
 
error_t ikeSendErrorResponse (IkeContext *context, uint8_t *message, size_t length)
 Send INFORMATIONAL response (outside of an IKE SA) More...
 
error_t ikeFormatIkeSaInitRequest (IkeSaEntry *sa, uint8_t *p, size_t *length)
 Format IKE_SA_INIT request. More...
 
error_t ikeFormatIkeSaInitResponse (IkeSaEntry *sa, uint8_t *p, size_t *length)
 Format IKE_SA_INIT response. More...
 
error_t ikeFormatIkeAuthRequest (IkeSaEntry *sa, uint8_t *p, size_t *length)
 Format IKE_AUTH request. More...
 
error_t ikeFormatIkeAuthResponse (IkeSaEntry *sa, uint8_t *p, size_t *length)
 Format IKE_AUTH response. More...
 
error_t ikeFormatCreateChildSaRequest (IkeSaEntry *sa, IkeChildSaEntry *childSa, uint8_t *p, size_t *length)
 Format CREATE_CHILD_SA request. More...
 
error_t ikeFormatCreateChildSaResponse (IkeSaEntry *sa, IkeChildSaEntry *childSa, uint8_t *p, size_t *length)
 Format CREATE_CHILD_SA response. More...
 
error_t ikeFormatInformationalRequest (IkeSaEntry *sa, uint8_t *p, size_t *length)
 Format INFORMATIONAL request. More...
 
error_t ikeFormatInformationalResponse (IkeSaEntry *sa, uint8_t *p, size_t *length)
 Format INFORMATIONAL response. More...
 
error_t ikeFormatErrorResponse (IkeHeader *requestHeader, uint8_t *p, size_t *length)
 Format INFORMATIONAL response (outside of an IKE SA) More...
 

Detailed Description

IKE message formatting.

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_message_format.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   IKE_TRACE_LEVEL

Definition at line 32 of file ike_message_format.c.

Function Documentation

◆ ikeFormatCreateChildSaRequest()

error_t ikeFormatCreateChildSaRequest ( IkeSaEntry sa,
IkeChildSaEntry childSa,
uint8_t *  p,
size_t *  length 
)

Format CREATE_CHILD_SA request.

Parameters
[in]saPointer to the IKE SA
[in]childSaPointer to the Child SA
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 1283 of file ike_message_format.c.

◆ ikeFormatCreateChildSaResponse()

error_t ikeFormatCreateChildSaResponse ( IkeSaEntry sa,
IkeChildSaEntry childSa,
uint8_t *  p,
size_t *  length 
)

Format CREATE_CHILD_SA response.

Parameters
[in]saPointer to the IKE SA
[in]childSaPointer to the Child SA
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 1301 of file ike_message_format.c.

◆ ikeFormatErrorResponse()

error_t ikeFormatErrorResponse ( IkeHeader requestHeader,
uint8_t *  p,
size_t *  length 
)

Format INFORMATIONAL response (outside of an IKE SA)

Parameters
[in]requestHeaderPointer to the IKE header of the request
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 1644 of file ike_message_format.c.

◆ ikeFormatIkeAuthRequest()

error_t ikeFormatIkeAuthRequest ( IkeSaEntry sa,
uint8_t *  p,
size_t *  length 
)

Format IKE_AUTH request.

Parameters
[in]saPointer to the IKE SA
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 937 of file ike_message_format.c.

◆ ikeFormatIkeAuthResponse()

error_t ikeFormatIkeAuthResponse ( IkeSaEntry sa,
uint8_t *  p,
size_t *  length 
)

Format IKE_AUTH response.

Parameters
[in]saPointer to the IKE SA
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 1110 of file ike_message_format.c.

◆ ikeFormatIkeSaInitRequest()

error_t ikeFormatIkeSaInitRequest ( IkeSaEntry sa,
uint8_t *  p,
size_t *  length 
)

Format IKE_SA_INIT request.

Parameters
[in]saPointer to the IKE SA
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 700 of file ike_message_format.c.

◆ ikeFormatIkeSaInitResponse()

error_t ikeFormatIkeSaInitResponse ( IkeSaEntry sa,
uint8_t *  p,
size_t *  length 
)

Format IKE_SA_INIT response.

Parameters
[in]saPointer to the IKE SA
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 817 of file ike_message_format.c.

◆ ikeFormatInformationalRequest()

error_t ikeFormatInformationalRequest ( IkeSaEntry sa,
uint8_t *  p,
size_t *  length 
)

Format INFORMATIONAL request.

Parameters
[in]saPointer to the IKE SA
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 1370 of file ike_message_format.c.

◆ ikeFormatInformationalResponse()

error_t ikeFormatInformationalResponse ( IkeSaEntry sa,
uint8_t *  p,
size_t *  length 
)

Format INFORMATIONAL response.

Parameters
[in]saPointer to the IKE SA
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 1467 of file ike_message_format.c.

◆ ikeSendCreateChildSaRequest()

error_t ikeSendCreateChildSaRequest ( IkeSaEntry sa,
IkeChildSaEntry childSa 
)

Send CREATE_CHILD_SA request.

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

Definition at line 449 of file ike_message_format.c.

◆ ikeSendCreateChildSaResponse()

error_t ikeSendCreateChildSaResponse ( IkeSaEntry sa,
IkeChildSaEntry childSa 
)

Send CREATE_CHILD_SA response.

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

Definition at line 464 of file ike_message_format.c.

◆ ikeSendErrorResponse()

error_t ikeSendErrorResponse ( IkeContext context,
uint8_t *  message,
size_t  length 
)

Send INFORMATIONAL response (outside of an IKE SA)

Parameters
[in]contextPointer to the IKE context
[in]messagePointer to the received IKE message
[in]lengthLength of the IKE message, in bytes
Returns
Error code

Definition at line 650 of file ike_message_format.c.

◆ ikeSendIkeAuthRequest()

error_t ikeSendIkeAuthRequest ( IkeSaEntry sa)

Send IKE_AUTH request.

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

Definition at line 223 of file ike_message_format.c.

◆ ikeSendIkeAuthResponse()

error_t ikeSendIkeAuthResponse ( IkeSaEntry sa)

Send IKE_AUTH response.

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

Definition at line 308 of file ike_message_format.c.

◆ ikeSendIkeSaInitRequest()

error_t ikeSendIkeSaInitRequest ( IkeSaEntry sa)

Send IKE_SA_INIT request.

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

Definition at line 61 of file ike_message_format.c.

◆ ikeSendIkeSaInitResponse()

error_t ikeSendIkeSaInitResponse ( IkeSaEntry sa)

Send IKE_SA_INIT response.

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

Definition at line 107 of file ike_message_format.c.

◆ ikeSendInformationalRequest()

error_t ikeSendInformationalRequest ( IkeSaEntry sa)

Send INFORMATIONAL request.

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

Definition at line 510 of file ike_message_format.c.

◆ ikeSendInformationalResponse()

error_t ikeSendInformationalResponse ( IkeSaEntry sa)

Send INFORMATIONAL response.

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

Definition at line 579 of file ike_message_format.c.