28#ifndef PROTOCORE_IPSEC_DB_H
29#define PROTOCORE_IPSEC_DB_H
41#define PC_IPSEC_ADDR_MAX 16
43#define PC_IPSEC_SPD_MAX 8
45#define PC_IPSEC_SAD_MAX 8
48enum class IpsecAction : uint8_t
65 uint8_t src_lo[PC_IPSEC_ADDR_MAX];
66 uint8_t src_hi[PC_IPSEC_ADDR_MAX];
67 uint8_t dst_lo[PC_IPSEC_ADDR_MAX];
68 uint8_t dst_hi[PC_IPSEC_ADDR_MAX];
86 IpsecPolicy entries[PC_IPSEC_SPD_MAX];
105 uint8_t dst[PC_IPSEC_ADDR_MAX];
107 uint8_t key[PC_ESP_KEY_LEN];
108 uint8_t salt[PC_ESP_SALT_LEN];
118 IpsecSaEntry entries[PC_IPSEC_SAD_MAX];
125void pc_ipsec_spd_init(IpsecSpd *spd);
132bool pc_ipsec_spd_add(IpsecSpd *spd,
const IpsecSelector *sel, IpsecAction action, uint32_t sa_spi);
138const IpsecPolicy *pc_ipsec_spd_lookup(
const IpsecSpd *spd,
const IpsecFlow *flow);
141bool pc_ipsec_selector_match(
const IpsecSelector *sel,
const IpsecFlow *flow);
151bool pc_ipsec_selector_from_ts(IpsecSelector *out,
const IkeTrafficSelector *ts_src,
const IkeTrafficSelector *ts_dst);
156void pc_ipsec_sad_init(IpsecSad *sad);
165IpsecSaEntry *pc_ipsec_sad_add(IpsecSad *sad, uint32_t spi,
const uint8_t *dst, uint8_t addr_len,
166 const uint8_t key[PC_ESP_KEY_LEN],
const uint8_t salt[PC_ESP_SALT_LEN],
bool inbound);
169IpsecSaEntry *pc_ipsec_sad_find(IpsecSad *sad, uint32_t spi);
172bool pc_ipsec_sad_remove(IpsecSad *sad, uint32_t spi);
180bool pc_ipsec_sad_next_seq(IpsecSaEntry *sa, uint32_t *seq_out);
ESP (RFC 4303) packet transform with AES-256-GCM (RFC 4106) - the IPsec datapath's crypto core.
IKEv2 (RFC 7296) message + payload codec (PC_ENABLE_IKEV2) - a zero-heap builder / parser for the Int...
User-facing configuration for ProtoCore.