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_PMAX = 5 34 } roc_ae_ec_id; 35 36 /* Prime and order fields of built-in elliptic curves */ 37 struct roc_ae_ec_group { 38 struct { 39 /* P521 maximum length */ 40 uint8_t data[66]; 41 unsigned int length; 42 } prime; 43 44 struct { 45 /* P521 maximum length */ 46 uint8_t data[66]; 47 unsigned int length; 48 } order; 49 }; 50 51 struct roc_ae_ec_ctx { 52 /* Prime length defined by microcode for EC operations */ 53 uint8_t curveid; 54 }; 55 56 /* Buffer pointer */ 57 struct roc_ae_buf_ptr { 58 void *vaddr; 59 }; 60 61 int __roc_api roc_ae_ec_grp_get(struct roc_ae_ec_group **tbl); 62 void __roc_api roc_ae_ec_grp_put(void); 63 #endif /* __ROC_AE_H__ */ 64