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 {
37 struct rte_security_ipsec_xform ipsec_xform;
43 struct rte_crypto_sym_xform cipher;
44 struct rte_crypto_sym_xform auth;
46 struct rte_crypto_sym_xform aead;
50 struct ipsec_test_flags {
52 bool sa_expiry_pkts_soft;
53 bool sa_expiry_pkts_hard;
56 uint32_t tunnel_hdr_verify;
58 bool udp_ports_verify;
62 enum rte_crypto_sym_xform_type type;
64 enum rte_crypto_cipher_algorithm cipher;
65 enum rte_crypto_auth_algorithm auth;
66 enum rte_crypto_aead_algorithm aead;
71 static const struct crypto_param aead_list[] = {
73 .type = RTE_CRYPTO_SYM_XFORM_AEAD,
74 .alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
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,
89 int test_ipsec_sec_caps_verify(struct rte_security_ipsec_xform *ipsec_xform,
90 const struct rte_security_capability *sec_cap,
93 int test_ipsec_crypto_caps_aead_verify(
94 const struct rte_security_capability *sec_cap,
95 struct rte_crypto_sym_xform *aead);
97 void test_ipsec_td_in_from_out(const struct ipsec_test_data *td_out,
98 struct ipsec_test_data *td_in);
100 void test_ipsec_td_prepare(const struct crypto_param *param1,
101 const struct crypto_param *param2,
102 const struct ipsec_test_flags *flags,
103 struct ipsec_test_data *td_array,
106 void test_ipsec_td_update(struct ipsec_test_data td_inb[],
107 const struct ipsec_test_data td_outb[],
109 const struct ipsec_test_flags *flags);
111 void test_ipsec_display_alg(const struct crypto_param *param1,
112 const struct crypto_param *param2);
114 int test_ipsec_post_process(struct rte_mbuf *m,
115 const struct ipsec_test_data *td,
116 struct ipsec_test_data *res_d, bool silent,
117 const struct ipsec_test_flags *flags);
119 int test_ipsec_status_check(struct rte_crypto_op *op,
120 const struct ipsec_test_flags *flags,
121 enum rte_security_ipsec_sa_direction dir,