ah.h File Reference

AH (IP Authentication Header) More...

#include "ipsec/ipsec.h"

Go to the source code of this file.

Macros

#define AH_SUPPORT   DISABLED
 
#define AH_ESN_SUPPORT   ENABLED
 
#define AH_CMAC_SUPPORT   DISABLED
 
#define AH_HMAC_SUPPORT   ENABLED
 
#define AH_AES_128_SUPPORT   DISABLED
 
#define AH_MD5_SUPPORT   DISABLED
 
#define AH_SHA1_SUPPORT   ENABLED
 
#define AH_SHA256_SUPPORT   ENABLED
 
#define AH_SHA384_SUPPORT   ENABLED
 
#define AH_SHA512_SUPPORT   ENABLED
 
#define AH_MAX_ICV_SIZE   32
 
#define AH_MAX_OVERHEAD   (sizeof(AhHeader) + AH_MAX_ICV_SIZE)
 

Functions

error_t ipv4ProcessAhHeader (NetInterface *interface, const Ipv4Header *ipv4Header, const NetBuffer *buffer, size_t offset, NetRxAncillary *ancillary)
 Process AH protected packet. More...
 
error_t ahGenerateIcv (IpsecSadEntry *sa, const Ipv4Header *ipv4Header, AhHeader *ahHeader, const NetBuffer *buffer, size_t offset)
 ICV generation. More...
 
error_t ahVerifyIcv (IpsecSadEntry *sa, const Ipv4Header *ipv4Header, const AhHeader *ahHeader, const NetBuffer *buffer, size_t offset)
 ICV verification. More...
 
void ahProcessMutableIpv4Options (Ipv4Header *header)
 Zeroize mutable IPv4 options. More...
 
void ahDumpHeader (const AhHeader *ahHeader)
 Dump AH header for debugging purpose. More...
 

Variables

typedef __packed_struct
 AH header. More...
 
uint8_t payloadLen
 
uint16_t reserved
 
uint32_t spi
 
uint32_t seqNum
 
uint8_t icv []
 
 AhHeader
 

Detailed Description

AH (IP Authentication Header)

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

Macro Definition Documentation

◆ AH_AES_128_SUPPORT

#define AH_AES_128_SUPPORT   DISABLED

Definition at line 67 of file ah.h.

◆ AH_CMAC_SUPPORT

#define AH_CMAC_SUPPORT   DISABLED

Definition at line 53 of file ah.h.

◆ AH_ESN_SUPPORT

#define AH_ESN_SUPPORT   ENABLED

Definition at line 46 of file ah.h.

◆ AH_HMAC_SUPPORT

#define AH_HMAC_SUPPORT   ENABLED

Definition at line 60 of file ah.h.

◆ AH_MAX_ICV_SIZE

#define AH_MAX_ICV_SIZE   32

Definition at line 109 of file ah.h.

◆ AH_MAX_OVERHEAD

#define AH_MAX_OVERHEAD   (sizeof(AhHeader) + AH_MAX_ICV_SIZE)

Definition at line 119 of file ah.h.

◆ AH_MD5_SUPPORT

#define AH_MD5_SUPPORT   DISABLED

Definition at line 74 of file ah.h.

◆ AH_SHA1_SUPPORT

#define AH_SHA1_SUPPORT   ENABLED

Definition at line 81 of file ah.h.

◆ AH_SHA256_SUPPORT

#define AH_SHA256_SUPPORT   ENABLED

Definition at line 88 of file ah.h.

◆ AH_SHA384_SUPPORT

#define AH_SHA384_SUPPORT   ENABLED

Definition at line 95 of file ah.h.

◆ AH_SHA512_SUPPORT

#define AH_SHA512_SUPPORT   ENABLED

Definition at line 102 of file ah.h.

◆ AH_SUPPORT

#define AH_SUPPORT   DISABLED

Definition at line 39 of file ah.h.

Function Documentation

◆ ahDumpHeader()

void ahDumpHeader ( const AhHeader ahHeader)

Dump AH header for debugging purpose.

Parameters
[in]ahHeaderPointer to the AH header

Definition at line 760 of file ah.c.

◆ ahGenerateIcv()

error_t ahGenerateIcv ( IpsecSadEntry sa,
const Ipv4Header ipv4Header,
AhHeader ahHeader,
const NetBuffer buffer,
size_t  offset 
)

ICV generation.

Parameters
[in]saPointer to the SA
[in]ipv4HeaderPointer to the IPv4 header
[in,out]ahHeaderPointer to the AH header
[in]bufferMulti-part buffer containing the payload
[in]offsetOffset to the first byte of the payload
Returns
Error code

Definition at line 275 of file ah.c.

◆ ahProcessMutableIpv4Options()

void ahProcessMutableIpv4Options ( Ipv4Header header)

Zeroize mutable IPv4 options.

Parameters
[in]headerPointer to the IPv4 header

Definition at line 694 of file ah.c.

◆ ahVerifyIcv()

error_t ahVerifyIcv ( IpsecSadEntry sa,
const Ipv4Header ipv4Header,
const AhHeader ahHeader,
const NetBuffer buffer,
size_t  offset 
)

ICV verification.

Parameters
[in]saPointer to the SA
[in]ipv4HeaderPointer to the IPv4 header
[in]ahHeaderPointer to the AH header
[in]bufferMulti-part buffer containing the payload
[in]offsetOffset to the first byte of the payload
Returns
Error code

Definition at line 447 of file ah.c.

◆ ipv4ProcessAhHeader()

error_t ipv4ProcessAhHeader ( NetInterface interface,
const Ipv4Header ipv4Header,
const NetBuffer buffer,
size_t  offset,
NetRxAncillary ancillary 
)

Process AH protected packet.

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

Definition at line 60 of file ah.c.

Variable Documentation

◆ __packed_struct

typedef __packed_struct
Initial value:
{
uint8_t nextHeader

AH header.

Definition at line 138 of file ah.h.

◆ AhHeader

AhHeader

Definition at line 146 of file ah.h.

◆ icv

uint8_t icv[]

Definition at line 145 of file ah.h.

◆ payloadLen

uint8_t payloadLen

Definition at line 141 of file ah.h.

◆ reserved

uint16_t reserved

Definition at line 142 of file ah.h.

◆ seqNum

uint32_t seqNum

Definition at line 144 of file ah.h.

◆ spi

uint8_t spi

Definition at line 143 of file ah.h.

uint8_t nextHeader
Definition: ipv6.h:282