common/cnxk: swap ZUC-256 key
[dpdk.git] / drivers / common / cnxk / cnxk_security.h
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_api.h"
11
12 /* Response length calculation data */
13 struct cnxk_ipsec_outb_rlens {
14         uint16_t partial_len;
15         uint8_t roundup_byte;
16         int8_t roundup_len;
17         uint16_t max_extended_len;
18 };
19
20 int __roc_api
21 cnxk_ipsec_outb_rlens_get(struct cnxk_ipsec_outb_rlens *rlens,
22                           struct rte_security_ipsec_xform *ipsec_xfrm,
23                           struct rte_crypto_sym_xform *crypto_xfrm);
24 uint8_t __roc_api
25 cnxk_ipsec_ivlen_get(enum rte_crypto_cipher_algorithm c_algo,
26                      enum rte_crypto_auth_algorithm a_algo,
27                      enum rte_crypto_aead_algorithm aead_algo);
28 uint8_t __roc_api
29 cnxk_ipsec_icvlen_get(enum rte_crypto_cipher_algorithm c_algo,
30                       enum rte_crypto_auth_algorithm a_algo,
31                       enum rte_crypto_aead_algorithm aead_algo);
32
33 uint8_t __roc_api
34 cnxk_ipsec_outb_roundup_byte(enum rte_crypto_cipher_algorithm c_algo,
35                              enum rte_crypto_aead_algorithm aead_algo);
36
37 /* [CN10K, .) */
38 int __roc_api
39 cnxk_ot_ipsec_inb_sa_fill(struct roc_ot_ipsec_inb_sa *sa,
40                           struct rte_security_ipsec_xform *ipsec_xfrm,
41                           struct rte_crypto_sym_xform *crypto_xfrm,
42                           bool is_inline);
43 int __roc_api
44 cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa,
45                            struct rte_security_ipsec_xform *ipsec_xfrm,
46                            struct rte_crypto_sym_xform *crypto_xfrm);
47 bool __roc_api cnxk_ot_ipsec_inb_sa_valid(struct roc_ot_ipsec_inb_sa *sa);
48 bool __roc_api cnxk_ot_ipsec_outb_sa_valid(struct roc_ot_ipsec_outb_sa *sa);
49
50 /* [CN9K, CN10K) */
51 int __roc_api
52 cnxk_onf_ipsec_inb_sa_fill(struct roc_onf_ipsec_inb_sa *sa,
53                            struct rte_security_ipsec_xform *ipsec_xfrm,
54                            struct rte_crypto_sym_xform *crypto_xfrm);
55 int __roc_api
56 cnxk_onf_ipsec_outb_sa_fill(struct roc_onf_ipsec_outb_sa *sa,
57                             struct rte_security_ipsec_xform *ipsec_xfrm,
58                             struct rte_crypto_sym_xform *crypto_xfrm);
59 bool __roc_api cnxk_onf_ipsec_inb_sa_valid(struct roc_onf_ipsec_inb_sa *sa);
60 bool __roc_api cnxk_onf_ipsec_outb_sa_valid(struct roc_onf_ipsec_outb_sa *sa);
61
62 #endif /* _CNXK_SECURITY_H__ */