Helper Reference Manual  1.7.1
ipsec.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2014-2018 Linaro Limited
3  * Copyright (c) 2021 Nokia
4  */
5 
6 
13 #ifndef ODPH_IPSEC_H_
14 #define ODPH_IPSEC_H_
15 
16 #include <odp_api.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
27 #define ODPH_ESPHDR_LEN 8
28 #define ODPH_ESPTRL_LEN 2
29 #define ODPH_AHHDR_LEN 12
34 typedef struct ODP_PACKED {
35  odp_u32be_t spi;
36  odp_u32be_t seq_no;
37  uint8_t iv[];
39 
43 typedef struct ODP_PACKED {
44  uint8_t pad_len;
45  uint8_t next_header;
46  uint8_t icv[];
48 
52 typedef struct ODP_PACKED {
53  uint8_t next_header;
54  uint8_t ah_len;
55  odp_u16be_t pad;
56  odp_u32be_t spi;
57  odp_u32be_t seq_no;
58  uint8_t icv[];
60 
62 ODP_STATIC_ASSERT(sizeof(odph_esphdr_t) == ODPH_ESPHDR_LEN,
63  "ODPH_ESPHDR_T__SIZE_ERROR");
64 
65 ODP_STATIC_ASSERT(sizeof(odph_esptrl_t) == ODPH_ESPTRL_LEN,
66  "ODPH_ESPTRL_T__SIZE_ERROR");
67 
68 ODP_STATIC_ASSERT(sizeof(odph_ahhdr_t) == ODPH_AHHDR_LEN,
69  "ODPH_AHHDR_T__SIZE_ERROR");
89 int odph_ipsec_alg_check(const odp_ipsec_capability_t *capa,
90  odp_cipher_alg_t cipher_alg,
91  uint32_t cipher_key_len,
92  odp_auth_alg_t auth_alg,
93  uint32_t auth_key_len);
94 
105 uint32_t odph_ipsec_auth_icv_len_default(odp_auth_alg_t auth_alg);
106 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 #endif
#define ODPH_AHHDR_LEN
IPSec AH header length.
Definition: ipsec.h:29
int odph_ipsec_alg_check(const odp_ipsec_capability_t *capa, odp_cipher_alg_t cipher_alg, uint32_t cipher_key_len, odp_auth_alg_t auth_alg, uint32_t auth_key_len)
Check IPSEC algorithm support.
#define ODPH_ESPTRL_LEN
IPSec ESP trailer length.
Definition: ipsec.h:28
uint32_t odph_ipsec_auth_icv_len_default(odp_auth_alg_t auth_alg)
Return the default ICV length of an algorithm.
struct ODP_PACKED odph_ahhdr_t
IPSec AH header.
#define ODPH_ESPHDR_LEN
IPSec ESP header length.
Definition: ipsec.h:27
struct ODP_PACKED odph_esptrl_t
IPSec ESP trailer.
struct ODP_PACKED odph_esphdr_t
IPSec ESP header.
Ethernet MAC address.
Definition: eth.h:54
uint8_t icv[]
Integrity Check Value (optional)
Definition: ipsec.h:46
uint8_t next_header
Next header protocol.
Definition: ipsec.h:45
odp_u32be_t seq_no
Sequence Number.
Definition: ipsec.h:36
odp_u32be_t spi
Security Parameter Index.
Definition: ipsec.h:35
odp_u16be_t pad
Padding (must be 0)
Definition: ipsec.h:55
uint8_t iv[]
Initialization vector.
Definition: ipsec.h:37
uint8_t ah_len
AH header length.
Definition: ipsec.h:54
uint8_t pad_len
Padding length (0-255)
Definition: ipsec.h:44