Go to the documentation of this file.
36 #define IpsecSadEntry struct _IpsecSadEntry
39 #include "ipsec_config.h"
75 #ifndef GPL_LICENSE_TERMS_ACCEPTED
76 #error Before compiling CycloneIPSEC Open, you must accept the terms of the GPL license
80 #define CYCLONE_IPSEC_VERSION_STRING "2.4.4"
82 #define CYCLONE_IPSEC_MAJOR_VERSION 2
84 #define CYCLONE_IPSEC_MINOR_VERSION 4
86 #define CYCLONE_IPSEC_REV_NUMBER 4
90 #define IPSEC_SUPPORT ENABLED
91 #elif (IPSEC_SUPPORT != ENABLED && IPSEC_SUPPORT != DISABLED)
92 #error IPSEC_SUPPORT parameter is not valid
96 #ifndef IPSEC_ANTI_REPLAY_SUPPORT
97 #define IPSEC_ANTI_REPLAY_SUPPORT ENABLED
98 #elif (IPSEC_ANTI_REPLAY_SUPPORT != ENABLED && IPSEC_ANTI_REPLAY_SUPPORT != DISABLED)
99 #error IPSEC_ANTI_REPLAY_SUPPORT parameter is not valid
103 #ifndef IPSEC_ANTI_REPLAY_WINDOW_SIZE
104 #define IPSEC_ANTI_REPLAY_WINDOW_SIZE 64
105 #elif (IPSEC_ANTI_REPLAY_WINDOW_SIZE < 1)
106 #error IPSEC_ANTI_REPLAY_WINDOW_SIZE parameter is not valid
110 #ifndef IPSEC_MAX_ID_LEN
111 #define IPSEC_MAX_ID_LEN 64
112 #elif (IPSEC_MAX_ID_LEN < 0)
113 #error IPSEC_MAX_ID_LEN is not valid
117 #ifndef IPSEC_MAX_PSK_LEN
118 #define IPSEC_MAX_PSK_LEN 64
119 #elif (IPSEC_MAX_PSK_LEN < 0)
120 #error IPSEC_MAX_PSK_LEN is not valid
124 #ifndef IPSEC_MAX_ENC_KEY_LEN
125 #define IPSEC_MAX_ENC_KEY_LEN 36
126 #elif (IPSEC_MAX_ENC_KEY_LEN < 1)
127 #error IPSEC_MAX_ENC_KEY_LEN parameter is not valid
131 #ifndef IPSEC_MAX_AUTH_KEY_LEN
132 #define IPSEC_MAX_AUTH_KEY_LEN 64
133 #elif (IPSEC_MAX_AUTH_KEY_LEN < 1)
134 #error IPSEC_MAX_AUTH_KEY_LEN parameter is not valid
138 #define IPSEC_SPI_SIZE 4
141 #define IPSEC_PROTOCOL_ANY 0
144 #define IPSEC_PORT_START_ANY 0
145 #define IPSEC_PORT_END_ANY 65535
148 #define IPSEC_PORT_START_OPAQUE 65535
149 #define IPSEC_PORT_END_OPAQUE 0
152 #define IPSEC_ICMP_PORT(type, code) (((type) * 256) + (code))
369 #if (ESP_SUPPORT == ENABLED)
387 #if (IPSEC_ANTI_REPLAY_SUPPORT == ENABLED)
443 #if (AH_CMAC_SUPPORT == ENABLED || ESP_CMAC_SUPPORT == ENABLED)
446 #if (AH_HMAC_SUPPORT == ENABLED || ESP_HMAC_SUPPORT == ENABLED)
449 #if (ESP_SUPPORT == ENABLED)
IpsecSadEntry * sad
Security Association Database (SAD)
IpsecAddrRange ipAddr
IPv4 or IPv6 address range.
@ IPSEC_ID_TYPE_KEY_ID
Key ID.
IpsecMode
IPsec protocol modes.
uint_t numSadEntries
Number of entries in the SAD database.
size_t icvLen
Length of the ICV tag, in bytes.
@ IPSEC_ID_TYPE_IPV4_ADDR
IPv4 address.
uint_t numPadEntries
Number of entries in the PAD database.
uint32_t spi
Security parameter index.
IpsecSelector selector
Traffic selector.
void * prngContext
Pseudo-random number generator context.
const CipherAlgo * authCipherAlgo
Cipher algorithm for CMAC-based integrity calculations.
Collection of AEAD algorithms.
IpAddr remoteIpAddr
Remote IP address.
Generic cipher algorithm context.
bool_t antiReplayEnabled
Anti-replay mechanism enabled.
size_t pskLen
Length of the pre-shared key, in bytes.
@ IPSEC_PFP_FLAG_REMOTE_ADDR
#define IPSEC_MAX_ENC_KEY_LEN
#define IPSEC_ANTI_REPLAY_WINDOW_SIZE
systime_t lifetimeStart
Timestamp.
@ IPSEC_PFP_FLAG_LOCAL_ADDR
uint8_t authKey[IPSEC_MAX_AUTH_KEY_LEN]
Integrity protection key.
uint_t numSadEntries
Number of entries in the SAD database.
#define IPSEC_MAX_AUTH_KEY_LEN
@ IPSEC_POLICY_ACTION_PROTECT
@ IPSEC_ID_TYPE_RFC822_ADDR
RFC 822 email address.
Peer Authorization Database (PAD) entry.
uint16_t remotePort
Remote port.
bool_t esn
Extended sequence numbers.
ESP (IP Encapsulating Security Payload)
uint64_t seqNum
Sequence number counter.
IpsecSadEntry * sadEntries
Security Association Database (SAD)
IpAddr localTunnelAddr
Local tunnel IP address.
IpsecSpdEntry * spd
Security Policy Database (SPD)
ICMP (Internet Control Message Protocol)
IpsecAuthMethod authMethod
Authentication method (IKEv1, IKEv2, KINK)
uint8_t nextProtocol
Next layer protocol.
uint8_t nextProtocol
Next layer protocol.
uint16_t localPort
Local port.
@ IPSEC_ID_TYPE_FQDN
Fully-qualified domain name.
IpsecPolicyAction
Policy action.
uint8_t encKey[IPSEC_MAX_ENC_KEY_LEN]
Encryption key.
IpsecPolicyAction policyAction
Processing choice (DISCARD, BYPASS or PROTECT)
@ IPSEC_PFP_FLAG_REMOTE_PORT
IpsecPortRange remotePort
Remote port range.
@ IPSEC_POLICY_ACTION_DISCARD
IpsecPadEntry * pad
Peer Authorization Database (PAD)
IpsecProtocol protocol
Security protocol (AH or ESP)
@ IPSEC_AUTH_METHOD_IKEV1
Security Association Database (SAD) entry.
@ IPSEC_ID_TYPE_IPV6_ADDR
IPv6 address.
size_t saltLen
Length of the salt, in bytes.
General definitions for cryptographic algorithms.
IpAddr tunnelDestIpAddr
Tunnel header IP destination address.
uint32_t antiReplayWindow[(IPSEC_ANTI_REPLAY_WINDOW_SIZE+31)/32]
Anti-replay window.
@ IPSEC_AUTH_METHOD_IKEV2
IpsecPadEntry * padEntries
Peer Authorization Database (PAD)
Block cipher modes of operation.
const CipherAlgo * cipherAlgo
Cipher algorithm.
IpsecSaState state
SAD entry state.
IpsecDfPolicy
DF flag policy.
size_t trustedCaListLen
Trusted CA list (PEM format)
IpsecMode mode
IPsec mode (tunnel or transport)
const HashAlgo * authHashAlgo
Hash algorithm for HMAC-based integrity calculations.
IpsecDirection direction
Direction.
error_t ipsecClearSpdEntry(IpsecContext *context, uint_t index)
Clear entry at specified index in SPD database.
uint_t pfpFlags
PFP flags.
CipherMode
Cipher operation modes.
IpsecIdType idType
ID type.
AH (IP Authentication Header)
IpsecProtocol
Security protocols.
const PrngAlgo * prngAlgo
Pseudo-random number generator to be used.
const char_t * trustedCaList
Collection of hash algorithms.
uint32_t systime_t
System time.
error_t ipsecClearPadEntry(IpsecContext *context, uint_t index)
Clear entry at specified index in PAD database.
bool_t esn
Extended sequence numbers.
size_t idLen
Length of the ID, in bytes.
size_t authKeyLen
Length of the integrity protection key, in bytes.
TCP (Transmission Control Protocol)
uint_t numPadEntries
Number of entries in the PAD database.
uint8_t iv[16]
Initialization vector.
uint_t numSpdEntries
Number of entries in the SPD database.
IpsecAddrRange localIpAddr
Local IP address range.
@ IPSEC_POLICY_ACTION_INVALID
IpAddr localIpAddr
Local IP address.
@ IPSEC_PFP_FLAG_NEXT_PROTOCOL
UDP (User Datagram Protocol)
const PrngAlgo * prngAlgo
Pseudo-random number generator to be used.
@ IPSEC_ID_TYPE_DN
X.500 distinguished name.
CipherMode cipherMode
Cipher mode of operation.
IpAddr remoteTunnelAddr
Remote tunnel IP address.
uint_t numSpdEntries
Number of entries in the SPD database.
@ IPSEC_PFP_FLAG_LOCAL_PORT
Common interface for encryption algorithms.
CmacContext cmacContext
CMAC context.
@ IPSEC_POLICY_ACTION_BYPASS
#define IPSEC_MAX_PSK_LEN
Collection of MAC algorithms.
@ IPSEC_AUTH_METHOD_INVALID
void ipsecGetDefaultSettings(IpsecSettings *settings)
Initialize settings with default values.
IpsecProtocol protocol
Security protocol (AH or ESP)
IpsecSaState
IPsec SAD entry state.
Common interface for hash algorithms.
error_t ipsecSetSpdEntry(IpsecContext *context, uint_t index, IpsecSpdEntry *params)
Set entry at specified index in SPD database.
error_t ipsecSetPadEntry(IpsecContext *context, uint_t index, IpsecPadEntry *params)
Set entry at specified index in PAD database.
IpsecAuthMethod
Authentication methods.
Security Policy Database (SPD) entry.
HmacContext hmacContext
HMAC context.
size_t ivLen
Length of the initialization vector, in bytes.
IpsecSelector selector
Traffic selector.
CipherContext cipherContext
Cipher context.
@ IPSEC_SA_STATE_RESERVED
error_t ipsecInit(IpsecContext *context, const IpsecSettings *settings)
IPsec service initialization.
void * prngContext
Pseudo-random number generator context.
IpsecDfPolicy dfPolicy
DF flag policy.
error_t ipsecClearSadEntry(IpsecContext *context, uint_t index)
Clear entry at specified index in SAD database.
IpsecPortRange localPort
Local port range.
size_t encKeyLen
Length of the encryption key, in bytes.
IpsecAddrRange remoteIpAddr
Remote IP address range.
IpsecMode mode
IPsec mode (tunnel or transport)
IpsecSpdEntry * spdEntries
Security Policy Database (SPD)
error_t ipsecSetSadEntry(IpsecContext *context, uint_t index, IpsecSadEntry *params)
Set entry at specified index in SAD database.