API Reference Manual 1.51.0
Loading...
Searching...
No Matches
ipsec_crypto/odp_ipsec_cache.h
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2014-2018 Linaro Limited
3 */
4
7#ifndef ODP_IPSEC_CACHE_H_
8#define ODP_IPSEC_CACHE_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include <odp_api.h>
15#include <odp/helper/ipsec.h>
16
17#include <odp_ipsec_misc.h>
18#include <odp_ipsec_sa_db.h>
19
23typedef enum {
24 CRYPTO_API_SYNC,
25 CRYPTO_API_ASYNC,
26} crypto_api_mode_e;
27
31typedef struct ipsec_cache_entry_s {
32 struct ipsec_cache_entry_s *next;
33 odp_bool_t async;
34 int sa_flags;
35 uint32_t src_ip;
36 uint32_t dst_ip;
37 sa_mode_t mode;
38 uint32_t tun_src_ip;
39 uint32_t tun_dst_ip;
40 struct {
42 uint32_t spi;
43 uint32_t block_len;
44 uint32_t iv_len;
45 ipsec_key_t key;
46 } esp;
47 struct {
48 odp_auth_alg_t alg;
49 uint32_t spi;
50 uint32_t icv_len;
51 ipsec_key_t key;
52 } ah;
53
54 /* Per SA state */
55 struct {
56 odp_crypto_session_t session;
57 uint32_t esp_seq;
58 uint32_t ah_seq;
59 odp_u16be_t tun_hdr_id;
60 } state;
61} ipsec_cache_entry_t;
62
66typedef struct ipsec_cache_s {
67 uint32_t index;
68 ipsec_cache_entry_t *in_list;
69 ipsec_cache_entry_t *out_list;
70 ipsec_cache_entry_t array[MAX_DB];
71} ipsec_cache_t;
72
74extern ipsec_cache_t *ipsec_cache;
75
77void init_ipsec_cache(void);
78
92int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
93 sa_db_entry_t *auth_sa,
94 tun_db_entry_t *tun,
95 crypto_api_mode_e api_mode,
96 odp_bool_t in,
97 odp_queue_t completionq);
98
109ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
110 uint32_t dst_ip,
111 odph_ahhdr_t *ah,
112 odph_esphdr_t *esp);
113
123ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
124 uint32_t dst_ip,
125 uint8_t proto);
126
127int destroy_ipsec_cache(void);
128
129#ifdef __cplusplus
130}
131#endif
132
133#endif
uint16_t odp_u16be_t
unsigned 16bit big endian
odp_cipher_alg_t
Crypto API cipher algorithm.
uint64_t odp_crypto_session_t
Crypto API opaque session handle.
odp_auth_alg_t
Crypto API authentication algorithm.
bool odp_bool_t
Boolean type.
The OpenDataPlane API.