net/ice: fix perfect match for ACL rule
[dpdk.git] / app / test / test_cryptodev_asym_util.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Cavium Networks
3  */
4
5 #ifndef TEST_CRYPTODEV_ASYM_TEST_UTIL_H__
6 #define TEST_CRYPTODEV_ASYM_TEST_UTIL_H__
7
8 /* Below Apis compare resulted buffer to original test vector */
9
10 static inline int rsa_verify(struct rsa_test_data *rsa_param,
11                 struct rte_crypto_op *result_op)
12 {
13         if (memcmp(rsa_param->data,
14                                 result_op->asym->rsa.message.data,
15                                 result_op->asym->rsa.message.length))
16                 return -1;
17         return 0;
18 }
19
20 static inline int verify_modinv(uint8_t *mod_inv,
21                 struct rte_crypto_op *result_op)
22 {
23         if (memcmp(mod_inv, result_op->asym->modinv.result.data,
24                                 result_op->asym->modinv.result.length))
25                 return -1;
26         return 0;
27 }
28
29 static inline int verify_modexp(uint8_t *mod_exp,
30                 struct rte_crypto_op *result_op)
31 {
32         if (memcmp(mod_exp, result_op->asym->modex.result.data,
33                                 result_op->asym->modex.result.length))
34                 return -1;
35         return 0;
36 }
37
38 static inline int verify_ecdsa_sign(uint8_t *sign_r,
39                 uint8_t *sign_s, struct rte_crypto_op *result_op)
40 {
41         if (memcmp(sign_r, result_op->asym->ecdsa.r.data,
42                    result_op->asym->ecdsa.r.length) ||
43                    memcmp(sign_s, result_op->asym->ecdsa.s.data,
44                    result_op->asym->ecdsa.s.length))
45                 return -1;
46         return 0;
47 }
48
49 static inline int verify_ecpm(uint8_t *result_x, uint8_t *result_y,
50                               struct rte_crypto_op *result_op)
51 {
52         if (memcmp(result_x, result_op->asym->ecpm.r.x.data,
53                    result_op->asym->ecpm.r.x.length) ||
54                    memcmp(result_y, result_op->asym->ecpm.r.y.data,
55                    result_op->asym->ecpm.r.y.length))
56                 return -1;
57
58         return 0;
59 }
60 #endif /* TEST_CRYPTODEV_ASYM_TEST_UTIL_H__ */