Go to the documentation of this file.
39 #define ESP_SUPPORT ENABLED
40 #elif (ESP_SUPPORT != ENABLED && ESP_SUPPORT != DISABLED)
41 #error ESP_SUPPORT parameter is not valid
45 #ifndef ESP_UDP_ENCAPS_SUPPORT
46 #define ESP_UDP_ENCAPS_SUPPORT DISABLED
47 #elif (ESP_UDP_ENCAPS_SUPPORT != ENABLED && ESP_UDP_ENCAPS_SUPPORT != DISABLED)
48 #error ESP_UDP_ENCAPS_SUPPORT parameter is not valid
52 #ifndef ESP_ESN_SUPPORT
53 #define ESP_ESN_SUPPORT ENABLED
54 #elif (ESP_ESN_SUPPORT != ENABLED && ESP_ESN_SUPPORT != DISABLED)
55 #error ESP_ESN_SUPPORT parameter is not valid
59 #ifndef ESP_NULL_SUPPORT
60 #define ESP_NULL_SUPPORT DISABLED
61 #elif (ESP_NULL_SUPPORT != ENABLED && ESP_NULL_SUPPORT != DISABLED)
62 #error ESP_NULL_SUPPORT parameter is not valid
66 #ifndef ESP_CBC_SUPPORT
67 #define ESP_CBC_SUPPORT ENABLED
68 #elif (ESP_CBC_SUPPORT != ENABLED && ESP_CBC_SUPPORT != DISABLED)
69 #error ESP_CBC_SUPPORT parameter is not valid
73 #ifndef ESP_CTR_SUPPORT
74 #define ESP_CTR_SUPPORT DISABLED
75 #elif (ESP_CTR_SUPPORT != ENABLED && ESP_CTR_SUPPORT != DISABLED)
76 #error ESP_CTR_SUPPORT parameter is not valid
80 #ifndef ESP_CCM_8_SUPPORT
81 #define ESP_CCM_8_SUPPORT DISABLED
82 #elif (ESP_CCM_8_SUPPORT != ENABLED && ESP_CCM_8_SUPPORT != DISABLED)
83 #error ESP_CCM_8_SUPPORT parameter is not valid
87 #ifndef ESP_CCM_12_SUPPORT
88 #define ESP_CCM_12_SUPPORT DISABLED
89 #elif (ESP_CCM_12_SUPPORT != ENABLED && ESP_CCM_12_SUPPORT != DISABLED)
90 #error ESP_CCM_12_SUPPORT parameter is not valid
94 #ifndef ESP_CCM_16_SUPPORT
95 #define ESP_CCM_16_SUPPORT DISABLED
96 #elif (ESP_CCM_16_SUPPORT != ENABLED && ESP_CCM_16_SUPPORT != DISABLED)
97 #error ESP_CCM_16_SUPPORT parameter is not valid
101 #ifndef ESP_GCM_8_SUPPORT
102 #define ESP_GCM_8_SUPPORT DISABLED
103 #elif (ESP_GCM_8_SUPPORT != ENABLED && ESP_GCM_8_SUPPORT != DISABLED)
104 #error ESP_GCM_8_SUPPORT parameter is not valid
108 #ifndef ESP_GCM_12_SUPPORT
109 #define ESP_GCM_12_SUPPORT DISABLED
110 #elif (ESP_GCM_12_SUPPORT != ENABLED && ESP_GCM_12_SUPPORT != DISABLED)
111 #error ESP_GCM_12_SUPPORT parameter is not valid
115 #ifndef ESP_GCM_16_SUPPORT
116 #define ESP_GCM_16_SUPPORT ENABLED
117 #elif (ESP_GCM_16_SUPPORT != ENABLED && ESP_GCM_16_SUPPORT != DISABLED)
118 #error ESP_GCM_16_SUPPORT parameter is not valid
122 #ifndef ESP_CHACHA20_POLY1305_SUPPORT
123 #define ESP_CHACHA20_POLY1305_SUPPORT ENABLED
124 #elif (ESP_CHACHA20_POLY1305_SUPPORT != ENABLED && ESP_CHACHA20_POLY1305_SUPPORT != DISABLED)
125 #error ESP_CHACHA20_POLY1305_SUPPORT parameter is not valid
129 #ifndef ESP_CMAC_SUPPORT
130 #define ESP_CMAC_SUPPORT DISABLED
131 #elif (ESP_CMAC_SUPPORT != ENABLED && ESP_CMAC_SUPPORT != DISABLED)
132 #error ESP_CMAC_SUPPORT parameter is not valid
136 #ifndef ESP_GMAC_SUPPORT
137 #define ESP_GMAC_SUPPORT DISABLED
138 #elif (ESP_GMAC_SUPPORT != ENABLED && ESP_GMAC_SUPPORT != DISABLED)
139 #error ESP_GMAC_SUPPORT parameter is not valid
143 #ifndef ESP_HMAC_SUPPORT
144 #define ESP_HMAC_SUPPORT ENABLED
145 #elif (ESP_HMAC_SUPPORT != ENABLED && ESP_HMAC_SUPPORT != DISABLED)
146 #error ESP_HMAC_SUPPORT parameter is not valid
150 #ifndef ESP_KMAC128_SUPPORT
151 #define ESP_KMAC128_SUPPORT DISABLED
152 #elif (ESP_KMAC128_SUPPORT != ENABLED && ESP_KMAC128_SUPPORT != DISABLED)
153 #error ESP_KMAC128_SUPPORT parameter is not valid
157 #ifndef ESP_KMAC256_SUPPORT
158 #define ESP_KMAC256_SUPPORT DISABLED
159 #elif (ESP_KMAC256_SUPPORT != ENABLED && ESP_KMAC256_SUPPORT != DISABLED)
160 #error ESP_KMAC256_SUPPORT parameter is not valid
164 #ifndef ESP_IDEA_SUPPORT
165 #define ESP_IDEA_SUPPORT DISABLED
166 #elif (ESP_IDEA_SUPPORT != ENABLED && ESP_IDEA_SUPPORT != DISABLED)
167 #error ESP_IDEA_SUPPORT parameter is not valid
171 #ifndef ESP_DES_SUPPORT
172 #define ESP_DES_SUPPORT DISABLED
173 #elif (ESP_DES_SUPPORT != ENABLED && ESP_DES_SUPPORT != DISABLED)
174 #error ESP_DES_SUPPORT parameter is not valid
178 #ifndef ESP_3DES_SUPPORT
179 #define ESP_3DES_SUPPORT DISABLED
180 #elif (ESP_3DES_SUPPORT != ENABLED && ESP_3DES_SUPPORT != DISABLED)
181 #error ESP_3DES_SUPPORT parameter is not valid
185 #ifndef ESP_AES_128_SUPPORT
186 #define ESP_AES_128_SUPPORT ENABLED
187 #elif (ESP_AES_128_SUPPORT != ENABLED && ESP_AES_128_SUPPORT != DISABLED)
188 #error ESP_AES_128_SUPPORT parameter is not valid
192 #ifndef ESP_AES_192_SUPPORT
193 #define ESP_AES_192_SUPPORT ENABLED
194 #elif (ESP_AES_192_SUPPORT != ENABLED && ESP_AES_192_SUPPORT != DISABLED)
195 #error ESP_AES_192_SUPPORT parameter is not valid
199 #ifndef ESP_AES_256_SUPPORT
200 #define ESP_AES_256_SUPPORT ENABLED
201 #elif (ESP_AES_256_SUPPORT != ENABLED && ESP_AES_256_SUPPORT != DISABLED)
202 #error ESP_AES_256_SUPPORT parameter is not valid
206 #ifndef ESP_CAMELLIA_128_SUPPORT
207 #define ESP_CAMELLIA_128_SUPPORT DISABLED
208 #elif (ESP_CAMELLIA_128_SUPPORT != ENABLED && ESP_CAMELLIA_128_SUPPORT != DISABLED)
209 #error ESP_CAMELLIA_128_SUPPORT parameter is not valid
213 #ifndef ESP_CAMELLIA_192_SUPPORT
214 #define ESP_CAMELLIA_192_SUPPORT DISABLED
215 #elif (ESP_CAMELLIA_192_SUPPORT != ENABLED && ESP_CAMELLIA_192_SUPPORT != DISABLED)
216 #error ESP_CAMELLIA_192_SUPPORT parameter is not valid
220 #ifndef ESP_CAMELLIA_256_SUPPORT
221 #define ESP_CAMELLIA_256_SUPPORT DISABLED
222 #elif (ESP_CAMELLIA_256_SUPPORT != ENABLED && ESP_CAMELLIA_256_SUPPORT != DISABLED)
223 #error ESP_CAMELLIA_256_SUPPORT parameter is not valid
227 #ifndef ESP_SM4_SUPPORT
228 #define ESP_SM4_SUPPORT DISABLED
229 #elif (ESP_SM4_SUPPORT != ENABLED && ESP_SM4_SUPPORT != DISABLED)
230 #error ESP_SM4_SUPPORT parameter is not valid
234 #ifndef ESP_MD5_SUPPORT
235 #define ESP_MD5_SUPPORT DISABLED
236 #elif (ESP_MD5_SUPPORT != ENABLED && ESP_MD5_SUPPORT != DISABLED)
237 #error ESP_MD5_SUPPORT parameter is not valid
241 #ifndef ESP_SHA1_SUPPORT
242 #define ESP_SHA1_SUPPORT ENABLED
243 #elif (ESP_SHA1_SUPPORT != ENABLED && ESP_SHA1_SUPPORT != DISABLED)
244 #error ESP_SHA1_SUPPORT parameter is not valid
248 #ifndef ESP_SHA256_SUPPORT
249 #define ESP_SHA256_SUPPORT ENABLED
250 #elif (ESP_SHA256_SUPPORT != ENABLED && ESP_SHA256_SUPPORT != DISABLED)
251 #error ESP_SHA256_SUPPORT parameter is not valid
255 #ifndef ESP_SHA384_SUPPORT
256 #define ESP_SHA384_SUPPORT ENABLED
257 #elif (ESP_SHA384_SUPPORT != ENABLED && ESP_SHA384_SUPPORT != DISABLED)
258 #error ESP_SHA384_SUPPORT parameter is not valid
262 #ifndef ESP_SHA512_SUPPORT
263 #define ESP_SHA512_SUPPORT ENABLED
264 #elif (ESP_SHA512_SUPPORT != ENABLED && ESP_SHA512_SUPPORT != DISABLED)
265 #error ESP_SHA512_SUPPORT parameter is not valid
269 #ifndef ESP_SM3_SUPPORT
270 #define ESP_SM3_SUPPORT DISABLED
271 #elif (ESP_SM3_SUPPORT != ENABLED && ESP_SM3_SUPPORT != DISABLED)
272 #error ESP_SM3_SUPPORT parameter is not valid
276 #ifndef ESP_BUFFER_SIZE
277 #define ESP_BUFFER_SIZE 2048
278 #elif (ESP_BUFFER_SIZE < 256)
279 #error ESP_BUFFER_SIZE parameter is not valid
283 #if (ESP_HMAC_SUPPORT == ENABLED && ESP_SHA512_SUPPORT == ENABLED)
284 #define ESP_MAX_DIGEST_SIZE 64
285 #elif (ESP_HMAC_SUPPORT == ENABLED && ESP_SHA384_SUPPORT == ENABLED)
286 #define ESP_MAX_DIGEST_SIZE 48
287 #elif (ESP_HMAC_SUPPORT == ENABLED && ESP_SHA256_SUPPORT == ENABLED)
288 #define ESP_MAX_DIGEST_SIZE 32
290 #define ESP_MAX_DIGEST_SIZE 12
299 #if defined(__CCRX__)
301 #elif defined(__CWCC__) || defined(_WIN32)
302 #pragma pack(push, 1)
331 #if defined(__CCRX__)
333 #elif defined(__CWCC__) || defined(_WIN32)
340 uint16_t fragId,
NetBuffer *buffer,
size_t offset,
bool_t espIsUdpEncapsulatedPacket(const NetBuffer *buffer, size_t offset)
Determine if a packet uses UDP-encapsulated ESP format.
Structure describing a buffer that spans multiple chunks.
void espDumpHeader(const EspHeader *espHeader)
Dump ESP header for debugging purpose.
typedef __packed_struct
ESP header.
error_t espProcessInboundIpv4Packet(NetInterface *interface, const Ipv4Header *ipv4Header, const NetBuffer *buffer, size_t offset, NetRxAncillary *ancillary, bool_t udpEncapsulation)
Process ESP protected packet.
error_t espProtectOutboundIpv4Packet(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 ESP.