IKE payload formatting. More...
#include "ike/ike.h"
#include "ike/ike_algorithms.h"
#include "ike/ike_payload_format.h"
#include "ike/ike_auth.h"
#include "ike/ike_certificate.h"
#include "ike/ike_key_exchange.h"
#include "ike/ike_key_material.h"
#include "ah/ah_algorithms.h"
#include "esp/esp_algorithms.h"
#include "pkix/pem_import.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL IKE_TRACE_LEVEL |
Functions | |
error_t | ikeFormatSaPayload (IkeSaEntry *sa, IkeChildSaEntry *childSa, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Security Association payload. More... | |
error_t | ikeFormatSaProposal (IkeSaEntry *sa, const uint8_t *spi, uint8_t *p, size_t *written) |
Format Proposal substructure (IKE protocol) More... | |
error_t | ikeFormatChildSaProposal (IkeChildSaEntry *childSa, IpsecProtocol protocolId, const uint8_t *spi, uint8_t *p, size_t *written) |
Format Proposal substructure (AH or ESP protocol) More... | |
error_t | ikeFormatKePayload (IkeSaEntry *sa, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Key Exchange payload. More... | |
error_t | ikeFormatIdPayload (IkeSaEntry *sa, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Identification payload. More... | |
error_t | ikeFormatCertPayloads (IkeSaEntry *sa, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Certificate payloads. More... | |
error_t | ikeFormatCertPayload (const char_t *certChain, size_t certChainLen, size_t *consumed, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Certificate payload. More... | |
error_t | ikeFormatCertReqPayload (IkeSaEntry *sa, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Certificate Request payload. More... | |
error_t | ikeFormatAuthPayload (IkeSaEntry *sa, const IkeIdPayload *idPayload, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Authentication payload. More... | |
error_t | ikeFormatNoncePayload (IkeSaEntry *sa, IkeChildSaEntry *childSa, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Nonce payload. More... | |
error_t | ikeFormatNotifyPayload (IkeSaEntry *sa, IkeChildSaEntry *childSa, IkeNotifyMsgType notifyMsgType, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Notify payload. More... | |
error_t | ikeFormatSignHashAlgosNotificationData (IkeSaEntry *sa, uint8_t *p, size_t *written) |
Format SIGNATURE_HASH_ALGORITHMS notification data. More... | |
error_t | ikeFormatDeletePayload (IkeSaEntry *sa, IkeChildSaEntry *childSa, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Delete payload. More... | |
error_t | ikeFormatTsiPayload (IkeChildSaEntry *childSa, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Traffic Selector payload (initiator) More... | |
error_t | ikeFormatTsrPayload (IkeChildSaEntry *childSa, uint8_t *p, size_t *written, uint8_t **nextPayload) |
Format Traffic Selector payload (responder) More... | |
error_t | ikeFormatTs (const IkeTsParams *tsParams, uint8_t *p, size_t *written) |
Format Traffic Selector substructure. More... | |
Detailed Description
IKE payload 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.
- Version
- 2.4.4
Definition in file ike_payload_format.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL IKE_TRACE_LEVEL |
Definition at line 32 of file ike_payload_format.c.
Function Documentation
◆ ikeFormatAuthPayload()
error_t ikeFormatAuthPayload | ( | IkeSaEntry * | sa, |
const IkeIdPayload * | idPayload, | ||
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Authentication payload.
- Parameters
-
[in] sa Pointer to the IKE SA [in] idPayload Pointer to the Identification payload [out] p Buffer where to format the payload [out] written Length of the resulting payload [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 827 of file ike_payload_format.c.
◆ ikeFormatCertPayload()
error_t ikeFormatCertPayload | ( | const char_t * | certChain, |
size_t | certChainLen, | ||
size_t * | consumed, | ||
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Certificate payload.
- Parameters
-
[in] certChain Pointer to the certificate chain (PEM format) [in] certChainLen Length of the certificate chain, in bytes [out] consumed Total number of characters that have been consumed [out] p Buffer where to format the payload [out] written Length of the resulting payload [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 668 of file ike_payload_format.c.
◆ ikeFormatCertPayloads()
error_t ikeFormatCertPayloads | ( | IkeSaEntry * | sa, |
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Certificate payloads.
- Parameters
-
[in] sa Pointer to the IKE SA [out] p Buffer where to format the payloads [out] written Length of the resulting payloads [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 575 of file ike_payload_format.c.
◆ ikeFormatCertReqPayload()
error_t ikeFormatCertReqPayload | ( | IkeSaEntry * | sa, |
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Certificate Request payload.
- Parameters
-
[in] sa Pointer to the IKE SA [out] p Buffer where to format the payload [out] written Length of the resulting payload [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 729 of file ike_payload_format.c.
◆ ikeFormatChildSaProposal()
error_t ikeFormatChildSaProposal | ( | IkeChildSaEntry * | childSa, |
IpsecProtocol | protocolId, | ||
const uint8_t * | spi, | ||
uint8_t * | p, | ||
size_t * | written | ||
) |
Format Proposal substructure (AH or ESP protocol)
- Parameters
-
[in] childSa Pointer to the Child SA [in] protocolId Protocol identifier (AH or ESP) [in] spi Security parameter index [out] p Buffer where to format the Proposal substructure [out] written Length of the resulting Proposal substructure
- Returns
- Error code
Definition at line 256 of file ike_payload_format.c.
◆ ikeFormatDeletePayload()
error_t ikeFormatDeletePayload | ( | IkeSaEntry * | sa, |
IkeChildSaEntry * | childSa, | ||
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Delete payload.
- Parameters
-
[in] sa Pointer to the IKE SA [in] childSa Pointer to the Child SA [out] p Buffer where to format the payload [out] written Length of the resulting payload [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 1177 of file ike_payload_format.c.
◆ ikeFormatIdPayload()
error_t ikeFormatIdPayload | ( | IkeSaEntry * | sa, |
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Identification payload.
- Parameters
-
[in] sa Pointer to the IKE SA [out] p Buffer where to format the payload [out] written Length of the resulting payload [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 472 of file ike_payload_format.c.
◆ ikeFormatKePayload()
error_t ikeFormatKePayload | ( | IkeSaEntry * | sa, |
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Key Exchange payload.
- Parameters
-
[in] sa Pointer to the IKE SA [out] p Buffer where to format the payload [out] written Length of the resulting payload [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 417 of file ike_payload_format.c.
◆ ikeFormatNoncePayload()
error_t ikeFormatNoncePayload | ( | IkeSaEntry * | sa, |
IkeChildSaEntry * | childSa, | ||
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Nonce payload.
- Parameters
-
[in] sa Pointer to the IKE SA [in] childSa Pointer to the Child SA [out] p Buffer where to format the payload [out] written Length of the resulting payload [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 880 of file ike_payload_format.c.
◆ ikeFormatNotifyPayload()
error_t ikeFormatNotifyPayload | ( | IkeSaEntry * | sa, |
IkeChildSaEntry * | childSa, | ||
IkeNotifyMsgType | notifyMsgType, | ||
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Notify payload.
- Parameters
-
[in] sa Pointer to the IKE SA [in] childSa Pointer to the Child SA [in] notifyMsgType Type of notification [out] p Buffer where to format the payload [out] written Length of the resulting payload [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 968 of file ike_payload_format.c.
◆ ikeFormatSaPayload()
error_t ikeFormatSaPayload | ( | IkeSaEntry * | sa, |
IkeChildSaEntry * | childSa, | ||
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Security Association payload.
- Parameters
-
[in] sa Pointer to the IKE SA [in] childSa Pointer to the Child SA [out] p Buffer where to format the payload [out] written Length of the resulting payload [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 61 of file ike_payload_format.c.
◆ ikeFormatSaProposal()
error_t ikeFormatSaProposal | ( | IkeSaEntry * | sa, |
const uint8_t * | spi, | ||
uint8_t * | p, | ||
size_t * | written | ||
) |
Format Proposal substructure (IKE protocol)
- Parameters
-
[in] sa Pointer to the IKE SA [in] spi Security parameter index (optional parameter) [out] p Buffer where to format the Proposal substructure [out] written Length of the resulting Proposal substructure
- Returns
- Error code
Definition at line 136 of file ike_payload_format.c.
◆ ikeFormatSignHashAlgosNotificationData()
error_t ikeFormatSignHashAlgosNotificationData | ( | IkeSaEntry * | sa, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format SIGNATURE_HASH_ALGORITHMS notification data.
- Parameters
-
[in] sa Pointer to the IKE SA [out] p Buffer where to format the notification data [out] written Length of the notification data, in bytes
- Returns
- Error code
Definition at line 1108 of file ike_payload_format.c.
◆ ikeFormatTs()
error_t ikeFormatTs | ( | const IkeTsParams * | tsParams, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format Traffic Selector substructure.
- Parameters
-
[in] tsParams Traffic selector parameters [out] p Buffer where to format the Traffic Selector substructure [out] written Length of the resulting Traffic Selector substructure
- Returns
- Error code
Definition at line 1407 of file ike_payload_format.c.
◆ ikeFormatTsiPayload()
error_t ikeFormatTsiPayload | ( | IkeChildSaEntry * | childSa, |
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Traffic Selector payload (initiator)
- Parameters
-
[in] childSa Pointer to the Child SA [out] p Buffer where to format the payload [out] written Length of the resulting payload [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 1240 of file ike_payload_format.c.
◆ ikeFormatTsrPayload()
error_t ikeFormatTsrPayload | ( | IkeChildSaEntry * | childSa, |
uint8_t * | p, | ||
size_t * | written, | ||
uint8_t ** | nextPayload | ||
) |
Format Traffic Selector payload (responder)
- Parameters
-
[in] childSa Pointer to the Child SA [out] p Buffer where to format the payload [out] written Length of the resulting payload [in,out] nextPayload Pointer to the Next Payload field
- Returns
- Error code
Definition at line 1324 of file ike_payload_format.c.