X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcommon%2Fcpt%2Fcpt_mcode_defines.h;h=69d831b5cc12d17615f76e0242cbf6af98646659;hb=4211cc0e922616f9d017504b0db6d3f91b111bcd;hp=b7c3feb24b53a1d4c113dc67e1351e47e7d058f1;hpb=131966f876206ae77cd05dabef4040c51aa1e16d;p=dpdk.git diff --git a/drivers/common/cpt/cpt_mcode_defines.h b/drivers/common/cpt/cpt_mcode_defines.h index b7c3feb24b..69d831b5cc 100644 --- a/drivers/common/cpt/cpt_mcode_defines.h +++ b/drivers/common/cpt/cpt_mcode_defines.h @@ -6,6 +6,7 @@ #define _CPT_MCODE_DEFINES_H_ #include +#include #include /* @@ -20,6 +21,23 @@ #define CPT_MAJOR_OP_KASUMI 0x38 #define CPT_MAJOR_OP_MISC 0x01 +/* AE opcodes */ +#define CPT_MAJOR_OP_MODEX 0x03 +#define CPT_MAJOR_OP_ECDSA 0x04 +#define CPT_MAJOR_OP_ECC 0x05 +#define CPT_MINOR_OP_MODEX 0x01 +#define CPT_MINOR_OP_PKCS_ENC 0x02 +#define CPT_MINOR_OP_PKCS_ENC_CRT 0x03 +#define CPT_MINOR_OP_PKCS_DEC 0x04 +#define CPT_MINOR_OP_PKCS_DEC_CRT 0x05 +#define CPT_MINOR_OP_MODEX_CRT 0x06 +#define CPT_MINOR_OP_ECDSA_SIGN 0x01 +#define CPT_MINOR_OP_ECDSA_VERIFY 0x02 +#define CPT_MINOR_OP_ECC_UMP 0x03 + +#define CPT_BLOCK_TYPE1 0 +#define CPT_BLOCK_TYPE2 1 + #define CPT_BYTE_16 16 #define CPT_BYTE_24 24 #define CPT_BYTE_32 32 @@ -190,6 +208,20 @@ typedef enum { CPT_8X_COMP_E_LAST_ENTRY = (0xFF) } cpt_comp_e_t; +/** + * Enumeration cpt_ec_id + * + * Enumerates supported elliptic curves + */ +typedef enum { + CPT_EC_ID_P192 = 0, + CPT_EC_ID_P224 = 1, + CPT_EC_ID_P256 = 2, + CPT_EC_ID_P384 = 3, + CPT_EC_ID_P521 = 4, + CPT_EC_ID_PMAX = 5 +} cpt_ec_id_t; + typedef struct sglist_comp { union { uint64_t len; @@ -213,6 +245,8 @@ struct cpt_sess_misc { uint16_t is_null:1; /** Flag for GMAC */ uint16_t is_gmac:1; + /** Engine group */ + uint16_t egrp:3; /** AAD length */ uint16_t aad_length; /** MAC len in bytes */ @@ -233,41 +267,16 @@ struct cpt_sess_misc { phys_addr_t ctx_dma_addr; }; -typedef union { - uint64_t flags; - struct { -#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN - uint64_t enc_cipher : 4; - uint64_t reserved1 : 1; - uint64_t aes_key : 2; - uint64_t iv_source : 1; - uint64_t hash_type : 4; - uint64_t reserved2 : 3; - uint64_t auth_input_type : 1; - uint64_t mac_len : 8; - uint64_t reserved3 : 8; - uint64_t encr_offset : 16; - uint64_t iv_offset : 8; - uint64_t auth_offset : 8; -#else - uint64_t auth_offset : 8; - uint64_t iv_offset : 8; - uint64_t encr_offset : 16; - uint64_t reserved3 : 8; - uint64_t mac_len : 8; - uint64_t auth_input_type : 1; - uint64_t reserved2 : 3; - uint64_t hash_type : 4; - uint64_t iv_source : 1; - uint64_t aes_key : 2; - uint64_t reserved1 : 1; - uint64_t enc_cipher : 4; -#endif - } e; -} encr_ctrl_t; - typedef struct { - encr_ctrl_t enc_ctrl; + uint64_t iv_source : 1; + uint64_t aes_key : 2; + uint64_t rsvd_60 : 1; + uint64_t enc_cipher : 4; + uint64_t auth_input_type : 1; + uint64_t rsvd_52_54 : 3; + uint64_t hash_type : 4; + uint64_t mac_len : 8; + uint64_t rsvd_39_0 : 40; uint8_t encr_key[32]; uint8_t encr_iv[16]; } mc_enc_context_t; @@ -311,7 +320,36 @@ struct cpt_ctx { mc_zuc_snow3g_ctx_t zs_ctx; mc_kasumi_ctx_t k_ctx; }; - uint8_t auth_key[64]; + uint8_t auth_key[1024]; +}; + +/* Prime and order fields of built-in elliptic curves */ +struct cpt_ec_group { + struct { + /* P521 maximum length */ + uint8_t data[66]; + unsigned int length; + } prime; + + struct { + /* P521 maximum length */ + uint8_t data[66]; + unsigned int length; + } order; +}; + +struct cpt_asym_ec_ctx { + /* Prime length defined by microcode for EC operations */ + uint8_t curveid; +}; + +struct cpt_asym_sess_misc { + enum rte_crypto_asym_xform_type xfrm_type; + union { + struct rte_crypto_rsa_xform rsa_ctx; + struct rte_crypto_modex_xform mod_ctx; + struct cpt_asym_ec_ctx ec_ctx; + }; }; /* Buffer pointer */ @@ -357,6 +395,14 @@ typedef struct fc_params { } fc_params_t; +/* + * Parameters for asymmetric operations + */ +struct asym_op_params { + struct cpt_request_info *req; + phys_addr_t meta_buf; +}; + /* * Parameters for digest * generate requests @@ -373,8 +419,6 @@ typedef mc_hash_type_t auth_type_t; /* Helper macros */ -#define CPT_P_ENC_CTRL(fctx) fctx->enc.enc_ctrl.e - #define SRC_IOV_SIZE \ (sizeof(iov_ptr_t) + (sizeof(buf_ptr_t) * CPT_MAX_SG_CNT)) #define DST_IOV_SIZE \