xref: /dpdk/drivers/common/cnxk/cnxk_security.h (revision 930d94170e044ce1a2a2f222306c7dad50898728)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4 #ifndef _CNXK_SECURITY_H__
5 #define _CNXK_SECURITY_H__
6 
7 #include <rte_crypto.h>
8 #include <rte_security.h>
9 
10 #include "roc_ie_on.h"
11 #include "roc_ie_ot.h"
12 
13 /* Response length calculation data */
14 struct cnxk_ipsec_outb_rlens {
15 	uint16_t partial_len;
16 	uint8_t roundup_byte;
17 	int8_t roundup_len;
18 	uint16_t max_extended_len;
19 };
20 
21 int __roc_api
22 cnxk_ipsec_outb_rlens_get(struct cnxk_ipsec_outb_rlens *rlens,
23 			  struct rte_security_ipsec_xform *ipsec_xfrm,
24 			  struct rte_crypto_sym_xform *crypto_xfrm);
25 uint8_t __roc_api
26 cnxk_ipsec_ivlen_get(enum rte_crypto_cipher_algorithm c_algo,
27 		     enum rte_crypto_auth_algorithm a_algo,
28 		     enum rte_crypto_aead_algorithm aead_algo);
29 uint8_t __roc_api
30 cnxk_ipsec_icvlen_get(enum rte_crypto_cipher_algorithm c_algo,
31 		      enum rte_crypto_auth_algorithm a_algo,
32 		      enum rte_crypto_aead_algorithm aead_algo);
33 
34 uint8_t __roc_api
35 cnxk_ipsec_outb_roundup_byte(enum rte_crypto_cipher_algorithm c_algo,
36 			     enum rte_crypto_aead_algorithm aead_algo);
37 
38 /* [CN10K, .) */
39 int __roc_api
40 cnxk_ot_ipsec_inb_sa_fill(struct roc_ot_ipsec_inb_sa *sa,
41 			  struct rte_security_ipsec_xform *ipsec_xfrm,
42 			  struct rte_crypto_sym_xform *crypto_xfrm,
43 			  bool is_inline);
44 int __roc_api
45 cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa,
46 			   struct rte_security_ipsec_xform *ipsec_xfrm,
47 			   struct rte_crypto_sym_xform *crypto_xfrm);
48 bool __roc_api cnxk_ot_ipsec_inb_sa_valid(struct roc_ot_ipsec_inb_sa *sa);
49 bool __roc_api cnxk_ot_ipsec_outb_sa_valid(struct roc_ot_ipsec_outb_sa *sa);
50 
51 /* [CN9K] */
52 int __roc_api cnxk_on_ipsec_inb_sa_create(struct rte_security_ipsec_xform *ipsec,
53 					  struct rte_crypto_sym_xform *crypto_xform,
54 					  struct roc_ie_on_inb_sa *in_sa);
55 
56 int __roc_api cnxk_on_ipsec_outb_sa_create(struct rte_security_ipsec_xform *ipsec,
57 					   struct rte_crypto_sym_xform *crypto_xform,
58 					   struct roc_ie_on_outb_sa *out_sa);
59 #endif /* _CNXK_SECURITY_H__ */
60