1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
5 #ifndef _TEST_CRYPTODEV_SECURITY_IPSEC_H_
6 #define _TEST_CRYPTODEV_SECURITY_IPSEC_H_
8 #include <rte_cryptodev.h>
9 #include <rte_security.h>
11 #define IPSEC_TEST_PACKETS_MAX 32
13 struct ipsec_test_data {
40 struct rte_security_ipsec_xform ipsec_xform;
46 struct rte_crypto_sym_xform cipher;
47 struct rte_crypto_sym_xform auth;
49 struct rte_crypto_sym_xform aead;
53 struct ipsec_test_flags {
55 bool sa_expiry_pkts_soft;
56 bool sa_expiry_pkts_hard;
59 uint32_t tunnel_hdr_verify;
61 bool udp_ports_verify;
67 enum rte_crypto_sym_xform_type type;
69 enum rte_crypto_cipher_algorithm cipher;
70 enum rte_crypto_auth_algorithm auth;
71 enum rte_crypto_aead_algorithm aead;
76 static const struct crypto_param aead_list[] = {
78 .type = RTE_CRYPTO_SYM_XFORM_AEAD,
79 .alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
83 .type = RTE_CRYPTO_SYM_XFORM_AEAD,
84 .alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
88 .type = RTE_CRYPTO_SYM_XFORM_AEAD,
89 .alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
94 int test_ipsec_sec_caps_verify(struct rte_security_ipsec_xform *ipsec_xform,
95 const struct rte_security_capability *sec_cap,
98 int test_ipsec_crypto_caps_aead_verify(
99 const struct rte_security_capability *sec_cap,
100 struct rte_crypto_sym_xform *aead);
102 int test_ipsec_crypto_caps_cipher_verify(
103 const struct rte_security_capability *sec_cap,
104 struct rte_crypto_sym_xform *cipher);
106 int test_ipsec_crypto_caps_auth_verify(
107 const struct rte_security_capability *sec_cap,
108 struct rte_crypto_sym_xform *auth);
110 void test_ipsec_td_in_from_out(const struct ipsec_test_data *td_out,
111 struct ipsec_test_data *td_in);
113 void test_ipsec_td_prepare(const struct crypto_param *param1,
114 const struct crypto_param *param2,
115 const struct ipsec_test_flags *flags,
116 struct ipsec_test_data *td_array,
119 void test_ipsec_td_update(struct ipsec_test_data td_inb[],
120 const struct ipsec_test_data td_outb[],
122 const struct ipsec_test_flags *flags);
124 void test_ipsec_display_alg(const struct crypto_param *param1,
125 const struct crypto_param *param2);
127 int test_ipsec_post_process(struct rte_mbuf *m,
128 const struct ipsec_test_data *td,
129 struct ipsec_test_data *res_d, bool silent,
130 const struct ipsec_test_flags *flags);
132 int test_ipsec_status_check(struct rte_crypto_op *op,
133 const struct ipsec_test_flags *flags,
134 enum rte_security_ipsec_sa_direction dir,