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;
59 enum rte_crypto_sym_xform_type type;
61 enum rte_crypto_cipher_algorithm cipher;
62 enum rte_crypto_auth_algorithm auth;
63 enum rte_crypto_aead_algorithm aead;
68 static const struct crypto_param aead_list[] = {
70 .type = RTE_CRYPTO_SYM_XFORM_AEAD,
71 .alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
75 .type = RTE_CRYPTO_SYM_XFORM_AEAD,
76 .alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
80 .type = RTE_CRYPTO_SYM_XFORM_AEAD,
81 .alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
86 int test_ipsec_sec_caps_verify(struct rte_security_ipsec_xform *ipsec_xform,
87 const struct rte_security_capability *sec_cap,
90 int test_ipsec_crypto_caps_aead_verify(
91 const struct rte_security_capability *sec_cap,
92 struct rte_crypto_sym_xform *aead);
94 void test_ipsec_td_in_from_out(const struct ipsec_test_data *td_out,
95 struct ipsec_test_data *td_in);
97 void test_ipsec_td_prepare(const struct crypto_param *param1,
98 const struct crypto_param *param2,
99 const struct ipsec_test_flags *flags,
100 struct ipsec_test_data *td_array,
103 void test_ipsec_td_update(struct ipsec_test_data td_inb[],
104 const struct ipsec_test_data td_outb[],
106 const struct ipsec_test_flags *flags);
108 void test_ipsec_display_alg(const struct crypto_param *param1,
109 const struct crypto_param *param2);
111 int test_ipsec_post_process(struct rte_mbuf *m,
112 const struct ipsec_test_data *td,
113 struct ipsec_test_data *res_d, bool silent,
114 const struct ipsec_test_flags *flags);
116 int test_ipsec_status_check(struct rte_crypto_op *op,
117 const struct ipsec_test_flags *flags,
118 enum rte_security_ipsec_sa_direction dir,