xref: /dpdk/drivers/common/cnxk/roc_ae.h (revision f4d66aef)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4 
5 #ifndef __ROC_AE_H__
6 #define __ROC_AE_H__
7 
8 /* AE opcodes */
9 #define ROC_AE_MAJOR_OP_MODEX	     0x03
10 #define ROC_AE_MAJOR_OP_ECDSA	     0x04
11 #define ROC_AE_MAJOR_OP_ECC	     0x05
12 #define ROC_AE_MINOR_OP_MODEX	     0x01
13 #define ROC_AE_MINOR_OP_PKCS_ENC     0x02
14 #define ROC_AE_MINOR_OP_PKCS_ENC_CRT 0x03
15 #define ROC_AE_MINOR_OP_PKCS_DEC     0x04
16 #define ROC_AE_MINOR_OP_PKCS_DEC_CRT 0x05
17 #define ROC_AE_MINOR_OP_MODEX_CRT    0x06
18 #define ROC_AE_MINOR_OP_ECDSA_SIGN   0x01
19 #define ROC_AE_MINOR_OP_ECDSA_VERIFY 0x02
20 #define ROC_AE_MINOR_OP_ECC_UMP	     0x03
21 
22 /**
23  * Enumeration roc_ae_ec_id
24  *
25  * Enumerates supported elliptic curves
26  */
27 typedef enum {
28 	ROC_AE_EC_ID_P192 = 0,
29 	ROC_AE_EC_ID_P224 = 1,
30 	ROC_AE_EC_ID_P256 = 2,
31 	ROC_AE_EC_ID_P384 = 3,
32 	ROC_AE_EC_ID_P521 = 4,
33 	ROC_AE_EC_ID_P160 = 5,
34 	ROC_AE_EC_ID_P320 = 6,
35 	ROC_AE_EC_ID_P512 = 7,
36 	ROC_AE_EC_ID_PMAX = 8
37 } roc_ae_ec_id;
38 
39 /* Prime and order fields of built-in elliptic curves */
40 struct roc_ae_ec_group {
41 	struct {
42 		/* P521 maximum length */
43 		uint8_t data[66];
44 		unsigned int length;
45 	} prime;
46 
47 	struct {
48 		/* P521 maximum length */
49 		uint8_t data[66];
50 		unsigned int length;
51 	} order;
52 
53 	struct {
54 		/* P521 maximum length */
55 		uint8_t data[66];
56 		unsigned int length;
57 	} consta;
58 
59 	struct {
60 		/* P521 maximum length */
61 		uint8_t data[66];
62 		unsigned int length;
63 	} constb;
64 };
65 
66 struct roc_ae_ec_ctx {
67 	/* Prime length defined by microcode for EC operations */
68 	uint8_t curveid;
69 };
70 
71 /* Buffer pointer */
72 struct roc_ae_buf_ptr {
73 	void *vaddr;
74 };
75 
76 int __roc_api roc_ae_ec_grp_get(struct roc_ae_ec_group **tbl);
77 void __roc_api roc_ae_ec_grp_put(void);
78 #endif /* __ROC_AE_H__ */
79