IKE payload parsing. More...
#include "ike/ike.h"#include "ike/ike_algorithms.h"#include "ike/ike_payload_parse.h"#include "ike/ike_auth.h"#include "ike/ike_certificate.h"#include "ike/ike_key_exchange.h"#include "ike/ike_key_material.h"#include "ike/ike_sign_misc.h"#include "ike/ike_misc.h"#include "ah/ah_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 | |
| void | ikeParseIkeMessagePayloads (const uint8_t *message, size_t length, IkeMessagePayloads *payloads) |
| Parse IKE message payloads. More... | |
| error_t | ikeParseSaPayload (const IkeSaPayload *saPayload) |
| Parse Security Association payload. More... | |
| error_t | ikeParseProposal (const IkeProposal *proposal, size_t length) |
| Parse Proposal substructure. More... | |
| error_t | ikeParseTransform (const IkeTransform *transform, size_t length) |
| Parse Transform substructure. More... | |
| error_t | ikeParseTransformAttr (const IkeTransformAttr *attr, size_t length, size_t *consumed) |
| Parse transform attribute. More... | |
| error_t | ikeParseKePayload (IkeKeContext *keContext, const IkeKePayload *kePayload) |
| Parse Key Exchange payload. More... | |
| error_t | ikeParseIdPayload (IkeSaEntry *sa, const IkeIdPayload *idPayload) |
| Parse Identification payload. More... | |
| error_t | ikeParseCertReqPayload (IkeSaEntry *sa, const IkeCertReqPayload *certReqPayload) |
| Parse Certificate Request payload. More... | |
| error_t | ikeParseNoncePayload (const IkeNoncePayload *noncePayload, uint8_t *nonce, size_t *nonceLen) |
| Parse Nonce payload. More... | |
| error_t | ikeParseInvalidKePayloadNotification (IkeKeContext *keContext, const IkeNotifyPayload *notifyPayload) |
| Parse INVALID_KE_PAYLOAD notification. More... | |
| error_t | ikeParseCookieNotification (IkeSaEntry *sa, const IkeNotifyPayload *notifyPayload) |
| Parse COOKIE notification. More... | |
| error_t | ikeParseSignHashAlgosNotification (IkeSaEntry *sa, const IkeNotifyPayload *notifyPayload) |
| Parse SIGNATURE_HASH_ALGORITHMS notification. More... | |
| error_t | ikeParseNatDetectSrcIpNotification (IkeSaEntry *sa, const uint8_t *message, size_t length) |
| Parse NAT_DETECTION_SOURCE_IP notification. More... | |
| error_t | ikeParseNatDetectDestIpNotification (IkeSaEntry *sa, const IkeNotifyPayload *notifyPayload) |
| Parse NAT_DETECTION_DESTINATION_IP notification. More... | |
| error_t | ikeParseDeletePayload (IkeSaEntry *sa, const IkeDeletePayload *deletePayload, bool_t response) |
| Parse Delete payload. More... | |
| error_t | ikeParseTsPayload (const IkeTsPayload *tsPayload, uint_t index, IkeTsEntry *tsEntry) |
| Parse Traffic Selector payload. More... | |
| error_t | ikeParseTsEntry (const IkeTs *ts, size_t length, IkeTsEntry *tsEntry) |
| Parse Traffic Selector substructure. More... | |
| const IkePayloadHeader * | ikeGetPayload (const uint8_t *message, size_t length, uint8_t type, uint_t index) |
| Search an IKE message for a given payload type. More... | |
| const IkeNotifyPayload * | ikeGetErrorNotifyPayload (const uint8_t *message, size_t length) |
| Search an IKE message for an error Notify payload. More... | |
| const IkeNotifyPayload * | ikeGetStatusNotifyPayload (const uint8_t *message, size_t length, uint16_t type, uint_t index) |
| Search an IKE message for a given status Notify payload. More... | |
| error_t | ikeCheckCriticalPayloads (const uint8_t *message, size_t length, uint8_t *unsupportedCriticalPayload) |
| Check whether the message contains an unsupported critical payload. More... | |
Detailed Description
IKE payload parsing.
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.
- Version
- 2.6.6
Definition in file ike_payload_parse.c.
Macro Definition Documentation
◆ TRACE_LEVEL
| #define TRACE_LEVEL IKE_TRACE_LEVEL |
Definition at line 32 of file ike_payload_parse.c.
Function Documentation
◆ ikeCheckCriticalPayloads()
| error_t ikeCheckCriticalPayloads | ( | const uint8_t * | message, |
| size_t | length, | ||
| uint8_t * | unsupportedCriticalPayload | ||
| ) |
Check whether the message contains an unsupported critical payload.
- Parameters
-
[in] message Pointer to the IKE message [in] length Length of the IKE message, in bytes [out] unsupportedCriticalPayload Type of the unsupported critical payload, if any
- Returns
- Error code
Definition at line 1406 of file ike_payload_parse.c.
◆ ikeGetErrorNotifyPayload()
| const IkeNotifyPayload* ikeGetErrorNotifyPayload | ( | const uint8_t * | message, |
| size_t | length | ||
| ) |
Search an IKE message for an error Notify payload.
- Parameters
-
[in] message Pointer to the received IKE message [in] length Length of the IKE message, in bytes
- Returns
- Pointer to the error Notify payload, if any
Definition at line 1233 of file ike_payload_parse.c.
◆ ikeGetPayload()
| const IkePayloadHeader* ikeGetPayload | ( | const uint8_t * | message, |
| size_t | length, | ||
| uint8_t | type, | ||
| uint_t | index | ||
| ) |
Search an IKE message for a given payload type.
- Parameters
-
[in] message Pointer to the IKE message [in] length Length of the IKE message, in bytes [in] type Payload type [in] index Payload occurrence index
- Returns
- If the specified payload type is found, a pointer to the payload header is returned. Otherwise NULL pointer is returned
Definition at line 1161 of file ike_payload_parse.c.
◆ ikeGetStatusNotifyPayload()
| const IkeNotifyPayload* ikeGetStatusNotifyPayload | ( | const uint8_t * | message, |
| size_t | length, | ||
| uint16_t | type, | ||
| uint_t | index | ||
| ) |
Search an IKE message for a given status Notify payload.
- Parameters
-
[in] message Pointer to the received IKE message [in] length Length of the IKE message, in bytes [in] type Notify message type [in] index Notification occurrence index
- Returns
- Pointer to the error Notify payload, if any
Definition at line 1316 of file ike_payload_parse.c.
◆ ikeParseCertReqPayload()
| error_t ikeParseCertReqPayload | ( | IkeSaEntry * | sa, |
| const IkeCertReqPayload * | certReqPayload | ||
| ) |
Parse Certificate Request payload.
- Parameters
-
[in] sa Pointer to the IKE SA [in] certReqPayload Pointer to the Certificate Request payload
- Returns
- Error code
Definition at line 491 of file ike_payload_parse.c.
◆ ikeParseCookieNotification()
| error_t ikeParseCookieNotification | ( | IkeSaEntry * | sa, |
| const IkeNotifyPayload * | notifyPayload | ||
| ) |
Parse COOKIE notification.
- Parameters
-
[in] sa Pointer to the IKE SA [in] notifyPayload Pointer to the Notify payload
- Returns
- Error code
Definition at line 602 of file ike_payload_parse.c.
◆ ikeParseDeletePayload()
| error_t ikeParseDeletePayload | ( | IkeSaEntry * | sa, |
| const IkeDeletePayload * | deletePayload, | ||
| bool_t | response | ||
| ) |
Parse Delete payload.
- Parameters
-
[in] sa Pointer to the IKE SA [in] deletePayload Pointer to the Delete payload [in] response TRUE if the received INFORMATIONAL message is a response
- Returns
- Error code
Definition at line 856 of file ike_payload_parse.c.
◆ ikeParseIdPayload()
| error_t ikeParseIdPayload | ( | IkeSaEntry * | sa, |
| const IkeIdPayload * | idPayload | ||
| ) |
Parse Identification payload.
- Parameters
-
[in] sa Pointer to the IKE SA [in] idPayload Pointer to the Identification payload
- Returns
- Error code
Definition at line 456 of file ike_payload_parse.c.
◆ ikeParseIkeMessagePayloads()
| void ikeParseIkeMessagePayloads | ( | const uint8_t * | message, |
| size_t | length, | ||
| IkeMessagePayloads * | payloads | ||
| ) |
Parse IKE message payloads.
- Parameters
-
[in] message Pointer to the IKE message [in] length Length of the IKE message, in bytes [out] payloads IKE message payloads
Definition at line 59 of file ike_payload_parse.c.
◆ ikeParseInvalidKePayloadNotification()
| error_t ikeParseInvalidKePayloadNotification | ( | IkeKeContext * | keContext, |
| const IkeNotifyPayload * | notifyPayload | ||
| ) |
Parse INVALID_KE_PAYLOAD notification.
- Parameters
-
[in] keContext Pointer to the key exchange context [in] notifyPayload Pointer to the Notify payload
- Returns
- Error code
Definition at line 561 of file ike_payload_parse.c.
◆ ikeParseKePayload()
| error_t ikeParseKePayload | ( | IkeKeContext * | keContext, |
| const IkeKePayload * | kePayload | ||
| ) |
Parse Key Exchange payload.
- Parameters
-
[in] keContext Pointer to the key exchange context [in] kePayload Pointer to the Key Exchange payload
- Returns
- Error code
Definition at line 416 of file ike_payload_parse.c.
◆ ikeParseNatDetectDestIpNotification()
| error_t ikeParseNatDetectDestIpNotification | ( | IkeSaEntry * | sa, |
| const IkeNotifyPayload * | notifyPayload | ||
| ) |
Parse NAT_DETECTION_DESTINATION_IP notification.
- Parameters
-
[in] sa Pointer to the IKE SA [in] notifyPayload Pointer to the Notify payload
- Returns
- Error code
Definition at line 784 of file ike_payload_parse.c.
◆ ikeParseNatDetectSrcIpNotification()
| error_t ikeParseNatDetectSrcIpNotification | ( | IkeSaEntry * | sa, |
| const uint8_t * | message, | ||
| size_t | length | ||
| ) |
Parse NAT_DETECTION_SOURCE_IP notification.
- Parameters
-
[in] sa Pointer to the IKE SA [in] message Pointer to the received IKE message [in] length Length of the IKE message, in bytes
- Returns
- Error code
Definition at line 690 of file ike_payload_parse.c.
◆ ikeParseNoncePayload()
| error_t ikeParseNoncePayload | ( | const IkeNoncePayload * | noncePayload, |
| uint8_t * | nonce, | ||
| size_t * | nonceLen | ||
| ) |
Parse Nonce payload.
- Parameters
-
[in] noncePayload Pointer to the Nonce payload [out] nonce Pointer to the buffer where to store the nonce [out] nonceLen Length of the nonce, in bytes
- Returns
- Error code
Definition at line 525 of file ike_payload_parse.c.
◆ ikeParseProposal()
| error_t ikeParseProposal | ( | const IkeProposal * | proposal, |
| size_t | length | ||
| ) |
Parse Proposal substructure.
- Parameters
-
[in] proposal Pointer to the Proposal substructure [in] length Length of the Proposal substructure, in bytes
- Returns
- Error code
Definition at line 238 of file ike_payload_parse.c.
◆ ikeParseSaPayload()
| error_t ikeParseSaPayload | ( | const IkeSaPayload * | saPayload | ) |
Parse Security Association payload.
- Parameters
-
[in] saPayload Pointer to the Security Association payload
- Returns
- Error code
Definition at line 165 of file ike_payload_parse.c.
◆ ikeParseSignHashAlgosNotification()
| error_t ikeParseSignHashAlgosNotification | ( | IkeSaEntry * | sa, |
| const IkeNotifyPayload * | notifyPayload | ||
| ) |
Parse SIGNATURE_HASH_ALGORITHMS notification.
- Parameters
-
[in] sa Pointer to the IKE SA [in] notifyPayload Pointer to the Notify payload
- Returns
- Error code
Definition at line 636 of file ike_payload_parse.c.
◆ ikeParseTransform()
| error_t ikeParseTransform | ( | const IkeTransform * | transform, |
| size_t | length | ||
| ) |
Parse Transform substructure.
- Parameters
-
[in] transform Pointer to the Transform substructure [in] length Length of the Transform substructure, in bytes
- Returns
- Error code
Definition at line 312 of file ike_payload_parse.c.
◆ ikeParseTransformAttr()
| error_t ikeParseTransformAttr | ( | const IkeTransformAttr * | attr, |
| size_t | length, | ||
| size_t * | consumed | ||
| ) |
Parse transform attribute.
- Parameters
-
[in] attr Pointer to the transform attribute [in] length Number of bytes available in the input stream [out] consumed Total number of characters that have been consumed
- Returns
- Error code
Definition at line 375 of file ike_payload_parse.c.
◆ ikeParseTsEntry()
| error_t ikeParseTsEntry | ( | const IkeTs * | ts, |
| size_t | length, | ||
| IkeTsEntry * | tsEntry | ||
| ) |
Parse Traffic Selector substructure.
- Parameters
-
[in] ts Pointer to the Traffic Selector substructure [in] length Length of the Traffic Selector substructure, in bytes [out] tsEntry Traffic selector entry
- Returns
- Error code
Definition at line 1055 of file ike_payload_parse.c.
◆ ikeParseTsPayload()
| error_t ikeParseTsPayload | ( | const IkeTsPayload * | tsPayload, |
| uint_t | index, | ||
| IkeTsEntry * | tsEntry | ||
| ) |
Parse Traffic Selector payload.
- Parameters
-
[in] tsPayload Pointer to the Traffic Selector payload [in] index Index of the Traffic Selector substructure to parse [out] tsEntry Traffic selector entry
- Returns
- Error code
Definition at line 974 of file ike_payload_parse.c.
