xref: /dpdk/drivers/crypto/ipsec_mb/pmd_snow3g_priv.h (revision 27595cd83053b2d39634a159d6709b3ce3cdf3b0)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016-2021 Intel Corporation
3  */
4 
5 #ifndef _PMD_SNOW3G_PRIV_H_
6 #define _PMD_SNOW3G_PRIV_H_
7 
8 #include "ipsec_mb_private.h"
9 
10 #define SNOW3G_IV_LENGTH 16
11 #define SNOW3G_MAX_BURST 8
12 #define BYTE_LEN 8
13 #define SNOW3G_DIGEST_LENGTH 4
14 #define SNOW3G_MAX_KEY_SIZE  128
15 
16 uint8_t pmd_driver_id_snow3g;
17 
18 static const struct rte_cryptodev_capabilities snow3g_capabilities[] = {
19 	{	/* SNOW 3G (UIA2) */
20 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
21 		{.sym = {
22 			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
23 			{.auth = {
24 				.algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
25 				.block_size = 16,
26 				.key_size = {
27 					.min = 16,
28 					.max = 16,
29 					.increment = 0
30 				},
31 				.digest_size = {
32 					.min = SNOW3G_DIGEST_LENGTH,
33 					.max = SNOW3G_DIGEST_LENGTH,
34 					.increment = 0
35 				},
36 				.iv_size = {
37 					.min = SNOW3G_IV_LENGTH,
38 					.max = SNOW3G_IV_LENGTH,
39 					.increment = 0
40 				}
41 			}, }
42 		}, }
43 	},
44 	{	/* SNOW 3G (UEA2) */
45 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
46 		{.sym = {
47 			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
48 			{.cipher = {
49 				.algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
50 				.block_size = 16,
51 				.key_size = {
52 					.min = 16,
53 					.max = 16,
54 					.increment = 0
55 				},
56 				.iv_size = {
57 					.min = SNOW3G_IV_LENGTH,
58 					.max = SNOW3G_IV_LENGTH,
59 					.increment = 0
60 				}
61 			}, }
62 		}, }
63 	},
64 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
65 };
66 
67 /** SNOW 3G private session structure */
68 struct __rte_cache_aligned snow3g_session {
69 	enum ipsec_mb_operation op;
70 	enum rte_crypto_auth_operation auth_op;
71 	snow3g_key_schedule_t pKeySched_cipher;
72 	snow3g_key_schedule_t pKeySched_hash;
73 	uint16_t cipher_iv_offset;
74 	uint16_t auth_iv_offset;
75 };
76 
77 struct snow3g_qp_data {
78 	uint8_t temp_digest[SNOW3G_DIGEST_LENGTH];
79 	/**< Buffer 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_SNOW3G_PRIV_H_ */
86