5f1b46d874e10cada8c001fb15b77365faa3f5af
[dpdk.git] / app / test / test_cryptodev_security_ipsec.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4
5 #ifndef _TEST_CRYPTODEV_SECURITY_IPSEC_H_
6 #define _TEST_CRYPTODEV_SECURITY_IPSEC_H_
7
8 #include <rte_cryptodev.h>
9 #include <rte_security.h>
10
11 struct ipsec_test_data {
12         struct {
13                 uint8_t data[32];
14         } key;
15
16         struct {
17                 uint8_t data[1024];
18                 unsigned int len;
19         } input_text;
20
21         struct {
22                 uint8_t data[1024];
23                 unsigned int len;
24         } output_text;
25
26         struct {
27                 uint8_t data[4];
28                 unsigned int len;
29         } salt;
30
31         struct {
32                 uint8_t data[16];
33         } iv;
34
35         struct rte_security_ipsec_xform ipsec_xform;
36
37         bool aead;
38
39         union {
40                 struct {
41                         struct rte_crypto_sym_xform cipher;
42                         struct rte_crypto_sym_xform auth;
43                 } chain;
44                 struct rte_crypto_sym_xform aead;
45         } xform;
46 };
47
48 int test_ipsec_sec_caps_verify(struct rte_security_ipsec_xform *ipsec_xform,
49                                const struct rte_security_capability *sec_cap,
50                                bool silent);
51
52 int test_ipsec_crypto_caps_aead_verify(
53                 const struct rte_security_capability *sec_cap,
54                 struct rte_crypto_sym_xform *aead);
55
56 void test_ipsec_td_in_from_out(const struct ipsec_test_data *td_out,
57                                struct ipsec_test_data *td_in);
58
59 int test_ipsec_post_process(struct rte_mbuf *m,
60                             const struct ipsec_test_data *td,
61                             struct ipsec_test_data *res_d, bool silent);
62
63 int test_ipsec_status_check(struct rte_crypto_op *op,
64                             enum rte_security_ipsec_sa_direction dir);
65
66 #endif