esp.h File Reference

ESP (IP Encapsulating Security Payload) More...

#include "ipsec/ipsec.h"

Go to the source code of this file.

Macros

#define ESP_SUPPORT   ENABLED
 
#define ESP_UDP_ENCAPS_SUPPORT   DISABLED
 
#define ESP_ESN_SUPPORT   ENABLED
 
#define ESP_NULL_SUPPORT   DISABLED
 
#define ESP_CBC_SUPPORT   ENABLED
 
#define ESP_CTR_SUPPORT   DISABLED
 
#define ESP_CCM_8_SUPPORT   DISABLED
 
#define ESP_CCM_12_SUPPORT   DISABLED
 
#define ESP_CCM_16_SUPPORT   DISABLED
 
#define ESP_GCM_8_SUPPORT   DISABLED
 
#define ESP_GCM_12_SUPPORT   DISABLED
 
#define ESP_GCM_16_SUPPORT   ENABLED
 
#define ESP_CHACHA20_POLY1305_SUPPORT   ENABLED
 
#define ESP_CMAC_SUPPORT   DISABLED
 
#define ESP_GMAC_SUPPORT   DISABLED
 
#define ESP_HMAC_SUPPORT   ENABLED
 
#define ESP_KMAC128_SUPPORT   DISABLED
 
#define ESP_KMAC256_SUPPORT   DISABLED
 
#define ESP_IDEA_SUPPORT   DISABLED
 
#define ESP_DES_SUPPORT   DISABLED
 
#define ESP_3DES_SUPPORT   DISABLED
 
#define ESP_AES_128_SUPPORT   ENABLED
 
#define ESP_AES_192_SUPPORT   ENABLED
 
#define ESP_AES_256_SUPPORT   ENABLED
 
#define ESP_CAMELLIA_128_SUPPORT   DISABLED
 
#define ESP_CAMELLIA_192_SUPPORT   DISABLED
 
#define ESP_CAMELLIA_256_SUPPORT   DISABLED
 
#define ESP_SM4_SUPPORT   DISABLED
 
#define ESP_MD5_SUPPORT   DISABLED
 
#define ESP_SHA1_SUPPORT   ENABLED
 
#define ESP_SHA256_SUPPORT   ENABLED
 
#define ESP_SHA384_SUPPORT   ENABLED
 
#define ESP_SHA512_SUPPORT   ENABLED
 
#define ESP_SM3_SUPPORT   DISABLED
 
#define ESP_BUFFER_SIZE   2048
 
#define ESP_MAX_DIGEST_SIZE   64
 

Functions

error_t espProtectOutboundIpv4Packet (IpsecContext *context, IpsecSadEntry *sa, NetInterface *interface, const Ipv4PseudoHeader *pseudoHeader, uint16_t fragId, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
 Protect an outbound IPv4 packet using ESP. More...
 
error_t espProcessInboundIpv4Packet (NetInterface *interface, const Ipv4Header *ipv4Header, const NetBuffer *buffer, size_t offset, NetRxAncillary *ancillary, bool_t udpEncapsulation)
 Process ESP protected packet. More...
 
bool_t espIsUdpEncapsulatedPacket (const NetBuffer *buffer, size_t offset)
 Determine if a packet uses UDP-encapsulated ESP format. More...
 
void espDumpHeader (const EspHeader *espHeader)
 Dump ESP header for debugging purpose. More...
 

Variables

typedef __packed_struct
 ESP header. More...
 
uint32_t seqNum
 
uint8_t payloadData []
 
 EspHeader
 
uint8_t nextHeader
 
uint8_t icv []
 
 EspTrailer
 

Detailed Description

ESP (IP Encapsulating Security Payload)

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 esp.h.

Macro Definition Documentation

◆ ESP_3DES_SUPPORT

#define ESP_3DES_SUPPORT   DISABLED

Definition at line 179 of file esp.h.

◆ ESP_AES_128_SUPPORT

#define ESP_AES_128_SUPPORT   ENABLED

Definition at line 186 of file esp.h.

◆ ESP_AES_192_SUPPORT

#define ESP_AES_192_SUPPORT   ENABLED

Definition at line 193 of file esp.h.

◆ ESP_AES_256_SUPPORT

#define ESP_AES_256_SUPPORT   ENABLED

Definition at line 200 of file esp.h.

◆ ESP_BUFFER_SIZE

#define ESP_BUFFER_SIZE   2048

Definition at line 277 of file esp.h.

◆ ESP_CAMELLIA_128_SUPPORT

#define ESP_CAMELLIA_128_SUPPORT   DISABLED

Definition at line 207 of file esp.h.

◆ ESP_CAMELLIA_192_SUPPORT

#define ESP_CAMELLIA_192_SUPPORT   DISABLED

Definition at line 214 of file esp.h.

◆ ESP_CAMELLIA_256_SUPPORT

#define ESP_CAMELLIA_256_SUPPORT   DISABLED

Definition at line 221 of file esp.h.

◆ ESP_CBC_SUPPORT

#define ESP_CBC_SUPPORT   ENABLED

Definition at line 67 of file esp.h.

◆ ESP_CCM_12_SUPPORT

#define ESP_CCM_12_SUPPORT   DISABLED

Definition at line 88 of file esp.h.

◆ ESP_CCM_16_SUPPORT

#define ESP_CCM_16_SUPPORT   DISABLED

Definition at line 95 of file esp.h.

◆ ESP_CCM_8_SUPPORT

#define ESP_CCM_8_SUPPORT   DISABLED

Definition at line 81 of file esp.h.

◆ ESP_CHACHA20_POLY1305_SUPPORT

#define ESP_CHACHA20_POLY1305_SUPPORT   ENABLED

Definition at line 123 of file esp.h.

◆ ESP_CMAC_SUPPORT

#define ESP_CMAC_SUPPORT   DISABLED

Definition at line 130 of file esp.h.

◆ ESP_CTR_SUPPORT

#define ESP_CTR_SUPPORT   DISABLED

Definition at line 74 of file esp.h.

◆ ESP_DES_SUPPORT

#define ESP_DES_SUPPORT   DISABLED

Definition at line 172 of file esp.h.

◆ ESP_ESN_SUPPORT

#define ESP_ESN_SUPPORT   ENABLED

Definition at line 53 of file esp.h.

◆ ESP_GCM_12_SUPPORT

#define ESP_GCM_12_SUPPORT   DISABLED

Definition at line 109 of file esp.h.

◆ ESP_GCM_16_SUPPORT

#define ESP_GCM_16_SUPPORT   ENABLED

Definition at line 116 of file esp.h.

◆ ESP_GCM_8_SUPPORT

#define ESP_GCM_8_SUPPORT   DISABLED

Definition at line 102 of file esp.h.

◆ ESP_GMAC_SUPPORT

#define ESP_GMAC_SUPPORT   DISABLED

Definition at line 137 of file esp.h.

◆ ESP_HMAC_SUPPORT

#define ESP_HMAC_SUPPORT   ENABLED

Definition at line 144 of file esp.h.

◆ ESP_IDEA_SUPPORT

#define ESP_IDEA_SUPPORT   DISABLED

Definition at line 165 of file esp.h.

◆ ESP_KMAC128_SUPPORT

#define ESP_KMAC128_SUPPORT   DISABLED

Definition at line 151 of file esp.h.

◆ ESP_KMAC256_SUPPORT

#define ESP_KMAC256_SUPPORT   DISABLED

Definition at line 158 of file esp.h.

◆ ESP_MAX_DIGEST_SIZE

#define ESP_MAX_DIGEST_SIZE   64

Definition at line 284 of file esp.h.

◆ ESP_MD5_SUPPORT

#define ESP_MD5_SUPPORT   DISABLED

Definition at line 235 of file esp.h.

◆ ESP_NULL_SUPPORT

#define ESP_NULL_SUPPORT   DISABLED

Definition at line 60 of file esp.h.

◆ ESP_SHA1_SUPPORT

#define ESP_SHA1_SUPPORT   ENABLED

Definition at line 242 of file esp.h.

◆ ESP_SHA256_SUPPORT

#define ESP_SHA256_SUPPORT   ENABLED

Definition at line 249 of file esp.h.

◆ ESP_SHA384_SUPPORT

#define ESP_SHA384_SUPPORT   ENABLED

Definition at line 256 of file esp.h.

◆ ESP_SHA512_SUPPORT

#define ESP_SHA512_SUPPORT   ENABLED

Definition at line 263 of file esp.h.

◆ ESP_SM3_SUPPORT

#define ESP_SM3_SUPPORT   DISABLED

Definition at line 270 of file esp.h.

◆ ESP_SM4_SUPPORT

#define ESP_SM4_SUPPORT   DISABLED

Definition at line 228 of file esp.h.

◆ ESP_SUPPORT

#define ESP_SUPPORT   ENABLED

Definition at line 39 of file esp.h.

◆ ESP_UDP_ENCAPS_SUPPORT

#define ESP_UDP_ENCAPS_SUPPORT   DISABLED

Definition at line 46 of file esp.h.

Function Documentation

◆ espDumpHeader()

void espDumpHeader ( const EspHeader *  espHeader)

Dump ESP header for debugging purpose.

Parameters
[in]espHeaderPointer to the ESP header

Definition at line 496 of file esp.c.

◆ espIsUdpEncapsulatedPacket()

bool_t espIsUdpEncapsulatedPacket ( const NetBuffer *  buffer,
size_t  offset 
)

Determine if a packet uses UDP-encapsulated ESP format.

Parameters
[in]bufferMulti-part buffer containing the UDP packet
[in]offsetOffset to the first byte of the UDP header

Definition at line 453 of file esp.c.

◆ espProcessInboundIpv4Packet()

error_t espProcessInboundIpv4Packet ( NetInterface *  interface,
const Ipv4Header *  ipv4Header,
const NetBuffer *  buffer,
size_t  offset,
NetRxAncillary *  ancillary,
bool_t  udpEncapsulation 
)

Process ESP protected packet.

Parameters
[in]interfaceUnderlying network interface
[in]ipv4HeaderPointer to the IPv4 header
[in]bufferMulti-part buffer containing the ESP protected packet
[in]offsetOffset to the first byte of the ESP header
[in]ancillaryAdditional options passed to the stack along with the packet
[in]udpEncapsulationUDP-encapsulated ESP packet
Returns
Error code

Definition at line 228 of file esp.c.

◆ espProtectOutboundIpv4Packet()

error_t espProtectOutboundIpv4Packet ( IpsecContext *  context,
IpsecSadEntry *  sa,
NetInterface *  interface,
const Ipv4PseudoHeader *  pseudoHeader,
uint16_t  fragId,
NetBuffer *  buffer,
size_t  offset,
NetTxAncillary *  ancillary 
)

Protect an outbound IPv4 packet using ESP.

Parameters
[in]contextPointer to the IPsec context
[in]saPointer to the security association
[in]interfaceUnderlying network interface
[in]pseudoHeaderIPv4 pseudo header
[in]fragIdFragment identification field
[in]bufferMulti-part buffer containing the payload
[in]offsetOffset to the first byte of the payload
[in]ancillaryAdditional options passed to the stack along with the packet
Returns
Error code

Definition at line 66 of file esp.c.

Variable Documentation

◆ __packed_struct

typedef __packed_struct
Initial value:
{
uint32_t spi

ESP header.

ESP trailer.

Definition at line 310 of file esp.h.

◆ EspHeader

EspHeader

Definition at line 315 of file esp.h.

◆ EspTrailer

EspTrailer

Definition at line 327 of file esp.h.

◆ icv

uint8_t icv[]

Definition at line 326 of file esp.h.

◆ nextHeader

uint8_t nextHeader

Definition at line 325 of file esp.h.

◆ payloadData

uint8_t payloadData[]

Definition at line 314 of file esp.h.

◆ seqNum

uint32_t seqNum

Definition at line 313 of file esp.h.

uint32_t spi
Definition: ah.h:175