esp_packet_encrypt.h File Reference

ESP packet encryption. More...

#include "ipsec/ipsec.h"
#include "esp/esp.h"

Go to the source code of this file.

Functions

error_t espEncryptPacket (IpsecContext *context, IpsecSadEntry *sa, const EspHeader *espHeader, uint8_t *payload, size_t *payloadLen, uint8_t nextHeader)
 Encrypt an outgoing ESP packet. More...
 
error_t espComputeChecksum (IpsecContext *context, IpsecSadEntry *sa, const EspHeader *espHeader, const uint8_t *payload, size_t length, uint8_t *icv)
 Compute ICV checksum. More...
 
size_t espAddTrailer (IpsecSadEntry *sa, uint8_t *data, size_t length, uint8_t nextHeader)
 Append ESP trailer. More...
 
void espGenerateIv (uint8_t *iv)
 IV generation. More...
 

Detailed Description

ESP packet encryption.

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

Function Documentation

◆ espAddTrailer()

size_t espAddTrailer ( IpsecSadEntry sa,
uint8_t *  data,
size_t  length,
uint8_t  nextHeader 
)

Append ESP trailer.

Parameters
[in]saPointer to the SAD entry
[in]dataPointer to the payload data
[in]lengthLength of the payload data, in bytes
[in]nextHeaderValue of the next header field
Returns
Length of the resulting payload data

Definition at line 459 of file esp_packet_encrypt.c.

◆ espComputeChecksum()

error_t espComputeChecksum ( IpsecContext context,
IpsecSadEntry sa,
const EspHeader espHeader,
const uint8_t *  payload,
size_t  length,
uint8_t *  icv 
)

Compute ICV checksum.

Parameters
[in]contextPointer to the IPsec context
[in]saPointer to the SAD entry
[in]espHeaderPointer to the ESP header
[in]payloadPointer to the payload data
[in]lengthLength of the packet, in bytes
[out]icvIntegrity Checksum Value (ICV)
Returns
Error code

Definition at line 356 of file esp_packet_encrypt.c.

◆ espEncryptPacket()

error_t espEncryptPacket ( IpsecContext context,
IpsecSadEntry sa,
const EspHeader espHeader,
uint8_t *  payload,
size_t *  payloadLen,
uint8_t  nextHeader 
)

Encrypt an outgoing ESP packet.

Parameters
[in]contextPointer to the IPsec context
[in]saPointer to the SAD entry
[in]espHeaderPointer to the ESP header
[in,out]payloadPayload data to be encrypted
[in,out]payloadLenActual length of the payload data
[in]nextHeaderValue of the next header field
Returns
Error code

Definition at line 58 of file esp_packet_encrypt.c.

◆ espGenerateIv()

void espGenerateIv ( uint8_t *  iv)

IV generation.

Parameters
[in,out]ivPointer to the 8-octet initialization vector

Definition at line 527 of file esp_packet_encrypt.c.