xref: /dpdk/drivers/crypto/ipsec_mb/pmd_zuc_priv.h (revision 27595cd83053b2d39634a159d6709b3ce3cdf3b0)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016-2021 Intel Corporation
3  */
4 
5 #ifndef _PMD_ZUC_PRIV_H_
6 #define _PMD_ZUC_PRIV_H_
7 
8 #include "ipsec_mb_private.h"
9 
10 #define ZUC_IV_KEY_LENGTH 16
11 #define ZUC_DIGEST_LENGTH 4
12 #define ZUC_MAX_BURST 16
13 #define BYTE_LEN 8
14 
15 uint8_t pmd_driver_id_zuc;
16 
17 static const struct rte_cryptodev_capabilities zuc_capabilities[] = {
18 	{	/* ZUC (EIA3) */
19 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
20 		{.sym = {
21 			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
22 			{.auth = {
23 				.algo = RTE_CRYPTO_AUTH_ZUC_EIA3,
24 				.block_size = 16,
25 				.key_size = {
26 					.min = 16,
27 					.max = 16,
28 					.increment = 0
29 				},
30 				.digest_size = {
31 					.min = ZUC_DIGEST_LENGTH,
32 					.max = ZUC_DIGEST_LENGTH,
33 					.increment = 0
34 				},
35 				.iv_size = {
36 					.min = ZUC_IV_KEY_LENGTH,
37 					.max = ZUC_IV_KEY_LENGTH,
38 					.increment = 0
39 				}
40 			}, }
41 		}, }
42 	},
43 	{	/* ZUC (EEA3) */
44 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
45 		{.sym = {
46 			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
47 			{.cipher = {
48 				.algo = RTE_CRYPTO_CIPHER_ZUC_EEA3,
49 				.block_size = 16,
50 				.key_size = {
51 					.min = 16,
52 					.max = 16,
53 					.increment = 0
54 				},
55 				.iv_size = {
56 					.min = ZUC_IV_KEY_LENGTH,
57 					.max = ZUC_IV_KEY_LENGTH,
58 					.increment = 0
59 				},
60 			}, }
61 		}, }
62 	},
63 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
64 };
65 
66 /** ZUC private session structure */
67 struct __rte_cache_aligned zuc_session {
68 	enum ipsec_mb_operation op;
69 	enum rte_crypto_auth_operation auth_op;
70 	uint8_t pKey_cipher[ZUC_IV_KEY_LENGTH];
71 	uint8_t pKey_hash[ZUC_IV_KEY_LENGTH];
72 	uint16_t cipher_iv_offset;
73 	uint16_t auth_iv_offset;
74 };
75 
76 struct zuc_qp_data {
77 
78 	uint8_t temp_digest[ZUC_MAX_BURST][ZUC_DIGEST_LENGTH];
79 	/* *< Buffers used to store the digest generated
80 	 * by the driver when verifying a digest provided
81 	 * by the user (using authentication verify operation)
82 	 */
83 };
84 
85 #endif /* _PMD_ZUC_PRIV_H_ */
86