ike_response_format.c File Reference

IKE response formatting. More...

#include "ike/ike.h"
#include "ike/ike_fsm.h"
#include "ike/ike_message_encrypt.h"
#include "ike/ike_response_format.h"
#include "ike/ike_payload_format.h"
#include "ike/ike_key_exchange.h"
#include "ike/ike_key_material.h"
#include "ike/ike_misc.h"
#include "ike/ike_debug.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   IKE_TRACE_LEVEL
 

Functions

error_t ikeSendResponse (IkeContext *context, const uint8_t *message, size_t length)
 Send IKE response. More...
 
error_t ikeSendIkeSaInitResponse (IkeSaEntry *sa)
 Send IKE_SA_INIT response. More...
 
error_t ikeSendIkeAuthResponse (IkeSaEntry *sa)
 Send IKE_AUTH response. More...
 
error_t ikeSendCreateChildSaResponse (IkeSaEntry *sa)
 Send CREATE_CHILD_SA response. More...
 
error_t ikeSendInfoResponse (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 ikeFormatIkeSaInitResponse (IkeSaEntry *sa, uint8_t *p, size_t *length)
 Format IKE_SA_INIT response. More...
 
error_t ikeFormatIkeAuthResponse (IkeSaEntry *sa, uint8_t *p, size_t *length)
 Format IKE_AUTH response. More...
 
error_t ikeFormatCreateChildSaResponse (IkeSaEntry *sa, uint8_t *p, size_t *length)
 Format CREATE_CHILD_SA response. More...
 
error_t ikeFormatInfoResponse (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...
 
error_t ikeFormatChildSaCreateResponse (IkeSaEntry *sa, uint8_t *p, size_t *length, uint8_t **nextPayload)
 Format Child SA creation/rekeying response. More...
 
error_t ikeFormatIkeSaRekeyResponse (IkeSaEntry *sa, uint8_t *p, size_t *length, uint8_t **nextPayload)
 Format IKE SA rekeying response. More...
 

Detailed Description

IKE response formatting.

License

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

Copyright (C) 2022-2026 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.6.6

Definition in file ike_response_format.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   IKE_TRACE_LEVEL

Definition at line 32 of file ike_response_format.c.

Function Documentation

◆ ikeFormatChildSaCreateResponse()

error_t ikeFormatChildSaCreateResponse ( IkeSaEntry *  sa,
uint8_t *  p,
size_t *  length,
uint8_t **  nextPayload 
)

Format Child SA creation/rekeying response.

Parameters
[in]saPointer to the IKE SA
[out]pBuffer where to format the payloads
[out]lengthLength of the resulting payloads, in bytes
[in,out]nextPayloadPointer to the Next Payload field
Returns
Error code

Definition at line 1202 of file ike_response_format.c.

◆ ikeFormatCreateChildSaResponse()

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

Format CREATE_CHILD_SA 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 826 of file ike_response_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 1126 of file ike_response_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 695 of file ike_response_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 533 of file ike_response_format.c.

◆ ikeFormatIkeSaRekeyResponse()

error_t ikeFormatIkeSaRekeyResponse ( IkeSaEntry *  sa,
uint8_t *  p,
size_t *  length,
uint8_t **  nextPayload 
)

Format IKE SA rekeying response.

Parameters
[in]saPointer to the IKE SA
[out]pBuffer where to format the payloads
[out]lengthLength of the resulting payloads, in bytes
[in,out]nextPayloadPointer to the Next Payload field
Returns
Error code

Definition at line 1317 of file ike_response_format.c.

◆ ikeFormatInfoResponse()

error_t ikeFormatInfoResponse ( 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 949 of file ike_response_format.c.

◆ ikeSendCreateChildSaResponse()

error_t ikeSendCreateChildSaResponse ( IkeSaEntry *  sa)

Send CREATE_CHILD_SA response.

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

Definition at line 371 of file ike_response_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 485 of file ike_response_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 228 of file ike_response_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 112 of file ike_response_format.c.

◆ ikeSendInfoResponse()

error_t ikeSendInfoResponse ( IkeSaEntry *  sa)

Send INFORMATIONAL response.

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

Definition at line 415 of file ike_response_format.c.

◆ ikeSendResponse()

error_t ikeSendResponse ( IkeContext *  context,
const uint8_t *  message,
size_t  length 
)

Send IKE response.

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

Definition at line 58 of file ike_response_format.c.