ipsec_outbound.c File Reference

IPsec processing of outbound IP traffic. More...

#include "ipsec/ipsec.h"
#include "ipsec/ipsec_outbound.h"
#include "ipsec/ipsec_misc.h"
#include "ike/ike.h"
#include "ah/ah.h"
#include "esp/esp_packet_encrypt.h"
#include "debug.h"

Go to the source code of this file.

Functions

error_t ipsecProcessOutboundIpv4Packet (NetInterface *interface, const Ipv4PseudoHeader *pseudoHeader, uint16_t fragId, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
 Outbound IPv4 traffic processing. More...
 
error_t ipsecGetOutboundIpv4PacketSelector (const Ipv4PseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, IpsecSelector *selector)
 Extract packet's selector from outbound IPv4 packet. More...
 
error_t ipsecProtectIpv4Packet (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 AH or ESP. More...
 
error_t ipsecSendIpv4Packet (NetInterface *interface, const Ipv4PseudoHeader *pseudoHeader, uint16_t fragId, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
 Send an IPv4 packet. More...
 

Detailed Description

IPsec processing of outbound IP traffic.

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.4

Definition in file ipsec_outbound.c.

Function Documentation

◆ ipsecGetOutboundIpv4PacketSelector()

error_t ipsecGetOutboundIpv4PacketSelector ( const Ipv4PseudoHeader pseudoHeader,
const NetBuffer buffer,
size_t  offset,
IpsecSelector selector 
)

Extract packet's selector from outbound IPv4 packet.

Parameters
[in]pseudoHeaderIPv4 pseudo header
[in]bufferMulti-part buffer containing the IP payload
[in]offsetOffset from the beginning of the buffer
[out]selectorPointer to the IPsec selector
Returns
Error code

Definition at line 152 of file ipsec_outbound.c.

◆ ipsecProcessOutboundIpv4Packet()

error_t ipsecProcessOutboundIpv4Packet ( NetInterface interface,
const Ipv4PseudoHeader pseudoHeader,
uint16_t  fragId,
NetBuffer buffer,
size_t  offset,
NetTxAncillary ancillary 
)

Outbound IPv4 traffic processing.

Parameters
[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 56 of file ipsec_outbound.c.

◆ ipsecProtectIpv4Packet()

error_t ipsecProtectIpv4Packet ( 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 AH or 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 261 of file ipsec_outbound.c.

◆ ipsecSendIpv4Packet()

error_t ipsecSendIpv4Packet ( NetInterface interface,
const Ipv4PseudoHeader pseudoHeader,
uint16_t  fragId,
NetBuffer buffer,
size_t  offset,
NetTxAncillary ancillary 
)

Send an IPv4 packet.

Parameters
[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 444 of file ipsec_outbound.c.